Changeset 54569 for branches/4.9/src/wp-includes/date.php
- Timestamp:
- 10/17/2022 06:11:47 PM (2 years ago)
- Location:
- branches/4.9
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
- Property svn:mergeinfo changed
/trunk merged: 54521-54530,54541
- Property svn:mergeinfo changed
-
branches/4.9/src/wp-includes/date.php
r41162 r54569 146 146 */ 147 147 public function __construct( $date_query, $default_column = 'post_date' ) { 148 if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] )) {149 $this->relation = 'OR';148 if ( isset( $date_query['relation'] ) ) { 149 $this->relation = $this->sanitize_relation( $date_query['relation'] ); 150 150 } else { 151 151 $this->relation = 'AND'; … … 225 225 $this->validate_date_values( $queries ); 226 226 } 227 228 // Sanitize the relation parameter. 229 $queries['relation'] = $this->sanitize_relation( $queries['relation'] ); 227 230 228 231 foreach ( $queries as $key => $q ) { … … 999 1002 return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); 1000 1003 } 1004 1005 /** 1006 * Sanitizes a 'relation' operator. 1007 * 1008 * @since 6.0.3 1009 * 1010 * @param string $relation Raw relation key from the query argument. 1011 * @return string Sanitized relation ('AND' or 'OR'). 1012 */ 1013 public function sanitize_relation( $relation ) { 1014 if ( 'OR' === strtoupper( $relation ) ) { 1015 return 'OR'; 1016 } else { 1017 return 'AND'; 1018 } 1019 } 1001 1020 }
Note: See TracChangeset
for help on using the changeset viewer.