Make WordPress Core

Ticket #36717: 36717.diff

File 36717.diff, 2.0 KB (added by flixos90, 9 years ago)

patch with magic methods

  • src/wp-includes/class-wp-network.php

     
    138138        }
    139139
    140140        /**
     141         * Getter.
     142         *
     143         * Allows to use current naming conventions when getting properties.
     144         *
     145         * @since 4.6.0
     146         * @access public
     147         *
     148         * @param string $key Property to get.
     149         * @return mixed
     150         */
     151        public function __get( $key ) {
     152                switch ( $key ) {
     153                        case 'site_id':
     154                                return $this->blog_id;
     155                }
     156
     157                return null;
     158        }
     159
     160        /**
     161         * Isset-er.
     162         *
     163         * Allows to use current naming conventions when checking for properties.
     164         *
     165         * @since 4.6.0
     166         * @access public
     167         *
     168         * @param string $key Property to check if set.
     169         * @return bool
     170         */
     171        public function __isset( $key ) {
     172                switch ( $key ) {
     173                        case 'site_id':
     174                                return true;
     175                }
     176
     177                return false;
     178        }
     179
     180        /**
    141181         * Set the site name assigned to the network if one has not been populated.
    142182         *
    143183         * @since 4.4.0
  • src/wp-includes/class-wp-site.php

     
    198198                        $this->$key = $value;
    199199                }
    200200        }
     201
     202        /**
     203         * Getter.
     204         *
     205         * Allows to use current naming conventions when getting properties.
     206         *
     207         * @since 4.6.0
     208         * @access public
     209         *
     210         * @param string $key Property to get.
     211         * @return mixed
     212         */
     213        public function __get( $key ) {
     214                switch ( $key ) {
     215                        case 'id':
     216                                return $this->blog_id;
     217
     218                        case 'network_id':
     219                                return $this->site_id;
     220                }
     221
     222                return null;
     223        }
     224
     225        /**
     226         * Isset-er.
     227         *
     228         * Allows to use current naming conventions when checking for properties.
     229         *
     230         * @since 4.6.0
     231         * @access public
     232         *
     233         * @param string $key Property to check if set.
     234         * @return bool
     235         */
     236        public function __isset( $key ) {
     237                switch ( $key ) {
     238                        case 'id':
     239                        case 'network_id':
     240                                return true;
     241                }
     242
     243                return false;
     244        }
    201245}