<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[28523] trunk: Add missing access modifiers to methods in `WP_Query`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/28523">28523</a></dd>
<dt>Author</dt> <dd>wonderboymusic</dd>
<dt>Date</dt> <dd>2014-05-19 06:48:56 +0000 (Mon, 19 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add missing access modifiers to methods in `WP_Query`. Add magic methods for `__get()`, `__set()`, `__isset()`, `__unset()`, and `__call()`.
Add unit test for magic methods.
See <a href="http://core.trac.wordpress.org/ticket/27881">#27881</a>, <a href="http://core.trac.wordpress.org/ticket/22234">#22234</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesqueryphp">trunk/src/wp-includes/query.php</a></li>
<li><a href="#trunktestsphpunitincludesfunctionsphp">trunk/tests/phpunit/includes/functions.php</a></li>
<li><a href="#trunktestsphpunittestsbasicphp">trunk/tests/phpunit/tests/basic.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesqueryphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/query.php (28522 => 28523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/query.php 2014-05-19 06:34:01 UTC (rev 28522)
+++ trunk/src/wp-includes/query.php 2014-05-19 06:48:56 UTC (rev 28523)
</span><span class="lines">@@ -845,7 +845,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var array
</span><span class="cx"> */
</span><del>- var $query;
</del><ins>+ public $query;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Query vars, after parsing
</span><span class="lines">@@ -854,7 +854,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var array
</span><span class="cx"> */
</span><del>- var $query_vars = array();
</del><ins>+ public $query_vars = array();
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Taxonomy query, as passed to get_tax_sql()
</span><span class="lines">@@ -863,7 +863,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var object WP_Tax_Query
</span><span class="cx"> */
</span><del>- var $tax_query;
</del><ins>+ public $tax_query;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Metadata query container
</span><span class="lines">@@ -872,7 +872,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var object WP_Meta_Query
</span><span class="cx"> */
</span><del>- var $meta_query = false;
</del><ins>+ public $meta_query = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Date query container
</span><span class="lines">@@ -881,7 +881,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var object WP_Date_Query
</span><span class="cx"> */
</span><del>- var $date_query = false;
</del><ins>+ public $date_query = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Holds the data for a single object that is queried.
</span><span class="lines">@@ -892,7 +892,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var object|array
</span><span class="cx"> */
</span><del>- var $queried_object;
</del><ins>+ public $queried_object;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The ID of the queried object.
</span><span class="lines">@@ -901,7 +901,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $queried_object_id;
</del><ins>+ public $queried_object_id;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Get post database query.
</span><span class="lines">@@ -910,7 +910,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var string
</span><span class="cx"> */
</span><del>- var $request;
</del><ins>+ public $request;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * List of posts.
</span><span class="lines">@@ -919,7 +919,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var array
</span><span class="cx"> */
</span><del>- var $posts;
</del><ins>+ public $posts;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The amount of posts for the current query.
</span><span class="lines">@@ -928,7 +928,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $post_count = 0;
</del><ins>+ public $post_count = 0;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Index of the current item in the loop.
</span><span class="lines">@@ -937,7 +937,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $current_post = -1;
</del><ins>+ public $current_post = -1;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Whether the loop has started and the caller is in the loop.
</span><span class="lines">@@ -946,7 +946,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $in_the_loop = false;
</del><ins>+ public $in_the_loop = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The current post.
</span><span class="lines">@@ -955,7 +955,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var WP_Post
</span><span class="cx"> */
</span><del>- var $post;
</del><ins>+ public $post;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The list of comments for current post.
</span><span class="lines">@@ -964,7 +964,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var array
</span><span class="cx"> */
</span><del>- var $comments;
</del><ins>+ public $comments;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The amount of comments for the posts.
</span><span class="lines">@@ -973,7 +973,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $comment_count = 0;
</del><ins>+ public $comment_count = 0;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The index of the comment in the comment loop.
</span><span class="lines">@@ -982,7 +982,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $current_comment = -1;
</del><ins>+ public $current_comment = -1;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Current comment ID.
</span><span class="lines">@@ -991,7 +991,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $comment;
</del><ins>+ public $comment;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The amount of found posts for the current query.
</span><span class="lines">@@ -1002,7 +1002,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $found_posts = 0;
</del><ins>+ public $found_posts = 0;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The amount of pages.
</span><span class="lines">@@ -1011,7 +1011,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $max_num_pages = 0;
</del><ins>+ public $max_num_pages = 0;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * The amount of comment pages.
</span><span class="lines">@@ -1020,7 +1020,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var int
</span><span class="cx"> */
</span><del>- var $max_num_comment_pages = 0;
</del><ins>+ public $max_num_comment_pages = 0;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is single post.
</span><span class="lines">@@ -1029,7 +1029,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_single = false;
</del><ins>+ public $is_single = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is preview of blog.
</span><span class="lines">@@ -1038,7 +1038,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_preview = false;
</del><ins>+ public $is_preview = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query returns a page.
</span><span class="lines">@@ -1047,7 +1047,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_page = false;
</del><ins>+ public $is_page = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is an archive list.
</span><span class="lines">@@ -1056,7 +1056,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_archive = false;
</del><ins>+ public $is_archive = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is part of a date.
</span><span class="lines">@@ -1065,7 +1065,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_date = false;
</del><ins>+ public $is_date = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains a year.
</span><span class="lines">@@ -1074,7 +1074,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_year = false;
</del><ins>+ public $is_year = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains a month.
</span><span class="lines">@@ -1083,7 +1083,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_month = false;
</del><ins>+ public $is_month = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains a day.
</span><span class="lines">@@ -1092,7 +1092,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_day = false;
</del><ins>+ public $is_day = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains time.
</span><span class="lines">@@ -1101,7 +1101,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_time = false;
</del><ins>+ public $is_time = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains an author.
</span><span class="lines">@@ -1110,7 +1110,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_author = false;
</del><ins>+ public $is_author = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains category.
</span><span class="lines">@@ -1119,7 +1119,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_category = false;
</del><ins>+ public $is_category = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains tag.
</span><span class="lines">@@ -1128,7 +1128,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_tag = false;
</del><ins>+ public $is_tag = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains taxonomy.
</span><span class="lines">@@ -1137,7 +1137,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_tax = false;
</del><ins>+ public $is_tax = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query was part of a search result.
</span><span class="lines">@@ -1146,7 +1146,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_search = false;
</del><ins>+ public $is_search = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is feed display.
</span><span class="lines">@@ -1155,7 +1155,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_feed = false;
</del><ins>+ public $is_feed = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is comment feed display.
</span><span class="lines">@@ -1164,7 +1164,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_comment_feed = false;
</del><ins>+ public $is_comment_feed = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is trackback.
</span><span class="lines">@@ -1173,7 +1173,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_trackback = false;
</del><ins>+ public $is_trackback = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is blog homepage.
</span><span class="lines">@@ -1182,7 +1182,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_home = false;
</del><ins>+ public $is_home = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query couldn't found anything.
</span><span class="lines">@@ -1191,7 +1191,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_404 = false;
</del><ins>+ public $is_404 = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is within comments popup window.
</span><span class="lines">@@ -1200,7 +1200,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_comments_popup = false;
</del><ins>+ public $is_comments_popup = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is paged
</span><span class="lines">@@ -1209,7 +1209,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_paged = false;
</del><ins>+ public $is_paged = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is part of administration page.
</span><span class="lines">@@ -1218,7 +1218,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_admin = false;
</del><ins>+ public $is_admin = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is an attachment.
</span><span class="lines">@@ -1227,7 +1227,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_attachment = false;
</del><ins>+ public $is_attachment = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if is single, is a page, or is an attachment.
</span><span class="lines">@@ -1236,7 +1236,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_singular = false;
</del><ins>+ public $is_singular = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is for robots.
</span><span class="lines">@@ -1245,7 +1245,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_robots = false;
</del><ins>+ public $is_robots = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query contains posts.
</span><span class="lines">@@ -1256,7 +1256,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_posts_page = false;
</del><ins>+ public $is_posts_page = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if query is for a post type archive.
</span><span class="lines">@@ -1265,7 +1265,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $is_post_type_archive = false;
</del><ins>+ public $is_post_type_archive = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Stores the ->query_vars state like md5(serialize( $this->query_vars ) ) so we know
</span><span class="lines">@@ -1274,7 +1274,7 @@
</span><span class="cx"> * @since 3.1.0
</span><span class="cx"> * @access private
</span><span class="cx"> */
</span><del>- var $query_vars_hash = false;
</del><ins>+ private $query_vars_hash = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Whether query vars have changed since the initial parse_query() call. Used to catch modifications to query vars made
</span><span class="lines">@@ -1283,7 +1283,7 @@
</span><span class="cx"> * @since 3.1.1
</span><span class="cx"> * @access private
</span><span class="cx"> */
</span><del>- var $query_vars_changed = true;
</del><ins>+ private $query_vars_changed = true;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Set if post thumbnails are cached
</span><span class="lines">@@ -1292,7 +1292,7 @@
</span><span class="cx"> * @access public
</span><span class="cx"> * @var bool
</span><span class="cx"> */
</span><del>- var $thumbnails_cached = false;
</del><ins>+ public $thumbnails_cached = false;
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Cached list of search stopwords.
</span><span class="lines">@@ -1310,7 +1310,7 @@
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> * @access private
</span><span class="cx"> */
</span><del>- function init_query_flags() {
</del><ins>+ private function init_query_flags() {
</ins><span class="cx"> $this->is_single = false;
</span><span class="cx"> $this->is_preview = false;
</span><span class="cx"> $this->is_page = false;
</span><span class="lines">@@ -1346,7 +1346,7 @@
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> * @access public
</span><span class="cx"> */
</span><del>- function init() {
</del><ins>+ public function init() {
</ins><span class="cx"> unset($this->posts);
</span><span class="cx"> unset($this->query);
</span><span class="cx"> $this->query_vars = array();
</span><span class="lines">@@ -1374,7 +1374,7 @@
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> * @access public
</span><span class="cx"> */
</span><del>- function parse_query_vars() {
</del><ins>+ public function parse_query_vars() {
</ins><span class="cx"> $this->parse_query();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1387,7 +1387,7 @@
</span><span class="cx"> * @param array $array Defined query variables.
</span><span class="cx"> * @return array Complete query variables with undefined ones filled in empty.
</span><span class="cx"> */
</span><del>- function fill_query_vars($array) {
</del><ins>+ public function fill_query_vars($array) {
</ins><span class="cx"> $keys = array(
</span><span class="cx"> 'error'
</span><span class="cx"> , 'm'
</span><span class="lines">@@ -1451,7 +1451,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @param string|array $query Optional query.
</span><span class="cx"> */
</span><del>- function parse_query( $query = '' ) {
</del><ins>+ public function parse_query( $query = '' ) {
</ins><span class="cx"> if ( ! empty( $query ) ) {
</span><span class="cx"> $this->init();
</span><span class="cx"> $this->query = $this->query_vars = wp_parse_args( $query );
</span><span class="lines">@@ -1732,7 +1732,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @param array &$q The query variables
</span><span class="cx"> */
</span><del>- function parse_tax_query( &$q ) {
</del><ins>+ protected function parse_tax_query( &$q ) {
</ins><span class="cx"> if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) {
</span><span class="cx"> $tax_query = $q['tax_query'];
</span><span class="cx"> } else {
</span><span class="lines">@@ -2113,7 +2113,7 @@
</span><span class="cx"> * @since 2.0.0
</span><span class="cx"> * @access public
</span><span class="cx"> */
</span><del>- function set_404() {
</del><ins>+ public function set_404() {
</ins><span class="cx"> $is_feed = $this->is_feed;
</span><span class="cx">
</span><span class="cx"> $this->init_query_flags();
</span><span class="lines">@@ -2132,7 +2132,7 @@
</span><span class="cx"> * @param mixed $default Value to return if the query variable is not set. Default ''.
</span><span class="cx"> * @return mixed
</span><span class="cx"> */
</span><del>- function get( $query_var, $default = '' ) {
</del><ins>+ public function get( $query_var, $default = '' ) {
</ins><span class="cx"> if ( isset( $this->query_vars[ $query_var ] ) ) {
</span><span class="cx"> return $this->query_vars[ $query_var ];
</span><span class="cx"> }
</span><span class="lines">@@ -2149,7 +2149,7 @@
</span><span class="cx"> * @param string $query_var Query variable key.
</span><span class="cx"> * @param mixed $value Query variable value.
</span><span class="cx"> */
</span><del>- function set($query_var, $value) {
</del><ins>+ public function set($query_var, $value) {
</ins><span class="cx"> $this->query_vars[$query_var] = $value;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2165,7 +2165,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return array List of posts.
</span><span class="cx"> */
</span><del>- function get_posts() {
</del><ins>+ public function get_posts() {
</ins><span class="cx"> global $wpdb;
</span><span class="cx">
</span><span class="cx"> $this->parse_query();
</span><span class="lines">@@ -3466,7 +3466,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return WP_Post Next post.
</span><span class="cx"> */
</span><del>- function next_post() {
</del><ins>+ public function next_post() {
</ins><span class="cx">
</span><span class="cx"> $this->current_post++;
</span><span class="cx">
</span><span class="lines">@@ -3485,7 +3485,7 @@
</span><span class="cx"> * @uses $post
</span><span class="cx"> * @uses do_action_ref_array() Calls 'loop_start' if loop has just started
</span><span class="cx"> */
</span><del>- function the_post() {
</del><ins>+ public function the_post() {
</ins><span class="cx"> global $post;
</span><span class="cx"> $this->in_the_loop = true;
</span><span class="cx">
</span><span class="lines">@@ -3514,7 +3514,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool True if posts are available, false if end of loop.
</span><span class="cx"> */
</span><del>- function have_posts() {
</del><ins>+ public function have_posts() {
</ins><span class="cx"> if ( $this->current_post + 1 < $this->post_count ) {
</span><span class="cx"> return true;
</span><span class="cx"> } elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
</span><span class="lines">@@ -3540,7 +3540,7 @@
</span><span class="cx"> * @since 1.5.0
</span><span class="cx"> * @access public
</span><span class="cx"> */
</span><del>- function rewind_posts() {
</del><ins>+ public function rewind_posts() {
</ins><span class="cx"> $this->current_post = -1;
</span><span class="cx"> if ( $this->post_count > 0 ) {
</span><span class="cx"> $this->post = $this->posts[0];
</span><span class="lines">@@ -3555,7 +3555,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return object Comment object.
</span><span class="cx"> */
</span><del>- function next_comment() {
</del><ins>+ public function next_comment() {
</ins><span class="cx"> $this->current_comment++;
</span><span class="cx">
</span><span class="cx"> $this->comment = $this->comments[$this->current_comment];
</span><span class="lines">@@ -3570,7 +3570,7 @@
</span><span class="cx"> * @global object $comment Current comment.
</span><span class="cx"> * @uses do_action() Calls 'comment_loop_start' hook when first comment is processed.
</span><span class="cx"> */
</span><del>- function the_comment() {
</del><ins>+ public function the_comment() {
</ins><span class="cx"> global $comment;
</span><span class="cx">
</span><span class="cx"> $comment = $this->next_comment();
</span><span class="lines">@@ -3595,7 +3595,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool True, if more comments. False, if no more posts.
</span><span class="cx"> */
</span><del>- function have_comments() {
</del><ins>+ public function have_comments() {
</ins><span class="cx"> if ( $this->current_comment + 1 < $this->comment_count ) {
</span><span class="cx"> return true;
</span><span class="cx"> } elseif ( $this->current_comment + 1 == $this->comment_count ) {
</span><span class="lines">@@ -3611,7 +3611,7 @@
</span><span class="cx"> * @since 2.2.0
</span><span class="cx"> * @access public
</span><span class="cx"> */
</span><del>- function rewind_comments() {
</del><ins>+ public function rewind_comments() {
</ins><span class="cx"> $this->current_comment = -1;
</span><span class="cx"> if ( $this->comment_count > 0 ) {
</span><span class="cx"> $this->comment = $this->comments[0];
</span><span class="lines">@@ -3627,7 +3627,7 @@
</span><span class="cx"> * @param string $query URL query string.
</span><span class="cx"> * @return array List of posts.
</span><span class="cx"> */
</span><del>- function query( $query ) {
</del><ins>+ public function query( $query ) {
</ins><span class="cx"> $this->init();
</span><span class="cx"> $this->query = $this->query_vars = wp_parse_args( $query );
</span><span class="cx"> return $this->get_posts();
</span><span class="lines">@@ -3645,7 +3645,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return object
</span><span class="cx"> */
</span><del>- function get_queried_object() {
</del><ins>+ public function get_queried_object() {
</ins><span class="cx"> if ( isset($this->queried_object) )
</span><span class="cx"> return $this->queried_object;
</span><span class="cx">
</span><span class="lines">@@ -3713,7 +3713,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return int
</span><span class="cx"> */
</span><del>- function get_queried_object_id() {
</del><ins>+ public function get_queried_object_id() {
</ins><span class="cx"> $this->get_queried_object();
</span><span class="cx">
</span><span class="cx"> if ( isset($this->queried_object_id) ) {
</span><span class="lines">@@ -3734,13 +3734,58 @@
</span><span class="cx"> * @param string $query URL query string.
</span><span class="cx"> * @return WP_Query
</span><span class="cx"> */
</span><del>- function __construct($query = '') {
</del><ins>+ public function __construct($query = '') {
</ins><span class="cx"> if ( ! empty($query) ) {
</span><span class="cx"> $this->query($query);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * Make private properties readable for backwards compatibility
+ *
+ * @since 4.0.0
+ * @param string $name
+ * @return mixed
+ */
+ public function __get( $name ) {
+ return $this->$name;
+ }
+
+ /**
+ * Make private properties setable for backwards compatibility
+ *
+ * @since 4.0.0
+ * @param string $name
+ * @return mixed
+ */
+ public function __isset( $name ) {
+ return isset( $this->$name );
+ }
+
+ /**
+ * Make private properties setable for backwards compatibility
+ *
+ * @since 4.0.0
+ * @param string $name
+ * @return mixed
+ */
+ public function __unset( $name ) {
+ unset( $this->$name );
+ }
+
+ /**
+ * Make private/protected methods readable for backwards compatibility
+ *
+ * @since 4.0.0
+ * @param string $name
+ * @param array $arguments
+ * @return mixed
+ */
+ public function __call( $name, $arguments ) {
+ return call_user_func_array( array( $this, $name ), $arguments );
+ }
+
+ /**
</ins><span class="cx"> * Is the query for an existing archive page?
</span><span class="cx"> *
</span><span class="cx"> * Month, Year, Category, Author, Post Type archive...
</span><span class="lines">@@ -3749,7 +3794,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_archive() {
</del><ins>+ public function is_archive() {
</ins><span class="cx"> return (bool) $this->is_archive;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3761,7 +3806,7 @@
</span><span class="cx"> * @param mixed $post_types Optional. Post type or array of posts types to check against.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_post_type_archive( $post_types = '' ) {
</del><ins>+ public function is_post_type_archive( $post_types = '' ) {
</ins><span class="cx"> if ( empty( $post_types ) || ! $this->is_post_type_archive )
</span><span class="cx"> return (bool) $this->is_post_type_archive;
</span><span class="cx">
</span><span class="lines">@@ -3781,7 +3826,7 @@
</span><span class="cx"> * @param mixed $attachment Attachment ID, title, slug, or array of such.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_attachment( $attachment = '' ) {
</del><ins>+ public function is_attachment( $attachment = '' ) {
</ins><span class="cx"> if ( ! $this->is_attachment ) {
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="lines">@@ -3815,7 +3860,7 @@
</span><span class="cx"> * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_author( $author = '' ) {
</del><ins>+ public function is_author( $author = '' ) {
</ins><span class="cx"> if ( !$this->is_author )
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -3847,7 +3892,7 @@
</span><span class="cx"> * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_category( $category = '' ) {
</del><ins>+ public function is_category( $category = '' ) {
</ins><span class="cx"> if ( !$this->is_category )
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -3879,7 +3924,7 @@
</span><span class="cx"> * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_tag( $tag = '' ) {
</del><ins>+ public function is_tag( $tag = '' ) {
</ins><span class="cx"> if ( ! $this->is_tag )
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -3916,7 +3961,7 @@
</span><span class="cx"> * @param mixed $term. Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_tax( $taxonomy = '', $term = '' ) {
</del><ins>+ public function is_tax( $taxonomy = '', $term = '' ) {
</ins><span class="cx"> global $wp_taxonomies;
</span><span class="cx">
</span><span class="cx"> if ( !$this->is_tax )
</span><span class="lines">@@ -3951,7 +3996,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_comments_popup() {
</del><ins>+ public function is_comments_popup() {
</ins><span class="cx"> return (bool) $this->is_comments_popup;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3962,7 +4007,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_date() {
</del><ins>+ public function is_date() {
</ins><span class="cx"> return (bool) $this->is_date;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3973,7 +4018,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_day() {
</del><ins>+ public function is_day() {
</ins><span class="cx"> return (bool) $this->is_day;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -3985,7 +4030,7 @@
</span><span class="cx"> * @param string|array $feeds Optional feed types to check.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_feed( $feeds = '' ) {
</del><ins>+ public function is_feed( $feeds = '' ) {
</ins><span class="cx"> if ( empty( $feeds ) || ! $this->is_feed )
</span><span class="cx"> return (bool) $this->is_feed;
</span><span class="cx"> $qv = $this->get( 'feed' );
</span><span class="lines">@@ -4001,7 +4046,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_comment_feed() {
</del><ins>+ public function is_comment_feed() {
</ins><span class="cx"> return (bool) $this->is_comment_feed;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4023,7 +4068,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool True, if front of site.
</span><span class="cx"> */
</span><del>- function is_front_page() {
</del><ins>+ public function is_front_page() {
</ins><span class="cx"> // most likely case
</span><span class="cx"> if ( 'posts' == get_option( 'show_on_front') && $this->is_home() )
</span><span class="cx"> return true;
</span><span class="lines">@@ -4049,7 +4094,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool True if blog view homepage.
</span><span class="cx"> */
</span><del>- function is_home() {
</del><ins>+ public function is_home() {
</ins><span class="cx"> return (bool) $this->is_home;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4060,7 +4105,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_month() {
</del><ins>+ public function is_month() {
</ins><span class="cx"> return (bool) $this->is_month;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4078,7 +4123,7 @@
</span><span class="cx"> * @param mixed $page Page ID, title, slug, or array of such.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_page( $page = '' ) {
</del><ins>+ public function is_page( $page = '' ) {
</ins><span class="cx"> if ( !$this->is_page )
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -4106,7 +4151,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_paged() {
</del><ins>+ public function is_paged() {
</ins><span class="cx"> return (bool) $this->is_paged;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4117,7 +4162,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_preview() {
</del><ins>+ public function is_preview() {
</ins><span class="cx"> return (bool) $this->is_preview;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4128,7 +4173,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_robots() {
</del><ins>+ public function is_robots() {
</ins><span class="cx"> return (bool) $this->is_robots;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4139,7 +4184,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_search() {
</del><ins>+ public function is_search() {
</ins><span class="cx"> return (bool) $this->is_search;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4159,7 +4204,7 @@
</span><span class="cx"> * @param mixed $post Post ID, title, slug, or array of such.
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_single( $post = '' ) {
</del><ins>+ public function is_single( $post = '' ) {
</ins><span class="cx"> if ( !$this->is_single )
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -4194,7 +4239,7 @@
</span><span class="cx"> * @param mixed $post_types Optional. Post Type or array of Post Types
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_singular( $post_types = '' ) {
</del><ins>+ public function is_singular( $post_types = '' ) {
</ins><span class="cx"> if ( empty( $post_types ) || !$this->is_singular )
</span><span class="cx"> return (bool) $this->is_singular;
</span><span class="cx">
</span><span class="lines">@@ -4210,7 +4255,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_time() {
</del><ins>+ public function is_time() {
</ins><span class="cx"> return (bool) $this->is_time;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4221,7 +4266,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_trackback() {
</del><ins>+ public function is_trackback() {
</ins><span class="cx"> return (bool) $this->is_trackback;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4232,7 +4277,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_year() {
</del><ins>+ public function is_year() {
</ins><span class="cx"> return (bool) $this->is_year;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4243,7 +4288,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_404() {
</del><ins>+ public function is_404() {
</ins><span class="cx"> return (bool) $this->is_404;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -4254,7 +4299,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function is_main_query() {
</del><ins>+ public function is_main_query() {
</ins><span class="cx"> global $wp_the_query;
</span><span class="cx"> return $wp_the_query === $this;
</span><span class="cx"> }
</span><span class="lines">@@ -4267,7 +4312,7 @@
</span><span class="cx"> *
</span><span class="cx"> * @return bool
</span><span class="cx"> */
</span><del>- function reset_postdata() {
</del><ins>+ public function reset_postdata() {
</ins><span class="cx"> if ( ! empty( $this->post ) ) {
</span><span class="cx"> $GLOBALS['post'] = $this->post;
</span><span class="cx"> setup_postdata( $this->post );
</span></span></pre></div>
<a id="trunktestsphpunitincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/includes/functions.php (28522 => 28523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/includes/functions.php 2014-05-19 06:34:01 UTC (rev 28522)
+++ trunk/tests/phpunit/includes/functions.php 2014-05-19 06:48:56 UTC (rev 28523)
</span><span class="lines">@@ -49,6 +49,18 @@
</span><span class="cx"> return $this->$name;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ public function __set( $name, $value ) {
+ return $this->$name = $value;
+ }
+
+ public function __isset( $name ) {
+ return isset( $this->$name );
+ }
+
+ public function __unset( $name ) {
+ unset( $this->$name );
+ }
+
</ins><span class="cx"> public function __call( $name, $arguments ) {
</span><span class="cx"> return call_user_func_array( array( $this, $name ), $arguments );
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsbasicphp"></a>
<div class="modfile"><h4>Modified: trunk/tests/phpunit/tests/basic.php (28522 => 28523)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/phpunit/tests/basic.php 2014-05-19 06:34:01 UTC (rev 28522)
+++ trunk/tests/phpunit/tests/basic.php 2014-05-19 06:48:56 UTC (rev 28523)
</span><span class="lines">@@ -145,4 +145,18 @@
</span><span class="cx">
</span><span class="cx"> $this->assertEquals( 'maybe', $basic->callMe() );
</span><span class="cx"> }
</span><ins>+
+ function test_subclass_isset() {
+ $basic = new Basic_Subclass();
+
+ $this->assertTrue( isset( $basic->foo ) );
+ }
+
+ function test_subclass_unset() {
+ $basic = new Basic_Subclass();
+
+ unset( $basic->foo );
+
+ $this->assertFalse( isset( $basic->foo ) );
+ }
</ins><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>