Ticket #25775: 25775.viper007bond.patch
File 25775.viper007bond.patch, 1.9 KB (added by , 11 years ago) |
---|
-
src/wp-includes/date.php
153 153 } 154 154 155 155 /** 156 * Validates a column name parameter .156 * Validates a column name parameter and prepends the appropriate $wpdb table name. 157 157 * 158 158 * @since 3.7.0 159 159 * @access public 160 160 * 161 161 * @param string $column The user-supplied column name. 162 * @return string A validated column name value .162 * @return string A validated column name value prepended by its $wpdb table name. 163 163 */ 164 164 public function validate_column( $column ) { 165 global $wpdb; 166 165 167 $valid_columns = array( 166 'post_date', 'post_date_gmt', 'post_modified', 167 'post_modified_gmt', 'comment_date', 'comment_date_gmt' 168 'post_date' => $wpdb->posts, 169 'post_date_gmt' => $wpdb->posts, 170 'post_modified' => $wpdb->posts, 171 'post_modified_gmt' => $wpdb->posts, 172 'comment_date' => $wpdb->comments, 173 'comment_date_gmt' => $wpdb->comments, 168 174 ); 175 169 176 /** 170 177 * Filter the list of valid date query columns. 171 178 * 172 179 * @since 3.7.0 173 180 * 174 * @param array $valid_columns An array of valid date query columns . Defaults are 'post_date', 'post_date_gmt',175 * 'post_modified', 'post_modified_gmt', 'comment_date', 'comment_date_gmt'181 * @param array $valid_columns An array of valid date query columns, with the key being the column name and the value 182 * being the table name. See $valid_columns in WP_Date_Query::validate_column() for the defaults; 176 183 */ 177 if ( ! in_array( $column, apply_filters( 'date_query_valid_columns', $valid_columns ) ) ) 184 $valid_columns = apply_filters( 'date_query_valid_columns', $valid_columns ); 185 186 if ( ! isset( $valid_columns[ $column ] ) ) { 178 187 $column = 'post_date'; 188 } 179 189 190 $column = $valid_columns[ $column ] . '.' . $column; 191 180 192 return $column; 181 193 } 182 194