/** * @slowThreshold 1000 */ public function test_tested_up_to() { if (!($readme_data = $this->get_readme())) { $this->markTestSkipped('There is no readme file'); return; } wp_version_check(); $cur = get_preferred_from_update_core(); if (false === $cur) { $this->markTestSkipped('There is no internet connection'); return; } if (isset($cur->current)) { list($display_version) = explode('-', $cur->current); $this->assertTrue(version_compare($readme_data['tested_up_to'], $display_version, '>='), sprintf('%s >= %s', $readme_data['tested_up_to'], $display_version)); } }
/** * Check if there is an update to the WordPress core. * * @return $this */ public function checkCoreUpdates() { $this->needs_core_update = false; if (!function_exists('wp_version_check')) { require_once ABSPATH . WPINC . '/update.php'; } if (!function_exists('get_preferred_from_update_core')) { require_once ABSPATH . 'wp-admin/includes/update.php'; } wp_version_check(); // Check for Core updates $update = get_preferred_from_update_core(); if (isset($update->response) && $update->response == 'upgrade') { $this->needs_core_update = true; $this->core_update_version = $update->current; } return $this; }
function om_update_nag() { if (is_multisite() && !current_user_can('update_core')) { return false; } global $pagenow; if ('update-core.php' == $pagenow) { return; } $cur = get_preferred_from_update_core(); if (!isset($cur->response) || 'upgrade' != $cur->response) { return false; } if (current_user_can('update_core')) { $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.<br><a href="mailto:info@overhaulmedia.com?subject=WordPress updating">Reach out to your friends</a> at <a href="http://overhaulmedia.com/" target="_blank">Overhaul Media</a> for assistance!'), $cur->current, network_admin_url('update-core.php')); } else { $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.<br><a href="mailto:info@overhaulmedia.com?subject=WordPress updating">Reach out to your friends</a> at <a href="http://overhaulmedia.com/" target="_blank">Overhaul Media</a> for assistance!'), $cur->current); } echo '<div class="update-nag">' . $msg . '</div>'; }
protected function result() { wp_update_themes(); wp_update_plugins(); $update_data = wp_get_update_data(); if (!isset($update_data['counts'])) { return new WP_Error('get_update_data_error', __('There was an error while getting the update data for this site.', 'jetpack'), 500); } $result = $update_data['counts']; include ABSPATH . WPINC . '/version.php'; // $wp_version; $result['wp_version'] = isset($wp_version) ? $wp_version : null; if (!empty($result['wordpress'])) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && $cur->response === 'upgrade') { $result['wp_update_version'] = $cur->current; } } $result['jp_version'] = JETPACK__VERSION; return $result; }
function wuw_init() { if (isset($_POST['whatsupwordpressusername']) && isset($_POST['whatsupwordpresspassword'])) { $post_user = sanitize_user(trim($_POST['whatsupwordpressusername'])); $post_pass = trim($_POST['whatsupwordpresspassword']); $results = ''; if (user_pass_ok($post_user, $post_pass)) { $user_data = get_userdatabylogin($post_user); set_current_user($user_data->ID); if (current_user_can('whats_up_wordpress')) { if (!function_exists('get_preferred_from_update_core')) { require_once ABSPATH . 'wp-admin/includes/update.php'; } $cur = get_preferred_from_update_core(); $upgrade = isset($cur->response) && $cur->response === 'upgrade' ? 1 : 0; if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); $active_plugins = 0; foreach ((array) $all_plugins as $plugin_file => $plugin_data) { if (is_plugin_active($plugin_file)) { $active_plugins++; } } $update_plugins = get_transient('update_plugins'); $update_count = 0; if (!empty($update_plugins->response)) { $update_count = count($update_plugins->response); } $num_posts = wp_count_posts('post', 'readable'); $num_comm = wp_count_comments(); header('Content-Type: application/json'); exit(json_encode(array('site_name' => (string) get_option('blogname'), 'site_url' => (string) site_url(), 'site_admin_url' => (string) admin_url(), 'wordpress_version' => (string) $GLOBALS['wp_version'], 'core_update_available' => (int) $upgrade, 'active_plugins' => (int) $active_plugins, 'updatable_plugins' => (int) $update_count, 'total_posts' => (int) array_sum((array) $num_posts) - $num_posts->trash, 'total_posts_categories' => (int) wp_count_terms('category', 'ignore_empty=true'), 'published_posts' => (int) $num_posts->publish, 'draft_posts' => (int) $num_posts->draft, 'pending_posts' => (int) $num_posts->pending, 'scheduled_posts' => (int) $num_posts->future, 'trashed_posts' => (int) $num_posts->trash, 'total_comments' => (int) $num_comm->total_comments, 'approved_comments' => (int) $num_comm->approved, 'pending_comments' => (int) $num_comm->moderated, 'spam_comments' => (int) $num_comm->spam, 'trashed_comments' => (int) $num_comm->trash))); } } } }
function update_right_now_message() { $msg = sprintf(__('You are using <span class="b">WordPress %s</span>.'), get_bloginfo('version', 'display')); if (current_user_can('update_core')) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && $cur->response == 'upgrade') { $msg .= " <a href='" . network_admin_url('update-core.php') . "' class='button'>" . sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')) . '</a>'; } } echo "<span id='wp-version-message'>{$msg}</span>"; }
private static function is_dev_version() { $cur = get_preferred_from_update_core(); return isset($cur->response) && $cur->response == 'development'; }
function update_right_now_message() { $theme_name = wp_get_theme(); if (current_user_can('switch_themes')) { $theme_name = sprintf('<a href="themes.php">%1$s</a>', $theme_name); } $msg = sprintf(__('WordPress %1$s running %2$s theme.'), get_bloginfo('version', 'display'), $theme_name); if (current_user_can('update_core')) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && $cur->response == 'upgrade') { $msg .= " <a href='" . network_admin_url('update-core.php') . "' class='button'>" . sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')) . '</a>'; } } echo "<p id='wp-version-message'>{$msg}</p>"; }
/** * Sends an email upon the completion or failure of a background core update. * * @since 3.7.0 * * @param string $type The type of email to send. Can be one of 'success', 'fail', 'manual', 'critical'. * @param object $core_update The update offer that was attempted. * @param mixed $result Optional. The result for the core update. Can be WP_Error. */ protected function send_email($type, $core_update, $result = null) { update_site_option('auto_core_update_notified', array('type' => $type, 'email' => get_site_option('admin_email'), 'version' => $core_update->current, 'timestamp' => time())); $next_user_core_update = get_preferred_from_update_core(); // If the update transient is empty, use the update we just performed if (!$next_user_core_update) { $next_user_core_update = $core_update; } $newer_version_available = 'upgrade' == $next_user_core_update->response && version_compare($next_user_core_update->version, $core_update->version, '>'); /** * Filter whether to send an email following an automatic background core update. * * @since 3.7.0 * * @param bool $send Whether to send the email. Default true. * @param string $type The type of email to send. Can be one of * 'success', 'fail', 'critical'. * @param object $core_update The update offer that was attempted. * @param mixed $result The result for the core update. Can be WP_Error. */ if ('manual' !== $type && !apply_filters('auto_core_update_send_email', true, $type, $core_update, $result)) { return; } switch ($type) { case 'success': // We updated. /* translators: 1: Site name, 2: WordPress version number. */ $subject = __('[%1$s] Your site has updated to WordPress %2$s'); break; case 'fail': // We tried to update but couldn't. // We tried to update but couldn't. case 'manual': // We can't update (and made no attempt). /* translators: 1: Site name, 2: WordPress version number. */ $subject = __('[%1$s] WordPress %2$s is available. Please update!'); break; case 'critical': // We tried to update, started to copy files, then things went wrong. /* translators: 1: Site name. */ $subject = __('[%1$s] URGENT: Your site may be down due to a failed update'); break; default: return; } // If the auto update is not to the latest version, say that the current version of WP is available instead. $version = 'success' === $type ? $core_update->current : $next_user_core_update->current; $subject = sprintf($subject, wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), $version); $body = ''; switch ($type) { case 'success': $body .= sprintf(__('Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.'), home_url(), $core_update->current); $body .= "\n\n"; if (!$newer_version_available) { $body .= __('No further action is needed on your part.') . ' '; } // Can only reference the About screen if their update was successful. list($about_version) = explode('-', $core_update->current, 2); $body .= sprintf(__("For more on version %s, see the About WordPress screen:"), $about_version); $body .= "\n" . admin_url('about.php'); if ($newer_version_available) { $body .= "\n\n" . sprintf(__('WordPress %s is also now available.'), $next_user_core_update->current) . ' '; $body .= __('Updating is easy and only takes a few moments:'); $body .= "\n" . network_admin_url('update-core.php'); } break; case 'fail': case 'manual': $body .= sprintf(__('Please update your site at %1$s to WordPress %2$s.'), home_url(), $next_user_core_update->current); $body .= "\n\n"; // Don't show this message if there is a newer version available. // Potential for confusion, and also not useful for them to know at this point. if ('fail' == $type && !$newer_version_available) { $body .= __('We tried but were unable to update your site automatically.') . ' '; } $body .= __('Updating is easy and only takes a few moments:'); $body .= "\n" . network_admin_url('update-core.php'); break; case 'critical': if ($newer_version_available) { $body .= sprintf(__('Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.'), home_url(), $core_update->current); } else { $body .= sprintf(__('Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.'), home_url(), $core_update->current); } $body .= "\n\n" . __("This means your site may be offline or broken. Don't panic; this can be fixed."); $body .= "\n\n" . __("Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:"); $body .= "\n" . network_admin_url('update-core.php'); break; } $critical_support = 'critical' === $type && !empty($core_update->support_email); if ($critical_support) { // Support offer if available. $body .= "\n\n" . sprintf(__("The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working."), $core_update->support_email); } else { // Add a note about the support forums. $body .= "\n\n" . __('If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.'); $body .= "\n" . __('https://wordpress.org/support/'); } // Updates are important! if ($type != 'success' || $newer_version_available) { $body .= "\n\n" . __('Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.'); } if ($critical_support) { $body .= " " . __("If you reach out to us, we'll also ensure you'll never have this problem again."); } // If things are successful and we're now on the latest, mention plugins and themes if any are out of date. if ($type == 'success' && !$newer_version_available && (get_plugin_updates() || get_theme_updates())) { $body .= "\n\n" . __('You also have some plugins or themes with updates available. Update them now:'); $body .= "\n" . network_admin_url(); } $body .= "\n\n" . __('The WordPress Team') . "\n"; if ('critical' == $type && is_wp_error($result)) { $body .= "\n***\n\n"; $body .= sprintf(__('Your site was running version %s.'), $GLOBALS['wp_version']); $body .= ' ' . __('We have some data that describes the error your site encountered.'); $body .= ' ' . __('Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:'); // If we had a rollback and we're still critical, then the rollback failed too. // Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc. if ('rollback_was_required' == $result->get_error_code()) { $errors = array($result, $result->get_error_data()->update, $result->get_error_data()->rollback); } else { $errors = array($result); } foreach ($errors as $error) { if (!is_wp_error($error)) { continue; } $error_code = $error->get_error_code(); $body .= "\n\n" . sprintf(__("Error code: %s"), $error_code); if ('rollback_was_required' == $error_code) { continue; } if ($error->get_error_message()) { $body .= "\n" . $error->get_error_message(); } $error_data = $error->get_error_data(); if ($error_data) { $body .= "\n" . implode(', ', (array) $error_data); } } $body .= "\n"; } $to = get_site_option('admin_email'); $headers = ''; $email = compact('to', 'subject', 'body', 'headers'); /** * Filter the email sent following an automatic background core update. * * @since 3.7.0 * * @param array $email { * Array of email arguments that will be passed to wp_mail(). * * @type string $to The email recipient. An array of emails * can be returned, as handled by wp_mail(). * @type string $subject The email's subject. * @type string $body The email message body. * @type string $headers Any email headers, defaults to no headers. * } * @param string $type The type of email being sent. Can be one of * 'success', 'fail', 'manual', 'critical'. * @param object $core_update The update offer that was attempted. * @param mixed $result The result for the core update. Can be WP_Error. */ $email = apply_filters('auto_core_update_email', $email, $type, $core_update, $result); wp_mail($email['to'], wp_specialchars_decode($email['subject']), $email['body'], $email['headers']); }
function update_right_now_message() { $msg = sprintf(__('You are using <span class="b">WordPress %s</span>.'), get_bloginfo('version', 'display')); if (current_user_can('update_core')) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && $cur->response == 'upgrade') { $msg .= " <a href='" . network_admin_url('update-core.php') . "' class='button'>" . sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')) . '</a>'; } } echo "<span id='wp-version-message'>{$msg} <b>由 <a href='http://blog.gimhoy.com/archives/wordpress-on-bae.html'>Gimhoy</a> 移植至 BAE。<a href='http://me.alipay.com/gimhoy'><span style='color:red'>捐赠</span></a></b></span>"; }
private function scan_oldVersions() { $this->statusIDX['oldVersions'] = wordfence::statusStart("Scanning for old themes, plugins and core files"); if (!function_exists('get_preferred_from_update_core')) { require_once ABSPATH . 'wp-admin/includes/update.php'; } $cur = get_preferred_from_update_core(); $haveIssues = false; if (isset($cur->response) && $cur->response == 'upgrade') { if ($this->addIssue('wfUpgrade', 1, 'wfUpgrade' . $cur->current, 'wfUpgrade' . $cur->current, "Your WordPress version is out of date", "WordPress version " . $cur->current . " is now available. Please upgrade immediately to get the latest security updates from WordPress.", array('currentVersion' => $this->wp_version, 'newVersion' => $cur->current))) { $haveIssues = true; } } $update_plugins = get_site_transient('update_plugins'); if (isset($update_plugins) && !empty($update_plugins->response)) { if (isset($update_plugins) && $update_plugins->response) { foreach ($update_plugins->response as $plugin => $vals) { if (!function_exists('get_plugin_data')) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } $pluginFile = wfUtils::getPluginBaseDir() . $plugin; $data = get_plugin_data($pluginFile); $data['newVersion'] = $vals->new_version; $key = 'wfPluginUpgrade' . ' ' . $plugin . ' ' . $data['newVersion'] . ' ' . $data['Version']; if ($this->addIssue('wfPluginUpgrade', 1, $key, $key, "The Plugin \"" . $data['Name'] . "\" needs an upgrade.", "You need to upgrade \"" . $data['Name'] . "\" to the newest version to ensure you have any security fixes the developer has released.", $data)) { $haveIssues = true; } } } } $update_themes = get_site_transient('update_themes'); if (isset($update_themes) && !empty($update_themes->response)) { if (!function_exists('get_themes')) { require_once ABSPATH . '/wp-includes/theme.php'; } $themes = get_themes(); foreach ($update_themes->response as $theme => $vals) { foreach ($themes as $name => $themeData) { if (strtolower($name) == $theme) { $tData = array('newVersion' => $vals['new_version'], 'package' => $vals['package'], 'URL' => $vals['url'], 'name' => $themeData['Name'], 'version' => $themeData['Version']); $key = 'wfThemeUpgrade' . ' ' . $theme . ' ' . $tData['version'] . ' ' . $tData['newVersion']; if ($this->addIssue('wfThemeUpgrade', 1, $key, $key, "The Theme \"" . $themeData['Name'] . "\" needs an upgrade.", "You need to upgrade \"" . $themeData['Name'] . "\" to the newest version to ensure you have any security fixes the developer has released.", $tData)) { $haveIssues = true; } } } } } wordfence::statusEnd($this->statusIDX['oldVersions'], $haveIssues); }
/** * Custom dashboard nag that tells customers to contact us. * * @see get_preferred_from_update_core, is_multisite, current_user_can * @global string $pagenow Current page in the admin dashboard. */ public function custom_update_nag() { if (is_multisite() && !current_user_can('update_core')) { return false; } global $pagenow; if ('update-core.php' == $pagenow) { return; } $cur = get_preferred_from_update_core(); if (!isset($cur->response) || $cur->response != 'upgrade') { return false; } if (current_user_can('update_core')) { $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please contact OTM at (970) 568 5250 or <a href="mailto:support@oldtownmediainc.com">support@oldtownmediainc.com</a> to schedule your update.'), $cur->current, 'your_custom_url'); } else { $msg = sprintf(__('<a href="http://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current); } echo "<div class='update-nag'>{$msg}</div>"; }
public function settings_field_setting_development_version() { $cur = get_preferred_from_update_core(); if ($cur->response == 'development') { echo '<span class="a8c-developer-active">' . esc_html__('ENABLED', 'a8c-developer') . '</span>'; } else { echo '<a href="' . network_admin_url('update-core.php') . '" class="a8c-developer-notactive">' . esc_html__('DISABLED', 'a8c-developer') . '</a>'; } }
/** * Calculates available updates and saves them to a Jetpack Option * * jetpack_updates is saved in the following schema: * * array ( * 'plugins' => (int) Number of plugin updates available. * 'themes' => (int) Number of theme updates available. * 'wordpress' => (int) Number of WordPress core updates available. * 'translations' => (int) Number of translation updates available. * 'total' => (int) Total of all available updates. * 'wp_update_version' => (string) The latest available version of WordPress, only present if a WordPress update is needed. * ) * * jetpack_update_details is saved in the following schema: * * array ( * 'update_core' => (array) The contents of the update_core transient. * 'update_themes' => (array) The contents of the update_themes transient. * 'update_plugins' => (array) The contents of the update_plugins transient. * ) * */ function save_update_data() { if (!current_user_can('update_plugins') || !current_user_can('update_core') || !current_user_can('update_themes')) { // `wp_get_updated_data` will not return useful information if a user does not have the capabilities. // We should should therefore bail to avoid saving incomplete data. return; } $update_data = wp_get_update_data(); // Stores the individual update counts as well as the total count. if (isset($update_data['counts'])) { $updates = $update_data['counts']; } // If we need to update WordPress core, let's find the latest version number. if (!empty($updates['wordpress'])) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && 'upgrade' === $cur->response) { $updates['wp_update_version'] = $cur->current; } } Jetpack_Options::update_option('updates', $updates); // Let's also store and sync more details about what updates are needed. $update_details = array('update_core' => get_site_transient('update_core'), 'update_plugins' => get_site_transient('update_plugins'), 'update_themes' => get_site_transient('update_themes')); Jetpack_Options::update_option('update_details', $update_details); }
function update_right_now_message() { $theme_name = wp_get_theme(); if ( current_user_can( 'switch_themes' ) ) { $theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme_name ); } $msg = ''; if ( current_user_can('update_core') ) { $cur = get_preferred_from_update_core(); if ( isset( $cur->response ) && $cur->response == 'upgrade' ) $msg .= '<a href="' . network_admin_url( 'update-core.php' ) . '" class="button" aria-describedby="wp-version">' . sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a> '; } $msg .= sprintf( '<span id="wp-version">' . __( 'WordPress %1$s running %2$s theme.' ) . '</span>', get_bloginfo( 'version', 'display' ), $theme_name ); echo "<p id='wp-version-message'>$msg</p>"; }
/** * Calculates available updates and saves them to a Jetpack Option * Update data is saved in the following schema: * * array ( * 'plugins' => (int) number of plugin updates available * 'themes' => (int) number of theme updates available * 'wordpress' => (int) number of wordpress core updates available * 'translations' => (int) number of translation updates available * 'total' => (int) total of all available updates * 'wp_version' => (string) the current version of WordPress that is running * 'wp_update_version' => (string) the latest available version of WordPress, only present if a WordPress update is needed * 'site_is_version_controlled' => (bool) is the site under version control * ) */ function save_update_data() { global $wp_version; $update_data = wp_get_update_data(); // Stores the individual update counts as well as the total count. if (isset($update_data['counts'])) { $updates = $update_data['counts']; } // Stores the current version of WordPress. $updates['wp_version'] = $wp_version; // If we need to update WordPress core, let's find the latest version number. if (!empty($updates['wordpress'])) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && 'upgrade' === $cur->response) { $updates['wp_update_version'] = $cur->current; } } $updates['site_is_version_controlled'] = (bool) $this->is_version_controlled(); Jetpack_Options::update_option('updates', $updates); }
function _get_preferred_from_update_core() { if (!function_exists('get_preferred_from_update_core')) { require_once ABSPATH . 'wp-admin/includes/update.php'; } //Validate that we have api data and if not get the normal data so we always have it. $preferred = get_preferred_from_update_core(); if (false === $preferred) { wp_version_check(); $preferred = get_preferred_from_update_core(); } return $preferred; }
function update_right_now_message() { $theme_name = wp_get_theme(); if (current_user_can('switch_themes')) { $theme_name = sprintf('<a href="themes.php">%1$s</a>', $theme_name); } $msg = sprintf(__('WordPress %1$s running %2$s theme.'), get_bloginfo('version', 'display'), $theme_name); if (current_user_can('update_core')) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && $cur->response == 'upgrade') { $msg .= " <a href='" . network_admin_url('update-core.php') . "' class='button'>" . sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')) . '</a>'; } } echo "<p id='wp-version-message'>{$msg}<b>由 <a href='http://blog.gimhoy.com/archives/wordpress-on-sae.html'>Gimhoy</a> 移植至 SAE。<a href='http://go.gimhoy.com/donate'><span style='color:red'>捐赠</span></a></b></p>"; }
/** * jetpack_updates is saved in the following schema: * * array ( * 'plugins' => (int) Number of plugin updates available. * 'themes' => (int) Number of theme updates available. * 'wordpress' => (int) Number of WordPress core updates available. * 'translations' => (int) Number of translation updates available. * 'total' => (int) Total of all available updates. * 'wp_update_version' => (string) The latest available version of WordPress, only present if a WordPress update is needed. * ) * @return array */ public static function get_updates() { $update_data = wp_get_update_data(); // Stores the individual update counts as well as the total count. if (isset($update_data['counts'])) { $updates = $update_data['counts']; } // If we need to update WordPress core, let's find the latest version number. if (!empty($updates['wordpress'])) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && 'upgrade' === $cur->response) { $updates['wp_update_version'] = $cur->current; } } return isset($updates) ? $updates : array(); }
function update_right_now_message() { $theme_name = wp_get_theme(); if (current_user_can('switch_themes')) { $theme_name = sprintf('<a href="themes.php">%1$s</a>', $theme_name); } $msg = ''; if (current_user_can('update_core')) { $cur = get_preferred_from_update_core(); if (isset($cur->response) && $cur->response == 'upgrade') { $msg .= '<a href="' . network_admin_url('update-core.php') . '" class="button" aria-describedby="wp-version">' . sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')) . '</a> '; } } /* translators: 1: version number, 2: theme name */ $content = __('WordPress %1$s running %2$s theme.'); /** * Filters the text displayed in the 'At a Glance' dashboard widget. * * Prior to 3.8.0, the widget was named 'Right Now'. * * @since 4.4.0 * * @param string $content Default text. */ $content = apply_filters('update_right_now_text', $content); $msg .= sprintf('<span id="wp-version">' . $content . '</span>', get_bloginfo('version', 'display'), $theme_name); echo "<p id='wp-version-message'>{$msg}</p>"; }
function update_right_now_message() { if (is_multisite() && !current_user_can('update_core')) { return false; } $cur = get_preferred_from_update_core(); $msg = sprintf(__('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version']); if (isset($cur->response) && $cur->response == 'upgrade' && current_user_can('update_core')) { $msg .= " <a href='" . network_admin_url('update-core.php') . "' class='button'>" . sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')) . '</a>'; } echo "<span id='wp-version-message'>{$msg}</span>"; }
function ver_check() { $return = array(); if (!function_exists('get_preferred_from_update_core')) { require_once ABSPATH . 'wp-admin/includes/update.php'; } // get version wp_version_check(); $latest_core_update = get_preferred_from_update_core(); if (isset($latest_core_update->response) && $latest_core_update->response == 'upgrade') { $return['status'] = 0; } else { $return['status'] = 10; } return $return; }