wp/wp-admin/update-core.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    17 if ( is_multisite() && ! is_network_admin() ) {
    17 if ( is_multisite() && ! is_network_admin() ) {
    18 	wp_redirect( network_admin_url( 'update-core.php' ) );
    18 	wp_redirect( network_admin_url( 'update-core.php' ) );
    19 	exit();
    19 	exit();
    20 }
    20 }
    21 
    21 
    22 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_languages' ) )
    22 if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_languages' ) ) {
    23 	wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
    23 	wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
       
    24 }
    24 
    25 
    25 /**
    26 /**
    26  *
       
    27  * @global string $wp_local_package
    27  * @global string $wp_local_package
    28  * @global wpdb   $wpdb
    28  * @global wpdb   $wpdb
    29  *
    29  *
    30  * @staticvar bool $first_pass
    30  * @staticvar bool $first_pass
    31  *
    31  *
    32  * @param object $update
    32  * @param object $update
    33  */
    33  */
    34 function list_core_update( $update ) {
    34 function list_core_update( $update ) {
    35  	global $wp_local_package, $wpdb;
    35 	global $wp_local_package, $wpdb;
    36   	static $first_pass = true;
    36 	static $first_pass = true;
    37 
    37 
    38 	$wp_version = get_bloginfo( 'version' );
    38 	$wp_version = get_bloginfo( 'version' );
    39 
    39 
    40  	if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
    40 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) {
    41  		$version_string = $update->current;
    41 		$version_string = $update->current;
    42  	// If the only available update is a partial builds, it doesn't need a language-specific version string.
    42 	} elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) {
    43  	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) )
    43 		// If the only available update is a partial builds, it doesn't need a language-specific version string.
    44  		$version_string = $update->current;
    44 		$version_string = $update->current;
    45  	else
    45 	} else {
    46  		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $update->current, $update->locale );
    46 		$version_string = sprintf( '%s&ndash;<strong>%s</strong>', $update->current, $update->locale );
       
    47 	}
    47 
    48 
    48 	$current = false;
    49 	$current = false;
    49 	if ( !isset($update->response) || 'latest' == $update->response )
    50 	if ( ! isset( $update->response ) || 'latest' == $update->response ) {
    50 		$current = true;
    51 		$current = true;
    51 	$submit = __('Update Now');
    52 	}
    52 	$form_action = 'update-core.php?action=do-core-upgrade';
    53 	$submit        = __( 'Update Now' );
    53 	$php_version    = phpversion();
    54 	$form_action   = 'update-core.php?action=do-core-upgrade';
    54 	$mysql_version  = $wpdb->db_version();
    55 	$php_version   = phpversion();
    55 	$show_buttons = true;
    56 	$mysql_version = $wpdb->db_version();
       
    57 	$show_buttons  = true;
    56 	if ( 'development' == $update->response ) {
    58 	if ( 'development' == $update->response ) {
    57 		$message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically:');
    59 		$message = __( 'You are using a development version of WordPress. You can update to the latest nightly build automatically:' );
    58 	} else {
    60 	} else {
    59 		if ( $current ) {
    61 		if ( $current ) {
    60 			$message = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string );
    62 			$message     = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string );
    61 			$submit = __('Re-install Now');
    63 			$submit      = __( 'Re-install Now' );
    62 			$form_action = 'update-core.php?action=do-core-reinstall';
    64 			$form_action = 'update-core.php?action=do-core-reinstall';
    63 		} else {
    65 		} else {
    64 			$php_compat     = version_compare( $php_version, $update->php_version, '>=' );
    66 			$php_compat = version_compare( $php_version, $update->php_version, '>=' );
    65 			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
    67 			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
    66 				$mysql_compat = true;
    68 				$mysql_compat = true;
    67 			else
    69 			} else {
    68 				$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
    70 				$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
    69 
    71 			}
    70 			if ( !$mysql_compat && !$php_compat )
    72 
    71 				/* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Minimum required MySQL version number, 4: Current PHP version number, 5: Current MySQL version number */
    73 			$version_url = sprintf(
    72 				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
    74 				/* translators: %s: WordPress version */
    73 			elseif ( !$php_compat )
    75 				esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
    74 				/* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Current PHP version number */
    76 				sanitize_title( $update->current )
    75 				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
    77 			);
    76 			elseif ( !$mysql_compat )
    78 
    77 				/* translators: 1: WordPress version number, 2: Minimum required MySQL version number, 3: Current MySQL version number */
    79 			/* translators: %s: Update PHP page URL */
    78 				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
    80 			$php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) );
    79 			else
    81 
    80 				/* translators: 1: WordPress version number, 2: WordPress version number including locale if necessary */
    82 			$annotation = wp_get_update_php_annotation();
    81 				$message = 	sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically:'), $update->current, $version_string);
    83 			if ( $annotation ) {
    82 			if ( !$mysql_compat || !$php_compat )
    84 				$php_update_message .= '</p><p><em>' . $annotation . '</em>';
       
    85 			}
       
    86 
       
    87 			if ( ! $mysql_compat && ! $php_compat ) {
       
    88 				/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number */
       
    89 				$message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), $version_url, $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ) . $php_update_message;
       
    90 			} elseif ( ! $php_compat ) {
       
    91 				/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number */
       
    92 				$message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), $version_url, $update->current, $update->php_version, $php_version ) . $php_update_message;
       
    93 			} elseif ( ! $mysql_compat ) {
       
    94 				/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number */
       
    95 				$message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), $version_url, $update->current, $update->mysql_version, $mysql_version );
       
    96 			} else {
       
    97 				/* translators: 1: URL to WordPress release notes, 2: WordPress version number including locale if necessary */
       
    98 				$message = sprintf( __( 'You can update to <a href="%1$s">WordPress %2$s</a> automatically:' ), $version_url, $version_string );
       
    99 			}
       
   100 			if ( ! $mysql_compat || ! $php_compat ) {
    83 				$show_buttons = false;
   101 				$show_buttons = false;
       
   102 			}
    84 		}
   103 		}
    85 	}
   104 	}
    86 
   105 
    87 	echo '<p>';
   106 	echo '<p>';
    88 	echo $message;
   107 	echo $message;
    89 	echo '</p>';
   108 	echo '</p>';
    90 	echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
   109 	echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
    91 	wp_nonce_field('upgrade-core');
   110 	wp_nonce_field( 'upgrade-core' );
    92 	echo '<p>';
   111 	echo '<p>';
    93 	echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
   112 	echo '<input name="version" value="' . esc_attr( $update->current ) . '" type="hidden"/>';
    94 	echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
   113 	echo '<input name="locale" value="' . esc_attr( $update->locale ) . '" type="hidden"/>';
    95 	if ( $show_buttons ) {
   114 	if ( $show_buttons ) {
    96 		if ( $first_pass ) {
   115 		if ( $first_pass ) {
    97 			submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false );
   116 			submit_button( $submit, $current ? '' : 'primary regular', 'upgrade', false );
    98 			$first_pass = false;
   117 			$first_pass = false;
    99 		} else {
   118 		} else {
   100 			submit_button( $submit, '', 'upgrade', false );
   119 			submit_button( $submit, '', 'upgrade', false );
   101 		}
   120 		}
   102 	}
   121 	}
   103 	if ( 'en_US' != $update->locale )
   122 	if ( 'en_US' != $update->locale ) {
   104 		if ( !isset( $update->dismissed ) || !$update->dismissed )
   123 		if ( ! isset( $update->dismissed ) || ! $update->dismissed ) {
   105 			submit_button( __( 'Hide this update' ), '', 'dismiss', false );
   124 			submit_button( __( 'Hide this update' ), '', 'dismiss', false );
   106 		else
   125 		} else {
   107 			submit_button( __( 'Bring back this update' ), '', 'undismiss', false );
   126 			submit_button( __( 'Bring back this update' ), '', 'undismiss', false );
       
   127 		}
       
   128 	}
   108 	echo '</p>';
   129 	echo '</p>';
   109 	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
   130 	if ( 'en_US' != $update->locale && ( ! isset( $wp_local_package ) || $wp_local_package != $update->locale ) ) {
   110 	    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
   131 		echo '<p class="hint">' . __( 'This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.' ) . '</p>';
   111 	// Partial builds don't need language-specific warnings.
   132 	} elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
   112 	elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
   133 		// Partial builds don't need language-specific warnings.
   113 	    echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
   134 		echo '<p class="hint">' . sprintf( __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ), $update->response != 'development' ? $update->current : '' ) . '</p>';
   114 	}
   135 	}
   115 	echo '</form>';
   136 	echo '</form>';
   116 
   137 
   117 }
   138 }
   118 
   139 
   119 /**
   140 /**
   120  * @since 2.7.0
   141  * @since 2.7.0
   121  */
   142  */
   122 function dismissed_updates() {
   143 function dismissed_updates() {
   123 	$dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
   144 	$dismissed = get_core_updates(
       
   145 		array(
       
   146 			'dismissed' => true,
       
   147 			'available' => false,
       
   148 		)
       
   149 	);
   124 	if ( $dismissed ) {
   150 	if ( $dismissed ) {
   125 
   151 
   126 		$show_text = esc_js(__('Show hidden updates'));
   152 		$show_text = esc_js( __( 'Show hidden updates' ) );
   127 		$hide_text = esc_js(__('Hide hidden updates'));
   153 		$hide_text = esc_js( __( 'Hide hidden updates' ) );
   128 	?>
   154 		?>
   129 	<script type="text/javascript">
   155 	<script type="text/javascript">
   130 
   156 		jQuery(function( $ ) {
   131 		jQuery(function($) {
   157 			$( 'dismissed-updates' ).show();
   132 			$('dismissed-updates').show();
   158 			$( '#show-dismissed' ).toggle( function() { $( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' ); }, function() { $( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' ); } );
   133 			$('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});
   159 			$( '#show-dismissed' ).click( function() { $( '#dismissed-updates' ).toggle( 'fast' ); } );
   134 			$('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
       
   135 		});
   160 		});
   136 	</script>
   161 	</script>
   137 	<?php
   162 		<?php
   138 		echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
   163 		echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>';
   139 		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
   164 		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
   140 		foreach ( (array) $dismissed as $update) {
   165 		foreach ( (array) $dismissed as $update ) {
   141 			echo '<li>';
   166 			echo '<li>';
   142 			list_core_update( $update );
   167 			list_core_update( $update );
   143 			echo '</li>';
   168 			echo '</li>';
   144 		}
   169 		}
   145 		echo '</ul>';
   170 		echo '</ul>';
   156  */
   181  */
   157 function core_upgrade_preamble() {
   182 function core_upgrade_preamble() {
   158 	global $required_php_version, $required_mysql_version;
   183 	global $required_php_version, $required_mysql_version;
   159 
   184 
   160 	$wp_version = get_bloginfo( 'version' );
   185 	$wp_version = get_bloginfo( 'version' );
   161 	$updates = get_core_updates();
   186 	$updates    = get_core_updates();
   162 
   187 
   163 	if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
   188 	if ( ! isset( $updates[0]->response ) || 'latest' == $updates[0]->response ) {
   164 		echo '<h2>';
   189 		echo '<h2>';
   165 		_e('You have the latest version of WordPress.');
   190 		_e( 'You have the latest version of WordPress.' );
   166 
   191 
   167 		if ( wp_http_supports( array( 'ssl' ) ) ) {
   192 		if ( wp_http_supports( array( 'ssl' ) ) ) {
   168 			require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
   193 			require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
   169 			$upgrader = new WP_Automatic_Updater;
   194 			$upgrader            = new WP_Automatic_Updater;
   170 			$future_minor_update = (object) array(
   195 			$future_minor_update = (object) array(
   171 				'current'       => $wp_version . '.1.next.minor',
   196 				'current'       => $wp_version . '.1.next.minor',
   172 				'version'       => $wp_version . '.1.next.minor',
   197 				'version'       => $wp_version . '.1.next.minor',
   173 				'php_version'   => $required_php_version,
   198 				'php_version'   => $required_php_version,
   174 				'mysql_version' => $required_mysql_version,
   199 				'mysql_version' => $required_mysql_version,
   175 			);
   200 			);
   176 			$should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
   201 			$should_auto_update  = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
   177 			if ( $should_auto_update )
   202 			if ( $should_auto_update ) {
   178 				echo ' ' . __( 'Future security updates will be applied automatically.' );
   203 				echo ' ' . __( 'Future security updates will be applied automatically.' );
       
   204 			}
   179 		}
   205 		}
   180 		echo '</h2>';
   206 		echo '</h2>';
   181 	} else {
   207 	} else {
   182 		echo '<div class="notice notice-warning"><p>';
   208 		echo '<div class="notice notice-warning"><p>';
   183 		_e('<strong>Important:</strong> before updating, please <a href="https://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="https://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.');
   209 		_e( '<strong>Important:</strong> Before updating, please <a href="https://codex.wordpress.org/WordPress_Backups">back up your database and files</a>. For help with updates, visit the <a href="https://codex.wordpress.org/Updating_WordPress">Updating WordPress</a> Codex page.' );
   184 		echo '</p></div>';
   210 		echo '</p></div>';
   185 
   211 
   186 		echo '<h2 class="response">';
   212 		echo '<h2 class="response">';
   187 		_e( 'An updated version of WordPress is available.' );
   213 		_e( 'An updated version of WordPress is available.' );
   188 		echo '</h2>';
   214 		echo '</h2>';
   208 	// Don't show the maintenance mode notice when we are only showing a single re-install option.
   234 	// Don't show the maintenance mode notice when we are only showing a single re-install option.
   209 	if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
   235 	if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
   210 		echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
   236 		echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
   211 	} elseif ( ! $updates ) {
   237 	} elseif ( ! $updates ) {
   212 		list( $normalized_version ) = explode( '-', $wp_version );
   238 		list( $normalized_version ) = explode( '-', $wp_version );
   213 		echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
   239 		echo '<p>' . sprintf( __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
   214 	}
   240 	}
   215 	dismissed_updates();
   241 	dismissed_updates();
   216 }
   242 }
   217 
   243 
   218 function list_plugin_updates() {
   244 function list_plugin_updates() {
   219 	$wp_version = get_bloginfo( 'version' );
   245 	$wp_version     = get_bloginfo( 'version' );
   220 	$cur_wp_version = preg_replace( '/-.*$/', '', $wp_version );
   246 	$cur_wp_version = preg_replace( '/-.*$/', '', $wp_version );
   221 
   247 
   222 	require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
   248 	require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
   223 	$plugins = get_plugin_updates();
   249 	$plugins = get_plugin_updates();
   224 	if ( empty( $plugins ) ) {
   250 	if ( empty( $plugins ) ) {
   225 		echo '<h2>' . __( 'Plugins' ) . '</h2>';
   251 		echo '<h2>' . __( 'Plugins' ) . '</h2>';
   226 		echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
   252 		echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
   227 		return;
   253 		return;
   228 	}
   254 	}
   229 	$form_action = 'update-core.php?action=do-plugin-upgrade';
   255 	$form_action = 'update-core.php?action=do-plugin-upgrade';
   230 
   256 
   231 	$core_updates = get_core_updates();
   257 	$core_updates = get_core_updates();
   232 	if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
   258 	if ( ! isset( $core_updates[0]->response ) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=' ) ) {
   233 		$core_update_version = false;
   259 		$core_update_version = false;
   234 	else
   260 	} else {
   235 		$core_update_version = $core_updates[0]->current;
   261 		$core_update_version = $core_updates[0]->current;
       
   262 	}
   236 	?>
   263 	?>
   237 <h2><?php _e( 'Plugins' ); ?></h2>
   264 <h2><?php _e( 'Plugins' ); ?></h2>
   238 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
   265 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
   239 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
   266 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
   240 <?php wp_nonce_field('upgrade-core'); ?>
   267 	<?php wp_nonce_field( 'upgrade-core' ); ?>
   241 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
   268 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p>
   242 <table class="widefat updates-table" id="update-plugins-table">
   269 <table class="widefat updates-table" id="update-plugins-table">
   243 	<thead>
   270 	<thead>
   244 	<tr>
   271 	<tr>
   245 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
   272 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
   246 		<td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
   273 		<td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
   247 	</tr>
   274 	</tr>
   248 	</thead>
   275 	</thead>
   249 
   276 
   250 	<tbody class="plugins">
   277 	<tbody class="plugins">
   251 <?php
   278 	<?php
   252 	foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
   279 	foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
   253 		$plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
   280 		$plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
   254 
   281 
   255 		$icon = '<span class="dashicons dashicons-admin-plugins"></span>';
   282 		$icon            = '<span class="dashicons dashicons-admin-plugins"></span>';
   256 		$preferred_icons = array( 'svg', '1x', '2x', 'default' );
   283 		$preferred_icons = array( 'svg', '2x', '1x', 'default' );
   257 		foreach ( $preferred_icons as $preferred_icon ) {
   284 		foreach ( $preferred_icons as $preferred_icon ) {
   258 			if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) {
   285 			if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) {
   259 				$icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />';
   286 				$icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />';
   260 				break;
   287 				break;
   261 			}			
   288 			}
   262 		}
   289 		}
   263 
   290 
   264 		// Get plugin compat for running version of WordPress.
   291 		// Get plugin compat for running version of WordPress.
   265 		if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
   292 		if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) {
   266 			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
   293 			$compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $cur_wp_version );
   267 		} elseif ( isset($plugin_data->update->compatibility->{$cur_wp_version}) ) {
       
   268 			$compat = $plugin_data->update->compatibility->{$cur_wp_version};
       
   269 			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes);
       
   270 		} else {
   294 		} else {
   271 			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
   295 			$compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $cur_wp_version );
   272 		}
   296 		}
   273 		// Get plugin compat for updated version of WordPress.
   297 		// Get plugin compat for updated version of WordPress.
   274 		if ( $core_update_version ) {
   298 		if ( $core_update_version ) {
   275 			if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
   299 			if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
   276 				$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version );
   300 				$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version );
   277 			} elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) {
       
   278 				$update_compat = $plugin_data->update->compatibility->{$core_update_version};
       
   279 				$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes);
       
   280 			} else {
   301 			} else {
   281 				$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
   302 				$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $core_update_version );
   282 			}
   303 			}
   283 		}
   304 		}
       
   305 
       
   306 		$requires_php   = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null;
       
   307 		$compatible_php = is_php_version_compatible( $requires_php );
       
   308 
       
   309 		if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
       
   310 			$compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of PHP.' ) . '&nbsp;';
       
   311 			/* translators: %s: Update PHP page URL */
       
   312 			$compat .= sprintf(
       
   313 				__( '<a href="%s">Learn more about updating PHP</a>.' ),
       
   314 				esc_url( wp_get_update_php_url() )
       
   315 			);
       
   316 
       
   317 			$annotation = wp_get_update_php_annotation();
       
   318 
       
   319 			if ( $annotation ) {
       
   320 				$compat .= '</p><p><em>' . $annotation . '</em>';
       
   321 			}
       
   322 		}
       
   323 
   284 		// Get the upgrade notice for the new plugin version.
   324 		// Get the upgrade notice for the new plugin version.
   285 		if ( isset($plugin_data->update->upgrade_notice) ) {
   325 		if ( isset( $plugin_data->update->upgrade_notice ) ) {
   286 			$upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
   326 			$upgrade_notice = '<br />' . strip_tags( $plugin_data->update->upgrade_notice );
   287 		} else {
   327 		} else {
   288 			$upgrade_notice = '';
   328 			$upgrade_notice = '';
   289 		}
   329 		}
   290 
   330 
   291 		$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662');
   331 		$details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662' );
   292 		$details = sprintf(
   332 		$details     = sprintf(
   293 			'<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
   333 			'<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
   294 			esc_url( $details_url ),
   334 			esc_url( $details_url ),
   295 			/* translators: 1: plugin name, 2: version number */
   335 			/* translators: 1: plugin name, 2: version number */
   296 			esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ),
   336 			esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ),
   297 			/* translators: %s: plugin version */
   337 			/* translators: %s: plugin version */
   298 			sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version )
   338 			sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version )
   299 		);
   339 		);
   300 
   340 
   301 		$checkbox_id = "checkbox_" . md5( $plugin_data->Name );
   341 		$checkbox_id = 'checkbox_' . md5( $plugin_data->Name );
   302 		?>
   342 		?>
   303 		<tr>
   343 	<tr>
   304 			<td class="check-column">
   344 		<td class="check-column">
   305 				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
   345 		<?php if ( $compatible_php ) : ?>
   306 				<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
   346 			<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
   307 					/* translators: %s: plugin name */
   347 			<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
   308 					printf( __( 'Select %s' ),
   348 			<?php
   309 						$plugin_data->Name
   349 				/* translators: %s: plugin name */
   310 					);
   350 				printf(
   311 				?></label>
   351 					__( 'Select %s' ),
   312 			</td>
   352 					$plugin_data->Name
   313 			<td class="plugin-title"><p>
   353 				);
   314 				<?php echo $icon; ?>
   354 			?>
   315 				<strong><?php echo $plugin_data->Name; ?></strong>
   355 			</label>
   316 				<?php
   356 		<?php endif; ?>
   317 					/* translators: 1: plugin version, 2: new version */
   357 		</td>
   318 					printf( __( 'You have version %1$s installed. Update to %2$s.' ),
   358 		<td class="plugin-title"><p>
   319 						$plugin_data->Version,
   359 			<?php echo $icon; ?>
   320 						$plugin_data->update->new_version
   360 			<strong><?php echo $plugin_data->Name; ?></strong>
   321 					);
   361 			<?php
   322 					echo ' ' . $details . $compat . $upgrade_notice;
   362 			/* translators: 1: plugin version, 2: new version */
   323 				?>
   363 			printf(
   324 			</p></td>
   364 				__( 'You have version %1$s installed. Update to %2$s.' ),
   325 		</tr>
   365 				$plugin_data->Version,
       
   366 				$plugin_data->update->new_version
       
   367 			);
       
   368 			echo ' ' . $details . $compat . $upgrade_notice;
       
   369 			?>
       
   370 		</p></td>
       
   371 	</tr>
   326 		<?php
   372 		<?php
   327 	}
   373 	}
   328 ?>
   374 	?>
   329 	</tbody>
   375 	</tbody>
   330 
   376 
   331 	<tfoot>
   377 	<tfoot>
   332 	<tr>
   378 	<tr>
   333 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
   379 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
   334 		<td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
   380 		<td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
   335 	</tr>
   381 	</tr>
   336 	</tfoot>
   382 	</tfoot>
   337 </table>
   383 </table>
   338 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
   384 <p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p>
   339 </form>
   385 </form>
   340 <?php
   386 	<?php
   341 }
   387 }
   342 
   388 
   343 /**
   389 /**
   344  * @since 2.9.0
   390  * @since 2.9.0
   345  */
   391  */
   350 		echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
   396 		echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
   351 		return;
   397 		return;
   352 	}
   398 	}
   353 
   399 
   354 	$form_action = 'update-core.php?action=do-theme-upgrade';
   400 	$form_action = 'update-core.php?action=do-theme-upgrade';
   355 ?>
   401 	?>
   356 <h2><?php _e( 'Themes' ); ?></h2>
   402 <h2><?php _e( 'Themes' ); ?></h2>
   357 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
   403 <p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
   358 <p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p>
   404 <p>
       
   405 	<?php
       
   406 	printf(
       
   407 		/* translators: %s: link to documentation on child themes */
       
   408 		__( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ),
       
   409 		__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
       
   410 	);
       
   411 	?>
       
   412 </p>
   359 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
   413 <form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
   360 <?php wp_nonce_field('upgrade-core'); ?>
   414 	<?php wp_nonce_field( 'upgrade-core' ); ?>
   361 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
   415 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p>
   362 <table class="widefat updates-table" id="update-themes-table">
   416 <table class="widefat updates-table" id="update-themes-table">
   363 	<thead>
   417 	<thead>
   364 	<tr>
   418 	<tr>
   365 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
   419 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
   366 		<td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
   420 		<td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
   367 	</tr>
   421 	</tr>
   368 	</thead>
   422 	</thead>
   369 
   423 
   370 	<tbody class="plugins">
   424 	<tbody class="plugins">
   371 <?php
   425 	<?php
   372 	foreach ( $themes as $stylesheet => $theme ) {
   426 	foreach ( $themes as $stylesheet => $theme ) {
   373 		$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
   427 		$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
   374 		?>
   428 		?>
   375 		<tr>
   429 	<tr>
   376 			<td class="check-column">
   430 		<td class="check-column">
   377 				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
   431 			<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
   378 				<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
   432 			<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
   379 					/* translators: %s: theme name */
   433 			<?php
   380 					printf( __( 'Select %s' ),
   434 				/* translators: %s: theme name */
   381 						$theme->display( 'Name' )
   435 				printf(
   382 					);
   436 					__( 'Select %s' ),
   383 				?></label>
   437 					$theme->display( 'Name' )
   384 			</td>
   438 				);
   385 			<td class="plugin-title"><p>
   439 			?>
   386 				<img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
   440 			</label>
   387 				<strong><?php echo $theme->display( 'Name' ); ?></strong>
   441 		</td>
   388 				<?php
   442 		<td class="plugin-title"><p>
   389 					/* translators: 1: theme version, 2: new version */
   443 			<img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
   390 					printf( __( 'You have version %1$s installed. Update to %2$s.' ),
   444 			<strong><?php echo $theme->display( 'Name' ); ?></strong>
   391 						$theme->display( 'Version' ),
   445 			<?php
   392 						$theme->update['new_version']
   446 			/* translators: 1: theme version, 2: new version */
   393 					);
   447 			printf(
   394 				?>
   448 				__( 'You have version %1$s installed. Update to %2$s.' ),
   395 			</p></td>
   449 				$theme->display( 'Version' ),
   396 		</tr>
   450 				$theme->update['new_version']
   397 		<?php
   451 			);
   398 	}
   452 			?>
   399 ?>
   453 		</p></td>
       
   454 	</tr>
       
   455 			<?php
       
   456 	}
       
   457 	?>
   400 	</tbody>
   458 	</tbody>
   401 
   459 
   402 	<tfoot>
   460 	<tfoot>
   403 	<tr>
   461 	<tr>
   404 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
   462 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
   405 		<td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
   463 		<td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
   406 	</tr>
   464 	</tr>
   407 	</tfoot>
   465 	</tfoot>
   408 </table>
   466 </table>
   409 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
   467 <p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p>
   410 </form>
   468 </form>
   411 <?php
   469 	<?php
   412 }
   470 }
   413 
   471 
   414 /**
   472 /**
   415  * @since 3.7.0
   473  * @since 3.7.0
   416  */
   474  */
   438 /**
   496 /**
   439  * Upgrade WordPress core display.
   497  * Upgrade WordPress core display.
   440  *
   498  *
   441  * @since 2.7.0
   499  * @since 2.7.0
   442  *
   500  *
   443  * @global WP_Filesystem_Base $wp_filesystem Subclass
   501  * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
   444  *
   502  *
   445  * @param bool $reinstall
   503  * @param bool $reinstall
   446  */
   504  */
   447 function do_core_upgrade( $reinstall = false ) {
   505 function do_core_upgrade( $reinstall = false ) {
   448 	global $wp_filesystem;
   506 	global $wp_filesystem;
   449 
   507 
   450 	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
   508 	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
   451 
   509 
   452 	if ( $reinstall )
   510 	if ( $reinstall ) {
   453 		$url = 'update-core.php?action=do-core-reinstall';
   511 		$url = 'update-core.php?action=do-core-reinstall';
   454 	else
   512 	} else {
   455 		$url = 'update-core.php?action=do-core-upgrade';
   513 		$url = 'update-core.php?action=do-core-upgrade';
   456 	$url = wp_nonce_url($url, 'upgrade-core');
   514 	}
   457 
   515 	$url = wp_nonce_url( $url, 'upgrade-core' );
   458 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
   516 
   459 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
   517 	$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
   460 	$update = find_core_update( $version, $locale );
   518 	$locale  = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
   461 	if ( !$update )
   519 	$update  = find_core_update( $version, $locale );
   462 		return;
   520 	if ( ! $update ) {
       
   521 		return;
       
   522 	}
   463 
   523 
   464 	// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
   524 	// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
   465 	// that it's safe to do so. This only happens when there are no new files to create.
   525 	// that it's safe to do so. This only happens when there are no new files to create.
   466 	$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
   526 	$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
   467 
   527 
   468 ?>
   528 	?>
   469 	<div class="wrap">
   529 	<div class="wrap">
   470 	<h1><?php _e( 'Update WordPress' ); ?></h1>
   530 	<h1><?php _e( 'Update WordPress' ); ?></h1>
   471 <?php
   531 	<?php
   472 
   532 
   473 	if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
   533 	if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
   474 		echo '</div>';
   534 		echo '</div>';
   475 		return;
   535 		return;
   476 	}
   536 	}
   480 		request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
   540 		request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
   481 		echo '</div>';
   541 		echo '</div>';
   482 		return;
   542 		return;
   483 	}
   543 	}
   484 
   544 
   485 	if ( $wp_filesystem->errors->get_error_code() ) {
   545 	if ( $wp_filesystem->errors->has_errors() ) {
   486 		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
   546 		foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {
   487 			show_message($message);
   547 			show_message( $message );
       
   548 		}
   488 		echo '</div>';
   549 		echo '</div>';
   489 		return;
   550 		return;
   490 	}
   551 	}
   491 
   552 
   492 	if ( $reinstall )
   553 	if ( $reinstall ) {
   493 		$update->response = 'reinstall';
   554 		$update->response = 'reinstall';
       
   555 	}
   494 
   556 
   495 	add_filter( 'update_feedback', 'show_message' );
   557 	add_filter( 'update_feedback', 'show_message' );
   496 
   558 
   497 	$upgrader = new Core_Upgrader();
   559 	$upgrader = new Core_Upgrader();
   498 	$result = $upgrader->upgrade( $update, array(
   560 	$result   = $upgrader->upgrade(
   499 		'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership
   561 		$update,
   500 	) );
   562 		array(
   501 
   563 			'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
   502 	if ( is_wp_error($result) ) {
   564 		)
   503 		show_message($result);
   565 	);
   504 		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() )
   566 
   505 			show_message( __('Installation Failed') );
   567 	if ( is_wp_error( $result ) ) {
       
   568 		show_message( $result );
       
   569 		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) {
       
   570 			show_message( __( 'Installation Failed' ) );
       
   571 		}
   506 		echo '</div>';
   572 		echo '</div>';
   507 		return;
   573 		return;
   508 	}
   574 	}
   509 
   575 
   510 	show_message( __('WordPress updated successfully') );
   576 	show_message( __( 'WordPress updated successfully' ) );
   511 	show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
   577 	show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
   512 	show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
   578 	show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
   513 	?>
   579 	?>
   514 	</div>
   580 	</div>
   515 	<script type="text/javascript">
   581 	<script type="text/javascript">
   520 
   586 
   521 /**
   587 /**
   522  * @since 2.7.0
   588  * @since 2.7.0
   523  */
   589  */
   524 function do_dismiss_core_update() {
   590 function do_dismiss_core_update() {
   525 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
   591 	$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
   526 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
   592 	$locale  = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
   527 	$update = find_core_update( $version, $locale );
   593 	$update  = find_core_update( $version, $locale );
   528 	if ( !$update )
   594 	if ( ! $update ) {
   529 		return;
   595 		return;
       
   596 	}
   530 	dismiss_core_update( $update );
   597 	dismiss_core_update( $update );
   531 	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
   598 	wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) );
   532 	exit;
   599 	exit;
   533 }
   600 }
   534 
   601 
   535 /**
   602 /**
   536  * @since 2.7.0
   603  * @since 2.7.0
   537  */
   604  */
   538 function do_undismiss_core_update() {
   605 function do_undismiss_core_update() {
   539 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
   606 	$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
   540 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
   607 	$locale  = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
   541 	$update = find_core_update( $version, $locale );
   608 	$update  = find_core_update( $version, $locale );
   542 	if ( !$update )
   609 	if ( ! $update ) {
   543 		return;
   610 		return;
       
   611 	}
   544 	undismiss_core_update( $version, $locale );
   612 	undismiss_core_update( $version, $locale );
   545 	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
   613 	wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) );
   546 	exit;
   614 	exit;
   547 }
   615 }
   548 
   616 
   549 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
   617 $action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core';
   550 
   618 
   551 $upgrade_error = false;
   619 $upgrade_error = false;
   552 if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
   620 if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
   553 	&& ! isset( $_POST['checked'] ) ) {
   621 	&& ! isset( $_POST['checked'] ) ) {
   554 	$upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
   622 	$upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
   555 	$action = 'upgrade-core';
   623 	$action        = 'upgrade-core';
   556 }
   624 }
   557 
   625 
   558 $title = __('WordPress Updates');
   626 $title       = __( 'WordPress Updates' );
   559 $parent_file = 'index.php';
   627 $parent_file = 'index.php';
   560 
   628 
   561 $updates_overview  = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>';
   629 $updates_overview  = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>';
   562 $updates_overview .= '<p>' . __( 'If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
   630 $updates_overview .= '<p>' . __( 'If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
   563 
   631 
   564 get_current_screen()->add_help_tab( array(
   632 get_current_screen()->add_help_tab(
   565 	'id'      => 'overview',
   633 	array(
   566 	'title'   => __( 'Overview' ),
   634 		'id'      => 'overview',
   567 	'content' => $updates_overview
   635 		'title'   => __( 'Overview' ),
   568 ) );
   636 		'content' => $updates_overview,
       
   637 	)
       
   638 );
   569 
   639 
   570 $updates_howto  = '<p>' . __( '<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update Now&#8221; button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>';
   640 $updates_howto  = '<p>' . __( '<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update Now&#8221; button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>';
   571 $updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>';
   641 $updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>';
   572 
   642 
   573 if ( 'en_US' != get_locale() ) {
   643 if ( 'en_US' != get_locale() ) {
   574 	$updates_howto .= '<p>' . __( '<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.' ) . '</p>';
   644 	$updates_howto .= '<p>' . __( '<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.' ) . '</p>';
   575 }
   645 }
   576 
   646 
   577 get_current_screen()->add_help_tab( array(
   647 get_current_screen()->add_help_tab(
   578 	'id'      => 'how-to-update',
   648 	array(
   579 	'title'   => __( 'How to Update' ),
   649 		'id'      => 'how-to-update',
   580 	'content' => $updates_howto
   650 		'title'   => __( 'How to Update' ),
   581 ) );
   651 		'content' => $updates_howto,
       
   652 	)
       
   653 );
   582 
   654 
   583 get_current_screen()->set_help_sidebar(
   655 get_current_screen()->set_help_sidebar(
   584 	'<p><strong>' . __('For more information:') . '</strong></p>' .
   656 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   585 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen">Documentation on Updating WordPress</a>' ) . '</p>' .
   657 	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen">Documentation on Updating WordPress</a>' ) . '</p>' .
   586 	'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
   658 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   587 );
   659 );
   588 
   660 
   589 if ( 'upgrade-core' == $action ) {
   661 if ( 'upgrade-core' == $action ) {
   590 	// Force a update check when requested
   662 	// Force a update check when requested
   591 	$force_check = ! empty( $_GET['force-check'] );
   663 	$force_check = ! empty( $_GET['force-check'] );
   592 	wp_version_check( array(), $force_check );
   664 	wp_version_check( array(), $force_check );
   593 
   665 
   594 	require_once(ABSPATH . 'wp-admin/admin-header.php');
   666 	require_once( ABSPATH . 'wp-admin/admin-header.php' );
   595 	?>
   667 	?>
   596 	<div class="wrap">
   668 	<div class="wrap">
   597 	<h1><?php _e( 'WordPress Updates' ); ?></h1>
   669 	<h1><?php _e( 'WordPress Updates' ); ?></h1>
   598 	<?php
   670 	<?php
   599 	if ( $upgrade_error ) {
   671 	if ( $upgrade_error ) {
   600 		echo '<div class="error"><p>';
   672 		echo '<div class="error"><p>';
   601 		if ( $upgrade_error == 'themes' )
   673 		if ( $upgrade_error == 'themes' ) {
   602 			_e('Please select one or more themes to update.');
   674 			_e( 'Please select one or more themes to update.' );
   603 		else
   675 		} else {
   604 			_e('Please select one or more plugins to update.');
   676 			_e( 'Please select one or more plugins to update.' );
       
   677 		}
   605 		echo '</p></div>';
   678 		echo '</p></div>';
   606 	}
   679 	}
   607 
   680 
   608 	$last_update_check = false;
   681 	$last_update_check = false;
   609 	$current = get_site_transient( 'update_core' );
   682 	$current           = get_site_transient( 'update_core' );
   610 
   683 
   611 	if ( $current && isset ( $current->last_checked ) )	{
   684 	if ( $current && isset( $current->last_checked ) ) {
   612 		$last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
   685 		$last_update_check = $current->last_checked + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS;
   613 	}
   686 	}
   614 
   687 
   615 	echo '<p>';
   688 	echo '<p>';
   616 	/* translators: %1 date, %2 time. */
   689 	/* translators: 1: date, 2: time */
   617 	printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a' ), $last_update_check ) );
   690 	printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a' ), $last_update_check ) );
   618 	echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
   691 	echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url( 'update-core.php?force-check=1' ) ) . '">' . __( 'Check Again' ) . '</a>';
   619 	echo '</p>';
   692 	echo '</p>';
   620 
   693 
   621 	if ( current_user_can( 'update_core' ) ) {
   694 	if ( current_user_can( 'update_core' ) ) {
   622 		core_upgrade_preamble();
   695 		core_upgrade_preamble();
   623 	}
   696 	}
   637 	 * @since 2.9.0
   710 	 * @since 2.9.0
   638 	 */
   711 	 */
   639 	do_action( 'core_upgrade_preamble' );
   712 	do_action( 'core_upgrade_preamble' );
   640 	echo '</div>';
   713 	echo '</div>';
   641 
   714 
   642 	wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
   715 	wp_localize_script(
   643 		'totals'  => wp_get_update_data(),
   716 		'updates',
   644 	) );
   717 		'_wpUpdatesItemCounts',
   645 
   718 		array(
   646 	include(ABSPATH . 'wp-admin/admin-footer.php');
   719 			'totals' => wp_get_update_data(),
       
   720 		)
       
   721 	);
       
   722 
       
   723 	include( ABSPATH . 'wp-admin/admin-footer.php' );
   647 
   724 
   648 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
   725 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
   649 
   726 
   650 	if ( ! current_user_can( 'update_core' ) )
   727 	if ( ! current_user_can( 'update_core' ) ) {
   651 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
   728 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
   652 
   729 	}
   653 	check_admin_referer('upgrade-core');
   730 
       
   731 	check_admin_referer( 'upgrade-core' );
   654 
   732 
   655 	// Do the (un)dismiss actions before headers, so that they can redirect.
   733 	// Do the (un)dismiss actions before headers, so that they can redirect.
   656 	if ( isset( $_POST['dismiss'] ) )
   734 	if ( isset( $_POST['dismiss'] ) ) {
   657 		do_dismiss_core_update();
   735 		do_dismiss_core_update();
   658 	elseif ( isset( $_POST['undismiss'] ) )
   736 	} elseif ( isset( $_POST['undismiss'] ) ) {
   659 		do_undismiss_core_update();
   737 		do_undismiss_core_update();
   660 
   738 	}
   661 	require_once(ABSPATH . 'wp-admin/admin-header.php');
   739 
   662 	if ( 'do-core-reinstall' == $action )
   740 	require_once( ABSPATH . 'wp-admin/admin-header.php' );
       
   741 	if ( 'do-core-reinstall' == $action ) {
   663 		$reinstall = true;
   742 		$reinstall = true;
   664 	else
   743 	} else {
   665 		$reinstall = false;
   744 		$reinstall = false;
   666 
   745 	}
   667 	if ( isset( $_POST['upgrade'] ) )
   746 
   668 		do_core_upgrade($reinstall);
   747 	if ( isset( $_POST['upgrade'] ) ) {
   669 
   748 		do_core_upgrade( $reinstall );
   670 	wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
   749 	}
   671 		'totals'  => wp_get_update_data(),
   750 
   672 	) );
   751 	wp_localize_script(
   673 
   752 		'updates',
   674 	include(ABSPATH . 'wp-admin/admin-footer.php');
   753 		'_wpUpdatesItemCounts',
       
   754 		array(
       
   755 			'totals' => wp_get_update_data(),
       
   756 		)
       
   757 	);
       
   758 
       
   759 	include( ABSPATH . 'wp-admin/admin-footer.php' );
   675 
   760 
   676 } elseif ( 'do-plugin-upgrade' == $action ) {
   761 } elseif ( 'do-plugin-upgrade' == $action ) {
   677 
   762 
   678 	if ( ! current_user_can( 'update_plugins' ) )
   763 	if ( ! current_user_can( 'update_plugins' ) ) {
   679 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
   764 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
   680 
   765 	}
   681 	check_admin_referer('upgrade-core');
   766 
       
   767 	check_admin_referer( 'upgrade-core' );
   682 
   768 
   683 	if ( isset( $_GET['plugins'] ) ) {
   769 	if ( isset( $_GET['plugins'] ) ) {
   684 		$plugins = explode( ',', $_GET['plugins'] );
   770 		$plugins = explode( ',', $_GET['plugins'] );
   685 	} elseif ( isset( $_POST['checked'] ) ) {
   771 	} elseif ( isset( $_POST['checked'] ) ) {
   686 		$plugins = (array) $_POST['checked'];
   772 		$plugins = (array) $_POST['checked'];
   687 	} else {
   773 	} else {
   688 		wp_redirect( admin_url('update-core.php') );
   774 		wp_redirect( admin_url( 'update-core.php' ) );
   689 		exit;
   775 		exit;
   690 	}
   776 	}
   691 
   777 
   692 	$url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
   778 	$url = 'update.php?action=update-selected&plugins=' . urlencode( implode( ',', $plugins ) );
   693 	$url = wp_nonce_url($url, 'bulk-update-plugins');
   779 	$url = wp_nonce_url( $url, 'bulk-update-plugins' );
   694 
   780 
   695 	$title = __('Update Plugins');
   781 	$title = __( 'Update Plugins' );
   696 
   782 
   697 	require_once(ABSPATH . 'wp-admin/admin-header.php');
   783 	require_once( ABSPATH . 'wp-admin/admin-header.php' );
   698 	echo '<div class="wrap">';
   784 	echo '<div class="wrap">';
   699 	echo '<h1>' . __( 'Update Plugins' ) . '</h1>';
   785 	echo '<h1>' . __( 'Update Plugins' ) . '</h1>';
   700 	echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>';
   786 	echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>';
   701 	echo '</div>';
   787 	echo '</div>';
   702 
   788 
   703 	wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
   789 	wp_localize_script(
   704 		'totals'  => wp_get_update_data(),
   790 		'updates',
   705 	) );
   791 		'_wpUpdatesItemCounts',
   706 
   792 		array(
   707 	include(ABSPATH . 'wp-admin/admin-footer.php');
   793 			'totals' => wp_get_update_data(),
       
   794 		)
       
   795 	);
       
   796 
       
   797 	include( ABSPATH . 'wp-admin/admin-footer.php' );
   708 
   798 
   709 } elseif ( 'do-theme-upgrade' == $action ) {
   799 } elseif ( 'do-theme-upgrade' == $action ) {
   710 
   800 
   711 	if ( ! current_user_can( 'update_themes' ) )
   801 	if ( ! current_user_can( 'update_themes' ) ) {
   712 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
   802 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
   713 
   803 	}
   714 	check_admin_referer('upgrade-core');
   804 
       
   805 	check_admin_referer( 'upgrade-core' );
   715 
   806 
   716 	if ( isset( $_GET['themes'] ) ) {
   807 	if ( isset( $_GET['themes'] ) ) {
   717 		$themes = explode( ',', $_GET['themes'] );
   808 		$themes = explode( ',', $_GET['themes'] );
   718 	} elseif ( isset( $_POST['checked'] ) ) {
   809 	} elseif ( isset( $_POST['checked'] ) ) {
   719 		$themes = (array) $_POST['checked'];
   810 		$themes = (array) $_POST['checked'];
   720 	} else {
   811 	} else {
   721 		wp_redirect( admin_url('update-core.php') );
   812 		wp_redirect( admin_url( 'update-core.php' ) );
   722 		exit;
   813 		exit;
   723 	}
   814 	}
   724 
   815 
   725 	$url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
   816 	$url = 'update.php?action=update-selected-themes&themes=' . urlencode( implode( ',', $themes ) );
   726 	$url = wp_nonce_url($url, 'bulk-update-themes');
   817 	$url = wp_nonce_url( $url, 'bulk-update-themes' );
   727 
   818 
   728 	$title = __('Update Themes');
   819 	$title = __( 'Update Themes' );
   729 
   820 
   730 	require_once(ABSPATH . 'wp-admin/admin-header.php');
   821 	require_once( ABSPATH . 'wp-admin/admin-header.php' );
   731 	?>
   822 	?>
   732 	<div class="wrap">
   823 	<div class="wrap">
   733 		<h1><?php _e( 'Update Themes' ); ?></h1>
   824 		<h1><?php _e( 'Update Themes' ); ?></h1>
   734 		<iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
   825 		<iframe src="<?php echo $url; ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
   735 	</div>
   826 	</div>
   736 	<?php
   827 	<?php
   737 
   828 
   738 	wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
   829 	wp_localize_script(
   739 		'totals'  => wp_get_update_data(),
   830 		'updates',
   740 	) );
   831 		'_wpUpdatesItemCounts',
   741 
   832 		array(
   742 	include(ABSPATH . 'wp-admin/admin-footer.php');
   833 			'totals' => wp_get_update_data(),
       
   834 		)
       
   835 	);
       
   836 
       
   837 	include( ABSPATH . 'wp-admin/admin-footer.php' );
   743 
   838 
   744 } elseif ( 'do-translation-upgrade' == $action ) {
   839 } elseif ( 'do-translation-upgrade' == $action ) {
   745 
   840 
   746 	if ( ! current_user_can( 'update_languages' ) )
   841 	if ( ! current_user_can( 'update_languages' ) ) {
   747 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
   842 		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
       
   843 	}
   748 
   844 
   749 	check_admin_referer( 'upgrade-translations' );
   845 	check_admin_referer( 'upgrade-translations' );
   750 
   846 
   751 	require_once( ABSPATH . 'wp-admin/admin-header.php' );
   847 	require_once( ABSPATH . 'wp-admin/admin-header.php' );
   752 	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
   848 	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
   753 
   849 
   754 	$url = 'update-core.php?action=do-translation-upgrade';
   850 	$url     = 'update-core.php?action=do-translation-upgrade';
   755 	$nonce = 'upgrade-translations';
   851 	$nonce   = 'upgrade-translations';
   756 	$title = __( 'Update Translations' );
   852 	$title   = __( 'Update Translations' );
   757 	$context = WP_LANG_DIR;
   853 	$context = WP_LANG_DIR;
   758 
   854 
   759 	$upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
   855 	$upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
   760 	$result = $upgrader->bulk_upgrade();
   856 	$result   = $upgrader->bulk_upgrade();
   761 
   857 
   762 	wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
   858 	wp_localize_script(
   763 		'totals'  => wp_get_update_data(),
   859 		'updates',
   764 	) );
   860 		'_wpUpdatesItemCounts',
       
   861 		array(
       
   862 			'totals' => wp_get_update_data(),
       
   863 		)
       
   864 	);
   765 
   865 
   766 	require_once( ABSPATH . 'wp-admin/admin-footer.php' );
   866 	require_once( ABSPATH . 'wp-admin/admin-footer.php' );
   767 
   867 
   768 } else {
   868 } else {
   769 	/**
   869 	/**