Changeset 54530 for trunk/src/wp-includes/class-wp-date-query.php
- Timestamp:
- 10/17/2022 11:47:41 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-date-query.php
r54133 r54530 151 151 } 152 152 153 if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] )) {154 $this->relation = 'OR';153 if ( isset( $date_query['relation'] ) ) { 154 $this->relation = $this->sanitize_relation( $date_query['relation'] ); 155 155 } else { 156 156 $this->relation = 'AND'; … … 220 220 $this->validate_date_values( $queries ); 221 221 } 222 223 // Sanitize the relation parameter. 224 $queries['relation'] = $this->sanitize_relation( $queries['relation'] ); 222 225 223 226 foreach ( $queries as $key => $q ) { … … 1042 1045 return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); 1043 1046 } 1047 1048 /** 1049 * Sanitizes a 'relation' operator. 1050 * 1051 * @since 6.0.3 1052 * 1053 * @param string $relation Raw relation key from the query argument. 1054 * @return string Sanitized relation ('AND' or 'OR'). 1055 */ 1056 public function sanitize_relation( $relation ) { 1057 if ( 'OR' === strtoupper( $relation ) ) { 1058 return 'OR'; 1059 } else { 1060 return 'AND'; 1061 } 1062 } 1044 1063 }
Note: See TracChangeset
for help on using the changeset viewer.