Changes in branches/2.6/wp-includes/query.php [8559:8795]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.6/wp-includes/query.php
r8559 r8795 776 776 $qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']); 777 777 778 if ( $this->is_posts_page && !$qv['withcomments'])778 if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) ) 779 779 $this->is_comment_feed = false; 780 780 … … 830 830 $search = ''; 831 831 $groupby = ''; 832 $fields = "$wpdb->posts.*"; 832 833 $post_status_join = false; 834 $page = 1; 835 836 if ( !isset($q['suppress_filters']) ) 837 $q['suppress_filters'] = false; 833 838 834 839 if ( !isset($q['post_type']) ) { … … 1362 1367 // Apply filters on where and join prior to paging so that any 1363 1368 // manipulations to them are reflected in the paging by day queries. 1364 $where = apply_filters('posts_where', $where); 1365 $join = apply_filters('posts_join', $join); 1369 if ( !$q['suppress_filters'] ) { 1370 $where = apply_filters('posts_where', $where); 1371 $join = apply_filters('posts_join', $join); 1372 } 1366 1373 1367 1374 // Paging … … 1395 1402 } 1396 1403 1397 $cjoin = apply_filters('comment_feed_join', $cjoin); 1398 $cwhere = apply_filters('comment_feed_where', $cwhere); 1399 $cgroupby = apply_filters('comment_feed_groupby', $cgroupby); 1404 if ( !$q['suppress_filters'] ) { 1405 $cjoin = apply_filters('comment_feed_join', $cjoin); 1406 $cwhere = apply_filters('comment_feed_where', $cwhere); 1407 $cgroupby = apply_filters('comment_feed_groupby', $cgroupby); 1408 } 1400 1409 1401 1410 $this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby ORDER BY comment_date_gmt DESC LIMIT " . get_option('posts_per_rss')); … … 1415 1424 } 1416 1425 1426 $orderby = $q['orderby']; 1427 1417 1428 // Apply post-paging filters on where and join. Only plugins that 1418 1429 // manipulate paging queries should use these hooks. 1419 1420 $where = apply_filters('posts_where_paged', $where); 1421 $groupby = apply_filters('posts_groupby', $groupby); 1422 $join = apply_filters('posts_join_paged', $join); 1423 $orderby = apply_filters('posts_orderby', $q['orderby']); 1424 $distinct = apply_filters('posts_distinct', $distinct); 1425 $fields = apply_filters('posts_fields', "$wpdb->posts.*"); 1426 $limits = apply_filters( 'post_limits', $limits ); 1430 if ( !$q['suppress_filters'] ) { 1431 $where = apply_filters('posts_where_paged', $where); 1432 $groupby = apply_filters('posts_groupby', $groupby); 1433 $join = apply_filters('posts_join_paged', $join); 1434 $orderby = apply_filters('posts_orderby', $orderby); 1435 $distinct = apply_filters('posts_distinct', $distinct); 1436 $fields = apply_filters('posts_fields', $fields); 1437 $limits = apply_filters( 'post_limits', $limits ); 1438 } 1427 1439 1428 1440 // Announce current selection parameters. For use by caching plugins. … … 1430 1442 1431 1443 // Filter again for the benefit of caching plugins. Regular plugins should use the hooks above. 1432 $where = apply_filters('posts_where_request', $where); 1433 $groupby = apply_filters('posts_groupby_request', $groupby); 1434 $join = apply_filters('posts_join_request', $join); 1435 $orderby = apply_filters('posts_orderby_request', $orderby); 1436 $distinct = apply_filters('posts_distinct_request', $distinct); 1437 $fields = apply_filters('posts_fields_request', $fields); 1438 $limits = apply_filters( 'post_limits_request', $limits ); 1444 if ( !$q['suppress_filters'] ) { 1445 $where = apply_filters('posts_where_request', $where); 1446 $groupby = apply_filters('posts_groupby_request', $groupby); 1447 $join = apply_filters('posts_join_request', $join); 1448 $orderby = apply_filters('posts_orderby_request', $orderby); 1449 $distinct = apply_filters('posts_distinct_request', $distinct); 1450 $fields = apply_filters('posts_fields_request', $fields); 1451 $limits = apply_filters( 'post_limits_request', $limits ); 1452 } 1439 1453 1440 1454 if ( ! empty($groupby) ) … … 1446 1460 $found_rows = 'SQL_CALC_FOUND_ROWS'; 1447 1461 1448 $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 1449 $this->request = apply_filters('posts_request', $request); 1462 $this->request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 1463 if ( !$q['suppress_filters'] ) 1464 $this->request = apply_filters('posts_request', $this->request); 1450 1465 1451 1466 $this->posts = $wpdb->get_results($this->request); 1452 1467 // Raw results filter. Prior to status checks. 1453 $this->posts = apply_filters('posts_results', $this->posts); 1468 if ( !$q['suppress_filters'] ) 1469 $this->posts = apply_filters('posts_results', $this->posts); 1454 1470 1455 1471 if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) { … … 1498 1514 } 1499 1515 1500 $this->posts = apply_filters('the_posts', $this->posts); 1516 if ( !$q['suppress_filters'] ) 1517 $this->posts = apply_filters('the_posts', $this->posts); 1501 1518 1502 1519 update_post_caches($this->posts);
Note: See TracChangeset
for help on using the changeset viewer.