Changeset 54568 for branches/4.8/src/wp-includes/date.php
- Timestamp:
- 10/17/2022 06:10:19 PM (2 years ago)
- Location:
- branches/4.8
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.8
- Property svn:mergeinfo changed
/trunk merged: 54521-54530,54541
- Property svn:mergeinfo changed
-
branches/4.8/src/wp-includes/date.php
r39672 r54568 152 152 */ 153 153 public function __construct( $date_query, $default_column = 'post_date' ) { 154 if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] )) {155 $this->relation = 'OR';154 if ( isset( $date_query['relation'] ) ) { 155 $this->relation = $this->sanitize_relation( $date_query['relation'] ); 156 156 } else { 157 157 $this->relation = 'AND'; … … 232 232 $this->validate_date_values( $queries ); 233 233 } 234 235 // Sanitize the relation parameter. 236 $queries['relation'] = $this->sanitize_relation( $queries['relation'] ); 234 237 235 238 foreach ( $queries as $key => $q ) { … … 1018 1021 return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); 1019 1022 } 1023 1024 /** 1025 * Sanitizes a 'relation' operator. 1026 * 1027 * @since 6.0.3 1028 * 1029 * @param string $relation Raw relation key from the query argument. 1030 * @return string Sanitized relation ('AND' or 'OR'). 1031 */ 1032 public function sanitize_relation( $relation ) { 1033 if ( 'OR' === strtoupper( $relation ) ) { 1034 return 'OR'; 1035 } else { 1036 return 'AND'; 1037 } 1038 } 1020 1039 }
Note: See TracChangeset
for help on using the changeset viewer.