Ticket #38630: 38630.3.diff
File 38630.3.diff, 3.3 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'] = (string) $data['id']; 216 $data['site_id'] = (string) $data['network_id']; 217 218 unset( $data['id'], $data['network_id'] ); 219 220 return $data; 219 221 } 220 222 221 223 /** … … 232 234 */ 233 235 public function __get( $key ) { 234 236 switch ( $key ) { 235 case 'id':236 return (int) $this->blog_id;237 case 'network_id':238 return (int) $this->site_id;239 237 case 'blogname': 240 238 case 'siteurl': 241 239 case 'post_count': … … 245 243 } 246 244 $details = $this->get_details(); 247 245 return $details->$key; 246 247 // Support blog_id for legacy reasons. 248 case 'blog_id': 249 return (string) $this->id; 250 251 // Support site_id for legacy reasons. 252 case 'site_id': 253 return (string) $this->network_id; 248 254 } 249 255 250 256 return null; … … 264 270 */ 265 271 public function __isset( $key ) { 266 272 switch ( $key ) { 267 case 'id':268 case 'network_id':269 return true;270 273 case 'blogname': 271 274 case 'siteurl': 272 275 case 'post_count': … … 275 278 return false; 276 279 } 277 280 return true; 281 282 // Support blog_id and site_id for legacy reasons. 283 case 'blog_id': 284 case 'site_id': 285 return true; 278 286 } 279 287 280 288 return false; … … 293 301 */ 294 302 public function __set( $key, $value ) { 295 303 switch ( $key ) { 304 // Support blog_id for legacy reasons. 305 case 'blog_id': 296 306 case 'id': 297 $this-> blog_id = (string) $value;307 $this->id = (int) $value; 298 308 break; 309 310 // Support site_id for legacy reasons. 311 case 'site_id': 299 312 case 'network_id': 300 $this-> site_id = (string) $value;313 $this->network_id = (int) $value; 301 314 break; 302 315 default: 303 316 $this->$key = $value;