Ticket #38630: 38630.2.diff
File 38630.2.diff, 3.1 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-wp-site.php
15 15 * 16 16 * @since 4.5.0 17 17 * 18 * @property int $id19 * @property int $network_id20 18 * @property string $blogname 21 19 * @property string $siteurl 22 20 * @property int $post_count … … 27 25 /** 28 26 * Site ID. 29 27 * 30 * A numeric string, for compatibility reasons. 31 * 32 * @since 4.5.0 28 * @since 4.8.0 Replaces the $blog_id property. 33 29 * @access public 34 * @var string30 * @var int 35 31 */ 36 public $ blog_id;32 public $id; 37 33 38 34 /** 39 35 * Domain of the site. … … 56 52 /** 57 53 * The ID of the site's parent network. 58 54 * 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 Replaces the $site_id property. 65 56 * @access public 66 * @var string57 * @var int 67 58 */ 68 public $ site_id = '0';59 public $network_id = 0; 69 60 70 61 /** 71 62 * The date on which the site was created or registered. … … 202 193 */ 203 194 public function __construct( $site ) { 204 195 foreach( get_object_vars( $site ) as $key => $value ) { 205 $this-> $key = $value;196 $this->__set( $key, $value ); 206 197 } 207 198 } 208 199 … … 212 203 * @since 4.6.0 213 204 * @access public 214 205 * 206 * @deprecated 4.8.0 Use get_object_vars(). 207 * 215 208 * @return array Object as array. 216 209 */ 217 210 public function to_array() { 218 return get_object_vars( $this ); 211 _deprecated_function( __METHOD__, '4.8.0', 'get_object_vars()' ); 212 213 $data = get_object_vars( $this ); 214 215 $data['blog_id'] = $data['id']; 216 $data['site_id'] = $data['network_id']; 217 218 unset( $data['id'], $data['network_id'] ); 219 220 return $data; 219 221 } 220 222 221 223 /** … … 233 235 public function __get( $key ) { 234 236 switch ( $key ) { 235 237 case 'id': 236 return (int) $this-> blog_id;238 return (int) $this->id; 237 239 case 'network_id': 238 return (int) $this-> site_id;240 return (int) $this->network_id; 239 241 case 'blogname': 240 242 case 'siteurl': 241 243 case 'post_count': … … 245 247 } 246 248 $details = $this->get_details(); 247 249 return $details->$key; 250 251 // Support blog_id for legacy reasons. 252 case 'blog_id': 253 return (string) $this->id; 254 255 // Support site_id for legacy reasons. 256 case 'site_id': 257 return (string) $this->network_id; 248 258 } 249 259 250 260 return null; … … 275 285 return false; 276 286 } 277 287 return true; 288 289 // Support blog_id and site_id for legacy reasons. 290 case 'blog_id': 291 case 'site_id': 292 return true; 278 293 } 279 294 280 295 return false; … … 293 308 */ 294 309 public function __set( $key, $value ) { 295 310 switch ( $key ) { 311 // Support blog_id for legacy reasons. 312 case 'blog_id': 296 313 case 'id': 297 $this-> blog_id = (string) $value;314 $this->id = (int) $value; 298 315 break; 316 317 // Support site_id for legacy reasons. 318 case 'site_id': 299 319 case 'network_id': 300 $this-> site_id = (string) $value;320 $this->network_id = (int) $value; 301 321 break; 302 322 default: 303 323 $this->$key = $value;