Make WordPress Core

Changeset 28528


Ignore:
Timestamp:
05/19/2014 03:47:33 PM (12 years ago)
Author:
wonderboymusic
Message:

Add access modifiers to WP_User_Query.

Add magic methods for BC: get(), set(), isset(), unset(), and
call().

See #27881, #22234.

File:
1 edited

Legend:

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

    r28454 r28528  
    450450         * @var array
    451451         */
    452         var $query_vars = array();
     452        public $query_vars = array();
    453453
    454454        /**
     
    459459         * @var array
    460460         */
    461         var $results;
     461        private $results;
    462462
    463463        /**
     
    468468         * @var int
    469469         */
    470         var $total_users = 0;
     470        private $total_users = 0;
    471471
    472472        // SQL clauses
    473         var $query_fields;
    474         var $query_from;
    475         var $query_where;
    476         var $query_orderby;
    477         var $query_limit;
     473        public $query_fields;
     474        public $query_from;
     475        public $query_where;
     476        public $query_orderby;
     477        public $query_limit;
    478478
    479479        /**
     
    485485         * @return WP_User_Query
    486486         */
    487         function __construct( $query = null ) {
     487        public function __construct( $query = null ) {
    488488                if ( ! empty( $query ) ) {
    489489                        $this->prepare_query( $query );
     
    499499         * @param string|array $args Optional. The query variables.
    500500         */
    501         function prepare_query( $query = array() ) {
     501        public function prepare_query( $query = array() ) {
    502502                global $wpdb;
    503503
     
    713713         * @global wpdb $wpdb WordPress database object for queries.
    714714         */
    715         function query() {
     715        public function query() {
    716716                global $wpdb;
    717717
     
    765765         * @return mixed
    766766         */
    767         function get( $query_var ) {
     767        public function get( $query_var ) {
    768768                if ( isset( $this->query_vars[$query_var] ) )
    769769                        return $this->query_vars[$query_var];
     
    781781         * @param mixed $value Query variable value.
    782782         */
    783         function set( $query_var, $value ) {
     783        public function set( $query_var, $value ) {
    784784                $this->query_vars[$query_var] = $value;
    785785        }
     
    797797         * @return string
    798798         */
    799         function get_search_sql( $string, $cols, $wild = false ) {
     799        protected function get_search_sql( $string, $cols, $wild = false ) {
    800800                $string = esc_sql( $string );
    801801
     
    821821         * @return array Array of results.
    822822         */
    823         function get_results() {
     823        public function get_results() {
    824824                return $this->results;
    825825        }
     
    833833         * @return array Array of total users.
    834834         */
    835         function get_total() {
     835        public function get_total() {
    836836                return $this->total_users;
     837        }
     838
     839        /**
     840         * Make private properties readable for backwards compatibility
     841         *
     842         * @since 4.0.0
     843         * @param string $name
     844         * @return mixed
     845         */
     846        public function __get( $name ) {
     847                return $this->$name;
     848        }
     849
     850        /**
     851         * Make private properties setable for backwards compatibility
     852         *
     853         * @since 4.0.0
     854         * @param string $name
     855         * @param string $value
     856         * @return mixed
     857         */
     858        public function __set( $name, $value ) {
     859                return $this->$name = $value;
     860        }
     861
     862        /**
     863         * Make private properties checkable for backwards compatibility
     864         *
     865         * @since 4.0.0
     866         * @param string $name
     867         * @return mixed
     868         */
     869        public function __isset( $name ) {
     870                return isset( $this->$name );
     871        }
     872
     873        /**
     874         * Make private properties unsetable for backwards compatibility
     875         *
     876         * @since 4.0.0
     877         * @param string $name
     878         * @return mixed
     879         */
     880        public function __unset( $name ) {
     881                unset( $this->$name );
     882        }
     883
     884        /**
     885         * Make private/protected methods readable for backwards compatibility
     886         *
     887         * @since 4.0.0
     888         * @param string $name
     889         * @param array $arguments
     890         * @return mixed
     891         */
     892        public function __call( $name, $arguments ) {
     893                return call_user_func_array( array( $this, $name ), $arguments );
    837894        }
    838895}
Note: See TracChangeset for help on using the changeset viewer.