wp/wp-admin/includes/ms.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    14  *
    14  *
    15  * @param array $file $_FILES array for a given file.
    15  * @param array $file $_FILES array for a given file.
    16  * @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
    16  * @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
    17  */
    17  */
    18 function check_upload_size( $file ) {
    18 function check_upload_size( $file ) {
    19 	if ( get_site_option( 'upload_space_check_disabled' ) )
    19 	if ( get_site_option( 'upload_space_check_disabled' ) ) {
    20 		return $file;
    20 		return $file;
    21 
    21 	}
    22 	if ( $file['error'] != '0' ) // there's already an error
    22 
       
    23 	if ( $file['error'] != '0' ) { // there's already an error
    23 		return $file;
    24 		return $file;
    24 
    25 	}
    25 	if ( defined( 'WP_IMPORTING' ) )
    26 
       
    27 	if ( defined( 'WP_IMPORTING' ) ) {
    26 		return $file;
    28 		return $file;
       
    29 	}
    27 
    30 
    28 	$space_left = get_upload_space_available();
    31 	$space_left = get_upload_space_available();
    29 
    32 
    30 	$file_size = filesize( $file['tmp_name'] );
    33 	$file_size = filesize( $file['tmp_name'] );
    31 	if ( $space_left < $file_size ) {
    34 	if ( $space_left < $file_size ) {
    32 		/* translators: 1: Required disk space in kilobytes */
    35 		/* translators: %s: required disk space in kilobytes */
    33 		$file['error'] = sprintf( __( 'Not enough space to upload. %1$s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) );
    36 		$file['error'] = sprintf( __( 'Not enough space to upload. %s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) );
    34 	}
    37 	}
    35 
    38 
    36 	if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
    39 	if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
    37 		/* translators: 1: Maximum allowed file size in kilobytes */
    40 		/* translators: %s: maximum allowed file size in kilobytes */
    38 		$file['error'] = sprintf( __( 'This file is too big. Files must be less than %1$s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) );
    41 		$file['error'] = sprintf( __( 'This file is too big. Files must be less than %s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) );
    39 	}
    42 	}
    40 
    43 
    41 	if ( upload_is_user_over_quota( false ) ) {
    44 	if ( upload_is_user_over_quota( false ) ) {
    42 		$file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
    45 		$file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
    43 	}
    46 	}
    51 
    54 
    52 /**
    55 /**
    53  * Delete a site.
    56  * Delete a site.
    54  *
    57  *
    55  * @since 3.0.0
    58  * @since 3.0.0
       
    59  * @since 5.1.0 Use wp_delete_site() internally to delete the site row from the database.
    56  *
    60  *
    57  * @global wpdb $wpdb WordPress database abstraction object.
    61  * @global wpdb $wpdb WordPress database abstraction object.
    58  *
    62  *
    59  * @param int  $blog_id Site ID.
    63  * @param int  $blog_id Site ID.
    60  * @param bool $drop    True if site's database tables should be dropped. Default is false.
    64  * @param bool $drop    True if site's database tables should be dropped. Default is false.
    67 		$switch = true;
    71 		$switch = true;
    68 		switch_to_blog( $blog_id );
    72 		switch_to_blog( $blog_id );
    69 	}
    73 	}
    70 
    74 
    71 	$blog = get_site( $blog_id );
    75 	$blog = get_site( $blog_id );
    72 	/**
       
    73 	 * Fires before a site is deleted.
       
    74 	 *
       
    75 	 * @since MU (3.0.0)
       
    76 	 *
       
    77 	 * @param int  $blog_id The site ID.
       
    78 	 * @param bool $drop    True if site's table should be dropped. Default is false.
       
    79 	 */
       
    80 	do_action( 'delete_blog', $blog_id, $drop );
       
    81 
       
    82 	$users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
       
    83 
       
    84 	// Remove users from this blog.
       
    85 	if ( ! empty( $users ) ) {
       
    86 		foreach ( $users as $user_id ) {
       
    87 			remove_user_from_blog( $user_id, $blog_id );
       
    88 		}
       
    89 	}
       
    90 
       
    91 	update_blog_status( $blog_id, 'deleted', 1 );
       
    92 
    76 
    93 	$current_network = get_network();
    77 	$current_network = get_network();
    94 
    78 
    95 	// If a full blog object is not available, do not destroy anything.
    79 	// If a full blog object is not available, do not destroy anything.
    96 	if ( $drop && ! $blog ) {
    80 	if ( $drop && ! $blog ) {
   108 	if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( $upload_path ) ) {
    92 	if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( $upload_path ) ) {
   109 		$drop = false;
    93 		$drop = false;
   110 	}
    94 	}
   111 
    95 
   112 	if ( $drop ) {
    96 	if ( $drop ) {
   113 		$uploads = wp_get_upload_dir();
    97 		wp_delete_site( $blog_id );
   114 
    98 	} else {
   115 		$tables = $wpdb->tables( 'blog' );
    99 		/** This action is documented in wp-includes/ms-blogs.php */
   116 		/**
   100 		do_action_deprecated( 'delete_blog', array( $blog_id, false ), '5.1.0' );
   117 		 * Filters the tables to drop when the site is deleted.
   101 
   118 		 *
   102 		$users = get_users(
   119 		 * @since MU (3.0.0)
   103 			array(
   120 		 *
   104 				'blog_id' => $blog_id,
   121 		 * @param array $tables  The site tables to be dropped.
   105 				'fields'  => 'ids',
   122 		 * @param int   $blog_id The ID of the site to drop tables for.
   106 			)
   123 		 */
   107 		);
   124 		$drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $blog_id );
   108 
   125 
   109 		// Remove users from this blog.
   126 		foreach ( (array) $drop_tables as $table ) {
   110 		if ( ! empty( $users ) ) {
   127 			$wpdb->query( "DROP TABLE IF EXISTS `$table`" );
   111 			foreach ( $users as $user_id ) {
       
   112 				remove_user_from_blog( $user_id, $blog_id );
       
   113 			}
   128 		}
   114 		}
   129 
   115 
   130 		$wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) );
   116 		update_blog_status( $blog_id, 'deleted', 1 );
   131 
   117 
   132 		/**
   118 		/** This action is documented in wp-includes/ms-blogs.php */
   133 		 * Filters the upload base directory to delete when the site is deleted.
   119 		do_action_deprecated( 'deleted_blog', array( $blog_id, false ), '5.1.0' );
   134 		 *
   120 	}
   135 		 * @since MU (3.0.0)
   121 
   136 		 *
   122 	if ( $switch ) {
   137 		 * @param string $uploads['basedir'] Uploads path without subdirectory. @see wp_upload_dir()
       
   138 		 * @param int    $blog_id            The site ID.
       
   139 		 */
       
   140 		$dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
       
   141 		$dir = rtrim( $dir, DIRECTORY_SEPARATOR );
       
   142 		$top_dir = $dir;
       
   143 		$stack = array($dir);
       
   144 		$index = 0;
       
   145 
       
   146 		while ( $index < count( $stack ) ) {
       
   147 			// Get indexed directory from stack
       
   148 			$dir = $stack[$index];
       
   149 
       
   150 			$dh = @opendir( $dir );
       
   151 			if ( $dh ) {
       
   152 				while ( ( $file = @readdir( $dh ) ) !== false ) {
       
   153 					if ( $file == '.' || $file == '..' )
       
   154 						continue;
       
   155 
       
   156 					if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) {
       
   157 						$stack[] = $dir . DIRECTORY_SEPARATOR . $file;
       
   158 					} elseif ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) {
       
   159 						@unlink( $dir . DIRECTORY_SEPARATOR . $file );
       
   160 					}
       
   161 				}
       
   162 				@closedir( $dh );
       
   163 			}
       
   164 			$index++;
       
   165 		}
       
   166 
       
   167 		$stack = array_reverse( $stack ); // Last added dirs are deepest
       
   168 		foreach ( (array) $stack as $dir ) {
       
   169 			if ( $dir != $top_dir)
       
   170 			@rmdir( $dir );
       
   171 		}
       
   172 
       
   173 		clean_blog_cache( $blog );
       
   174 	}
       
   175 
       
   176 	/**
       
   177 	 * Fires after the site is deleted from the network.
       
   178 	 *
       
   179 	 * @since 4.8.0
       
   180 	 *
       
   181 	 * @param int  $blog_id The site ID.
       
   182 	 * @param bool $drop    True if site's tables should be dropped. Default is false.
       
   183 	 */
       
   184 	do_action( 'deleted_blog', $blog_id, $drop );
       
   185 
       
   186 	if ( $switch )
       
   187 		restore_current_blog();
   123 		restore_current_blog();
       
   124 	}
   188 }
   125 }
   189 
   126 
   190 /**
   127 /**
   191  * Delete a user from the network and remove from all sites.
   128  * Delete a user from the network and remove from all sites.
   192  *
   129  *
   204 
   141 
   205 	if ( ! is_numeric( $id ) ) {
   142 	if ( ! is_numeric( $id ) ) {
   206 		return false;
   143 		return false;
   207 	}
   144 	}
   208 
   145 
   209 	$id = (int) $id;
   146 	$id   = (int) $id;
   210 	$user = new WP_User( $id );
   147 	$user = new WP_User( $id );
   211 
   148 
   212 	if ( !$user->exists() )
   149 	if ( ! $user->exists() ) {
   213 		return false;
   150 		return false;
       
   151 	}
   214 
   152 
   215 	// Global super-administrators are protected, and cannot be deleted.
   153 	// Global super-administrators are protected, and cannot be deleted.
   216 	$_super_admins = get_super_admins();
   154 	$_super_admins = get_super_admins();
   217 	if ( in_array( $user->user_login, $_super_admins, true ) ) {
   155 	if ( in_array( $user->user_login, $_super_admins, true ) ) {
   218 		return false;
   156 		return false;
   241 
   179 
   242 			// Clean links
   180 			// Clean links
   243 			$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
   181 			$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
   244 
   182 
   245 			if ( $link_ids ) {
   183 			if ( $link_ids ) {
   246 				foreach ( $link_ids as $link_id )
   184 				foreach ( $link_ids as $link_id ) {
   247 					wp_delete_link( $link_id );
   185 					wp_delete_link( $link_id );
       
   186 				}
   248 			}
   187 			}
   249 
   188 
   250 			restore_current_blog();
   189 			restore_current_blog();
   251 		}
   190 		}
   252 	}
   191 	}
   253 
   192 
   254 	$meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
   193 	$meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
   255 	foreach ( $meta as $mid )
   194 	foreach ( $meta as $mid ) {
   256 		delete_metadata_by_mid( 'user', $mid );
   195 		delete_metadata_by_mid( 'user', $mid );
       
   196 	}
   257 
   197 
   258 	$wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
   198 	$wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
   259 
   199 
   260 	clean_user_cache( $user );
   200 	clean_user_cache( $user );
   261 
   201 
   272  *
   212  *
   273  * @param bool $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.
   213  * @param bool $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.
   274  * @return bool True if user is over upload space quota, otherwise false.
   214  * @return bool True if user is over upload space quota, otherwise false.
   275  */
   215  */
   276 function upload_is_user_over_quota( $echo = true ) {
   216 function upload_is_user_over_quota( $echo = true ) {
   277 	if ( get_site_option( 'upload_space_check_disabled' ) )
   217 	if ( get_site_option( 'upload_space_check_disabled' ) ) {
   278 		return false;
   218 		return false;
       
   219 	}
   279 
   220 
   280 	$space_allowed = get_space_allowed();
   221 	$space_allowed = get_space_allowed();
   281 	if ( ! is_numeric( $space_allowed ) ) {
   222 	if ( ! is_numeric( $space_allowed ) ) {
   282 		$space_allowed = 10; // Default space allowed is 10 MB
   223 		$space_allowed = 10; // Default space allowed is 10 MB
   283 	}
   224 	}
   284 	$space_used = get_space_used();
   225 	$space_used = get_space_used();
   285 
   226 
   286 	if ( ( $space_allowed - $space_used ) < 0 ) {
   227 	if ( ( $space_allowed - $space_used ) < 0 ) {
   287 		if ( $echo )
   228 		if ( $echo ) {
   288 			_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
   229 			printf(
       
   230 				/* translators: %s: allowed space allocation */
       
   231 				__( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ),
       
   232 				size_format( $space_allowed * MB_IN_BYTES )
       
   233 			);
       
   234 		}
   289 		return true;
   235 		return true;
   290 	} else {
   236 	} else {
   291 		return false;
   237 		return false;
   292 	}
   238 	}
   293 }
   239 }
   297  *
   243  *
   298  * @since MU (3.0.0)
   244  * @since MU (3.0.0)
   299  */
   245  */
   300 function display_space_usage() {
   246 function display_space_usage() {
   301 	$space_allowed = get_space_allowed();
   247 	$space_allowed = get_space_allowed();
   302 	$space_used = get_space_used();
   248 	$space_used    = get_space_used();
   303 
   249 
   304 	$percent_used = ( $space_used / $space_allowed ) * 100;
   250 	$percent_used = ( $space_used / $space_allowed ) * 100;
   305 
   251 
   306 	if ( $space_allowed > 1000 ) {
   252 	if ( $space_allowed > 1000 ) {
   307 		$space = number_format( $space_allowed / KB_IN_BYTES );
   253 		$space = number_format( $space_allowed / KB_IN_BYTES );
   311 		$space = number_format( $space_allowed );
   257 		$space = number_format( $space_allowed );
   312 		/* translators: Megabytes */
   258 		/* translators: Megabytes */
   313 		$space .= __( 'MB' );
   259 		$space .= __( 'MB' );
   314 	}
   260 	}
   315 	?>
   261 	?>
   316 	<strong><?php
   262 	<strong>
       
   263 	<?php
   317 		/* translators: Storage space that's been used. 1: Percentage of used space, 2: Total space allowed in megabytes or gigabytes */
   264 		/* translators: Storage space that's been used. 1: Percentage of used space, 2: Total space allowed in megabytes or gigabytes */
   318 		printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space );
   265 		printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space );
   319 	?></strong>
   266 	?>
       
   267 	</strong>
   320 	<?php
   268 	<?php
   321 }
   269 }
   322 
   270 
   323 /**
   271 /**
   324  * Get the remaining upload space for this site.
   272  * Get the remaining upload space for this site.
   346 function upload_space_setting( $id ) {
   294 function upload_space_setting( $id ) {
   347 	switch_to_blog( $id );
   295 	switch_to_blog( $id );
   348 	$quota = get_option( 'blog_upload_space' );
   296 	$quota = get_option( 'blog_upload_space' );
   349 	restore_current_blog();
   297 	restore_current_blog();
   350 
   298 
   351 	if ( !$quota )
   299 	if ( ! $quota ) {
   352 		$quota = '';
   300 		$quota = '';
       
   301 	}
   353 
   302 
   354 	?>
   303 	?>
   355 	<tr>
   304 	<tr>
   356 		<th><label for="blog-upload-space-number"><?php _e( 'Site Upload Space Quota' ); ?></label></th>
   305 		<th><label for="blog-upload-space-number"><?php _e( 'Site Upload Space Quota' ); ?></label></th>
   357 		<td>
   306 		<td>
   379  * @return int   The initially passed $value.
   328  * @return int   The initially passed $value.
   380  */
   329  */
   381 function update_user_status( $id, $pref, $value, $deprecated = null ) {
   330 function update_user_status( $id, $pref, $value, $deprecated = null ) {
   382 	global $wpdb;
   331 	global $wpdb;
   383 
   332 
   384 	if ( null !== $deprecated )
   333 	if ( null !== $deprecated ) {
   385 		_deprecated_argument( __FUNCTION__, '3.0.2' );
   334 		_deprecated_argument( __FUNCTION__, '3.0.2' );
       
   335 	}
   386 
   336 
   387 	$wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) );
   337 	$wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) );
   388 
   338 
   389 	$user = new WP_User( $id );
   339 	$user = new WP_User( $id );
   390 	clean_user_cache( $user );
   340 	clean_user_cache( $user );
   423  * @return bool|int The ID of the refreshed user or false if the user does not exist.
   373  * @return bool|int The ID of the refreshed user or false if the user does not exist.
   424  */
   374  */
   425 function refresh_user_details( $id ) {
   375 function refresh_user_details( $id ) {
   426 	$id = (int) $id;
   376 	$id = (int) $id;
   427 
   377 
   428 	if ( !$user = get_userdata( $id ) )
   378 	if ( ! $user = get_userdata( $id ) ) {
   429 		return false;
   379 		return false;
       
   380 	}
   430 
   381 
   431 	clean_user_cache( $user );
   382 	clean_user_cache( $user );
   432 
   383 
   433 	return $id;
   384 	return $id;
   434 }
   385 }
   441  * @param string $code Optional. The two-letter language code. Default empty.
   392  * @param string $code Optional. The two-letter language code. Default empty.
   442  * @return string The language corresponding to $code if it exists. If it does not exist,
   393  * @return string The language corresponding to $code if it exists. If it does not exist,
   443  *                then the first two letters of $code is returned.
   394  *                then the first two letters of $code is returned.
   444  */
   395  */
   445 function format_code_lang( $code = '' ) {
   396 function format_code_lang( $code = '' ) {
   446 	$code = strtolower( substr( $code, 0, 2 ) );
   397 	$code       = strtolower( substr( $code, 0, 2 ) );
   447 	$lang_codes = array(
   398 	$lang_codes = array(
   448 		'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali',
   399 		'aa' => 'Afar',
   449 		'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree',
   400 		'ab' => 'Abkhazian',
   450 		'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi; Dhivehi; Maldivian', 'nl' => 'Dutch; Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijjian', 'fi' => 'Finnish', 'fr' => 'French', 'fy' => 'Western Frisian', 'ff' => 'Fulah', 'ka' => 'Georgian', 'de' => 'German', 'gd' => 'Gaelic; Scottish Gaelic',
   401 		'af' => 'Afrikaans',
   451 		'ga' => 'Irish', 'gl' => 'Galician', 'gv' => 'Manx', 'el' => 'Greek, Modern', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian; Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'ig' => 'Igbo', 'is' => 'Icelandic', 'io' => 'Ido', 'ii' => 'Sichuan Yi', 'iu' => 'Inuktitut', 'ie' => 'Interlingue',
   402 		'ak' => 'Akan',
   452 		'ia' => 'Interlingua (International Auxiliary Language Association)', 'id' => 'Indonesian', 'ik' => 'Inupiaq', 'it' => 'Italian', 'jv' => 'Javanese', 'ja' => 'Japanese', 'kl' => 'Kalaallisut; Greenlandic', 'kn' => 'Kannada', 'ks' => 'Kashmiri', 'kr' => 'Kanuri', 'kk' => 'Kazakh', 'km' => 'Central Khmer', 'ki' => 'Kikuyu; Gikuyu', 'rw' => 'Kinyarwanda', 'ky' => 'Kirghiz; Kyrgyz',
   403 		'sq' => 'Albanian',
   453 		'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kuanyama; Kwanyama', 'ku' => 'Kurdish', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'li' => 'Limburgan; Limburger; Limburgish', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lb' => 'Luxembourgish; Letzeburgesch', 'lu' => 'Luba-Katanga', 'lg' => 'Ganda', 'mk' => 'Macedonian', 'mh' => 'Marshallese', 'ml' => 'Malayalam',
   404 		'am' => 'Amharic',
   454 		'mi' => 'Maori', 'mr' => 'Marathi', 'ms' => 'Malay', 'mg' => 'Malagasy', 'mt' => 'Maltese', 'mo' => 'Moldavian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo; Navaho', 'nr' => 'Ndebele, South; South Ndebele', 'nd' => 'Ndebele, North; North Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian', 'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',
   405 		'ar' => 'Arabic',
   455 		'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian',
   406 		'an' => 'Aragonese',
   456 		'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
   407 		'hy' => 'Armenian',
   457 		'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
   408 		'as' => 'Assamese',
   458 		've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
   409 		'av' => 'Avaric',
       
   410 		'ae' => 'Avestan',
       
   411 		'ay' => 'Aymara',
       
   412 		'az' => 'Azerbaijani',
       
   413 		'ba' => 'Bashkir',
       
   414 		'bm' => 'Bambara',
       
   415 		'eu' => 'Basque',
       
   416 		'be' => 'Belarusian',
       
   417 		'bn' => 'Bengali',
       
   418 		'bh' => 'Bihari',
       
   419 		'bi' => 'Bislama',
       
   420 		'bs' => 'Bosnian',
       
   421 		'br' => 'Breton',
       
   422 		'bg' => 'Bulgarian',
       
   423 		'my' => 'Burmese',
       
   424 		'ca' => 'Catalan; Valencian',
       
   425 		'ch' => 'Chamorro',
       
   426 		'ce' => 'Chechen',
       
   427 		'zh' => 'Chinese',
       
   428 		'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic',
       
   429 		'cv' => 'Chuvash',
       
   430 		'kw' => 'Cornish',
       
   431 		'co' => 'Corsican',
       
   432 		'cr' => 'Cree',
       
   433 		'cs' => 'Czech',
       
   434 		'da' => 'Danish',
       
   435 		'dv' => 'Divehi; Dhivehi; Maldivian',
       
   436 		'nl' => 'Dutch; Flemish',
       
   437 		'dz' => 'Dzongkha',
       
   438 		'en' => 'English',
       
   439 		'eo' => 'Esperanto',
       
   440 		'et' => 'Estonian',
       
   441 		'ee' => 'Ewe',
       
   442 		'fo' => 'Faroese',
       
   443 		'fj' => 'Fijjian',
       
   444 		'fi' => 'Finnish',
       
   445 		'fr' => 'French',
       
   446 		'fy' => 'Western Frisian',
       
   447 		'ff' => 'Fulah',
       
   448 		'ka' => 'Georgian',
       
   449 		'de' => 'German',
       
   450 		'gd' => 'Gaelic; Scottish Gaelic',
       
   451 		'ga' => 'Irish',
       
   452 		'gl' => 'Galician',
       
   453 		'gv' => 'Manx',
       
   454 		'el' => 'Greek, Modern',
       
   455 		'gn' => 'Guarani',
       
   456 		'gu' => 'Gujarati',
       
   457 		'ht' => 'Haitian; Haitian Creole',
       
   458 		'ha' => 'Hausa',
       
   459 		'he' => 'Hebrew',
       
   460 		'hz' => 'Herero',
       
   461 		'hi' => 'Hindi',
       
   462 		'ho' => 'Hiri Motu',
       
   463 		'hu' => 'Hungarian',
       
   464 		'ig' => 'Igbo',
       
   465 		'is' => 'Icelandic',
       
   466 		'io' => 'Ido',
       
   467 		'ii' => 'Sichuan Yi',
       
   468 		'iu' => 'Inuktitut',
       
   469 		'ie' => 'Interlingue',
       
   470 		'ia' => 'Interlingua (International Auxiliary Language Association)',
       
   471 		'id' => 'Indonesian',
       
   472 		'ik' => 'Inupiaq',
       
   473 		'it' => 'Italian',
       
   474 		'jv' => 'Javanese',
       
   475 		'ja' => 'Japanese',
       
   476 		'kl' => 'Kalaallisut; Greenlandic',
       
   477 		'kn' => 'Kannada',
       
   478 		'ks' => 'Kashmiri',
       
   479 		'kr' => 'Kanuri',
       
   480 		'kk' => 'Kazakh',
       
   481 		'km' => 'Central Khmer',
       
   482 		'ki' => 'Kikuyu; Gikuyu',
       
   483 		'rw' => 'Kinyarwanda',
       
   484 		'ky' => 'Kirghiz; Kyrgyz',
       
   485 		'kv' => 'Komi',
       
   486 		'kg' => 'Kongo',
       
   487 		'ko' => 'Korean',
       
   488 		'kj' => 'Kuanyama; Kwanyama',
       
   489 		'ku' => 'Kurdish',
       
   490 		'lo' => 'Lao',
       
   491 		'la' => 'Latin',
       
   492 		'lv' => 'Latvian',
       
   493 		'li' => 'Limburgan; Limburger; Limburgish',
       
   494 		'ln' => 'Lingala',
       
   495 		'lt' => 'Lithuanian',
       
   496 		'lb' => 'Luxembourgish; Letzeburgesch',
       
   497 		'lu' => 'Luba-Katanga',
       
   498 		'lg' => 'Ganda',
       
   499 		'mk' => 'Macedonian',
       
   500 		'mh' => 'Marshallese',
       
   501 		'ml' => 'Malayalam',
       
   502 		'mi' => 'Maori',
       
   503 		'mr' => 'Marathi',
       
   504 		'ms' => 'Malay',
       
   505 		'mg' => 'Malagasy',
       
   506 		'mt' => 'Maltese',
       
   507 		'mo' => 'Moldavian',
       
   508 		'mn' => 'Mongolian',
       
   509 		'na' => 'Nauru',
       
   510 		'nv' => 'Navajo; Navaho',
       
   511 		'nr' => 'Ndebele, South; South Ndebele',
       
   512 		'nd' => 'Ndebele, North; North Ndebele',
       
   513 		'ng' => 'Ndonga',
       
   514 		'ne' => 'Nepali',
       
   515 		'nn' => 'Norwegian Nynorsk; Nynorsk, Norwegian',
       
   516 		'nb' => 'Bokmål, Norwegian, Norwegian Bokmål',
       
   517 		'no' => 'Norwegian',
       
   518 		'ny' => 'Chichewa; Chewa; Nyanja',
       
   519 		'oc' => 'Occitan, Provençal',
       
   520 		'oj' => 'Ojibwa',
       
   521 		'or' => 'Oriya',
       
   522 		'om' => 'Oromo',
       
   523 		'os' => 'Ossetian; Ossetic',
       
   524 		'pa' => 'Panjabi; Punjabi',
       
   525 		'fa' => 'Persian',
       
   526 		'pi' => 'Pali',
       
   527 		'pl' => 'Polish',
       
   528 		'pt' => 'Portuguese',
       
   529 		'ps' => 'Pushto',
       
   530 		'qu' => 'Quechua',
       
   531 		'rm' => 'Romansh',
       
   532 		'ro' => 'Romanian',
       
   533 		'rn' => 'Rundi',
       
   534 		'ru' => 'Russian',
       
   535 		'sg' => 'Sango',
       
   536 		'sa' => 'Sanskrit',
       
   537 		'sr' => 'Serbian',
       
   538 		'hr' => 'Croatian',
       
   539 		'si' => 'Sinhala; Sinhalese',
       
   540 		'sk' => 'Slovak',
       
   541 		'sl' => 'Slovenian',
       
   542 		'se' => 'Northern Sami',
       
   543 		'sm' => 'Samoan',
       
   544 		'sn' => 'Shona',
       
   545 		'sd' => 'Sindhi',
       
   546 		'so' => 'Somali',
       
   547 		'st' => 'Sotho, Southern',
       
   548 		'es' => 'Spanish; Castilian',
       
   549 		'sc' => 'Sardinian',
       
   550 		'ss' => 'Swati',
       
   551 		'su' => 'Sundanese',
       
   552 		'sw' => 'Swahili',
       
   553 		'sv' => 'Swedish',
       
   554 		'ty' => 'Tahitian',
       
   555 		'ta' => 'Tamil',
       
   556 		'tt' => 'Tatar',
       
   557 		'te' => 'Telugu',
       
   558 		'tg' => 'Tajik',
       
   559 		'tl' => 'Tagalog',
       
   560 		'th' => 'Thai',
       
   561 		'bo' => 'Tibetan',
       
   562 		'ti' => 'Tigrinya',
       
   563 		'to' => 'Tonga (Tonga Islands)',
       
   564 		'tn' => 'Tswana',
       
   565 		'ts' => 'Tsonga',
       
   566 		'tk' => 'Turkmen',
       
   567 		'tr' => 'Turkish',
       
   568 		'tw' => 'Twi',
       
   569 		'ug' => 'Uighur; Uyghur',
       
   570 		'uk' => 'Ukrainian',
       
   571 		'ur' => 'Urdu',
       
   572 		'uz' => 'Uzbek',
       
   573 		've' => 'Venda',
       
   574 		'vi' => 'Vietnamese',
       
   575 		'vo' => 'Volapük',
       
   576 		'cy' => 'Welsh',
       
   577 		'wa' => 'Walloon',
       
   578 		'wo' => 'Wolof',
       
   579 		'xh' => 'Xhosa',
       
   580 		'yi' => 'Yiddish',
       
   581 		'yo' => 'Yoruba',
       
   582 		'za' => 'Zhuang; Chuang',
       
   583 		'zu' => 'Zulu',
       
   584 	);
   459 
   585 
   460 	/**
   586 	/**
   461 	 * Filters the language codes.
   587 	 * Filters the language codes.
   462 	 *
   588 	 *
   463 	 * @since MU (3.0.0)
   589 	 * @since MU (3.0.0)
   464 	 *
   590 	 *
   465 	 * @param array  $lang_codes Key/value pair of language codes where key is the short version.
   591 	 * @param string[] $lang_codes Array of key/value pairs of language codes where key is the short version.
   466 	 * @param string $code       A two-letter designation of the language.
   592 	 * @param string   $code       A two-letter designation of the language.
   467 	 */
   593 	 */
   468 	$lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
   594 	$lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
   469 	return strtr( $code, $lang_codes );
   595 	return strtr( $code, $lang_codes );
   470 }
   596 }
   471 
   597 
   472 /**
   598 /**
   473  * Synchronize category and post tag slugs when global terms are enabled.
   599  * Synchronizes category and post tag slugs when global terms are enabled.
   474  *
   600  *
   475  * @since 3.0.0
   601  * @since 3.0.0
   476  *
   602  *
   477  * @param object $term     The term.
   603  * @param WP_Term|array $term     The term.
   478  * @param string $taxonomy The taxonomy for `$term`. Should be 'category' or 'post_tag', as these are
   604  * @param string        $taxonomy The taxonomy for `$term`. Should be 'category' or 'post_tag', as these are
   479  *                         the only taxonomies which are processed by this function; anything else
   605  *                                the only taxonomies which are processed by this function; anything else
   480  *                         will be returned untouched.
   606  *                                will be returned untouched.
   481  * @return object|array Returns `$term`, after filtering the 'slug' field with sanitize_title()
   607  * @return WP_Term|array Returns `$term`, after filtering the 'slug' field with `sanitize_title()`
   482  *                      if $taxonomy is 'category' or 'post_tag'.
   608  *                       if `$taxonomy` is 'category' or 'post_tag'.
   483  */
   609  */
   484 function sync_category_tag_slugs( $term, $taxonomy ) {
   610 function sync_category_tag_slugs( $term, $taxonomy ) {
   485 	if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {
   611 	if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {
   486 		if ( is_object( $term ) ) {
   612 		if ( is_object( $term ) ) {
   487 			$term->slug = sanitize_title( $term->name );
   613 			$term->slug = sanitize_title( $term->name );
   498  *
   624  *
   499  * @since 3.2.0
   625  * @since 3.2.0
   500  * @access private
   626  * @access private
   501  */
   627  */
   502 function _access_denied_splash() {
   628 function _access_denied_splash() {
   503 	if ( ! is_user_logged_in() || is_network_admin() )
   629 	if ( ! is_user_logged_in() || is_network_admin() ) {
   504 		return;
   630 		return;
       
   631 	}
   505 
   632 
   506 	$blogs = get_blogs_of_user( get_current_user_id() );
   633 	$blogs = get_blogs_of_user( get_current_user_id() );
   507 
   634 
   508 	if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) )
   635 	if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
   509 		return;
   636 		return;
       
   637 	}
   510 
   638 
   511 	$blog_name = get_bloginfo( 'name' );
   639 	$blog_name = get_bloginfo( 'name' );
   512 
   640 
   513 	if ( empty( $blogs ) )
   641 	if ( empty( $blogs ) ) {
   514 		wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 );
   642 		wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 );
   515 
   643 	}
   516 	$output = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
   644 
       
   645 	$output  = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
   517 	$output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
   646 	$output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
   518 
   647 
   519 	$output .= '<h3>' . __('Your Sites') . '</h3>';
   648 	$output .= '<h3>' . __( 'Your Sites' ) . '</h3>';
   520 	$output .= '<table>';
   649 	$output .= '<table>';
   521 
   650 
   522 	foreach ( $blogs as $blog ) {
   651 	foreach ( $blogs as $blog ) {
   523 		$output .= '<tr>';
   652 		$output .= '<tr>';
   524 		$output .= "<td>{$blog->blogname}</td>";
   653 		$output .= "<td>{$blog->blogname}</td>";
   525 		$output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
   654 		$output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
   526 			'<a href="' . esc_url( get_home_url( $blog->userblog_id ) ). '">' . __( 'View Site' ) . '</a></td>';
   655 			'<a href="' . esc_url( get_home_url( $blog->userblog_id ) ) . '">' . __( 'View Site' ) . '</a></td>';
   527 		$output .= '</tr>';
   656 		$output .= '</tr>';
   528 	}
   657 	}
   529 
   658 
   530 	$output .= '</table>';
   659 	$output .= '</table>';
   531 
   660 
   552 /**
   681 /**
   553  * Generates and displays a drop-down of available languages.
   682  * Generates and displays a drop-down of available languages.
   554  *
   683  *
   555  * @since 3.0.0
   684  * @since 3.0.0
   556  *
   685  *
   557  * @param array  $lang_files Optional. An array of the language files. Default empty array.
   686  * @param string[] $lang_files Optional. An array of the language files. Default empty array.
   558  * @param string $current    Optional. The current language code. Default empty.
   687  * @param string   $current    Optional. The current language code. Default empty.
   559  */
   688  */
   560 function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
   689 function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
   561 	$flag = false;
   690 	$flag   = false;
   562 	$output = array();
   691 	$output = array();
   563 
   692 
   564 	foreach ( (array) $lang_files as $val ) {
   693 	foreach ( (array) $lang_files as $val ) {
   565 		$code_lang = basename( $val, '.mo' );
   694 		$code_lang = basename( $val, '.mo' );
   566 
   695 
   567 		if ( $code_lang == 'en_US' ) { // American English
   696 		if ( $code_lang == 'en_US' ) { // American English
   568 			$flag = true;
   697 			$flag          = true;
   569 			$ae = __( 'American English' );
   698 			$ae            = __( 'American English' );
   570 			$output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
   699 			$output[ $ae ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
   571 		} elseif ( $code_lang == 'en_GB' ) { // British English
   700 		} elseif ( $code_lang == 'en_GB' ) { // British English
   572 			$flag = true;
   701 			$flag          = true;
   573 			$be = __( 'British English' );
   702 			$be            = __( 'British English' );
   574 			$output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
   703 			$output[ $be ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
   575 		} else {
   704 		} else {
   576 			$translated = format_code_lang( $code_lang );
   705 			$translated            = format_code_lang( $code_lang );
   577 			$output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';
   706 			$output[ $translated ] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html( $translated ) . '</option>';
   578 		}
   707 		}
   579 
   708 	}
   580 	}
   709 
   581 
   710 	if ( $flag === false ) { // WordPress english
   582 	if ( $flag === false ) // WordPress english
   711 		$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . '</option>';
   583 		$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . "</option>";
   712 	}
   584 
   713 
   585 	// Order by name
   714 	// Order by name
   586 	uksort( $output, 'strnatcasecmp' );
   715 	uksort( $output, 'strnatcasecmp' );
   587 
   716 
   588 	/**
   717 	/**
   589 	 * Filters the languages available in the dropdown.
   718 	 * Filters the languages available in the dropdown.
   590 	 *
   719 	 *
   591 	 * @since MU (3.0.0)
   720 	 * @since MU (3.0.0)
   592 	 *
   721 	 *
   593 	 * @param array $output     HTML output of the dropdown.
   722 	 * @param string[] $output     Array of HTML output for the dropdown.
   594 	 * @param array $lang_files Available language files.
   723 	 * @param string[] $lang_files Array of available language files.
   595 	 * @param string $current   The current language code.
   724 	 * @param string   $current    The current language code.
   596 	 */
   725 	 */
   597 	$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
   726 	$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
   598 
   727 
   599 	echo implode( "\n\t", $output );
   728 	echo implode( "\n\t", $output );
   600 }
   729 }
   619 	if ( 'upgrade.php' == $pagenow ) {
   748 	if ( 'upgrade.php' == $pagenow ) {
   620 		return;
   749 		return;
   621 	}
   750 	}
   622 
   751 
   623 	if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
   752 	if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
   624 		echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "</div>";
   753 		echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . '</div>';
   625 	}
   754 	}
   626 }
   755 }
   627 
   756 
   628 /**
   757 /**
   629  * Avoids a collision between a site slug and a permalink slug.
   758  * Avoids a collision between a site slug and a permalink slug.
   636  * @param array $data    An array of post data.
   765  * @param array $data    An array of post data.
   637  * @param array $postarr An array of posts. Not currently used.
   766  * @param array $postarr An array of posts. Not currently used.
   638  * @return array The new array of post data after checking for collisions.
   767  * @return array The new array of post data after checking for collisions.
   639  */
   768  */
   640 function avoid_blog_page_permalink_collision( $data, $postarr ) {
   769 function avoid_blog_page_permalink_collision( $data, $postarr ) {
   641 	if ( is_subdomain_install() )
   770 	if ( is_subdomain_install() ) {
   642 		return $data;
   771 		return $data;
   643 	if ( $data['post_type'] != 'page' )
   772 	}
       
   773 	if ( $data['post_type'] != 'page' ) {
   644 		return $data;
   774 		return $data;
   645 	if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )
   775 	}
       
   776 	if ( ! isset( $data['post_name'] ) || $data['post_name'] == '' ) {
   646 		return $data;
   777 		return $data;
   647 	if ( !is_main_site() )
   778 	}
       
   779 	if ( ! is_main_site() ) {
   648 		return $data;
   780 		return $data;
       
   781 	}
   649 
   782 
   650 	$post_name = $data['post_name'];
   783 	$post_name = $data['post_name'];
   651 	$c = 0;
   784 	$c         = 0;
   652 	while( $c < 10 && get_id_from_blogname( $post_name ) ) {
   785 	while ( $c < 10 && get_id_from_blogname( $post_name ) ) {
   653 		$post_name .= mt_rand( 1, 10 );
   786 		$post_name .= mt_rand( 1, 10 );
   654 		$c ++;
   787 		$c ++;
   655 	}
   788 	}
   656 	if ( $post_name != $data['post_name'] ) {
   789 	if ( $post_name != $data['post_name'] ) {
   657 		$data['post_name'] = $post_name;
   790 		$data['post_name'] = $post_name;
   667  *
   800  *
   668  * @since 3.0.0
   801  * @since 3.0.0
   669  */
   802  */
   670 function choose_primary_blog() {
   803 function choose_primary_blog() {
   671 	?>
   804 	?>
   672 	<table class="form-table">
   805 	<table class="form-table" role="presentation">
   673 	<tr>
   806 	<tr>
   674 	<?php /* translators: My sites label */ ?>
   807 	<?php /* translators: My sites label */ ?>
   675 		<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
   808 		<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
   676 		<td>
   809 		<td>
   677 		<?php
   810 		<?php
   678 		$all_blogs = get_blogs_of_user( get_current_user_id() );
   811 		$all_blogs    = get_blogs_of_user( get_current_user_id() );
   679 		$primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
   812 		$primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
   680 		if ( count( $all_blogs ) > 1 ) {
   813 		if ( count( $all_blogs ) > 1 ) {
   681 			$found = false;
   814 			$found = false;
   682 			?>
   815 			?>
   683 			<select name="primary_blog" id="primary_blog">
   816 			<select name="primary_blog" id="primary_blog">
   684 				<?php foreach ( (array) $all_blogs as $blog ) {
   817 				<?php
   685 					if ( $primary_blog == $blog->userblog_id )
   818 				foreach ( (array) $all_blogs as $blog ) {
       
   819 					if ( $primary_blog == $blog->userblog_id ) {
   686 						$found = true;
   820 						$found = true;
   687 					?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
   821 					}
   688 				} ?>
   822 					?>
       
   823 					<option value="<?php echo $blog->userblog_id; ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ); ?></option>
       
   824 					<?php
       
   825 				}
       
   826 				?>
   689 			</select>
   827 			</select>
   690 			<?php
   828 			<?php
   691 			if ( !$found ) {
   829 			if ( ! $found ) {
   692 				$blog = reset( $all_blogs );
   830 				$blog = reset( $all_blogs );
   693 				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
   831 				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
   694 			}
   832 			}
   695 		} elseif ( count( $all_blogs ) == 1 ) {
   833 		} elseif ( count( $all_blogs ) == 1 ) {
   696 			$blog = reset( $all_blogs );
   834 			$blog = reset( $all_blogs );
   697 			echo esc_url( get_home_url( $blog->userblog_id ) );
   835 			echo esc_url( get_home_url( $blog->userblog_id ) );
   698 			if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
   836 			if ( $primary_blog != $blog->userblog_id ) { // Set the primary blog again if it's out of sync with blog list.
   699 				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
   837 				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
       
   838 			}
   700 		} else {
   839 		} else {
   701 			echo "N/A";
   840 			echo 'N/A';
   702 		}
   841 		}
   703 		?>
   842 		?>
   704 		</td>
   843 		</td>
   705 	</tr>
   844 	</tr>
   706 	</table>
   845 	</table>
   717  *
   856  *
   718  * @param int $network_id The network ID to check.
   857  * @param int $network_id The network ID to check.
   719  * @return bool True if network can be edited, otherwise false.
   858  * @return bool True if network can be edited, otherwise false.
   720  */
   859  */
   721 function can_edit_network( $network_id ) {
   860 function can_edit_network( $network_id ) {
   722 	if ( $network_id == get_current_network_id() )
   861 	if ( $network_id == get_current_network_id() ) {
   723 		$result = true;
   862 		$result = true;
   724 	else
   863 	} else {
   725 		$result = false;
   864 		$result = false;
       
   865 	}
   726 
   866 
   727 	/**
   867 	/**
   728 	 * Filters whether this network can be edited from this page.
   868 	 * Filters whether this network can be edited from this page.
   729 	 *
   869 	 *
   730 	 * @since 3.1.0
   870 	 * @since 3.1.0
   741  * @since 3.1.0
   881  * @since 3.1.0
   742  *
   882  *
   743  * @access private
   883  * @access private
   744  */
   884  */
   745 function _thickbox_path_admin_subfolder() {
   885 function _thickbox_path_admin_subfolder() {
   746 ?>
   886 	?>
   747 <script type="text/javascript">
   887 <script type="text/javascript">
   748 var tb_pathToImage = "<?php echo includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ); ?>";
   888 var tb_pathToImage = "<?php echo includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ); ?>";
   749 </script>
   889 </script>
   750 <?php
   890 	<?php
   751 }
   891 }
   752 
   892 
   753 /**
   893 /**
   754  *
       
   755  * @param array $users
   894  * @param array $users
   756  */
   895  */
   757 function confirm_delete_users( $users ) {
   896 function confirm_delete_users( $users ) {
   758 	$current_user = wp_get_current_user();
   897 	$current_user = wp_get_current_user();
   759 	if ( ! is_array( $users ) || empty( $users ) ) {
   898 	if ( ! is_array( $users ) || empty( $users ) ) {
   771 	<form action="users.php?action=dodelete" method="post">
   910 	<form action="users.php?action=dodelete" method="post">
   772 	<input type="hidden" name="dodelete" />
   911 	<input type="hidden" name="dodelete" />
   773 	<?php
   912 	<?php
   774 	wp_nonce_field( 'ms-users-delete' );
   913 	wp_nonce_field( 'ms-users-delete' );
   775 	$site_admins = get_super_admins();
   914 	$site_admins = get_super_admins();
   776 	$admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>'; ?>
   915 	$admin_out   = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>';
   777 	<table class="form-table">
   916 	?>
   778 	<?php foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
   917 	<table class="form-table" role="presentation">
       
   918 	<?php
       
   919 	foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
   779 		if ( $user_id != '' && $user_id != '0' ) {
   920 		if ( $user_id != '' && $user_id != '0' ) {
   780 			$delete_user = get_userdata( $user_id );
   921 			$delete_user = get_userdata( $user_id );
   781 
   922 
   782 			if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
   923 			if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
   783 				wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) );
   924 				wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) );
   789 			?>
   930 			?>
   790 			<tr>
   931 			<tr>
   791 				<th scope="row"><?php echo $delete_user->user_login; ?>
   932 				<th scope="row"><?php echo $delete_user->user_login; ?>
   792 					<?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?>
   933 					<?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?>
   793 				</th>
   934 				</th>
   794 			<?php $blogs = get_blogs_of_user( $user_id, true );
   935 			<?php
       
   936 			$blogs = get_blogs_of_user( $user_id, true );
   795 
   937 
   796 			if ( ! empty( $blogs ) ) {
   938 			if ( ! empty( $blogs ) ) {
   797 				?>
   939 				?>
   798 				<td><fieldset><p><legend><?php printf(
   940 				<td><fieldset><p><legend>
       
   941 				<?php
       
   942 				printf(
   799 					/* translators: user login */
   943 					/* translators: user login */
   800 					__( 'What should be done with content owned by %s?' ),
   944 					__( 'What should be done with content owned by %s?' ),
   801 					'<em>' . $delete_user->user_login . '</em>'
   945 					'<em>' . $delete_user->user_login . '</em>'
   802 				); ?></legend></p>
   946 				);
       
   947 				?>
       
   948 				</legend></p>
   803 				<?php
   949 				<?php
   804 				foreach ( (array) $blogs as $key => $details ) {
   950 				foreach ( (array) $blogs as $key => $details ) {
   805 					$blog_users = get_users( array( 'blog_id' => $details->userblog_id, 'fields' => array( 'ID', 'user_login' ) ) );
   951 					$blog_users = get_users(
   806 					if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
   952 						array(
   807 						$user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
   953 							'blog_id' => $details->userblog_id,
   808 						$user_dropdown = '<label for="reassign_user" class="screen-reader-text">' . __( 'Select a user' ) . '</label>';
   954 							'fields'  => array( 'ID', 'user_login' ),
       
   955 						)
       
   956 					);
       
   957 					if ( is_array( $blog_users ) && ! empty( $blog_users ) ) {
       
   958 						$user_site      = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
       
   959 						$user_dropdown  = '<label for="reassign_user" class="screen-reader-text">' . __( 'Select a user' ) . '</label>';
   809 						$user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
   960 						$user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
   810 						$user_list = '';
   961 						$user_list      = '';
   811 						foreach ( $blog_users as $user ) {
   962 						foreach ( $blog_users as $user ) {
   812 							if ( ! in_array( $user->ID, $allusers ) ) {
   963 							if ( ! in_array( $user->ID, $allusers ) ) {
   813 								$user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
   964 								$user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
   814 							}
   965 							}
   815 						}
   966 						}
   819 						$user_dropdown .= $user_list;
   970 						$user_dropdown .= $user_list;
   820 						$user_dropdown .= "</select>\n";
   971 						$user_dropdown .= "</select>\n";
   821 						?>
   972 						?>
   822 						<ul style="list-style:none;">
   973 						<ul style="list-style:none;">
   823 							<li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
   974 							<li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
   824 							<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
   975 							<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="delete" checked="checked" />
   825 							<?php _e( 'Delete all content.' ); ?></label></li>
   976 							<?php _e( 'Delete all content.' ); ?></label></li>
   826 							<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
   977 							<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID; ?>]" value="reassign" />
   827 							<?php _e( 'Attribute all content to:' ); ?></label>
   978 							<?php _e( 'Attribute all content to:' ); ?></label>
   828 							<?php echo $user_dropdown; ?></li>
   979 							<?php echo $user_dropdown; ?></li>
   829 						</ul>
   980 						</ul>
   830 						<?php
   981 						<?php
   831 					}
   982 					}
   832 				}
   983 				}
   833 				echo "</fieldset></td></tr>";
   984 				echo '</fieldset></td></tr>';
   834 			} else {
   985 			} else {
   835 				?>
   986 				?>
   836 				<td><fieldset><p><legend><?php _e( 'User has no sites or content and will be deleted.' ); ?></legend></p>
   987 				<td><p><?php _e( 'User has no sites or content and will be deleted.' ); ?></p></td>
   837 			<?php } ?>
   988 			<?php } ?>
   838 			</tr>
   989 			</tr>
   839 		<?php
   990 			<?php
   840 		}
   991 		}
   841 	}
   992 	}
   842 
   993 
   843 	?>
   994 	?>
   844 	</table>
   995 	</table>
   845 	<?php
   996 	<?php
   846 	/** This action is documented in wp-admin/users.php */
   997 	/** This action is documented in wp-admin/users.php */
   847 	do_action( 'delete_user_form', $current_user, $allusers );
   998 	do_action( 'delete_user_form', $current_user, $allusers );
   848 
   999 
   849 	if ( 1 == count( $users ) ) : ?>
  1000 	if ( 1 == count( $users ) ) :
       
  1001 		?>
   850 		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.' ); ?></p>
  1002 		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.' ); ?></p>
   851 	<?php else : ?>
  1003 	<?php else : ?>
   852 		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
  1004 		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
   853 	<?php endif;
  1005 		<?php
   854 
  1006 	endif;
   855 	submit_button( __('Confirm Deletion'), 'primary' );
  1007 
       
  1008 	submit_button( __( 'Confirm Deletion' ), 'primary' );
   856 	?>
  1009 	?>
   857 	</form>
  1010 	</form>
   858 	<?php
  1011 	<?php
   859 	return true;
  1012 	return true;
   860 }
  1013 }
   863  * Print JavaScript in the header on the Network Settings screen.
  1016  * Print JavaScript in the header on the Network Settings screen.
   864  *
  1017  *
   865  * @since 4.1.0
  1018  * @since 4.1.0
   866  */
  1019  */
   867 function network_settings_add_js() {
  1020 function network_settings_add_js() {
   868 ?>
  1021 	?>
   869 <script type="text/javascript">
  1022 <script type="text/javascript">
   870 jQuery(document).ready( function($) {
  1023 jQuery(document).ready( function($) {
   871 	var languageSelect = $( '#WPLANG' );
  1024 	var languageSelect = $( '#WPLANG' );
   872 	$( 'form' ).submit( function() {
  1025 	$( 'form' ).submit( function() {
   873 		// Don't show a spinner for English and installed languages,
  1026 		// Don't show a spinner for English and installed languages,
   876 			$( '#submit', this ).after( '<span class="spinner language-install-spinner is-active" />' );
  1029 			$( '#submit', this ).after( '<span class="spinner language-install-spinner is-active" />' );
   877 		}
  1030 		}
   878 	});
  1031 	});
   879 });
  1032 });
   880 </script>
  1033 </script>
   881 <?php
  1034 	<?php
   882 }
  1035 }
   883 
  1036 
   884 /**
  1037 /**
   885  * Outputs the HTML for a network's "Edit Site" tabular interface.
  1038  * Outputs the HTML for a network's "Edit Site" tabular interface.
   886  *
  1039  *
   913 	 *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
  1066 	 *         $type string $url   URL, relative to `network_admin_url()` to use for the link.
   914 	 *         $type string $cap   Capability required to see the link.
  1067 	 *         $type string $cap   Capability required to see the link.
   915 	 *     }
  1068 	 *     }
   916 	 * }
  1069 	 * }
   917 	 */
  1070 	 */
   918 	$links = apply_filters( 'network_edit_site_nav_links', array(
  1071 	$links = apply_filters(
   919 		'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php',     'cap' => 'manage_sites' ),
  1072 		'network_edit_site_nav_links',
   920 		'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php',    'cap' => 'manage_sites' ),
  1073 		array(
   921 		'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php',   'cap' => 'manage_sites' ),
  1074 			'site-info'     => array(
   922 		'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php', 'cap' => 'manage_sites' )
  1075 				'label' => __( 'Info' ),
   923 	) );
  1076 				'url'   => 'site-info.php',
       
  1077 				'cap'   => 'manage_sites',
       
  1078 			),
       
  1079 			'site-users'    => array(
       
  1080 				'label' => __( 'Users' ),
       
  1081 				'url'   => 'site-users.php',
       
  1082 				'cap'   => 'manage_sites',
       
  1083 			),
       
  1084 			'site-themes'   => array(
       
  1085 				'label' => __( 'Themes' ),
       
  1086 				'url'   => 'site-themes.php',
       
  1087 				'cap'   => 'manage_sites',
       
  1088 			),
       
  1089 			'site-settings' => array(
       
  1090 				'label' => __( 'Settings' ),
       
  1091 				'url'   => 'site-settings.php',
       
  1092 				'cap'   => 'manage_sites',
       
  1093 			),
       
  1094 		)
       
  1095 	);
   924 
  1096 
   925 	// Parse arguments
  1097 	// Parse arguments
   926 	$r = wp_parse_args( $args, array(
  1098 	$r = wp_parse_args(
   927 		'blog_id'  => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0,
  1099 		$args,
   928 		'links'    => $links,
  1100 		array(
   929 		'selected' => 'site-info',
  1101 			'blog_id'  => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0,
   930 	) );
  1102 			'links'    => $links,
       
  1103 			'selected' => 'site-info',
       
  1104 		)
       
  1105 	);
   931 
  1106 
   932 	// Setup the links array
  1107 	// Setup the links array
   933 	$screen_links = array();
  1108 	$screen_links = array();
   934 
  1109 
   935 	// Loop through tabs
  1110 	// Loop through tabs
   941 		}
  1116 		}
   942 
  1117 
   943 		// Link classes
  1118 		// Link classes
   944 		$classes = array( 'nav-tab' );
  1119 		$classes = array( 'nav-tab' );
   945 
  1120 
       
  1121 		// Aria-current attribute.
       
  1122 		$aria_current = '';
       
  1123 
   946 		// Selected is set by the parent OR assumed by the $pagenow global
  1124 		// Selected is set by the parent OR assumed by the $pagenow global
   947 		if ( $r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {
  1125 		if ( $r['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {
   948 			$classes[] = 'nav-tab-active';
  1126 			$classes[]    = 'nav-tab-active';
       
  1127 			$aria_current = ' aria-current="page"';
   949 		}
  1128 		}
   950 
  1129 
   951 		// Escape each class
  1130 		// Escape each class
   952 		$esc_classes = implode( ' ', $classes );
  1131 		$esc_classes = implode( ' ', $classes );
   953 
  1132 
   954 		// Get the URL for this link
  1133 		// Get the URL for this link
   955 		$url = add_query_arg( array( 'id' => $r['blog_id'] ), network_admin_url( $link['url'] ) );
  1134 		$url = add_query_arg( array( 'id' => $r['blog_id'] ), network_admin_url( $link['url'] ) );
   956 
  1135 
   957 		// Add link to nav links
  1136 		// Add link to nav links
   958 		$screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '">' . esc_html( $link['label'] ) . '</a>';
  1137 		$screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html( $link['label'] ) . '</a>';
   959 	}
  1138 	}
   960 
  1139 
   961 	// All done!
  1140 	// All done!
   962 	echo '<h2 class="nav-tab-wrapper wp-clearfix">';
  1141 	echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__( 'Secondary menu' ) . '">';
   963 	echo implode( '', $screen_links );
  1142 	echo implode( '', $screen_links );
   964 	echo '</h2>';
  1143 	echo '</nav>';
   965 }
  1144 }
   966 
  1145 
   967 /**
  1146 /**
   968  * Returns the arguments for the help tab on the Edit Site screens.
  1147  * Returns the arguments for the help tab on the Edit Site screens.
   969  *
  1148  *
   972  * @return array Help tab arguments.
  1151  * @return array Help tab arguments.
   973  */
  1152  */
   974 function get_site_screen_help_tab_args() {
  1153 function get_site_screen_help_tab_args() {
   975 	return array(
  1154 	return array(
   976 		'id'      => 'overview',
  1155 		'id'      => 'overview',
   977 		'title'   => __('Overview'),
  1156 		'title'   => __( 'Overview' ),
   978 		'content' =>
  1157 		'content' =>
   979 			'<p>' . __('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.') . '</p>' .
  1158 			'<p>' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '</p>' .
   980 			'<p>' . __('<strong>Info</strong> &mdash; The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.') . '</p>' .
  1159 			'<p>' . __( '<strong>Info</strong> &mdash; The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '</p>' .
   981 			'<p>' . __('<strong>Users</strong> &mdash; This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.') . '</p>' .
  1160 			'<p>' . __( '<strong>Users</strong> &mdash; This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.' ) . '</p>' .
   982 			'<p>' . sprintf( __('<strong>Themes</strong> &mdash; This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
  1161 			'<p>' . sprintf( __( '<strong>Themes</strong> &mdash; This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site&#8217;s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' .
   983 			'<p>' . __('<strong>Settings</strong> &mdash; This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.') . '</p>'
  1162 			'<p>' . __( '<strong>Settings</strong> &mdash; This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.' ) . '</p>',
   984 	);
  1163 	);
   985 }
  1164 }
   986 
  1165 
   987 /**
  1166 /**
   988  * Returns the content for the help sidebar on the Edit Site screens.
  1167  * Returns the content for the help sidebar on the Edit Site screens.
   990  * @since 4.9.0
  1169  * @since 4.9.0
   991  *
  1170  *
   992  * @return string Help sidebar content.
  1171  * @return string Help sidebar content.
   993  */
  1172  */
   994 function get_site_screen_help_sidebar_content() {
  1173 function get_site_screen_help_sidebar_content() {
   995 	return '<p><strong>' . __('For more information:') . '</strong></p>' .
  1174 	return '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   996 		'<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>') . '</p>' .
  1175 		'<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>' ) . '</p>' .
   997 		'<p>' . __('<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>') . '</p>';
  1176 		'<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>';
   998 }
  1177 }