Commit Graph

5 Commits

Author SHA1 Message Date
Jeremy Felt 4cce2ca14f Multisite: Fix `switch(` spacing after [37657]
Fixes #36717.

Built from https://develop.svn.wordpress.org/trunk@37658


git-svn-id: http://core.svn.wordpress.org/trunk@37624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 04:48:27 +00:00
Jeremy Felt b885fe6761 Multisite: Allow access to network and site properties using current naming conventions
* Add magic `__get()`, `__set()`, and `__isset()` methods to `WP_Site` and `WP_Network.
* Provide `(int) $network->site_id` for `(string) $network->blog_id`
* Provide `(int) $site->id` for `(string) $site->blog_id`
* Provide `(int) $site->network_id` for `(string) $site->site_id`

Props flixos90, jeremyfelt.
Fixes #36717.

Built from https://develop.svn.wordpress.org/trunk@37657


git-svn-id: http://core.svn.wordpress.org/trunk@37623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-06-08 04:14:29 +00:00
Jeremy Felt 9fa38fdc31 Multisite: Introduce `get_site()`
Given a site ID or site object, `get_site()` retrieves site data in the same vein as `get_post()` or `get_comment()`. This will allow for clean retrieval of sites from a primed cache when `WP_Site_Query` is implemented.

Adds a `WP_Site::to_array()` method to support multiple return types within `get_site()`.

Props spacedmonkey.
See #35791.

Built from https://develop.svn.wordpress.org/trunk@37468


git-svn-id: http://core.svn.wordpress.org/trunk@37436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-20 04:41:27 +00:00
Drew Jaynes e2cec35437 Docs: Make some minor improvements to inline docs for `WP_Site`, introduced in [36393].
* Uses third-person singular verbs in method summaries
* Adds an `@static` tag to the `WP_Site::get_instance()` DocBlock
* Adjusts return types for `WP_Site::get_instance()` to the more explicit `WP_Site|false`

See #32450. See #32246.

Built from https://develop.svn.wordpress.org/trunk@36495


git-svn-id: http://core.svn.wordpress.org/trunk@36462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-07 02:13:26 +00:00
Jeremy Felt 0b69f2cd63 Multisite: Introduce the WP_Site class.
* A `WP_Site` object initially matches a row from `wp_blogs`.
* A site can be retrieved by its ID through `WP_Site::get_instance()`.
* Adds `sites` to the global cache group and captures instance lookups.
* The multisite bootstrap now ensures `$current_blog` is an instance of `WP_Site`.

Props johnjamesjacoby, jeremyfelt.
See #32450.

Built from https://develop.svn.wordpress.org/trunk@36393


git-svn-id: http://core.svn.wordpress.org/trunk@36360 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-25 21:51:26 +00:00