2189 | | $where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) ); |
2190 | | $groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) ); |
2191 | | $join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) ); |
2192 | | $orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) ); |
2193 | | $distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) ); |
2194 | | $limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) ); |
2195 | | $fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) ); |
2196 | | |
2197 | | // Also apply a filter on all clauses at once, for convenience |
2198 | | $clauses = array(); |
2199 | | foreach ( array('distinct', 'fields', 'where', 'join', 'groupby', 'orderby', 'limits') as $var ) { |
2200 | | $clauses[ $var ] = $$var; |
2201 | | unset( $$var ); // so we can use EXTR_SKIP below |
2202 | | } |
2203 | | |
2204 | | $clauses = apply_filters_ref_array( 'wp_query_clauses', array( $clauses, &$this ) ); |
2205 | | |
2206 | | extract( $clauses, EXTR_SKIP ); |
2207 | | unset( $clauses ); |
| 2189 | $var_config = array( |
| 2190 | 'where' => 'posts_where_paged', |
| 2191 | 'groupby' => 'posts_groupby', |
| 2192 | 'join' => 'posts_join_paged', |
| 2193 | 'orderby' => 'posts_orderby', |
| 2194 | 'distinct' => 'posts_distinct', |
| 2195 | 'limits' => 'post_limits', |
| 2196 | 'fields' => 'posts_fields', |
| 2197 | ); |
| 2198 | $var_values = compact( array_keys( $var_config ) ); |
| 2199 | $result = $this->_filter_clause_variables( $var_config, $var_values, 'posts_clauses' ); |
| 2200 | extract( $result ); |
2215 | | $where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) ); |
2216 | | $groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) ); |
2217 | | $join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) ); |
2218 | | $orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) ); |
2219 | | $distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) ); |
2220 | | $fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) ); |
2221 | | $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) ); |
| 2208 | $var_config = array( |
| 2209 | 'where' => 'posts_where_request', |
| 2210 | 'groupby' => 'posts_groupby_request', |
| 2211 | 'join' => 'posts_join_request', |
| 2212 | 'orderby' => 'posts_orderby_request', |
| 2213 | 'distinct' => 'posts_distinct_request', |
| 2214 | 'fields' => 'posts_fields_request', |
| 2215 | 'limits' => 'post_limits_request', |
| 2216 | ); |
| 2217 | $var_values = compact( array_keys( $var_config ) ); |
| 2218 | $result = $this->_filter_clause_variables( $var_config, $var_values, 'posts_clauses_request' ); |
| 2219 | extract( $result ); |
| 2362 | * filter clause variables based on configuration. once per clause and |
| 2363 | * then all clauses at once. |
| 2364 | * |
| 2365 | * @access private |
| 2366 | * @param array $config filternames keyed with their variable names |
| 2367 | * @param array $values values keyed with their variable names |
| 2368 | * @param string $all_filter_name for the "single filter" |
| 2369 | * @return array filtered values keyed with their names |
| 2370 | */ |
| 2371 | function _filter_clause_variables( $config, $values, $all_filter_name ) { |
| 2372 | $clauses = array(); |
| 2373 | foreach ( $config as $variable_name => $filter ) { |
| 2374 | $clauses[$variable_name] = apply_filters_ref_array( $filter, array( $values[$variable_name], &$this ) ); |
| 2375 | } |
| 2376 | // run filter for all clauses at once |
| 2377 | $clauses = apply_filters_ref_array( $all_filter_name, array( $clauses, &$this ) ); |
| 2378 | if ( is_array( $clauses ) && array_keys( $clauses ) === array_keys( $values ) ) { |
| 2379 | $values = $clauses; |
| 2380 | } |
| 2381 | return $values; |
| 2382 | } |
| 2383 | |
| 2384 | /** |