# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /Applications/MAMP/htdocs/wordpress_develop/src/wp-includes
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
|
|
|
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 | /** |
| 187 | * Catch any filters implemented on date_query_valid_columns before #25775 |
| 188 | * https://core.trac.wordpress.org/ticket/25775 |
| 189 | */ |
| 190 | if ( in_array( $column, array_values( $valid_columns ) ) ) { |
| 191 | return $column; |
| 192 | } |
| 193 | |
| 194 | if ( ! isset( $valid_columns[ $column ] ) ) { |
178 | 195 | $column = 'post_date'; |
| 196 | } |
179 | 197 | |
| 198 | $column = $valid_columns[ $column ] . '.' . $column; |
| 199 | |
180 | 200 | return $column; |
181 | 201 | } |
182 | 202 | |