Make WordPress Core

Ticket #38630: 38630.diff

File 38630.diff, 2.6 KB (added by flixos90, 9 years ago)
  • src/wp-includes/class-wp-site.php

     
    1515 *
    1616 * @since 4.5.0
    1717 *
    18  * @property int    $id
    19  * @property int    $network_id
    2018 * @property string $blogname
    2119 * @property string $siteurl
    2220 * @property int    $post_count
     
    2725        /**
    2826         * Site ID.
    2927         *
    30          * A numeric string, for compatibility reasons.
    31          *
    32          * @since 4.5.0
     28         * @since 4.8.0
    3329         * @access public
    34          * @var string
     30         * @var int
    3531         */
    36         public $blog_id;
     32        public $id;
    3733
    3834        /**
    3935         * Domain of the site.
     
    5652        /**
    5753         * The ID of the site's parent network.
    5854         *
    59          * Named "site" vs. "network" for legacy reasons. An individual site's "site" is
    60          * its network.
    61          *
    62          * A numeric string, for compatibility reasons.
    63          *
    64          * @since 4.5.0
     55         * @since 4.8.0
    6556         * @access public
    66          * @var string
     57         * @var int
    6758         */
    68         public $site_id = '0';
     59        public $network_id = 0;
    6960
    7061        /**
    7162         * The date on which the site was created or registered.
     
    202193         */
    203194        public function __construct( $site ) {
    204195                foreach( get_object_vars( $site ) as $key => $value ) {
    205                         $this->$key = $value;
     196                        $this->__set( $key, $value );
    206197                }
    207198        }
    208199
     
    233224        public function __get( $key ) {
    234225                switch ( $key ) {
    235226                        case 'id':
    236                                 return (int) $this->blog_id;
     227                                return (int) $this->id;
    237228                        case 'network_id':
    238                                 return (int) $this->site_id;
     229                                return (int) $this->network_id;
    239230                        case 'blogname':
    240231                        case 'siteurl':
    241232                        case 'post_count':
     
    245236                                }
    246237                                $details = $this->get_details();
    247238                                return $details->$key;
     239
     240                        // Support blog_id for legacy reasons.
     241                        case 'blog_id':
     242                                return (string) $this->id;
     243
     244                        // Support site_id for legacy reasons.
     245                        case 'site_id':
     246                                return (string) $this->network_id;
    248247                }
    249248
    250249                return null;
     
    275274                                        return false;
    276275                                }
    277276                                return true;
     277
     278                        // Support blog_id and site_id for legacy reasons.
     279                        case 'blog_id':
     280                        case 'site_id':
     281                                return true;
    278282                }
    279283
    280284                return false;
     
    293297         */
    294298        public function __set( $key, $value ) {
    295299                switch ( $key ) {
     300                        // Support blog_id for legacy reasons.
     301                        case 'blog_id':
    296302                        case 'id':
    297                                 $this->blog_id = (string) $value;
     303                                $this->id = (int) $value;
    298304                                break;
     305
     306                        // Support site_id for legacy reasons.
     307                        case 'site_id':
    299308                        case 'network_id':
    300                                 $this->site_id = (string) $value;
     309                                $this->network_id = (int) $value;
    301310                                break;
    302311                        default:
    303312                                $this->$key = $value;