wp/wp-includes/class-wp-site.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
   143 	public $lang_id = '0';
   143 	public $lang_id = '0';
   144 
   144 
   145 	/**
   145 	/**
   146 	 * Retrieves a site from the database by its ID.
   146 	 * Retrieves a site from the database by its ID.
   147 	 *
   147 	 *
   148 	 * @static
       
   149 	 * @since 4.5.0
   148 	 * @since 4.5.0
   150 	 *
   149 	 *
   151 	 * @global wpdb $wpdb WordPress database abstraction object.
   150 	 * @global wpdb $wpdb WordPress database abstraction object.
   152 	 *
   151 	 *
   153 	 * @param int $site_id The ID of the site to retrieve.
   152 	 * @param int $site_id The ID of the site to retrieve.
   185 	 * @since 4.5.0
   184 	 * @since 4.5.0
   186 	 *
   185 	 *
   187 	 * @param WP_Site|object $site A site object.
   186 	 * @param WP_Site|object $site A site object.
   188 	 */
   187 	 */
   189 	public function __construct( $site ) {
   188 	public function __construct( $site ) {
   190 		foreach( get_object_vars( $site ) as $key => $value ) {
   189 		foreach ( get_object_vars( $site ) as $key => $value ) {
   191 			$this->$key = $value;
   190 			$this->$key = $value;
   192 		}
   191 		}
   193 	}
   192 	}
   194 
   193 
   195 	/**
   194 	/**
   314 		$details = wp_cache_get( $this->blog_id, 'site-details' );
   313 		$details = wp_cache_get( $this->blog_id, 'site-details' );
   315 
   314 
   316 		if ( false === $details ) {
   315 		if ( false === $details ) {
   317 
   316 
   318 			switch_to_blog( $this->blog_id );
   317 			switch_to_blog( $this->blog_id );
   319 			// Create a raw copy of the object for backwards compatibility with the filter below.
   318 			// Create a raw copy of the object for backward compatibility with the filter below.
   320 			$details = new stdClass();
   319 			$details = new stdClass();
   321 			foreach ( get_object_vars( $this ) as $key => $value ) {
   320 			foreach ( get_object_vars( $this ) as $key => $value ) {
   322 				$details->$key = $value;
   321 				$details->$key = $value;
   323 			}
   322 			}
   324 			$details->blogname   = get_option( 'blogname' );
   323 			$details->blogname   = get_option( 'blogname' );