Edit File by line
/home/barbar84/www/wp-inclu...
File: ms-deprecated.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Deprecated functions from WordPress MU and the multisite feature. You shouldn't
[2] Fix | Delete
* use these functions and look for the alternatives instead. The functions will be
[3] Fix | Delete
* removed in a later version.
[4] Fix | Delete
*
[5] Fix | Delete
* @package WordPress
[6] Fix | Delete
* @subpackage Deprecated
[7] Fix | Delete
* @since 3.0.0
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
/*
[11] Fix | Delete
* Deprecated functions come here to die.
[12] Fix | Delete
*/
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Get the "dashboard blog", the blog where users without a blog edit their profile data.
[16] Fix | Delete
* Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
[17] Fix | Delete
*
[18] Fix | Delete
* @since MU (3.0.0)
[19] Fix | Delete
* @deprecated 3.1.0 Use get_site()
[20] Fix | Delete
* @see get_site()
[21] Fix | Delete
*
[22] Fix | Delete
* @return WP_Site Current site object.
[23] Fix | Delete
*/
[24] Fix | Delete
function get_dashboard_blog() {
[25] Fix | Delete
_deprecated_function( __FUNCTION__, '3.1.0', 'get_site()' );
[26] Fix | Delete
if ( $blog = get_site_option( 'dashboard_blog' ) ) {
[27] Fix | Delete
return get_site( $blog );
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
return get_site( get_network()->site_id );
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* Generates a random password.
[35] Fix | Delete
*
[36] Fix | Delete
* @since MU (3.0.0)
[37] Fix | Delete
* @deprecated 3.0.0 Use wp_generate_password()
[38] Fix | Delete
* @see wp_generate_password()
[39] Fix | Delete
*
[40] Fix | Delete
* @param int $len Optional. The length of password to generate. Default 8.
[41] Fix | Delete
*/
[42] Fix | Delete
function generate_random_password( $len = 8 ) {
[43] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_generate_password()' );
[44] Fix | Delete
return wp_generate_password( $len );
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* Determine if user is a site admin.
[49] Fix | Delete
*
[50] Fix | Delete
* Plugins should use is_multisite() instead of checking if this function exists
[51] Fix | Delete
* to determine if multisite is enabled.
[52] Fix | Delete
*
[53] Fix | Delete
* This function must reside in a file included only if is_multisite() due to
[54] Fix | Delete
* legacy function_exists() checks to determine if multisite is enabled.
[55] Fix | Delete
*
[56] Fix | Delete
* @since MU (3.0.0)
[57] Fix | Delete
* @deprecated 3.0.0 Use is_super_admin()
[58] Fix | Delete
* @see is_super_admin()
[59] Fix | Delete
*
[60] Fix | Delete
* @param string $user_login Optional. Username for the user to check. Default empty.
[61] Fix | Delete
*/
[62] Fix | Delete
function is_site_admin( $user_login = '' ) {
[63] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'is_super_admin()' );
[64] Fix | Delete
[65] Fix | Delete
if ( empty( $user_login ) ) {
[66] Fix | Delete
$user_id = get_current_user_id();
[67] Fix | Delete
if ( !$user_id )
[68] Fix | Delete
return false;
[69] Fix | Delete
} else {
[70] Fix | Delete
$user = get_user_by( 'login', $user_login );
[71] Fix | Delete
if ( ! $user->exists() )
[72] Fix | Delete
return false;
[73] Fix | Delete
$user_id = $user->ID;
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
return is_super_admin( $user_id );
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
if ( !function_exists( 'graceful_fail' ) ) :
[80] Fix | Delete
/**
[81] Fix | Delete
* Deprecated functionality to gracefully fail.
[82] Fix | Delete
*
[83] Fix | Delete
* @since MU (3.0.0)
[84] Fix | Delete
* @deprecated 3.0.0 Use wp_die()
[85] Fix | Delete
* @see wp_die()
[86] Fix | Delete
*/
[87] Fix | Delete
function graceful_fail( $message ) {
[88] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_die()' );
[89] Fix | Delete
$message = apply_filters( 'graceful_fail', $message );
[90] Fix | Delete
$message_template = apply_filters( 'graceful_fail_template',
[91] Fix | Delete
'<!DOCTYPE html>
[92] Fix | Delete
<html><head>
[93] Fix | Delete
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
[94] Fix | Delete
<title>Error!</title>
[95] Fix | Delete
<style type="text/css">
[96] Fix | Delete
img {
[97] Fix | Delete
border: 0;
[98] Fix | Delete
}
[99] Fix | Delete
body {
[100] Fix | Delete
line-height: 1.6em; font-family: Georgia, serif; width: 390px; margin: auto;
[101] Fix | Delete
text-align: center;
[102] Fix | Delete
}
[103] Fix | Delete
.message {
[104] Fix | Delete
font-size: 22px;
[105] Fix | Delete
width: 350px;
[106] Fix | Delete
margin: auto;
[107] Fix | Delete
}
[108] Fix | Delete
</style>
[109] Fix | Delete
</head>
[110] Fix | Delete
<body>
[111] Fix | Delete
<p class="message">%s</p>
[112] Fix | Delete
</body>
[113] Fix | Delete
</html>' );
[114] Fix | Delete
die( sprintf( $message_template, $message ) );
[115] Fix | Delete
}
[116] Fix | Delete
endif;
[117] Fix | Delete
[118] Fix | Delete
/**
[119] Fix | Delete
* Deprecated functionality to retrieve user information.
[120] Fix | Delete
*
[121] Fix | Delete
* @since MU (3.0.0)
[122] Fix | Delete
* @deprecated 3.0.0 Use get_user_by()
[123] Fix | Delete
* @see get_user_by()
[124] Fix | Delete
*
[125] Fix | Delete
* @param string $username Username.
[126] Fix | Delete
*/
[127] Fix | Delete
function get_user_details( $username ) {
[128] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_by()' );
[129] Fix | Delete
return get_user_by('login', $username);
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
/**
[133] Fix | Delete
* Deprecated functionality to clear the global post cache.
[134] Fix | Delete
*
[135] Fix | Delete
* @since MU (3.0.0)
[136] Fix | Delete
* @deprecated 3.0.0 Use clean_post_cache()
[137] Fix | Delete
* @see clean_post_cache()
[138] Fix | Delete
*
[139] Fix | Delete
* @param int $post_id Post ID.
[140] Fix | Delete
*/
[141] Fix | Delete
function clear_global_post_cache( $post_id ) {
[142] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' );
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* Deprecated functionality to determin if the current site is the main site.
[147] Fix | Delete
*
[148] Fix | Delete
* @since MU (3.0.0)
[149] Fix | Delete
* @deprecated 3.0.0 Use is_main_site()
[150] Fix | Delete
* @see is_main_site()
[151] Fix | Delete
*/
[152] Fix | Delete
function is_main_blog() {
[153] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'is_main_site()' );
[154] Fix | Delete
return is_main_site();
[155] Fix | Delete
}
[156] Fix | Delete
[157] Fix | Delete
/**
[158] Fix | Delete
* Deprecated functionality to validate an email address.
[159] Fix | Delete
*
[160] Fix | Delete
* @since MU (3.0.0)
[161] Fix | Delete
* @deprecated 3.0.0 Use is_email()
[162] Fix | Delete
* @see is_email()
[163] Fix | Delete
*
[164] Fix | Delete
* @param string $email Email address to verify.
[165] Fix | Delete
* @param bool $check_domain Deprecated.
[166] Fix | Delete
* @return string|false Valid email address on success, false on failure.
[167] Fix | Delete
*/
[168] Fix | Delete
function validate_email( $email, $check_domain = true) {
[169] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' );
[170] Fix | Delete
return is_email( $email, $check_domain );
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
/**
[174] Fix | Delete
* Deprecated functionality to retrieve a list of all sites.
[175] Fix | Delete
*
[176] Fix | Delete
* @since MU (3.0.0)
[177] Fix | Delete
* @deprecated 3.0.0 Use wp_get_sites()
[178] Fix | Delete
* @see wp_get_sites()
[179] Fix | Delete
*
[180] Fix | Delete
* @param int $start Optional. Offset for retrieving the blog list. Default 0.
[181] Fix | Delete
* @param int $num Optional. Number of blogs to list. Default 10.
[182] Fix | Delete
* @param string $deprecated Unused.
[183] Fix | Delete
*/
[184] Fix | Delete
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {
[185] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' );
[186] Fix | Delete
[187] Fix | Delete
global $wpdb;
[188] Fix | Delete
$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 );
[189] Fix | Delete
[190] Fix | Delete
$blog_list = array();
[191] Fix | Delete
foreach ( (array) $blogs as $details ) {
[192] Fix | Delete
$blog_list[ $details['blog_id'] ] = $details;
[193] Fix | Delete
$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'" );
[194] Fix | Delete
}
[195] Fix | Delete
[196] Fix | Delete
if ( ! $blog_list ) {
[197] Fix | Delete
return array();
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
if ( 'all' === $num ) {
[201] Fix | Delete
return array_slice( $blog_list, $start, count( $blog_list ) );
[202] Fix | Delete
} else {
[203] Fix | Delete
return array_slice( $blog_list, $start, $num );
[204] Fix | Delete
}
[205] Fix | Delete
}
[206] Fix | Delete
[207] Fix | Delete
/**
[208] Fix | Delete
* Deprecated functionality to retrieve a list of the most active sites.
[209] Fix | Delete
*
[210] Fix | Delete
* @since MU (3.0.0)
[211] Fix | Delete
* @deprecated 3.0.0
[212] Fix | Delete
*
[213] Fix | Delete
* @param int $num Optional. Number of activate blogs to retrieve. Default 10.
[214] Fix | Delete
* @param bool $display Optional. Whether or not to display the most active blogs list. Default true.
[215] Fix | Delete
* @return array List of "most active" sites.
[216] Fix | Delete
*/
[217] Fix | Delete
function get_most_active_blogs( $num = 10, $display = true ) {
[218] Fix | Delete
_deprecated_function( __FUNCTION__, '3.0.0' );
[219] Fix | Delete
[220] Fix | Delete
$blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
[221] Fix | Delete
if ( is_array( $blogs ) ) {
[222] Fix | Delete
reset( $blogs );
[223] Fix | Delete
$most_active = array();
[224] Fix | Delete
$blog_list = array();
[225] Fix | Delete
foreach ( (array) $blogs as $key => $details ) {
[226] Fix | Delete
$most_active[ $details['blog_id'] ] = $details['postcount'];
[227] Fix | Delete
$blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!
[228] Fix | Delete
}
[229] Fix | Delete
arsort( $most_active );
[230] Fix | Delete
reset( $most_active );
[231] Fix | Delete
$t = array();
[232] Fix | Delete
foreach ( (array) $most_active as $key => $details ) {
[233] Fix | Delete
$t[ $key ] = $blog_list[ $key ];
[234] Fix | Delete
}
[235] Fix | Delete
unset( $most_active );
[236] Fix | Delete
$most_active = $t;
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
if ( $display ) {
[240] Fix | Delete
if ( is_array( $most_active ) ) {
[241] Fix | Delete
reset( $most_active );
[242] Fix | Delete
foreach ( (array) $most_active as $key => $details ) {
[243] Fix | Delete
$url = esc_url('http://' . $details['domain'] . $details['path']);
[244] Fix | Delete
echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
[245] Fix | Delete
}
[246] Fix | Delete
}
[247] Fix | Delete
}
[248] Fix | Delete
return array_slice( $most_active, 0, $num );
[249] Fix | Delete
}
[250] Fix | Delete
[251] Fix | Delete
/**
[252] Fix | Delete
* Redirect a user based on $_GET or $_POST arguments.
[253] Fix | Delete
*
[254] Fix | Delete
* The function looks for redirect arguments in the following order:
[255] Fix | Delete
* 1) $_GET['ref']
[256] Fix | Delete
* 2) $_POST['ref']
[257] Fix | Delete
* 3) $_SERVER['HTTP_REFERER']
[258] Fix | Delete
* 4) $_GET['redirect']
[259] Fix | Delete
* 5) $_POST['redirect']
[260] Fix | Delete
* 6) $url
[261] Fix | Delete
*
[262] Fix | Delete
* @since MU (3.0.0)
[263] Fix | Delete
* @deprecated 3.3.0 Use wp_redirect()
[264] Fix | Delete
* @see wp_redirect()
[265] Fix | Delete
*
[266] Fix | Delete
* @param string $url Optional. Redirect URL. Default empty.
[267] Fix | Delete
*/
[268] Fix | Delete
function wpmu_admin_do_redirect( $url = '' ) {
[269] Fix | Delete
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_redirect()' );
[270] Fix | Delete
[271] Fix | Delete
$ref = '';
[272] Fix | Delete
if ( isset( $_GET['ref'] ) && isset( $_POST['ref'] ) && $_GET['ref'] !== $_POST['ref'] ) {
[273] Fix | Delete
wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
[274] Fix | Delete
} elseif ( isset( $_POST['ref'] ) ) {
[275] Fix | Delete
$ref = $_POST['ref'];
[276] Fix | Delete
} elseif ( isset( $_GET['ref'] ) ) {
[277] Fix | Delete
$ref = $_GET['ref'];
[278] Fix | Delete
}
[279] Fix | Delete
[280] Fix | Delete
if ( $ref ) {
[281] Fix | Delete
$ref = wpmu_admin_redirect_add_updated_param( $ref );
[282] Fix | Delete
wp_redirect( $ref );
[283] Fix | Delete
exit;
[284] Fix | Delete
}
[285] Fix | Delete
if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
[286] Fix | Delete
wp_redirect( $_SERVER['HTTP_REFERER'] );
[287] Fix | Delete
exit;
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
$url = wpmu_admin_redirect_add_updated_param( $url );
[291] Fix | Delete
if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) {
[292] Fix | Delete
wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
[293] Fix | Delete
} elseif ( isset( $_GET['redirect'] ) ) {
[294] Fix | Delete
if ( 's_' === substr( $_GET['redirect'], 0, 2 ) )
[295] Fix | Delete
$url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
[296] Fix | Delete
} elseif ( isset( $_POST['redirect'] ) ) {
[297] Fix | Delete
$url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
[298] Fix | Delete
}
[299] Fix | Delete
wp_redirect( $url );
[300] Fix | Delete
exit;
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
/**
[304] Fix | Delete
* Adds an 'updated=true' argument to a URL.
[305] Fix | Delete
*
[306] Fix | Delete
* @since MU (3.0.0)
[307] Fix | Delete
* @deprecated 3.3.0 Use add_query_arg()
[308] Fix | Delete
* @see add_query_arg()
[309] Fix | Delete
*
[310] Fix | Delete
* @param string $url Optional. Redirect URL. Default empty.
[311] Fix | Delete
* @return string
[312] Fix | Delete
*/
[313] Fix | Delete
function wpmu_admin_redirect_add_updated_param( $url = '' ) {
[314] Fix | Delete
_deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' );
[315] Fix | Delete
[316] Fix | Delete
if ( strpos( $url, 'updated=true' ) === false ) {
[317] Fix | Delete
if ( strpos( $url, '?' ) === false )
[318] Fix | Delete
return $url . '?updated=true';
[319] Fix | Delete
else
[320] Fix | Delete
return $url . '&updated=true';
[321] Fix | Delete
}
[322] Fix | Delete
return $url;
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
/**
[326] Fix | Delete
* Get a numeric user ID from either an email address or a login.
[327] Fix | Delete
*
[328] Fix | Delete
* A numeric string is considered to be an existing user ID
[329] Fix | Delete
* and is simply returned as such.
[330] Fix | Delete
*
[331] Fix | Delete
* @since MU (3.0.0)
[332] Fix | Delete
* @deprecated 3.6.0 Use get_user_by()
[333] Fix | Delete
* @see get_user_by()
[334] Fix | Delete
*
[335] Fix | Delete
* @param string $string Either an email address or a login.
[336] Fix | Delete
* @return int
[337] Fix | Delete
*/
[338] Fix | Delete
function get_user_id_from_string( $string ) {
[339] Fix | Delete
_deprecated_function( __FUNCTION__, '3.6.0', 'get_user_by()' );
[340] Fix | Delete
[341] Fix | Delete
if ( is_email( $string ) )
[342] Fix | Delete
$user = get_user_by( 'email', $string );
[343] Fix | Delete
elseif ( is_numeric( $string ) )
[344] Fix | Delete
return $string;
[345] Fix | Delete
else
[346] Fix | Delete
$user = get_user_by( 'login', $string );
[347] Fix | Delete
[348] Fix | Delete
if ( $user )
[349] Fix | Delete
return $user->ID;
[350] Fix | Delete
return 0;
[351] Fix | Delete
}
[352] Fix | Delete
[353] Fix | Delete
/**
[354] Fix | Delete
* Get a full blog URL, given a domain and a path.
[355] Fix | Delete
*
[356] Fix | Delete
* @since MU (3.0.0)
[357] Fix | Delete
* @deprecated 3.7.0
[358] Fix | Delete
*
[359] Fix | Delete
* @param string $domain
[360] Fix | Delete
* @param string $path
[361] Fix | Delete
* @return string
[362] Fix | Delete
*/
[363] Fix | Delete
function get_blogaddress_by_domain( $domain, $path ) {
[364] Fix | Delete
_deprecated_function( __FUNCTION__, '3.7.0' );
[365] Fix | Delete
[366] Fix | Delete
if ( is_subdomain_install() ) {
[367] Fix | Delete
$url = "http://" . $domain.$path;
[368] Fix | Delete
} else {
[369] Fix | Delete
if ( $domain != $_SERVER['HTTP_HOST'] ) {
[370] Fix | Delete
$blogname = substr( $domain, 0, strpos( $domain, '.' ) );
[371] Fix | Delete
$url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
[372] Fix | Delete
// We're not installing the main blog.
[373] Fix | Delete
if ( 'www.' !== $blogname )
[374] Fix | Delete
$url .= $blogname . '/';
[375] Fix | Delete
} else { // Main blog.
[376] Fix | Delete
$url = 'http://' . $domain . $path;
[377] Fix | Delete
}
[378] Fix | Delete
}
[379] Fix | Delete
return esc_url_raw( $url );
[380] Fix | Delete
}
[381] Fix | Delete
[382] Fix | Delete
/**
[383] Fix | Delete
* Create an empty blog.
[384] Fix | Delete
*
[385] Fix | Delete
* @since MU (3.0.0)
[386] Fix | Delete
* @deprecated 4.4.0
[387] Fix | Delete
*
[388] Fix | Delete
* @param string $domain The new blog's domain.
[389] Fix | Delete
* @param string $path The new blog's path.
[390] Fix | Delete
* @param string $weblog_title The new blog's title.
[391] Fix | Delete
* @param int $site_id Optional. Defaults to 1.
[392] Fix | Delete
* @return string|int The ID of the newly created blog
[393] Fix | Delete
*/
[394] Fix | Delete
function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
[395] Fix | Delete
_deprecated_function( __FUNCTION__, '4.4.0' );
[396] Fix | Delete
[397] Fix | Delete
if ( empty($path) )
[398] Fix | Delete
$path = '/';
[399] Fix | Delete
[400] Fix | Delete
// Check if the domain has been used already. We should return an error message.
[401] Fix | Delete
if ( domain_exists($domain, $path, $site_id) )
[402] Fix | Delete
return __( '<strong>Error</strong>: Site URL you&#8217;ve entered is already taken.' );
[403] Fix | Delete
[404] Fix | Delete
/*
[405] Fix | Delete
* Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
[406] Fix | Delete
* Need to get blog_id from wp_blogs, and create new table names.
[407] Fix | Delete
* Must restore table names at the end of function.
[408] Fix | Delete
*/
[409] Fix | Delete
[410] Fix | Delete
if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
[411] Fix | Delete
return __( '<strong>Error</strong>: There was a problem creating site entry.' );
[412] Fix | Delete
[413] Fix | Delete
switch_to_blog($blog_id);
[414] Fix | Delete
install_blog($blog_id);
[415] Fix | Delete
restore_current_blog();
[416] Fix | Delete
[417] Fix | Delete
return $blog_id;
[418] Fix | Delete
}
[419] Fix | Delete
[420] Fix | Delete
/**
[421] Fix | Delete
* Get the admin for a domain/path combination.
[422] Fix | Delete
*
[423] Fix | Delete
* @since MU (3.0.0)
[424] Fix | Delete
* @deprecated 4.4.0
[425] Fix | Delete
*
[426] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[427] Fix | Delete
*
[428] Fix | Delete
* @param string $domain Optional. Network domain.
[429] Fix | Delete
* @param string $path Optional. Network path.
[430] Fix | Delete
* @return array|false The network admins.
[431] Fix | Delete
*/
[432] Fix | Delete
function get_admin_users_for_domain( $domain = '', $path = '' ) {
[433] Fix | Delete
_deprecated_function( __FUNCTION__, '4.4.0' );
[434] Fix | Delete
[435] Fix | Delete
global $wpdb;
[436] Fix | Delete
[437] Fix | Delete
if ( ! $domain ) {
[438] Fix | Delete
$network_id = get_current_network_id();
[439] Fix | Delete
} else {
[440] Fix | Delete
$_networks = get_networks( array(
[441] Fix | Delete
'fields' => 'ids',
[442] Fix | Delete
'number' => 1,
[443] Fix | Delete
'domain' => $domain,
[444] Fix | Delete
'path' => $path,
[445] Fix | Delete
) );
[446] Fix | Delete
$network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0;
[447] Fix | Delete
}
[448] Fix | Delete
[449] Fix | Delete
if ( $network_id )
[450] Fix | Delete
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 );
[451] Fix | Delete
[452] Fix | Delete
return false;
[453] Fix | Delete
}
[454] Fix | Delete
[455] Fix | Delete
/**
[456] Fix | Delete
* Return an array of sites for a network or networks.
[457] Fix | Delete
*
[458] Fix | Delete
* @since 3.7.0
[459] Fix | Delete
* @deprecated 4.6.0 Use get_sites()
[460] Fix | Delete
* @see get_sites()
[461] Fix | Delete
*
[462] Fix | Delete
* @param array $args {
[463] Fix | Delete
* Array of default arguments. Optional.
[464] Fix | Delete
*
[465] Fix | Delete
* @type int|int[] $network_id A network ID or array of network IDs. Set to null to retrieve sites
[466] Fix | Delete
* from all networks. Defaults to current network ID.
[467] Fix | Delete
* @type int $public Retrieve public or non-public sites. Default null, for any.
[468] Fix | Delete
* @type int $archived Retrieve archived or non-archived sites. Default null, for any.
[469] Fix | Delete
* @type int $mature Retrieve mature or non-mature sites. Default null, for any.
[470] Fix | Delete
* @type int $spam Retrieve spam or non-spam sites. Default null, for any.
[471] Fix | Delete
* @type int $deleted Retrieve deleted or non-deleted sites. Default null, for any.
[472] Fix | Delete
* @type int $limit Number of sites to limit the query to. Default 100.
[473] Fix | Delete
* @type int $offset Exclude the first x sites. Used in combination with the $limit parameter. Default 0.
[474] Fix | Delete
* }
[475] Fix | Delete
* @return array[] An empty array if the installation is considered "large" via wp_is_large_network(). Otherwise,
[476] Fix | Delete
* an associative array of WP_Site data as arrays.
[477] Fix | Delete
*/
[478] Fix | Delete
function wp_get_sites( $args = array() ) {
[479] Fix | Delete
_deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );
[480] Fix | Delete
[481] Fix | Delete
if ( wp_is_large_network() )
[482] Fix | Delete
return array();
[483] Fix | Delete
[484] Fix | Delete
$defaults = array(
[485] Fix | Delete
'network_id' => get_current_network_id(),
[486] Fix | Delete
'public' => null,
[487] Fix | Delete
'archived' => null,
[488] Fix | Delete
'mature' => null,
[489] Fix | Delete
'spam' => null,
[490] Fix | Delete
'deleted' => null,
[491] Fix | Delete
'limit' => 100,
[492] Fix | Delete
'offset' => 0,
[493] Fix | Delete
);
[494] Fix | Delete
[495] Fix | Delete
$args = wp_parse_args( $args, $defaults );
[496] Fix | Delete
[497] Fix | Delete
// Backward compatibility.
[498] Fix | Delete
if( is_array( $args['network_id'] ) ){
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function