Advertisements

list_core_update

Definition:
function list_core_update( $update ) {}

Parameters

  • $update

Source code

function list_core_update( $update ) {

	global $wp_local_package, $wpdb;

	static $first_pass = true;



	$version_string = ('en_US' == $update->locale && 'en_US' == get_locale() ) ?

			$update->current : sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);

	$current = false;

	if ( !isset($update->response) || 'latest' == $update->response )

		$current = true;

	$submit = __('Update Now');

	$form_action = 'update-core.php?action=do-core-upgrade';

	$php_version    = phpversion();

	$mysql_version  = $wpdb->db_version();

	$show_buttons = true;

	if ( 'development' == $update->response ) {

		$message = __('You are using a development version of WordPress.  You can update to the latest nightly build automatically or download the nightly build and install it manually:');

		$download = __('Download nightly build');

	} else {

		if ( $current ) {

			$message = sprintf(__('You have the latest version of WordPress. You do not need to update. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:'), $version_string);

			$submit = __('Re-install Now');

			$form_action = 'update-core.php?action=do-core-reinstall';

		} else {

			$php_compat     = version_compare( $php_version, $update->php_version, '>=' );

			$mysql_compat   = version_compare( $mysql_version, $update->mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' );

			if ( !$mysql_compat && !$php_compat )

				$message = sprintf( __('You cannot update because <a href="http://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 );

			elseif ( !$php_compat )

				$message = sprintf( __('You cannot update because <a href="http://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 );

			elseif ( !$mysql_compat )

				$message = sprintf( __('You cannot update because <a href="http://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 );

			else

				$message = 	sprintf(__('You can update to <a href="http://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);

			if ( !$mysql_compat || !$php_compat )

				$show_buttons = false;

		}

		$download = sprintf(__('Download %s'), $version_string);

	}



	echo '<p>';

	echo $message;

	echo '</p>';

	echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';

	wp_nonce_field('upgrade-core');

	echo '<p>';

	echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';

	echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';

	if ( $show_buttons ) {

		if ( $first_pass ) {

			submit_button( $submit, 'button button-primary', 'upgrade', false );

			$first_pass = false;

		} else {

			submit_button( $submit, 'button', 'upgrade', false );

		}

		echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';

	}

	if ( 'en_US' != $update->locale )

		if ( !isset( $update->dismissed ) || !$update->dismissed )

			submit_button( __('Hide this update'), 'button', 'dismiss', false );

		else

			submit_button( __('Bring back this update'), 'button', 'undismiss', false );

	echo '</p>';

	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )

	    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>';

	else if ( 'en_US' == $update->locale && get_locale() != 'en_US' ) {

	    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>';

	}

	echo '</form>';



}

2269

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: