Make WordPress Core

Changeset 37652 for trunk/src


Ignore:
Timestamp:
06/08/2016 02:47:48 AM (10 years ago)
Author:
jeremyfelt
Message:

Multisite: Remove the output parameter from get_site()

Full WP_Site objects should be expected from get_site() rather than arrays.

In the single (soon to be deprecated) use of arrays for this in core, we can cast the result to (array) for back-compat.

See #35791.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-blogs.php

    r37618 r37652  
    480480 * @global WP_Site $current_blog The current site.
    481481 *
    482  * @param WP_Site|int $site   Site to retrieve.
    483  * @param string      $output Optional. Type of output to return. OBJECT or ARRAY_A or ARRAY_N constants.
     482 * @param WP_Site|int $site Site to retrieve.
    484483 * @return WP_Site|array|null Depends on $output value.
    485484 */
    486 function get_site( &$site = null, $output = OBJECT ) {
     485function get_site( &$site = null ) {
    487486        global $current_blog;
    488487        if ( empty( $site ) && isset( $current_blog ) ) {
    … …  
    510509         */
    511510        $_site = apply_filters( 'get_site', $_site );
    512 
    513         if ( $output == OBJECT ) {
    514                 return $_site;
    515         } elseif ( $output == ARRAY_A ) {
    516                 return $_site->to_array();
    517         } elseif ( $output == ARRAY_N ) {
    518                 return array_values( $_site->to_array() );
    519         }
    520511
    521512        return $_site;
  • trunk/src/wp-includes/ms-functions.php

    r37620 r37652  
    24892489
    24902490        foreach ( $_sites as $_site ) {
    2491                 $results[] = get_site( $_site, ARRAY_A );
     2491                $results[] = (array) get_site( $_site );
    24922492        }
    24932493
Note: See TracChangeset for help on using the changeset viewer.