Changeset 54563 for branches/5.2/src/wp-includes/date.php
- Timestamp:
- 10/17/2022 06:08:00 PM (2 years ago)
- Location:
- branches/5.2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.2
- Property svn:mergeinfo changed
/trunk merged: 54521-54530,54541
- Property svn:mergeinfo changed
-
branches/5.2/src/wp-includes/date.php
r42877 r54563 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 ) { … … 1021 1024 return $wpdb->prepare( "DATE_FORMAT( $column, %s ) $compare %f", $format, $time ); 1022 1025 } 1026 1027 /** 1028 * Sanitizes a 'relation' operator. 1029 * 1030 * @since 6.0.3 1031 * 1032 * @param string $relation Raw relation key from the query argument. 1033 * @return string Sanitized relation ('AND' or 'OR'). 1034 */ 1035 public function sanitize_relation( $relation ) { 1036 if ( 'OR' === strtoupper( $relation ) ) { 1037 return 'OR'; 1038 } else { 1039 return 'AND'; 1040 } 1041 } 1023 1042 }
Note: See TracChangeset
for help on using the changeset viewer.