Changeset 28523 for trunk/src/wp-includes/query.php
- Timestamp:
- 05/19/2014 06:48:56 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r28333 r28523 846 846 * @var array 847 847 */ 848 var$query;848 public $query; 849 849 850 850 /** … … 855 855 * @var array 856 856 */ 857 var$query_vars = array();857 public $query_vars = array(); 858 858 859 859 /** … … 864 864 * @var object WP_Tax_Query 865 865 */ 866 var$tax_query;866 public $tax_query; 867 867 868 868 /** … … 873 873 * @var object WP_Meta_Query 874 874 */ 875 var$meta_query = false;875 public $meta_query = false; 876 876 877 877 /** … … 882 882 * @var object WP_Date_Query 883 883 */ 884 var$date_query = false;884 public $date_query = false; 885 885 886 886 /** … … 893 893 * @var object|array 894 894 */ 895 var$queried_object;895 public $queried_object; 896 896 897 897 /** … … 902 902 * @var int 903 903 */ 904 var$queried_object_id;904 public $queried_object_id; 905 905 906 906 /** … … 911 911 * @var string 912 912 */ 913 var$request;913 public $request; 914 914 915 915 /** … … 920 920 * @var array 921 921 */ 922 var$posts;922 public $posts; 923 923 924 924 /** … … 929 929 * @var int 930 930 */ 931 var$post_count = 0;931 public $post_count = 0; 932 932 933 933 /** … … 938 938 * @var int 939 939 */ 940 var$current_post = -1;940 public $current_post = -1; 941 941 942 942 /** … … 947 947 * @var bool 948 948 */ 949 var$in_the_loop = false;949 public $in_the_loop = false; 950 950 951 951 /** … … 956 956 * @var WP_Post 957 957 */ 958 var$post;958 public $post; 959 959 960 960 /** … … 965 965 * @var array 966 966 */ 967 var$comments;967 public $comments; 968 968 969 969 /** … … 974 974 * @var int 975 975 */ 976 var$comment_count = 0;976 public $comment_count = 0; 977 977 978 978 /** … … 983 983 * @var int 984 984 */ 985 var$current_comment = -1;985 public $current_comment = -1; 986 986 987 987 /** … … 992 992 * @var int 993 993 */ 994 var$comment;994 public $comment; 995 995 996 996 /** … … 1003 1003 * @var int 1004 1004 */ 1005 var$found_posts = 0;1005 public $found_posts = 0; 1006 1006 1007 1007 /** … … 1012 1012 * @var int 1013 1013 */ 1014 var$max_num_pages = 0;1014 public $max_num_pages = 0; 1015 1015 1016 1016 /** … … 1021 1021 * @var int 1022 1022 */ 1023 var$max_num_comment_pages = 0;1023 public $max_num_comment_pages = 0; 1024 1024 1025 1025 /** … … 1030 1030 * @var bool 1031 1031 */ 1032 var$is_single = false;1032 public $is_single = false; 1033 1033 1034 1034 /** … … 1039 1039 * @var bool 1040 1040 */ 1041 var$is_preview = false;1041 public $is_preview = false; 1042 1042 1043 1043 /** … … 1048 1048 * @var bool 1049 1049 */ 1050 var$is_page = false;1050 public $is_page = false; 1051 1051 1052 1052 /** … … 1057 1057 * @var bool 1058 1058 */ 1059 var$is_archive = false;1059 public $is_archive = false; 1060 1060 1061 1061 /** … … 1066 1066 * @var bool 1067 1067 */ 1068 var$is_date = false;1068 public $is_date = false; 1069 1069 1070 1070 /** … … 1075 1075 * @var bool 1076 1076 */ 1077 var$is_year = false;1077 public $is_year = false; 1078 1078 1079 1079 /** … … 1084 1084 * @var bool 1085 1085 */ 1086 var$is_month = false;1086 public $is_month = false; 1087 1087 1088 1088 /** … … 1093 1093 * @var bool 1094 1094 */ 1095 var$is_day = false;1095 public $is_day = false; 1096 1096 1097 1097 /** … … 1102 1102 * @var bool 1103 1103 */ 1104 var$is_time = false;1104 public $is_time = false; 1105 1105 1106 1106 /** … … 1111 1111 * @var bool 1112 1112 */ 1113 var$is_author = false;1113 public $is_author = false; 1114 1114 1115 1115 /** … … 1120 1120 * @var bool 1121 1121 */ 1122 var$is_category = false;1122 public $is_category = false; 1123 1123 1124 1124 /** … … 1129 1129 * @var bool 1130 1130 */ 1131 var$is_tag = false;1131 public $is_tag = false; 1132 1132 1133 1133 /** … … 1138 1138 * @var bool 1139 1139 */ 1140 var$is_tax = false;1140 public $is_tax = false; 1141 1141 1142 1142 /** … … 1147 1147 * @var bool 1148 1148 */ 1149 var$is_search = false;1149 public $is_search = false; 1150 1150 1151 1151 /** … … 1156 1156 * @var bool 1157 1157 */ 1158 var$is_feed = false;1158 public $is_feed = false; 1159 1159 1160 1160 /** … … 1165 1165 * @var bool 1166 1166 */ 1167 var$is_comment_feed = false;1167 public $is_comment_feed = false; 1168 1168 1169 1169 /** … … 1174 1174 * @var bool 1175 1175 */ 1176 var$is_trackback = false;1176 public $is_trackback = false; 1177 1177 1178 1178 /** … … 1183 1183 * @var bool 1184 1184 */ 1185 var$is_home = false;1185 public $is_home = false; 1186 1186 1187 1187 /** … … 1192 1192 * @var bool 1193 1193 */ 1194 var$is_404 = false;1194 public $is_404 = false; 1195 1195 1196 1196 /** … … 1201 1201 * @var bool 1202 1202 */ 1203 var$is_comments_popup = false;1203 public $is_comments_popup = false; 1204 1204 1205 1205 /** … … 1210 1210 * @var bool 1211 1211 */ 1212 var$is_paged = false;1212 public $is_paged = false; 1213 1213 1214 1214 /** … … 1219 1219 * @var bool 1220 1220 */ 1221 var$is_admin = false;1221 public $is_admin = false; 1222 1222 1223 1223 /** … … 1228 1228 * @var bool 1229 1229 */ 1230 var$is_attachment = false;1230 public $is_attachment = false; 1231 1231 1232 1232 /** … … 1237 1237 * @var bool 1238 1238 */ 1239 var$is_singular = false;1239 public $is_singular = false; 1240 1240 1241 1241 /** … … 1246 1246 * @var bool 1247 1247 */ 1248 var$is_robots = false;1248 public $is_robots = false; 1249 1249 1250 1250 /** … … 1257 1257 * @var bool 1258 1258 */ 1259 var$is_posts_page = false;1259 public $is_posts_page = false; 1260 1260 1261 1261 /** … … 1266 1266 * @var bool 1267 1267 */ 1268 var$is_post_type_archive = false;1268 public $is_post_type_archive = false; 1269 1269 1270 1270 /** … … 1275 1275 * @access private 1276 1276 */ 1277 var$query_vars_hash = false;1277 private $query_vars_hash = false; 1278 1278 1279 1279 /** … … 1284 1284 * @access private 1285 1285 */ 1286 var$query_vars_changed = true;1286 private $query_vars_changed = true; 1287 1287 1288 1288 /** … … 1293 1293 * @var bool 1294 1294 */ 1295 var$thumbnails_cached = false;1295 public $thumbnails_cached = false; 1296 1296 1297 1297 /** … … 1311 1311 * @access private 1312 1312 */ 1313 function init_query_flags() {1313 private function init_query_flags() { 1314 1314 $this->is_single = false; 1315 1315 $this->is_preview = false; … … 1347 1347 * @access public 1348 1348 */ 1349 function init() {1349 public function init() { 1350 1350 unset($this->posts); 1351 1351 unset($this->query); … … 1375 1375 * @access public 1376 1376 */ 1377 function parse_query_vars() {1377 public function parse_query_vars() { 1378 1378 $this->parse_query(); 1379 1379 } … … 1388 1388 * @return array Complete query variables with undefined ones filled in empty. 1389 1389 */ 1390 function fill_query_vars($array) {1390 public function fill_query_vars($array) { 1391 1391 $keys = array( 1392 1392 'error' … … 1452 1452 * @param string|array $query Optional query. 1453 1453 */ 1454 function parse_query( $query = '' ) {1454 public function parse_query( $query = '' ) { 1455 1455 if ( ! empty( $query ) ) { 1456 1456 $this->init(); … … 1733 1733 * @param array &$q The query variables 1734 1734 */ 1735 function parse_tax_query( &$q ) {1735 protected function parse_tax_query( &$q ) { 1736 1736 if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) { 1737 1737 $tax_query = $q['tax_query']; … … 2114 2114 * @access public 2115 2115 */ 2116 function set_404() {2116 public function set_404() { 2117 2117 $is_feed = $this->is_feed; 2118 2118 … … 2133 2133 * @return mixed 2134 2134 */ 2135 function get( $query_var, $default = '' ) {2135 public function get( $query_var, $default = '' ) { 2136 2136 if ( isset( $this->query_vars[ $query_var ] ) ) { 2137 2137 return $this->query_vars[ $query_var ]; … … 2150 2150 * @param mixed $value Query variable value. 2151 2151 */ 2152 function set($query_var, $value) {2152 public function set($query_var, $value) { 2153 2153 $this->query_vars[$query_var] = $value; 2154 2154 } … … 2166 2166 * @return array List of posts. 2167 2167 */ 2168 function get_posts() {2168 public function get_posts() { 2169 2169 global $wpdb; 2170 2170 … … 3467 3467 * @return WP_Post Next post. 3468 3468 */ 3469 function next_post() {3469 public function next_post() { 3470 3470 3471 3471 $this->current_post++; … … 3486 3486 * @uses do_action_ref_array() Calls 'loop_start' if loop has just started 3487 3487 */ 3488 function the_post() {3488 public function the_post() { 3489 3489 global $post; 3490 3490 $this->in_the_loop = true; … … 3515 3515 * @return bool True if posts are available, false if end of loop. 3516 3516 */ 3517 function have_posts() {3517 public function have_posts() { 3518 3518 if ( $this->current_post + 1 < $this->post_count ) { 3519 3519 return true; … … 3541 3541 * @access public 3542 3542 */ 3543 function rewind_posts() {3543 public function rewind_posts() { 3544 3544 $this->current_post = -1; 3545 3545 if ( $this->post_count > 0 ) { … … 3556 3556 * @return object Comment object. 3557 3557 */ 3558 function next_comment() {3558 public function next_comment() { 3559 3559 $this->current_comment++; 3560 3560 … … 3571 3571 * @uses do_action() Calls 'comment_loop_start' hook when first comment is processed. 3572 3572 */ 3573 function the_comment() {3573 public function the_comment() { 3574 3574 global $comment; 3575 3575 … … 3596 3596 * @return bool True, if more comments. False, if no more posts. 3597 3597 */ 3598 function have_comments() {3598 public function have_comments() { 3599 3599 if ( $this->current_comment + 1 < $this->comment_count ) { 3600 3600 return true; … … 3612 3612 * @access public 3613 3613 */ 3614 function rewind_comments() {3614 public function rewind_comments() { 3615 3615 $this->current_comment = -1; 3616 3616 if ( $this->comment_count > 0 ) { … … 3628 3628 * @return array List of posts. 3629 3629 */ 3630 function query( $query ) {3630 public function query( $query ) { 3631 3631 $this->init(); 3632 3632 $this->query = $this->query_vars = wp_parse_args( $query ); … … 3646 3646 * @return object 3647 3647 */ 3648 function get_queried_object() {3648 public function get_queried_object() { 3649 3649 if ( isset($this->queried_object) ) 3650 3650 return $this->queried_object; … … 3714 3714 * @return int 3715 3715 */ 3716 function get_queried_object_id() {3716 public function get_queried_object_id() { 3717 3717 $this->get_queried_object(); 3718 3718 … … 3735 3735 * @return WP_Query 3736 3736 */ 3737 function __construct($query = '') {3737 public function __construct($query = '') { 3738 3738 if ( ! empty($query) ) { 3739 3739 $this->query($query); 3740 3740 } 3741 } 3742 3743 /** 3744 * Make private properties readable for backwards compatibility 3745 * 3746 * @since 4.0.0 3747 * @param string $name 3748 * @return mixed 3749 */ 3750 public function __get( $name ) { 3751 return $this->$name; 3752 } 3753 3754 /** 3755 * Make private properties setable for backwards compatibility 3756 * 3757 * @since 4.0.0 3758 * @param string $name 3759 * @return mixed 3760 */ 3761 public function __isset( $name ) { 3762 return isset( $this->$name ); 3763 } 3764 3765 /** 3766 * Make private properties setable for backwards compatibility 3767 * 3768 * @since 4.0.0 3769 * @param string $name 3770 * @return mixed 3771 */ 3772 public function __unset( $name ) { 3773 unset( $this->$name ); 3774 } 3775 3776 /** 3777 * Make private/protected methods readable for backwards compatibility 3778 * 3779 * @since 4.0.0 3780 * @param string $name 3781 * @param array $arguments 3782 * @return mixed 3783 */ 3784 public function __call( $name, $arguments ) { 3785 return call_user_func_array( array( $this, $name ), $arguments ); 3741 3786 } 3742 3787 … … 3750 3795 * @return bool 3751 3796 */ 3752 function is_archive() {3797 public function is_archive() { 3753 3798 return (bool) $this->is_archive; 3754 3799 } … … 3762 3807 * @return bool 3763 3808 */ 3764 function is_post_type_archive( $post_types = '' ) {3809 public function is_post_type_archive( $post_types = '' ) { 3765 3810 if ( empty( $post_types ) || ! $this->is_post_type_archive ) 3766 3811 return (bool) $this->is_post_type_archive; … … 3782 3827 * @return bool 3783 3828 */ 3784 function is_attachment( $attachment = '' ) {3829 public function is_attachment( $attachment = '' ) { 3785 3830 if ( ! $this->is_attachment ) { 3786 3831 return false; … … 3816 3861 * @return bool 3817 3862 */ 3818 function is_author( $author = '' ) {3863 public function is_author( $author = '' ) { 3819 3864 if ( !$this->is_author ) 3820 3865 return false; … … 3848 3893 * @return bool 3849 3894 */ 3850 function is_category( $category = '' ) {3895 public function is_category( $category = '' ) { 3851 3896 if ( !$this->is_category ) 3852 3897 return false; … … 3880 3925 * @return bool 3881 3926 */ 3882 function is_tag( $tag = '' ) {3927 public function is_tag( $tag = '' ) { 3883 3928 if ( ! $this->is_tag ) 3884 3929 return false; … … 3917 3962 * @return bool 3918 3963 */ 3919 function is_tax( $taxonomy = '', $term = '' ) {3964 public function is_tax( $taxonomy = '', $term = '' ) { 3920 3965 global $wp_taxonomies; 3921 3966 … … 3952 3997 * @return bool 3953 3998 */ 3954 function is_comments_popup() {3999 public function is_comments_popup() { 3955 4000 return (bool) $this->is_comments_popup; 3956 4001 } … … 3963 4008 * @return bool 3964 4009 */ 3965 function is_date() {4010 public function is_date() { 3966 4011 return (bool) $this->is_date; 3967 4012 } … … 3974 4019 * @return bool 3975 4020 */ 3976 function is_day() {4021 public function is_day() { 3977 4022 return (bool) $this->is_day; 3978 4023 } … … 3986 4031 * @return bool 3987 4032 */ 3988 function is_feed( $feeds = '' ) {4033 public function is_feed( $feeds = '' ) { 3989 4034 if ( empty( $feeds ) || ! $this->is_feed ) 3990 4035 return (bool) $this->is_feed; … … 4002 4047 * @return bool 4003 4048 */ 4004 function is_comment_feed() {4049 public function is_comment_feed() { 4005 4050 return (bool) $this->is_comment_feed; 4006 4051 } … … 4024 4069 * @return bool True, if front of site. 4025 4070 */ 4026 function is_front_page() {4071 public function is_front_page() { 4027 4072 // most likely case 4028 4073 if ( 'posts' == get_option( 'show_on_front') && $this->is_home() ) … … 4050 4095 * @return bool True if blog view homepage. 4051 4096 */ 4052 function is_home() {4097 public function is_home() { 4053 4098 return (bool) $this->is_home; 4054 4099 } … … 4061 4106 * @return bool 4062 4107 */ 4063 function is_month() {4108 public function is_month() { 4064 4109 return (bool) $this->is_month; 4065 4110 } … … 4079 4124 * @return bool 4080 4125 */ 4081 function is_page( $page = '' ) {4126 public function is_page( $page = '' ) { 4082 4127 if ( !$this->is_page ) 4083 4128 return false; … … 4107 4152 * @return bool 4108 4153 */ 4109 function is_paged() {4154 public function is_paged() { 4110 4155 return (bool) $this->is_paged; 4111 4156 } … … 4118 4163 * @return bool 4119 4164 */ 4120 function is_preview() {4165 public function is_preview() { 4121 4166 return (bool) $this->is_preview; 4122 4167 } … … 4129 4174 * @return bool 4130 4175 */ 4131 function is_robots() {4176 public function is_robots() { 4132 4177 return (bool) $this->is_robots; 4133 4178 } … … 4140 4185 * @return bool 4141 4186 */ 4142 function is_search() {4187 public function is_search() { 4143 4188 return (bool) $this->is_search; 4144 4189 } … … 4160 4205 * @return bool 4161 4206 */ 4162 function is_single( $post = '' ) {4207 public function is_single( $post = '' ) { 4163 4208 if ( !$this->is_single ) 4164 4209 return false; … … 4195 4240 * @return bool 4196 4241 */ 4197 function is_singular( $post_types = '' ) {4242 public function is_singular( $post_types = '' ) { 4198 4243 if ( empty( $post_types ) || !$this->is_singular ) 4199 4244 return (bool) $this->is_singular; … … 4211 4256 * @return bool 4212 4257 */ 4213 function is_time() {4258 public function is_time() { 4214 4259 return (bool) $this->is_time; 4215 4260 } … … 4222 4267 * @return bool 4223 4268 */ 4224 function is_trackback() {4269 public function is_trackback() { 4225 4270 return (bool) $this->is_trackback; 4226 4271 } … … 4233 4278 * @return bool 4234 4279 */ 4235 function is_year() {4280 public function is_year() { 4236 4281 return (bool) $this->is_year; 4237 4282 } … … 4244 4289 * @return bool 4245 4290 */ 4246 function is_404() {4291 public function is_404() { 4247 4292 return (bool) $this->is_404; 4248 4293 } … … 4255 4300 * @return bool 4256 4301 */ 4257 function is_main_query() {4302 public function is_main_query() { 4258 4303 global $wp_the_query; 4259 4304 return $wp_the_query === $this; … … 4268 4313 * @return bool 4269 4314 */ 4270 function reset_postdata() {4315 public function reset_postdata() { 4271 4316 if ( ! empty( $this->post ) ) { 4272 4317 $GLOBALS['post'] = $this->post;
Note: See TracChangeset
for help on using the changeset viewer.