Changeset 54556 for branches/5.5/src/wp-includes/class-wp-date-query.php
- Timestamp:
- 10/17/2022 05:58:36 PM (2 years ago)
- Location:
- branches/5.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.5
- Property svn:mergeinfo changed
/trunk merged: 54521-54530,54541
- Property svn:mergeinfo changed
-
branches/5.5/src/wp-includes/class-wp-date-query.php
r48586 r54556 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 ) { … … 1040 1043 return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); 1041 1044 } 1045 1046 /** 1047 * Sanitizes a 'relation' operator. 1048 * 1049 * @since 6.0.3 1050 * 1051 * @param string $relation Raw relation key from the query argument. 1052 * @return string Sanitized relation ('AND' or 'OR'). 1053 */ 1054 public function sanitize_relation( $relation ) { 1055 if ( 'OR' === strtoupper( $relation ) ) { 1056 return 'OR'; 1057 } else { 1058 return 'AND'; 1059 } 1060 } 1042 1061 }
Note: See TracChangeset
for help on using the changeset viewer.