[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> class-wp-network.php (summary)

Network API: WP_Network class

File Size: 476 lines (12 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Network:: (9 methods):
  get_instance()
  __construct()
  __get()
  __isset()
  __set()
  get_main_site_id()
  _set_site_name()
  _set_cookie_domain()
  get_by_path()


Class: WP_Network  - X-Ref

Core class used for interacting with a multisite network.

This class is used during load to populate the `$current_site` global and
setup the current network.

This class is most useful in WordPress multi-network installations where the
ability to interact with any network of sites is required.

get_instance( $network_id )   X-Ref
Retrieves a network from the database by its ID.

param: int $network_id The ID of the network to retrieve.
return: WP_Network|false The network's object if found. False if not.

__construct( $network )   X-Ref
Creates a new WP_Network object.

Will populate object properties from the object provided and assign other
default properties based on that information.

param: WP_Network|object $network A network object.

__get( $key )   X-Ref
Getter.

Allows current multisite naming conventions when getting properties.

param: string $key Property to get.
return: mixed Value of the property. Null if not available.

__isset( $key )   X-Ref
Isset-er.

Allows current multisite naming conventions when checking for properties.

param: string $key Property to check if set.
return: bool Whether the property is set.

__set( $key, $value )   X-Ref
Setter.

Allows current multisite naming conventions while setting properties.

param: string $key   Property to set.
param: mixed  $value Value to assign to the property.

get_main_site_id()   X-Ref
Returns the main site ID for the network.

Internal method used by the magic getter for the 'blog_id' and 'site_id'
properties.

return: int The ID of the main site.

_set_site_name()   X-Ref
Sets the site name assigned to the network if one has not been populated.


_set_cookie_domain()   X-Ref
Sets the cookie domain based on the network domain if one has
not been populated.


get_by_path( $domain = '', $path = '', $segments = null )   X-Ref
Retrieves the closest matching network for a domain and path.

This will not necessarily return an exact match for a domain and path. Instead, it
breaks the domain and path into pieces that are then used to match the closest
possibility from a query.

The intent of this method is to match a network during bootstrap for a
requested site address.

param: string   $domain   Domain to check.
param: string   $path     Path to check.
param: int|null $segments Path segments to use. Defaults to null, or the full path.
return: WP_Network|false Network object if successful. False when no network is found.



Generated : Thu Mar 28 08:20:01 2024 Cross-referenced by PHPXref