Changeset 54552 for branches/4.1/src/wp-includes/date.php
- Timestamp:
- 10/17/2022 05:53:02 PM (2 years ago)
- Location:
- branches/4.1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.1
- Property svn:mergeinfo changed
/trunk merged: 54521-54523,54525,54527,54529-54530,54541
- Property svn:mergeinfo changed
-
branches/4.1/src/wp-includes/date.php
r31396 r54552 142 142 public function __construct( $date_query, $default_column = 'post_date' ) { 143 143 144 if ( isset( $date_query['relation'] ) && 'OR' === strtoupper( $date_query['relation'] )) {145 $this->relation = 'OR';144 if ( isset( $date_query['relation'] ) ) { 145 $this->relation = $this->sanitize_relation( $date_query['relation'] ); 146 146 } else { 147 147 $this->relation = 'AND'; … … 224 224 $this->validate_date_values( $queries ); 225 225 } 226 227 // Sanitize the relation parameter. 228 $queries['relation'] = $this->sanitize_relation( $queries['relation'] ); 226 229 227 230 foreach ( $queries as $key => $q ) { … … 1003 1006 return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); 1004 1007 } 1008 1009 /** 1010 * Sanitizes a 'relation' operator. 1011 * 1012 * @since 6.0.3 1013 * 1014 * @param string $relation Raw relation key from the query argument. 1015 * @return string Sanitized relation ('AND' or 'OR'). 1016 */ 1017 public function sanitize_relation( $relation ) { 1018 if ( 'OR' === strtoupper( $relation ) ) { 1019 return 'OR'; 1020 } else { 1021 return 'AND'; 1022 } 1023 } 1005 1024 }
Note: See TracChangeset
for help on using the changeset viewer.