| 1 | Index: wp-includes/query.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/query.php (revision 13330) |
|---|
| 4 | +++ wp-includes/query.php (working copy) |
|---|
| 5 | @@ -1765,7 +1765,7 @@ |
|---|
| 6 | $search .= " AND ($wpdb->posts.post_password = '') "; |
|---|
| 7 | } |
|---|
| 8 | } |
|---|
| 9 | - $search = apply_filters('posts_search', $search, $this); |
|---|
| 10 | + $search = apply_filters('posts_search', $search, &$this); |
|---|
| 11 | |
|---|
| 12 | // Category stuff |
|---|
| 13 | |
|---|
| 14 | @@ -2196,8 +2196,8 @@ |
|---|
| 15 | // Apply filters on where and join prior to paging so that any |
|---|
| 16 | // manipulations to them are reflected in the paging by day queries. |
|---|
| 17 | if ( !$q['suppress_filters'] ) { |
|---|
| 18 | - $where = apply_filters('posts_where', $where); |
|---|
| 19 | - $join = apply_filters('posts_join', $join); |
|---|
| 20 | + $where = apply_filters('posts_where', $where, &$this); |
|---|
| 21 | + $join = apply_filters('posts_join', $join, &$this); |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | // Paging |
|---|
| 25 | @@ -2231,11 +2231,11 @@ |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | if ( !$q['suppress_filters'] ) { |
|---|
| 29 | - $cjoin = apply_filters('comment_feed_join', $cjoin); |
|---|
| 30 | - $cwhere = apply_filters('comment_feed_where', $cwhere); |
|---|
| 31 | - $cgroupby = apply_filters('comment_feed_groupby', $cgroupby); |
|---|
| 32 | - $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC'); |
|---|
| 33 | - $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss')); |
|---|
| 34 | + $cjoin = apply_filters('comment_feed_join', $cjoin, &$this); |
|---|
| 35 | + $cwhere = apply_filters('comment_feed_where', $cwhere, &$this); |
|---|
| 36 | + $cgroupby = apply_filters('comment_feed_groupby', $cgroupby, &$this); |
|---|
| 37 | + $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC', &$this); |
|---|
| 38 | + $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'), &$this); |
|---|
| 39 | } |
|---|
| 40 | $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; |
|---|
| 41 | $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; |
|---|
| 42 | @@ -2261,14 +2261,13 @@ |
|---|
| 43 | // Apply post-paging filters on where and join. Only plugins that |
|---|
| 44 | // manipulate paging queries should use these hooks. |
|---|
| 45 | if ( !$q['suppress_filters'] ) { |
|---|
| 46 | - $where = apply_filters('posts_where_paged', $where); |
|---|
| 47 | - $groupby = apply_filters('posts_groupby', $groupby); |
|---|
| 48 | - $join = apply_filters('posts_join_paged', $join); |
|---|
| 49 | - $orderby = apply_filters('posts_orderby', $orderby); |
|---|
| 50 | - $distinct = apply_filters('posts_distinct', $distinct); |
|---|
| 51 | - $limits = apply_filters( 'post_limits', $limits ); |
|---|
| 52 | - |
|---|
| 53 | - $fields = apply_filters('posts_fields', $fields); |
|---|
| 54 | + $where = apply_filters('posts_where_paged', $where, &$this); |
|---|
| 55 | + $groupby = apply_filters('posts_groupby', $groupby, &$this); |
|---|
| 56 | + $join = apply_filters('posts_join_paged', $join, &$this); |
|---|
| 57 | + $orderby = apply_filters('posts_orderby', $orderby, &$this); |
|---|
| 58 | + $distinct = apply_filters('posts_distinct', $distinct, &$this); |
|---|
| 59 | + $limits = apply_filters('post_limits', $limits, &$this); |
|---|
| 60 | + $fields = apply_filters('posts_fields', $fields, &$this); |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | // Announce current selection parameters. For use by caching plugins. |
|---|
| 64 | @@ -2276,13 +2275,13 @@ |
|---|
| 65 | |
|---|
| 66 | // Filter again for the benefit of caching plugins. Regular plugins should use the hooks above. |
|---|
| 67 | if ( !$q['suppress_filters'] ) { |
|---|
| 68 | - $where = apply_filters('posts_where_request', $where); |
|---|
| 69 | - $groupby = apply_filters('posts_groupby_request', $groupby); |
|---|
| 70 | - $join = apply_filters('posts_join_request', $join); |
|---|
| 71 | - $orderby = apply_filters('posts_orderby_request', $orderby); |
|---|
| 72 | - $distinct = apply_filters('posts_distinct_request', $distinct); |
|---|
| 73 | - $fields = apply_filters('posts_fields_request', $fields); |
|---|
| 74 | - $limits = apply_filters( 'post_limits_request', $limits ); |
|---|
| 75 | + $where = apply_filters('posts_where_request', $where, &$this); |
|---|
| 76 | + $groupby = apply_filters('posts_groupby_request', $groupby, &$this); |
|---|
| 77 | + $join = apply_filters('posts_join_request', $join, &$this); |
|---|
| 78 | + $orderby = apply_filters('posts_orderby_request', $orderby, &$this); |
|---|
| 79 | + $distinct = apply_filters('posts_distinct_request', $distinct, &$this); |
|---|
| 80 | + $fields = apply_filters('posts_fields_request', $fields, &$this); |
|---|
| 81 | + $limits = apply_filters('post_limits_request', $limits, &$this); |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | if ( ! empty($groupby) ) |
|---|
| 85 | @@ -2295,30 +2294,30 @@ |
|---|
| 86 | |
|---|
| 87 | $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; |
|---|
| 88 | if ( !$q['suppress_filters'] ) |
|---|
| 89 | - $this->request = apply_filters('posts_request', $this->request); |
|---|
| 90 | + $this->request = apply_filters('posts_request', $this->request, &$this); |
|---|
| 91 | |
|---|
| 92 | $this->posts = $wpdb->get_results($this->request); |
|---|
| 93 | // Raw results filter. Prior to status checks. |
|---|
| 94 | if ( !$q['suppress_filters'] ) |
|---|
| 95 | - $this->posts = apply_filters('posts_results', $this->posts); |
|---|
| 96 | + $this->posts = apply_filters('posts_results', $this->posts, &$this); |
|---|
| 97 | |
|---|
| 98 | if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { |
|---|
| 99 | - $cjoin = apply_filters('comment_feed_join', ''); |
|---|
| 100 | - $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'"); |
|---|
| 101 | - $cgroupby = apply_filters('comment_feed_groupby', ''); |
|---|
| 102 | + $cjoin = apply_filters('comment_feed_join', '', &$this); |
|---|
| 103 | + $cwhere = apply_filters('comment_feed_where', "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this); |
|---|
| 104 | + $cgroupby = apply_filters('comment_feed_groupby', '', &$this); |
|---|
| 105 | $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : ''; |
|---|
| 106 | - $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC'); |
|---|
| 107 | + $corderby = apply_filters('comment_feed_orderby', 'comment_date_gmt DESC', &$this); |
|---|
| 108 | $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : ''; |
|---|
| 109 | - $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss')); |
|---|
| 110 | + $climits = apply_filters('comment_feed_limits', 'LIMIT ' . get_option('posts_per_rss'), &$this); |
|---|
| 111 | $comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits"; |
|---|
| 112 | $this->comments = $wpdb->get_results($comments_request); |
|---|
| 113 | $this->comment_count = count($this->comments); |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | if ( !empty($limits) ) { |
|---|
| 117 | - $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' ); |
|---|
| 118 | + $found_posts_query = apply_filters('found_posts_query', 'SELECT FOUND_ROWS()', &$this); |
|---|
| 119 | $this->found_posts = $wpdb->get_var( $found_posts_query ); |
|---|
| 120 | - $this->found_posts = apply_filters( 'found_posts', $this->found_posts ); |
|---|
| 121 | + $this->found_posts = apply_filters('found_posts', $this->found_posts, &$this); |
|---|
| 122 | $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); |
|---|
| 123 | } |
|---|
| 124 | |
|---|
| 125 | @@ -2351,7 +2350,7 @@ |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | if ( $this->is_preview && current_user_can( $edit_cap, $this->posts[0]->ID ) ) |
|---|
| 129 | - $this->posts[0] = apply_filters('the_preview', $this->posts[0]); |
|---|
| 130 | + $this->posts[0] = apply_filters('the_preview', $this->posts[0], &$this); |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | // Put sticky posts at the top of the posts array |
|---|
| 134 | @@ -2400,7 +2399,7 @@ |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | if ( !$q['suppress_filters'] ) |
|---|
| 138 | - $this->posts = apply_filters('the_posts', $this->posts); |
|---|
| 139 | + $this->posts = apply_filters('the_posts', $this->posts, &$this); |
|---|
| 140 | |
|---|
| 141 | $this->post_count = count($this->posts); |
|---|
| 142 | |
|---|