From af719856254cfd5ec69842cbc5f601593924359a Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 31 Aug 2016 16:53:29 +0000 Subject: [PATCH] Query: r38356, you were not long for this world. Fixes #37830. Built from https://develop.svn.wordpress.org/trunk@38471 git-svn-id: http://core.svn.wordpress.org/trunk@38412 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-query.php | 176 +++++++++++++++++++++++++++++---- wp-includes/version.php | 2 +- 2 files changed, 157 insertions(+), 21 deletions(-) diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index de7c7b9da1..0ca0572b9d 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -14,21 +14,6 @@ * * @since 1.5.0 * @since 4.5.0 Removed the `$comments_popup` property. - * - * @method bool is_archive() Is the query for an existing archive page? Month, Year, Category, Author, Post Type archive... - * @method bool is_date() Is the query for an existing date archive? - * @method bool is_day() Is the query for an existing day archive? - * @method bool is_comment_feed() Is the query for a comments feed? - * @method bool is_month() Is the query for an existing month archive? - * @method bool is_paged() Is the query for paged result and not for the first page? - * @method bool is_preview() Is the query for a post or page preview? - * @method bool is_robots() Is the query for the robots file? - * @method bool is_search() Is the query for a search? - * @method bool is_time() Is the query for a specific time? - * @method bool is_trackback() Is the query for a trackback endpoint call? - * @method bool is_year() Is the query for an existing year archive? - * @method bool is_404() Is the query a 404 (returns no results)? - * @method bool is_embed() Is the query for an embedded post? */ class WP_Query { @@ -3396,14 +3381,22 @@ class WP_Query { if ( in_array( $name, $this->compat_methods ) ) { return call_user_func_array( array( $this, $name ), $arguments ); } - - if ( 'is_' === substr( $name, 0, 3 ) && property_exists( $this, $name ) ) { - return (bool) $this->{$name}; - } - return false; } + /** + * Is the query for an existing archive page? + * + * Month, Year, Category, Author, Post Type archive... + * + * @since 3.1.0 + * + * @return bool + */ + public function is_archive() { + return (bool) $this->is_archive; + } + /** * Is the query for an existing post type archive page? * @@ -3611,6 +3604,28 @@ class WP_Query { return false; } + /** + * Is the query for an existing date archive? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_date() { + return (bool) $this->is_date; + } + + /** + * Is the query for an existing day archive? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_day() { + return (bool) $this->is_day; + } + /** * Is the query for a feed? * @@ -3628,6 +3643,17 @@ class WP_Query { return in_array( $qv, (array) $feeds ); } + /** + * Is the query for a comments feed? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_comment_feed() { + return (bool) $this->is_comment_feed; + } + /** * Is the query for the front page of the site? * @@ -3674,6 +3700,17 @@ class WP_Query { return (bool) $this->is_home; } + /** + * Is the query for an existing month archive? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_month() { + return (bool) $this->is_month; + } + /** * Is the query for an existing single page? * @@ -3721,6 +3758,50 @@ class WP_Query { return false; } + /** + * Is the query for paged result and not for the first page? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_paged() { + return (bool) $this->is_paged; + } + + /** + * Is the query for a post or page preview? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_preview() { + return (bool) $this->is_preview; + } + + /** + * Is the query for the robots file? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_robots() { + return (bool) $this->is_robots; + } + + /** + * Is the query for a search? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_search() { + return (bool) $this->is_search; + } + /** * Is the query for an existing single post? * @@ -3792,6 +3873,61 @@ class WP_Query { return in_array( $post_obj->post_type, (array) $post_types ); } + /** + * Is the query for a specific time? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_time() { + return (bool) $this->is_time; + } + + /** + * Is the query for a trackback endpoint call? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_trackback() { + return (bool) $this->is_trackback; + } + + /** + * Is the query for an existing year archive? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_year() { + return (bool) $this->is_year; + } + + /** + * Is the query a 404 (returns no results)? + * + * @since 3.1.0 + * + * @return bool + */ + public function is_404() { + return (bool) $this->is_404; + } + + /** + * Is the query for an embedded post? + * + * @since 4.4.0 + * + * @return bool + */ + public function is_embed() { + return (bool) $this->is_embed; + } + /** * Is the query the main query? * diff --git a/wp-includes/version.php b/wp-includes/version.php index 69c7e735a9..3747671281 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38470'; +$wp_version = '4.7-alpha-38471'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.