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