Make WordPress Core

Changeset 28516


Ignore:
Timestamp:
05/19/2014 06:11:34 AM (12 years ago)
Author:
wonderboymusic
Message:

Add missing access modifiers to methods in WP and WP_MatchesMapRegex. Add magic __call() and __get() methods to WP_MatchesMapRegex for BC.

See #27881, #22234.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp.php

    r27782 r28516  
    1616         * @var array
    1717         */
    18         var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
     18        public $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage', 'post_type');
    1919
    2020        /**
    … …  
    2626         * @var array
    2727         */
    28         var $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in' );
     28        public $private_query_vars = array( 'offset', 'posts_per_page', 'posts_per_archive_page', 'showposts', 'nopaging', 'post_type', 'post_status', 'category__in', 'category__not_in', 'category__and', 'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'tag_id', 'post_mime_type', 'perm', 'comments_per_page', 'post__in', 'post__not_in', 'post_parent', 'post_parent__in', 'post_parent__not_in' );
    2929
    3030        /**
    … …  
    3434         * @var array
    3535         */
    36         var $extra_query_vars = array();
     36        public $extra_query_vars = array();
    3737
    3838        /**
    … …  
    4242         * @var array
    4343         */
    44         var $query_vars;
     44        public $query_vars;
    4545
    4646        /**
    … …  
    5050         * @var string
    5151         */
    52         var $query_string;
     52        public $query_string;
    5353
    5454        /**
    … …  
    5858         * @var string
    5959         */
    60         var $request;
     60        public $request;
    6161
    6262        /**
    … …  
    6666         * @var string
    6767         */
    68         var $matched_rule;
     68        public $matched_rule;
    6969
    7070        /**
    … …  
    7474         * @var string
    7575         */
    76         var $matched_query;
     76        public $matched_query;
    7777
    7878        /**
    … …  
    8282         * @var bool
    8383         */
    84         var $did_permalink = false;
     84        public $did_permalink = false;
    8585
    8686        /**
    … …  
    9191         * @param string $qv Query variable name.
    9292         */
    93         function add_query_var($qv) {
     93        public function add_query_var($qv) {
    9494                if ( !in_array($qv, $this->public_query_vars) )
    9595                        $this->public_query_vars[] = $qv;
    … …  
    104104         * @param mixed $value Query variable value.
    105105         */
    106         function set_query_var($key, $value) {
     106        public function set_query_var($key, $value) {
    107107                $this->query_vars[$key] = $value;
    108108        }
    … …  
    118118         * @param array|string $extra_query_vars Set the extra query variables.
    119119         */
    120         function parse_request($extra_query_vars = '') {
     120        public function parse_request($extra_query_vars = '') {
    121121                global $wp_rewrite;
    122122
    … …  
    342342         * @since 2.0.0
    343343         */
    344         function send_headers() {
     344        public function send_headers() {
    345345                $headers = array('X-Pingback' => get_bloginfo('pingback_url'));
    346346                $status = null;
    … …  
    457457         * @since 2.0.0
    458458         */
    459         function build_query_string() {
     459        public function build_query_string() {
    460460                $this->query_string = '';
    461461                foreach ( (array) array_keys($this->query_vars) as $wpvar) {
    … …  
    499499         * @since 2.0.0
    500500         */
    501         function register_globals() {
     501        public function register_globals() {
    502502                global $wp_query;
    503503
    … …  
    526526         * @since 2.0.0
    527527         */
    528         function init() {
     528        public function init() {
    529529                wp_get_current_user();
    530530        }
    … …  
    536536         * @since 2.0.0
    537537         */
    538         function query_posts() {
     538        public function query_posts() {
    539539                global $wp_the_query;
    540540                $this->build_query_string();
    … …  
    553553         * @since 2.0.0
    554554         */
    555         function handle_404() {
     555        public function handle_404() {
    556556                global $wp_query;
    557557
    … …  
    606606         * @param string|array $query_args Passed to {@link parse_request()}
    607607         */
    608         function main($query_args = '') {
     608        public function main($query_args = '') {
    609609                $this->init();
    610610                $this->parse_request($query_args);
    … …  
    638638         * @var array
    639639         */
    640         var $_matches;
     640        private $_matches;
    641641
    642642        /**
    … …  
    646646         * @var string
    647647         */
    648         var $output;
     648        public $output;
    649649
    650650        /**
    … …  
    654654         * @var string
    655655         */
    656         var $_subject;
     656        private $_subject;
    657657
    658658        /**
    … …  
    661661         * @var string
    662662         */
    663         var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
     663        public $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
     664
     665        /**
     666         * Make private properties readable for backwards compatibility
     667         *
     668         * @since 4.0.0
     669         * @param string $name
     670         * @return mixed
     671         */
     672        public function __get( $name ) {
     673                return $this->$name;
     674        }
     675
     676        /**
     677         * Make private/protected methods readable for backwards compatibility
     678         *
     679         * @since 4.0.0
     680         * @param string $name
     681         * @param array $arguments
     682         * @return mixed
     683         */
     684        public function __call( $name, $arguments ) {
     685                return call_user_func_array( array( $this, $name ), $arguments );
     686        }
    664687
    665688        /**
    … …  
    670693         * @return self
    671694         */
    672         function WP_MatchesMapRegex($subject, $matches) {
     695        public function WP_MatchesMapRegex($subject, $matches) {
    673696                $this->_subject = $subject;
    674697                $this->_matches = $matches;
    … …  
    697720         * @return string
    698721         */
    699         function _map() {
     722        private function _map() {
    700723                $callback = array($this, 'callback');
    701724                return preg_replace_callback($this->_pattern, $callback, $this->_subject);
    … …  
    709732         * @return string
    710733         */
    711         function callback($matches) {
     734        public function callback($matches) {
    712735                $index = intval(substr($matches[0], 9, -1));
    713736                return ( isset( $this->_matches[$index] ) ? urlencode($this->_matches[$index]) : '' );
Note: See TracChangeset for help on using the changeset viewer.