Ticket #16661: 16661.patch
File 16661.patch, 10.3 KB (added by , 13 years ago) |
---|
-
wp-includes/comment.php
320 320 $where .= $this->get_search_sql( $search, array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' ) ); 321 321 322 322 $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' ); 323 $clauses = apply_filters _ref_array( 'comments_clauses', array( compact( $pieces ), &$this ));323 $clauses = apply_filters( 'comments_clauses', compact( $pieces ), $this ); 324 324 foreach ( $pieces as $piece ) 325 325 $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; 326 326 … … 330 330 return $wpdb->get_var( $query ); 331 331 332 332 $comments = $wpdb->get_results( $query ); 333 $comments = apply_filters _ref_array( 'the_comments', array( $comments, &$this ));333 $comments = apply_filters( 'the_comments', $comments, $this ); 334 334 335 335 wp_cache_add( $cache_key, $comments, 'comment' ); 336 336 -
wp-includes/meta.php
442 442 $where .= $wpdb->prepare( " AND CAST($alias.meta_value AS {$meta_type}) {$meta_compare} {$meta_compare_string}", $meta_value ); 443 443 } 444 444 445 return apply_filters _ref_array( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column, &$context ) );445 return apply_filters( 'get_meta_sql', array( compact( 'join', 'where' ), $meta_query, $meta_type, $primary_table, $primary_id_column, $context ) ); 446 446 } 447 447 448 448 /** -
wp-includes/query.php
2147 2147 } 2148 2148 2149 2149 // Allow plugins to contextually add/remove/modify the search section of the database query 2150 $search = apply_filters _ref_array('posts_search', array( $search, &$this ));2150 $search = apply_filters( 'posts_search', $search, $this ); 2151 2151 2152 2152 // Taxonomies 2153 2153 $this->parse_tax_query( $q ); … … 2451 2451 // Apply filters on where and join prior to paging so that any 2452 2452 // manipulations to them are reflected in the paging by day queries. 2453 2453 if ( !$q['suppress_filters'] ) { 2454 $where = apply_filters _ref_array('posts_where', array( $where, &$this ));2455 $join = apply_filters _ref_array('posts_join', array( $join, &$this ));2454 $where = apply_filters( 'posts_where', $where, $this ); 2455 $join = apply_filters( 'posts_join', $join, $this ); 2456 2456 } 2457 2457 2458 2458 // Paging … … 2485 2485 } 2486 2486 2487 2487 if ( !$q['suppress_filters'] ) { 2488 $cjoin = apply_filters _ref_array('comment_feed_join', array( $cjoin, &$this ));2489 $cwhere = apply_filters _ref_array('comment_feed_where', array( $cwhere, &$this ));2490 $cgroupby = apply_filters _ref_array('comment_feed_groupby', array( $cgroupby, &$this ));2491 $corderby = apply_filters _ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ));2492 $climits = apply_filters _ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ));2488 $cjoin = apply_filters('comment_feed_join', $cjoin, $this ); 2489 $cwhere = apply_filters('comment_feed_where', $cwhere, $this ); 2490 $cgroupby = apply_filters('comment_feed_groupby', $cgroupby, $this ); 2491 $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC', $this ); 2492 $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'), $this ); 2493 2493 } 2494 2494 $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; 2495 2495 $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; … … 2517 2517 // Apply post-paging filters on where and join. Only plugins that 2518 2518 // manipulate paging queries should use these hooks. 2519 2519 if ( !$q['suppress_filters'] ) { 2520 $where = apply_filters _ref_array( 'posts_where_paged', array( $where, &$this ));2521 $groupby = apply_filters _ref_array( 'posts_groupby', array( $groupby, &$this ));2522 $join = apply_filters _ref_array( 'posts_join_paged', array( $join, &$this ));2523 $orderby = apply_filters _ref_array( 'posts_orderby', array( $orderby, &$this ));2524 $distinct = apply_filters _ref_array( 'posts_distinct', array( $distinct, &$this ));2525 $limits = apply_filters _ref_array( 'post_limits', array( $limits, &$this ));2526 $fields = apply_filters _ref_array( 'posts_fields', array( $fields, &$this ));2520 $where = apply_filters( 'posts_where_paged', $where, $this ); 2521 $groupby = apply_filters( 'posts_groupby', $groupby, $this ); 2522 $join = apply_filters( 'posts_join_paged', $join, $this ); 2523 $orderby = apply_filters( 'posts_orderby', $orderby, $this ); 2524 $distinct = apply_filters( 'posts_distinct', $distinct, $this ); 2525 $limits = apply_filters( 'post_limits', $limits, $this ); 2526 $fields = apply_filters( 'posts_fields', $fields, $this ); 2527 2527 2528 2528 // Filter all clauses at once, for convenience 2529 $clauses = (array) apply_filters _ref_array( 'posts_clauses', array( compact( $pieces ), &$this ));2529 $clauses = (array) apply_filters( 'posts_clauses', compact( $pieces ), $this ); 2530 2530 foreach ( $pieces as $piece ) 2531 2531 $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; 2532 2532 } … … 2536 2536 2537 2537 // Filter again for the benefit of caching plugins. Regular plugins should use the hooks above. 2538 2538 if ( !$q['suppress_filters'] ) { 2539 $where = apply_filters _ref_array( 'posts_where_request', array( $where, &$this ));2540 $groupby = apply_filters _ref_array( 'posts_groupby_request', array( $groupby, &$this ));2541 $join = apply_filters _ref_array( 'posts_join_request', array( $join, &$this ));2542 $orderby = apply_filters _ref_array( 'posts_orderby_request', array( $orderby, &$this ));2543 $distinct = apply_filters _ref_array( 'posts_distinct_request', array( $distinct, &$this ));2544 $fields = apply_filters _ref_array( 'posts_fields_request', array( $fields, &$this ));2545 $limits = apply_filters _ref_array( 'post_limits_request', array( $limits, &$this ));2539 $where = apply_filters( 'posts_where_request', $where, $this ); 2540 $groupby = apply_filters( 'posts_groupby_request', $groupby, $this ); 2541 $join = apply_filters( 'posts_join_request', $join, $this ); 2542 $orderby = apply_filters( 'posts_orderby_request', $orderby, $this ); 2543 $distinct = apply_filters( 'posts_distinct_request', $distinct, $this ); 2544 $fields = apply_filters( 'posts_fields_request', $fields, $this ); 2545 $limits = apply_filters( 'post_limits_request', $limits, $this ); 2546 2546 2547 2547 // Filter all clauses at once, for convenience 2548 $clauses = (array) apply_filters _ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ));2548 $clauses = (array) apply_filters( 'posts_clauses_request', compact( $pieces ), $this ); 2549 2549 foreach ( $pieces as $piece ) 2550 2550 $$piece = isset( $clauses[ $piece ] ) ? $clauses[ $piece ] : ''; 2551 2551 } … … 2561 2561 2562 2562 $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 2563 2563 if ( !$q['suppress_filters'] ) 2564 $this->request = apply_filters _ref_array('posts_request', array( $this->request, &$this ));2564 $this->request = apply_filters('posts_request', $this->request, $this ); 2565 2565 2566 2566 if ( 'ids' == $q['fields'] ) { 2567 2567 $this->posts = $wpdb->get_col($this->request); … … 2583 2583 2584 2584 // Raw results filter. Prior to status checks. 2585 2585 if ( !$q['suppress_filters'] ) 2586 $this->posts = apply_filters _ref_array('posts_results', array( $this->posts, &$this ));2586 $this->posts = apply_filters('posts_results', $this->posts, $this ); 2587 2587 2588 2588 if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { 2589 $cjoin = apply_filters _ref_array('comment_feed_join', array( '', &$this ));2590 $cwhere = apply_filters _ref_array('comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ));2591 $cgroupby = apply_filters _ref_array('comment_feed_groupby', array( '', &$this ));2589 $cjoin = apply_filters('comment_feed_join', '', $this ); 2590 $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", $this ); 2591 $cgroupby = apply_filters('comment_feed_groupby', '', $this ); 2592 2592 $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; 2593 $corderby = apply_filters _ref_array('comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ));2593 $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC', $this ); 2594 2594 $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; 2595 $climits = apply_filters _ref_array('comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ));2595 $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'), $this ); 2596 2596 $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"; 2597 2597 $this->comments = $wpdb->get_results($comments_request); 2598 2598 $this->comment_count = count($this->comments); 2599 2599 } 2600 2600 2601 2601 if ( !$q['no_found_rows'] && !empty($limits) ) { 2602 $found_posts_query = apply_filters _ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ));2602 $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()', $this ); 2603 2603 $this->found_posts = $wpdb->get_var( $found_posts_query ); 2604 $this->found_posts = apply_filters _ref_array( 'found_posts', array( $this->found_posts, &$this ));2604 $this->found_posts = apply_filters( 'found_posts', $this->found_posts, $this ); 2605 2605 $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); 2606 2606 } 2607 2607 … … 2634 2634 } 2635 2635 2636 2636 if ( $this->is_preview && current_user_can( $edit_cap, $this->posts[0]->ID ) ) 2637 $this->posts[0] = apply_filters _ref_array('the_preview', array( $this->posts[0], &$this ));2637 $this->posts[0] = apply_filters('the_preview', $this->posts[0], $this ); 2638 2638 } 2639 2639 2640 2640 // Put sticky posts at the top of the posts array … … 2688 2688 } 2689 2689 2690 2690 if ( !$q['suppress_filters'] ) 2691 $this->posts = apply_filters _ref_array('the_posts', array( $this->posts, &$this ));2691 $this->posts = apply_filters('the_posts', $this->posts, $this ); 2692 2692 2693 2693 $this->post_count = count($this->posts); 2694 2694