Changeset 32620
- Timestamp:
- 05/27/2015 06:14:08 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r32116 r32620 15 15 * Retrieve variable in the WP_Query class. 16 16 * 17 * @see WP_Query::get()18 17 * @since 1.5.0 19 * @uses $wp_query 18 * 19 * @global WP_Query $wp_query 20 20 * 21 21 * @param string $var The variable key to retrieve. … … 25 25 function get_query_var( $var, $default = '' ) { 26 26 global $wp_query; 27 28 27 return $wp_query->get( $var, $default ); 29 28 } … … 32 31 * Retrieve the currently-queried object. Wrapper for $wp_query->get_queried_object() 33 32 * 34 * @uses WP_Query::get_queried_object35 *36 33 * @since 3.1.0 37 34 * @access public 35 * 36 * @global WP_Query $wp_query 38 37 * 39 38 * @return object … … 47 46 * Retrieve ID of the current queried object. Wrapper for $wp_query->get_queried_object_id() 48 47 * 49 * @uses WP_Query::get_queried_object_id()50 *51 48 * @since 3.1.0 52 49 * @access public 50 * 51 * @global WP_Query $wp_query 53 52 * 54 53 * @return int … … 62 61 * Set query variable. 63 62 * 64 * @see WP_Query::set()65 63 * @since 2.2.0 66 * @uses $wp_query67 * 68 * @param string $var Query variable key.69 * @param mixed $value70 * @ return null64 * 65 * @global WP_Query $wp_query 66 * 67 * @param string $var Query variable key. 68 * @param mixed $value 71 69 */ 72 function set_query_var( $var, $value) {70 function set_query_var( $var, $value ) { 73 71 global $wp_query; 74 75 return $wp_query->set($var, $value); 72 $wp_query->set( $var, $value ); 76 73 } 77 74 … … 83 80 * 84 81 * @since 1.5.0 85 * @uses $wp_query 82 * 83 * @global WP_Query $wp_query 86 84 * 87 85 * @param string $query … … 101 99 * 102 100 * @since 2.3.0 103 * @uses $wp_query 101 * 102 * @global WP_Query $wp_query 103 * @global WP_Query $wp_the_query 104 104 */ 105 105 function wp_reset_query() { … … 113 113 * 114 114 * @since 3.0.0 115 * @uses $wp_query 115 * 116 * @global WP_Query $wp_query 116 117 */ 117 118 function wp_reset_postdata() { … … 132 133 * Month, Year, Category, Author, Post Type archive... 133 134 * 134 * @see WP_Query::is_archive()135 135 * @since 1.5.0 136 * @uses $wp_query 136 * 137 * @global WP_Query $wp_query 137 138 * 138 139 * @return bool … … 152 153 * Is the query for an existing post type archive page? 153 154 * 154 * @see WP_Query::is_post_type_archive()155 155 * @since 3.1.0 156 * @uses $wp_query 157 * 158 * @param mixed $post_types Optional. Post type or array of posts types to check against. 156 * 157 * @global WP_Query $wp_query 158 * 159 * @param string|array $post_types Optional. Post type or array of posts types to check against. 159 160 * @return bool 160 161 */ … … 173 174 * Is the query for an existing attachment page? 174 175 * 175 * @see WP_Query::is_attachment()176 176 * @since 2.0.0 177 * @uses $wp_query 177 * 178 * @global WP_Query $wp_query 178 179 * 179 180 * @param int|string|array|object $attachment Attachment ID, title, slug, or array of such. … … 197 198 * check if the query is for one of the authors specified. 198 199 * 199 * @see WP_Query::is_author()200 200 * @since 1.5.0 201 * @uses $wp_query 201 * 202 * @global WP_Query $wp_query 202 203 * 203 204 * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames … … 221 222 * check if the query is for one of the categories specified. 222 223 * 223 * @see WP_Query::is_category()224 224 * @since 1.5.0 225 * @uses $wp_query 225 * 226 * @global WP_Query $wp_query 226 227 * 227 228 * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs. … … 245 246 * check if the query is for one of the tags specified. 246 247 * 247 * @see WP_Query::is_tag()248 248 * @since 2.3.0 249 * @uses $wp_query 249 * 250 * @global WP_Query $wp_query 250 251 * 251 252 * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs. … … 273 274 * specified. 274 275 * 275 * @see WP_Query::is_tax()276 276 * @since 2.5.0 277 * @uses $wp_query 278 * 279 * @param string|array $taxonomy Optional. Taxonomy slug or slugs. 280 * @param int|string|array $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs. 277 * 278 * @global WP_Query $wp_query 279 * 280 * @param string|array $taxonomy Optional. Taxonomy slug or slugs. 281 * @param int|string|array $term Optional. Term ID, name, slug or array of Term IDs, names, and slugs. 281 282 * @return bool 282 283 */ … … 295 296 * Whether the current URL is within the comments popup window. 296 297 * 297 * @see WP_Query::is_comments_popup()298 298 * @since 1.5.0 299 * @uses $wp_query 299 * 300 * @global WP_Query $wp_query 300 301 * 301 302 * @return bool … … 315 316 * Is the query for an existing date archive? 316 317 * 317 * @see WP_Query::is_date()318 318 * @since 1.5.0 319 * @uses $wp_query 319 * 320 * @global WP_Query $wp_query 320 321 * 321 322 * @return bool … … 335 336 * Is the query for an existing day archive? 336 337 * 337 * @see WP_Query::is_day()338 338 * @since 1.5.0 339 * @uses $wp_query 339 * 340 * @global WP_Query $wp_query 340 341 * 341 342 * @return bool … … 355 356 * Is the query for a feed? 356 357 * 357 * @see WP_Query::is_feed()358 358 * @since 1.5.0 359 * @uses $wp_query 359 * 360 * @global WP_Query $wp_query 360 361 * 361 362 * @param string|array $feeds Optional feed types to check. … … 376 377 * Is the query for a comments feed? 377 378 * 378 * @see WP_Query::is_comments_feed()379 379 * @since 3.0.0 380 * @uses $wp_query 380 * 381 * @global WP_Query $wp_query 381 382 * 382 383 * @return bool … … 405 406 * Otherwise the same as @see is_home() 406 407 * 407 * @see WP_Query::is_front_page()408 408 * @since 2.5.0 409 * 410 * @global WP_Query $wp_query 409 411 * 410 412 * @return bool True, if front of site. … … 433 435 * @see is_front_page() 434 436 * 435 * @see WP_Query::is_home()436 437 * @since 1.5.0 437 * @uses $wp_query 438 * 439 * @global WP_Query $wp_query 438 440 * 439 441 * @return bool True if blog view homepage. … … 453 455 * Is the query for an existing month archive? 454 456 * 455 * @see WP_Query::is_month()456 457 * @since 1.5.0 457 * @uses $wp_query 458 * 459 * @global WP_Query $wp_query 458 460 * 459 461 * @return bool … … 479 481 * @see is_singular() 480 482 * 481 * @see WP_Query::is_page()482 483 * @since 1.5.0 483 * @uses $wp_query 484 * 485 * @global WP_Query $wp_query 484 486 * 485 487 * @param mixed $page Page ID, title, slug, or array of such. … … 500 502 * Is the query for paged result and not for the first page? 501 503 * 502 * @see WP_Query::is_paged()503 504 * @since 1.5.0 504 * @uses $wp_query 505 * 506 * @global WP_Query $wp_query 505 507 * 506 508 * @return bool … … 520 522 * Is the query for a post or page preview? 521 523 * 522 * @see WP_Query::is_preview()523 524 * @since 2.0.0 524 * @uses $wp_query 525 * 526 * @global WP_Query $wp_query 525 527 * 526 528 * @return bool … … 540 542 * Is the query for the robots file? 541 543 * 542 * @see WP_Query::is_robots()543 544 * @since 2.1.0 544 * @uses $wp_query 545 * 546 * @global WP_Query $wp_query 545 547 * 546 548 * @return bool … … 560 562 * Is the query for a search? 561 563 * 562 * @see WP_Query::is_search()563 564 * @since 1.5.0 564 * @uses $wp_query 565 * 566 * @global WP_Query $wp_query 565 567 * 566 568 * @return bool … … 588 590 * @see is_singular() 589 591 * 590 * @see WP_Query::is_single()591 592 * @since 1.5.0 592 * @uses $wp_query 593 * 594 * @global WP_Query $wp_query 593 595 * 594 596 * @param mixed $post Post ID, title, slug, or array of such. … … 615 617 * @see is_single() 616 618 * 617 * @see WP_Query::is_singular()618 619 * @since 1.5.0 619 * @uses $wp_query 620 * 621 * @global WP_Query $wp_query 620 622 * 621 623 * @param mixed $post_types Optional. Post Type or array of Post Types … … 636 638 * Is the query for a specific time? 637 639 * 638 * @see WP_Query::is_time()639 640 * @since 1.5.0 640 * @uses $wp_query 641 * 642 * @global WP_Query $wp_query 641 643 * 642 644 * @return bool … … 656 658 * Is the query for a trackback endpoint call? 657 659 * 658 * @see WP_Query::is_trackback()659 660 * @since 1.5.0 660 * @uses $wp_query 661 * 662 * @global WP_Query $wp_query 661 663 * 662 664 * @return bool … … 676 678 * Is the query for an existing year archive? 677 679 * 678 * @see WP_Query::is_year()679 680 * @since 1.5.0 680 * @uses $wp_query 681 * 682 * @global WP_Query $wp_query 681 683 * 682 684 * @return bool … … 696 698 * Is the query a 404 (returns no results)? 697 699 * 698 * @see WP_Query::is_404()699 700 * @since 1.5.0 700 * @uses $wp_query 701 * 702 * @global WP_Query $wp_query 701 703 * 702 704 * @return bool … … 717 719 * 718 720 * @since 3.3.0 721 * 722 * @global WP_Query $wp_query 719 723 * 720 724 * @return bool … … 738 742 * Whether current WordPress query has results to loop over. 739 743 * 740 * @see WP_Query::have_posts()741 744 * @since 1.5.0 742 * @uses $wp_query 745 * 746 * @global WP_Query $wp_query 743 747 * 744 748 * @return bool … … 746 750 function have_posts() { 747 751 global $wp_query; 748 749 752 return $wp_query->have_posts(); 750 753 } … … 754 757 * 755 758 * @since 2.0.0 756 * @uses $wp_query 759 * 760 * @global WP_Query $wp_query 757 761 * 758 762 * @return bool True if caller is within loop, false if loop hasn't started or ended. … … 760 764 function in_the_loop() { 761 765 global $wp_query; 762 763 766 return $wp_query->in_the_loop; 764 767 } … … 767 770 * Rewind the loop posts. 768 771 * 769 * @see WP_Query::rewind_posts()770 772 * @since 1.5.0 771 * @uses $wp_query 772 * 773 * @return null 773 * 774 * @global WP_Query $wp_query 774 775 */ 775 776 function rewind_posts() { 776 777 global $wp_query; 777 778 return $wp_query->rewind_posts(); 778 $wp_query->rewind_posts(); 779 779 } 780 780 … … 782 782 * Iterate the post index in the loop. 783 783 * 784 * @see WP_Query::the_post()785 784 * @since 1.5.0 786 * @uses $wp_query 785 * 786 * @global WP_Query $wp_query 787 787 */ 788 788 function the_post() { 789 789 global $wp_query; 790 791 790 $wp_query->the_post(); 792 791 } … … 799 798 * Whether there are comments to loop over. 800 799 * 801 * @see WP_Query::have_comments()802 800 * @since 2.2.0 803 * @uses $wp_query 801 * 802 * @global WP_Query $wp_query 804 803 * 805 804 * @return bool … … 813 812 * Iterate comment index in the comment loop. 814 813 * 815 * @see WP_Query::the_comment()816 814 * @since 2.2.0 817 * @uses $wp_query 815 * 816 * @global WP_Query $wp_query 818 817 * 819 818 * @return object … … 2180 2179 * 2181 2180 * @global wpdb $wpdb 2181 * 2182 2182 * @param array $q Query variables. 2183 2183 * @return string ORDER BY clause. … … 2225 2225 * 2226 2226 * @param string $orderby Alias for the field to order by. 2227 * @return string| boolTable-prefixed value to used in the ORDER clause. False otherwise.2227 * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise. 2228 2228 */ 2229 2229 protected function parse_orderby( $orderby ) { … … 2361 2361 * 2362 2362 * @param string $query_var Query variable key. 2363 * @param mixed $valueQuery variable value.2363 * @param mixed $value Query variable value. 2364 2364 */ 2365 2365 public function set($query_var, $value) { … … 2375 2375 * @since 1.5.0 2376 2376 * @access public 2377 * 2378 * @global wpdb $wpdb 2377 2379 * 2378 2380 * @return array List of posts. … … 3657 3659 * @since 3.5.0 3658 3660 * @access private 3661 * 3662 * @global wpdb $wpdb 3659 3663 */ 3660 3664 private function set_found_posts( $q, $limits ) { … … 3718 3722 * @since 1.5.0 3719 3723 * @access public 3724 * 3725 * @global WP_Post $post 3720 3726 */ 3721 3727 public function the_post() { … … 4015 4021 * @param callable $name Method to call. 4016 4022 * @param array $arguments Arguments to pass when calling. 4017 * @return mixed| boolReturn value of the callback, false otherwise.4023 * @return mixed|false Return value of the callback, false otherwise. 4018 4024 */ 4019 4025 public function __call( $name, $arguments ) { … … 4195 4201 * 4196 4202 * @since 3.1.0 4203 * 4204 * @global array $wp_taxonomies 4197 4205 * 4198 4206 * @param mixed $taxonomy Optional. Taxonomy slug or slugs. … … 4557 4565 * @since 3.3.0 4558 4566 * 4567 * @global WP_Query $wp_query 4568 * 4559 4569 * @return bool 4560 4570 */ … … 4569 4579 * @since 4.1.0 4570 4580 * 4581 * @global int $id 4582 * @global WP_User $authordata 4583 * @global string|int|bool $currentday 4584 * @global string|int|bool $currentmonth 4585 * @global int $page 4586 * @global array $pages 4587 * @global int $multipage 4588 * @global int $more 4589 * @global int $numpages 4590 * 4571 4591 * @param WP_Post $post Post data. 4572 * @return boolTrue when finished.4592 * @return true True when finished. 4573 4593 */ 4574 4594 public function setup_postdata( $post ) { … … 4637 4657 * 4638 4658 * @since 3.7.0 4659 * 4660 * @global WP_Post $post 4639 4661 */ 4640 4662 public function reset_postdata() { … … 4653 4675 * @since 2.1.0 4654 4676 * 4655 * @uses $wp_query 4656 * @global wpdb $wpdb WordPress database abstraction object. 4657 * 4658 * @return null If no link is found, null is returned. 4677 * @global WP_Query $wp_query 4678 * @global wpdb $wpdb WordPress database abstraction object. 4659 4679 */ 4660 4680 function wp_old_slug_redirect() { … … 4712 4732 * @since 1.5.0 4713 4733 * 4734 * @global WP_Query $wp_query 4735 * 4714 4736 * @param object $post Post data. 4715 4737 * @return bool True when finished.
Note: See TracChangeset
for help on using the changeset viewer.