Ticket #36717: 36717.4.diff
File 36717.4.diff, 4.5 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class-wp-network.php
17 17 * ability to interact with any network of sites is required. 18 18 * 19 19 * @since 4.4.0 20 * 21 * @property int $site_id 20 22 */ 21 23 class WP_Network { 22 24 … … 58 60 * A numeric string, for compatibility reasons. 59 61 * 60 62 * @since 4.4.0 61 * @access p ublic63 * @access private 62 64 * @var string 63 65 */ 64 p ublic$blog_id = 0;66 private $blog_id = 0; 65 67 66 68 /** 67 69 * Domain used to set cookies for this network. … … 138 140 } 139 141 140 142 /** 143 * Getter. 144 * 145 * Allows current multisite naming conventions when getting properties. 146 * 147 * @since 4.6.0 148 * @access public 149 * 150 * @param string $key Property to get. 151 * @return mixed Value of the property. Null if not available. 152 */ 153 public function __get( $key ) { 154 switch ( $key ) { 155 case 'blog_id': 156 return $this->blog_id; 157 case 'site_id': 158 return (int) $this->blog_id; 159 } 160 161 return null; 162 } 163 164 /** 165 * Isset-er. 166 * 167 * Allows current multisite naming conventions when checking for properties. 168 * 169 * @since 4.6.0 170 * @access public 171 * 172 * @param string $key Property to check if set. 173 * @return bool Whether the property is set. 174 */ 175 public function __isset( $key ) { 176 switch( $key ) { 177 case 'blog_id': 178 case 'site_id': 179 return true; 180 } 181 182 return false; 183 } 184 185 /** 186 * Setter. 187 * 188 * Allows current multisite naming conventions while setting properties. 189 * 190 * @since 4.6.0 191 * @access public 192 * 193 * @param string $key Property to set. 194 * @param mixed $value Value to assign to the property. 195 */ 196 public function __set( $key, $value ) { 197 switch( $key ) { 198 case 'blog_id': 199 case 'site_id': 200 $this->blog_id = (string) $value; 201 break; 202 default: 203 $this->$key = $value; 204 } 205 } 206 207 /** 141 208 * Set the site name assigned to the network if one has not been populated. 142 209 * 143 210 * @since 4.4.0 -
src/wp-includes/class-wp-site.php
14 14 * setup the current site. 15 15 * 16 16 * @since 4.5.0 17 * 18 * @property int $id 19 * @property int $network_id 17 20 */ 18 21 final class WP_Site { 19 22 … … 23 26 * A numeric string, for compatibility reasons. 24 27 * 25 28 * @since 4.5.0 26 * @access p ublic29 * @access private 27 30 * @var string 28 31 */ 29 p ublic$blog_id;32 private $blog_id; 30 33 31 34 /** 32 35 * Domain of the site. … … 55 58 * A numeric string, for compatibility reasons. 56 59 * 57 60 * @since 4.5.0 58 * @access p ublic61 * @access private 59 62 * @var string 60 63 */ 61 p ublic$site_id = '0';64 private $site_id = '0'; 62 65 63 66 /** 64 67 * The date on which the site was created or registered. … … 210 213 public function to_array() { 211 214 return get_object_vars( $this ); 212 215 } 216 217 /** 218 * Getter. 219 * 220 * Allows current multisite naming conventions when getting properties. 221 * 222 * @since 4.6.0 223 * @access public 224 * 225 * @param string $key Property to get. 226 * @return mixed Value of the property. Null if not available. 227 */ 228 public function __get( $key ) { 229 switch ( $key ) { 230 case 'id': 231 return (int) $this->blog_id; 232 case 'blog_id': 233 return $this->blog_id; 234 case 'site_id': 235 return $this->site_id; 236 case 'network_id': 237 return (int) $this->site_id; 238 } 239 240 return null; 241 } 242 243 /** 244 * Isset-er. 245 * 246 * Allows current multisite naming conventions when checking for properties. 247 * 248 * @since 4.6.0 249 * @access public 250 * 251 * @param string $key Property to check if set. 252 * @return bool Whether the property is set. 253 */ 254 public function __isset( $key ) { 255 switch ( $key ) { 256 case 'id': 257 case 'blog_id': 258 case 'site_id': 259 case 'network_id': 260 return true; 261 } 262 263 return false; 264 } 265 266 /** 267 * Setter. 268 * 269 * Allows current multisite naming conventions while setting properties. 270 * 271 * @since 4.6.0 272 * @access public 273 * 274 * @param string $key Property to set. 275 * @param mixed $value Value to assign to the property. 276 */ 277 public function __set( $key, $value ) { 278 switch( $key ) { 279 case 'id': 280 case 'blog_id': 281 $this->blog_id = (string) $value; 282 break; 283 case 'site_id': 284 case 'network_id': 285 $this->site_id = (string) $value; 286 break; 287 default: 288 $this->$key = $value; 289 } 290 } 213 291 }