Make WordPress Core

Ticket #36717: 36717.2.diff

File 36717.2.diff, 2.1 KB (added by jeremyfelt, 9 years ago)
  • src/wp-includes/class-wp-network.php

     
    138138        }
    139139
    140140        /**
     141         * Getter.
     142         *
     143         * Allows current multisite 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                if ( 'site_id' === $key ) {
     153                        return $this->blog_id;
     154                }
     155
     156                return null;
     157        }
     158
     159        /**
     160         * Isset-er.
     161         *
     162         * Allows current multisite naming conventions when checking for properties.
     163         *
     164         * @since 4.6.0
     165         * @access public
     166         *
     167         * @param string $key Property to check if set.
     168         * @return bool
     169         */
     170        public function __isset( $key ) {
     171                if ( 'site_id' === $key ) {
     172                        return true;
     173                }
     174
     175                return false;
     176        }
     177
     178        /**
    141179         * Set the site name assigned to the network if one has not been populated.
    142180         *
    143181         * @since 4.4.0
  • src/wp-includes/class-wp-site.php

     
    210210        public function to_array() {
    211211                return get_object_vars( $this );
    212212        }
     213
     214        /**
     215         * Getter.
     216         *
     217         * Allows current multisite naming conventions when getting properties.
     218         *
     219         * @since 4.6.0
     220         * @access public
     221         *
     222         * @param string $key Property to get.
     223         * @return mixed
     224         */
     225        public function __get( $key ) {
     226                switch ( $key ) {
     227                        case 'ID':
     228                                return $this->blog_id;
     229
     230                        case 'network_id':
     231                                return $this->site_id;
     232                }
     233
     234                return null;
     235        }
     236
     237        /**
     238         * Isset-er.
     239         *
     240         * Allows current multisite naming conventions when checking for properties.
     241         *
     242         * @since 4.6.0
     243         * @access public
     244         *
     245         * @param string $key Property to check if set.
     246         * @return bool
     247         */
     248        public function __isset( $key ) {
     249                switch ( $key ) {
     250                        case 'ID':
     251                        case 'network_id':
     252                                return true;
     253                }
     254
     255                return false;
     256        }
    213257}