wp/wp-includes/ms-deprecated.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    15 
    15 
    16 /**
    16 /**
    17  * Get the "dashboard blog", the blog where users without a blog edit their profile data.
    17  * Get the "dashboard blog", the blog where users without a blog edit their profile data.
    18  * Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
    18  * Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
    19  *
    19  *
    20  * @since MU
    20  * @since MU (3.0.0)
    21  * @deprecated 3.1.0
    21  * @deprecated 3.1.0 Use get_site()
    22  * @see get_blog_details()
    22  * @see get_site()
    23  * @return int
    23  *
       
    24  * @return WP_Site Current site object.
    24  */
    25  */
    25 function get_dashboard_blog() {
    26 function get_dashboard_blog() {
    26     _deprecated_function( __FUNCTION__, '3.1' );
    27     _deprecated_function( __FUNCTION__, '3.1.0', 'get_site()' );
    27     if ( $blog = get_site_option( 'dashboard_blog' ) )
    28     if ( $blog = get_site_option( 'dashboard_blog' ) ) {
    28         return get_blog_details( $blog );
    29 	    return get_site( $blog );
    29 
    30     }
    30     return get_blog_details( $GLOBALS['current_site']->blog_id );
    31 
    31 }
    32     return get_site( get_network()->site_id );
    32 
    33 }
    33 /**
    34 
    34  * @since MU
    35 /**
    35  * @deprecated 3.0.0
    36  * Generates a random password.
    36  * @deprecated Use wp_generate_password()
    37  *
       
    38  * @since MU (3.0.0)
       
    39  * @deprecated 3.0.0 Use wp_generate_password()
    37  * @see wp_generate_password()
    40  * @see wp_generate_password()
       
    41  *
       
    42  * @param int $len Optional. The length of password to generate. Default 8.
    38  */
    43  */
    39 function generate_random_password( $len = 8 ) {
    44 function generate_random_password( $len = 8 ) {
    40 	_deprecated_function( __FUNCTION__, '3.0', 'wp_generate_password()' );
    45 	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_generate_password()' );
    41 	return wp_generate_password( $len );
    46 	return wp_generate_password( $len );
    42 }
    47 }
    43 
    48 
    44 /**
    49 /**
    45  * Determine if user is a site admin.
    50  * Determine if user is a site admin.
    48  * to determine if multisite is enabled.
    53  * to determine if multisite is enabled.
    49  *
    54  *
    50  * This function must reside in a file included only if is_multisite() due to
    55  * This function must reside in a file included only if is_multisite() due to
    51  * legacy function_exists() checks to determine if multisite is enabled.
    56  * legacy function_exists() checks to determine if multisite is enabled.
    52  *
    57  *
    53  * @since MU
    58  * @since MU (3.0.0)
    54  * @deprecated 3.0.0
    59  * @deprecated 3.0.0 Use is_super_admin()
    55  * @deprecated Use is_super_admin()
       
    56  * @see is_super_admin()
    60  * @see is_super_admin()
    57  * @see is_multisite()
    61  *
    58  *
    62  * @param string $user_login Optional. Username for the user to check. Default empty.
    59  */
    63  */
    60 function is_site_admin( $user_login = '' ) {
    64 function is_site_admin( $user_login = '' ) {
    61 	_deprecated_function( __FUNCTION__, '3.0', 'is_super_admin()' );
    65 	_deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' );
    62 
    66 
    63 	if ( empty( $user_login ) ) {
    67 	if ( empty( $user_login ) ) {
    64 		$user_id = get_current_user_id();
    68 		$user_id = get_current_user_id();
    65 		if ( !$user_id )
    69 		if ( !$user_id )
    66 			return false;
    70 			return false;
    74 	return is_super_admin( $user_id );
    78 	return is_super_admin( $user_id );
    75 }
    79 }
    76 
    80 
    77 if ( !function_exists( 'graceful_fail' ) ) :
    81 if ( !function_exists( 'graceful_fail' ) ) :
    78 /**
    82 /**
    79  * @since MU
    83  * Deprecated functionality to gracefully fail.
    80  * @deprecated 3.0.0
    84  *
    81  * @deprecated Use wp_die()
    85  * @since MU (3.0.0)
       
    86  * @deprecated 3.0.0 Use wp_die()
    82  * @see wp_die()
    87  * @see wp_die()
    83  */
    88  */
    84 function graceful_fail( $message ) {
    89 function graceful_fail( $message ) {
    85 	_deprecated_function( __FUNCTION__, '3.0', 'wp_die()' );
    90 	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_die()' );
    86 	$message = apply_filters( 'graceful_fail', $message );
    91 	$message = apply_filters( 'graceful_fail', $message );
    87 	$message_template = apply_filters( 'graceful_fail_template',
    92 	$message_template = apply_filters( 'graceful_fail_template',
    88 '<!DOCTYPE html>
    93 '<!DOCTYPE html>
    89 <html xmlns="http://www.w3.org/1999/xhtml"><head>
    94 <html xmlns="http://www.w3.org/1999/xhtml"><head>
    90 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    95 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
   111 	die( sprintf( $message_template, $message ) );
   116 	die( sprintf( $message_template, $message ) );
   112 }
   117 }
   113 endif;
   118 endif;
   114 
   119 
   115 /**
   120 /**
   116  * @since MU
   121  * Deprecated functionality to retrieve user information.
   117  * @deprecated 3.0.0
   122  *
   118  * @deprecated Use get_user_by()
   123  * @since MU (3.0.0)
       
   124  * @deprecated 3.0.0 Use get_user_by()
   119  * @see get_user_by()
   125  * @see get_user_by()
       
   126  *
       
   127  * @param string $username Username.
   120  */
   128  */
   121 function get_user_details( $username ) {
   129 function get_user_details( $username ) {
   122 	_deprecated_function( __FUNCTION__, '3.0', 'get_user_by()' );
   130 	_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_by()' );
   123 	return get_user_by('login', $username);
   131 	return get_user_by('login', $username);
   124 }
   132 }
   125 
   133 
   126 /**
   134 /**
   127  * @since MU
   135  * Deprecated functionality to clear the global post cache.
   128  * @deprecated 3.0.0
   136  *
   129  * @deprecated Use clean_post_cache()
   137  * @since MU (3.0.0)
       
   138  * @deprecated 3.0.0 Use clean_post_cache()
   130  * @see clean_post_cache()
   139  * @see clean_post_cache()
       
   140  *
       
   141  * @param int $post_id Post ID.
   131  */
   142  */
   132 function clear_global_post_cache( $post_id ) {
   143 function clear_global_post_cache( $post_id ) {
   133 	_deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache()' );
   144 	_deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' );
   134 }
   145 }
   135 
   146 
   136 /**
   147 /**
   137  * @since MU
   148  * Deprecated functionality to determin if the current site is the main site.
   138  * @deprecated 3.0.0
   149  *
   139  * @deprecated Use is_main_site()
   150  * @since MU (3.0.0)
       
   151  * @deprecated 3.0.0 Use is_main_site()
   140  * @see is_main_site()
   152  * @see is_main_site()
   141  */
   153  */
   142 function is_main_blog() {
   154 function is_main_blog() {
   143 	_deprecated_function( __FUNCTION__, '3.0', 'is_main_site()' );
   155 	_deprecated_function( __FUNCTION__, '3.0.0', 'is_main_site()' );
   144 	return is_main_site();
   156 	return is_main_site();
   145 }
   157 }
   146 
   158 
   147 /**
   159 /**
   148  * @since MU
   160  * Deprecated functionality to validate an email address.
   149  * @deprecated 3.0.0
   161  *
   150  * @deprecated Use is_email()
   162  * @since MU (3.0.0)
       
   163  * @deprecated 3.0.0 Use is_email()
   151  * @see is_email()
   164  * @see is_email()
       
   165  *
       
   166  * @param string $email        Email address to verify.
       
   167  * @param bool   $check_domain Deprecated.
       
   168  * @return string|bool Either false or the valid email address.
   152  */
   169  */
   153 function validate_email( $email, $check_domain = true) {
   170 function validate_email( $email, $check_domain = true) {
   154 	_deprecated_function( __FUNCTION__, '3.0', 'is_email()' );
   171 	_deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' );
   155 	return is_email( $email, $check_domain );
   172 	return is_email( $email, $check_domain );
   156 }
   173 }
   157 
   174 
   158 /**
   175 /**
   159  * @since MU
   176  * Deprecated functionality to retrieve a list of all sites.
   160  * @deprecated 3.0.0
   177  *
   161  * @deprecated No alternative available. For performance reasons this function is not recommended.
   178  * @since MU (3.0.0)
       
   179  * @deprecated 3.0.0 Use wp_get_sites()
       
   180  * @see wp_get_sites()
       
   181  *
       
   182  * @param int    $start      Optional. Offset for retrieving the blog list. Default 0.
       
   183  * @param int    $num        Optional. Number of blogs to list. Default 10.
       
   184  * @param string $deprecated Unused.
   162  */
   185  */
   163 function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
   186 function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
   164 	_deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' );
   187 	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' );
   165 
   188 
   166 	global $wpdb;
   189 	global $wpdb;
   167 	$blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
   190 	$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id() ), ARRAY_A );
   168 
   191 
   169 	$blog_list = array();
   192 	$blog_list = array();
   170 	foreach ( (array) $blogs as $details ) {
   193 	foreach ( (array) $blogs as $details ) {
   171 		$blog_list[ $details['blog_id'] ] = $details;
   194 		$blog_list[ $details['blog_id'] ] = $details;
   172 		$blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
   195 		$blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );
   182 		return array_slice( $blog_list, $start, $num );
   205 		return array_slice( $blog_list, $start, $num );
   183 	}
   206 	}
   184 }
   207 }
   185 
   208 
   186 /**
   209 /**
   187  * @since MU
   210  * Deprecated functionality to retrieve a list of the most active sites.
       
   211  *
       
   212  * @since MU (3.0.0)
   188  * @deprecated 3.0.0
   213  * @deprecated 3.0.0
   189  * @deprecated No alternative available. For performance reasons this function is not recommended.
   214  *
       
   215  * @param int  $num     Optional. Number of activate blogs to retrieve. Default 10.
       
   216  * @param bool $display Optional. Whether or not to display the most active blogs list. Default true.
       
   217  * @return array List of "most active" sites.
   190  */
   218  */
   191 function get_most_active_blogs( $num = 10, $display = true ) {
   219 function get_most_active_blogs( $num = 10, $display = true ) {
   192 	_deprecated_function( __FUNCTION__, '3.0' );
   220 	_deprecated_function( __FUNCTION__, '3.0.0' );
   193 
   221 
   194 	$blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
   222 	$blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
   195 	if ( is_array( $blogs ) ) {
   223 	if ( is_array( $blogs ) ) {
   196 		reset( $blogs );
   224 		reset( $blogs );
   197 		$most_active = array();
   225 		$most_active = array();
   208 		}
   236 		}
   209 		unset( $most_active );
   237 		unset( $most_active );
   210 		$most_active = $t;
   238 		$most_active = $t;
   211 	}
   239 	}
   212 
   240 
   213 	if ( $display == true ) {
   241 	if ( $display ) {
   214 		if ( is_array( $most_active ) ) {
   242 		if ( is_array( $most_active ) ) {
   215 			reset( $most_active );
   243 			reset( $most_active );
   216 			foreach ( (array) $most_active as $key => $details ) {
   244 			foreach ( (array) $most_active as $key => $details ) {
   217 				$url = esc_url('http://' . $details['domain'] . $details['path']);
   245 				$url = esc_url('http://' . $details['domain'] . $details['path']);
   218 				echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
   246 				echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
   231  * 3) $_SERVER['HTTP_REFERER']
   259  * 3) $_SERVER['HTTP_REFERER']
   232  * 4) $_GET['redirect']
   260  * 4) $_GET['redirect']
   233  * 5) $_POST['redirect']
   261  * 5) $_POST['redirect']
   234  * 6) $url
   262  * 6) $url
   235  *
   263  *
   236  * @since MU
   264  * @since MU (3.0.0)
   237  * @deprecated 3.3.0
   265  * @deprecated 3.3.0 Use wp_redirect()
   238  * @deprecated Use wp_redirect()
   266  * @see wp_redirect()
   239  *
   267  *
   240  * @param string $url
   268  * @param string $url Optional. Redirect URL. Default empty.
   241  */
   269  */
   242 function wpmu_admin_do_redirect( $url = '' ) {
   270 function wpmu_admin_do_redirect( $url = '' ) {
   243 	_deprecated_function( __FUNCTION__, '3.3' );
   271 	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_redirect()' );
   244 
   272 
   245 	$ref = '';
   273 	$ref = '';
   246 	if ( isset( $_GET['ref'] ) )
   274 	if ( isset( $_GET['ref'] ) )
   247 		$ref = $_GET['ref'];
   275 		$ref = $_GET['ref'];
   248 	if ( isset( $_POST['ref'] ) )
   276 	if ( isset( $_POST['ref'] ) )
   251 	if ( $ref ) {
   279 	if ( $ref ) {
   252 		$ref = wpmu_admin_redirect_add_updated_param( $ref );
   280 		$ref = wpmu_admin_redirect_add_updated_param( $ref );
   253 		wp_redirect( $ref );
   281 		wp_redirect( $ref );
   254 		exit();
   282 		exit();
   255 	}
   283 	}
   256 	if ( empty( $_SERVER['HTTP_REFERER'] ) == false ) {
   284 	if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
   257 		wp_redirect( $_SERVER['HTTP_REFERER'] );
   285 		wp_redirect( $_SERVER['HTTP_REFERER'] );
   258 		exit();
   286 		exit();
   259 	}
   287 	}
   260 
   288 
   261 	$url = wpmu_admin_redirect_add_updated_param( $url );
   289 	$url = wpmu_admin_redirect_add_updated_param( $url );
   270 }
   298 }
   271 
   299 
   272 /**
   300 /**
   273  * Adds an 'updated=true' argument to a URL.
   301  * Adds an 'updated=true' argument to a URL.
   274  *
   302  *
   275  * @since MU
   303  * @since MU (3.0.0)
   276  * @deprecated 3.3.0
   304  * @deprecated 3.3.0 Use add_query_arg()
   277  * @deprecated Use add_query_arg()
   305  * @see add_query_arg()
   278  *
   306  *
   279  * @param string $url
   307  * @param string $url Optional. Redirect URL. Default empty.
   280  * @return string
   308  * @return string
   281  */
   309  */
   282 function wpmu_admin_redirect_add_updated_param( $url = '' ) {
   310 function wpmu_admin_redirect_add_updated_param( $url = '' ) {
   283 	_deprecated_function( __FUNCTION__, '3.3' );
   311 	_deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' );
   284 
   312 
   285 	if ( strpos( $url, 'updated=true' ) === false ) {
   313 	if ( strpos( $url, 'updated=true' ) === false ) {
   286 		if ( strpos( $url, '?' ) === false )
   314 		if ( strpos( $url, '?' ) === false )
   287 			return $url . '?updated=true';
   315 			return $url . '?updated=true';
   288 		else
   316 		else
   295  * Get a numeric user ID from either an email address or a login.
   323  * Get a numeric user ID from either an email address or a login.
   296  *
   324  *
   297  * A numeric string is considered to be an existing user ID
   325  * A numeric string is considered to be an existing user ID
   298  * and is simply returned as such.
   326  * and is simply returned as such.
   299  *
   327  *
   300  * @since MU
   328  * @since MU (3.0.0)
   301  * @deprecated 3.6.0
   329  * @deprecated 3.6.0 Use get_user_by()
   302  * @deprecated Use get_user_by()
   330  * @see get_user_by()
   303  *
   331  *
   304  * @param string $string Either an email address or a login.
   332  * @param string $string Either an email address or a login.
   305  * @return int
   333  * @return int
   306  */
   334  */
   307 function get_user_id_from_string( $string ) {
   335 function get_user_id_from_string( $string ) {
   308 	_deprecated_function( __FUNCTION__, '3.6', 'get_user_by()' );
   336 	_deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' );
   309 
   337 
   310 	if ( is_email( $string ) )
   338 	if ( is_email( $string ) )
   311 		$user = get_user_by( 'email', $string );
   339 		$user = get_user_by( 'email', $string );
   312 	elseif ( is_numeric( $string ) )
   340 	elseif ( is_numeric( $string ) )
   313 		return $string;
   341 		return $string;
   320 }
   348 }
   321 
   349 
   322 /**
   350 /**
   323  * Get a full blog URL, given a domain and a path.
   351  * Get a full blog URL, given a domain and a path.
   324  *
   352  *
   325  * @since MU
   353  * @since MU (3.0.0)
   326  * @deprecated 3.7.0
   354  * @deprecated 3.7.0
   327  *
   355  *
   328  * @param string $domain
   356  * @param string $domain
   329  * @param string $path
   357  * @param string $path
   330  * @return string
   358  * @return string
   331  */
   359  */
   332 function get_blogaddress_by_domain( $domain, $path ) {
   360 function get_blogaddress_by_domain( $domain, $path ) {
   333 	_deprecated_function( __FUNCTION__, '3.7' );
   361 	_deprecated_function( __FUNCTION__, '3.7.0' );
   334 
   362 
   335 	if ( is_subdomain_install() ) {
   363 	if ( is_subdomain_install() ) {
   336 		$url = "http://" . $domain.$path;
   364 		$url = "http://" . $domain.$path;
   337 	} else {
   365 	} else {
   338 		if ( $domain != $_SERVER['HTTP_HOST'] ) {
   366 		if ( $domain != $_SERVER['HTTP_HOST'] ) {
   345 			$url = 'http://' . $domain . $path;
   373 			$url = 'http://' . $domain . $path;
   346 		}
   374 		}
   347 	}
   375 	}
   348 	return esc_url_raw( $url );
   376 	return esc_url_raw( $url );
   349 }
   377 }
       
   378 
       
   379 /**
       
   380  * Create an empty blog.
       
   381  *
       
   382  * @since MU (3.0.0)
       
   383  * @deprecated 4.4.0
       
   384  *
       
   385  * @param string $domain       The new blog's domain.
       
   386  * @param string $path         The new blog's path.
       
   387  * @param string $weblog_title The new blog's title.
       
   388  * @param int    $site_id      Optional. Defaults to 1.
       
   389  * @return string|int The ID of the newly created blog
       
   390  */
       
   391 function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
       
   392 	_deprecated_function( __FUNCTION__, '4.4.0' );
       
   393 
       
   394 	if ( empty($path) )
       
   395 		$path = '/';
       
   396 
       
   397 	// Check if the domain has been used already. We should return an error message.
       
   398 	if ( domain_exists($domain, $path, $site_id) )
       
   399 		return __( '<strong>ERROR</strong>: Site URL already taken.' );
       
   400 
       
   401 	// Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
       
   402 	// Need to get blog_id from wp_blogs, and create new table names.
       
   403 	// Must restore table names at the end of function.
       
   404 
       
   405 	if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
       
   406 		return __( '<strong>ERROR</strong>: problem creating site entry.' );
       
   407 
       
   408 	switch_to_blog($blog_id);
       
   409 	install_blog($blog_id);
       
   410 	restore_current_blog();
       
   411 
       
   412 	return $blog_id;
       
   413 }
       
   414 
       
   415 /**
       
   416  * Get the admin for a domain/path combination.
       
   417  *
       
   418  * @since MU (3.0.0)
       
   419  * @deprecated 4.4.0
       
   420  *
       
   421  * @global wpdb $wpdb WordPress database abstraction object.
       
   422  *
       
   423  * @param string $domain Optional. Network domain.
       
   424  * @param string $path   Optional. Network path.
       
   425  * @return array|false The network admins.
       
   426  */
       
   427 function get_admin_users_for_domain( $domain = '', $path = '' ) {
       
   428 	_deprecated_function( __FUNCTION__, '4.4.0' );
       
   429 
       
   430 	global $wpdb;
       
   431 
       
   432 	if ( ! $domain ) {
       
   433 		$network_id = get_current_network_id();
       
   434 	} else {
       
   435 		$_networks  = get_networks( array(
       
   436 			'fields' => 'ids',
       
   437 			'number' => 1,
       
   438 			'domain' => $domain,
       
   439 			'path'   => $path,
       
   440 		) );
       
   441 		$network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0;
       
   442 	}
       
   443 
       
   444 	if ( $network_id )
       
   445 		return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $network_id ), ARRAY_A );
       
   446 
       
   447 	return false;
       
   448 }
       
   449 
       
   450 /**
       
   451  * Return an array of sites for a network or networks.
       
   452  *
       
   453  * @since 3.7.0
       
   454  * @deprecated 4.6.0 Use get_sites()
       
   455  * @see get_sites()
       
   456  *
       
   457  * @param array $args {
       
   458  *     Array of default arguments. Optional.
       
   459  *
       
   460  *     @type int|array $network_id A network ID or array of network IDs. Set to null to retrieve sites
       
   461  *                                 from all networks. Defaults to current network ID.
       
   462  *     @type int       $public     Retrieve public or non-public sites. Default null, for any.
       
   463  *     @type int       $archived   Retrieve archived or non-archived sites. Default null, for any.
       
   464  *     @type int       $mature     Retrieve mature or non-mature sites. Default null, for any.
       
   465  *     @type int       $spam       Retrieve spam or non-spam sites. Default null, for any.
       
   466  *     @type int       $deleted    Retrieve deleted or non-deleted sites. Default null, for any.
       
   467  *     @type int       $limit      Number of sites to limit the query to. Default 100.
       
   468  *     @type int       $offset     Exclude the first x sites. Used in combination with the $limit parameter. Default 0.
       
   469  * }
       
   470  * @return array An empty array if the installation is considered "large" via wp_is_large_network(). Otherwise,
       
   471  *               an associative array of site data arrays, each containing the site (network) ID, blog ID,
       
   472  *               site domain and path, dates registered and modified, and the language ID. Also, boolean
       
   473  *               values for whether the site is public, archived, mature, spam, and/or deleted.
       
   474  */
       
   475 function wp_get_sites( $args = array() ) {
       
   476 	_deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );
       
   477 
       
   478 	if ( wp_is_large_network() )
       
   479 		return array();
       
   480 
       
   481 	$defaults = array(
       
   482 		'network_id' => get_current_network_id(),
       
   483 		'public'     => null,
       
   484 		'archived'   => null,
       
   485 		'mature'     => null,
       
   486 		'spam'       => null,
       
   487 		'deleted'    => null,
       
   488 		'limit'      => 100,
       
   489 		'offset'     => 0,
       
   490 	);
       
   491 
       
   492 	$args = wp_parse_args( $args, $defaults );
       
   493 
       
   494 	// Backwards compatibility
       
   495 	if( is_array( $args['network_id'] ) ){
       
   496 		$args['network__in'] = $args['network_id'];
       
   497 		$args['network_id'] = null;
       
   498 	}
       
   499 
       
   500 	if( is_numeric( $args['limit'] ) ){
       
   501 		$args['number'] = $args['limit'];
       
   502 		$args['limit'] = null;
       
   503 	} elseif ( ! $args['limit'] ) {
       
   504 		$args['number'] = 0;
       
   505 		$args['limit'] = null;
       
   506 	}
       
   507 
       
   508 	// Make sure count is disabled.
       
   509 	$args['count'] = false;
       
   510 
       
   511 	$_sites  = get_sites( $args );
       
   512 
       
   513 	$results = array();
       
   514 
       
   515 	foreach ( $_sites as $_site ) {
       
   516 		$_site = get_site( $_site );
       
   517 		$results[] = $_site->to_array();
       
   518 	}
       
   519 
       
   520 	return $results;
       
   521 }
       
   522 
       
   523 /**
       
   524  * Check whether a usermeta key has to do with the current blog.
       
   525  *
       
   526  * @since MU (3.0.0)
       
   527  * @deprecated 4.9.0
       
   528  *
       
   529  * @global wpdb $wpdb WordPress database abstraction object.
       
   530  *
       
   531  * @param string $key
       
   532  * @param int    $user_id Optional. Defaults to current user.
       
   533  * @param int    $blog_id Optional. Defaults to current blog.
       
   534  * @return bool
       
   535  */
       
   536 function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
       
   537 	global $wpdb;
       
   538 
       
   539 	_deprecated_function( __FUNCTION__, '4.9.0' );
       
   540 
       
   541 	$current_user = wp_get_current_user();
       
   542 	if ( $blog_id == 0 ) {
       
   543 		$blog_id = get_current_blog_id();
       
   544 	}
       
   545 	$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
       
   546 
       
   547 	return isset( $current_user->$local_key );
       
   548 }