本文整理汇总了PHP中get_preferred_from_update_core函数的典型用法代码示例。如果您正苦于以下问题:PHP get_preferred_from_update_core函数的具体用法?PHP get_preferred_from_update_core怎么用?PHP get_preferred_from_update_core使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_preferred_from_update_core函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_tested_up_to
/**
* @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));
}
}
开发者ID:robwilde,项目名称:query-monitor,代码行数:20,代码来源:test-plugin.php
示例2: checkCoreUpdates
/**
* 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;
}
开发者ID:adamplabarge,项目名称:bermstyle,代码行数:23,代码来源:wfUpdateCheck.php
示例3: om_update_nag
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:[email protected]?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:[email protected]?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>';
}
开发者ID:madebyaris,项目名称:generator-dharma,代码行数:20,代码来源:om-dashboard.php
示例4: result
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;
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:21,代码来源:class.jetpack-json-api-updates-status-endpoint.php
示例5: wuw_init
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)));
}
}
}
}
开发者ID:jamesdimick,项目名称:whats-up-wordpress-plugin,代码行数:38,代码来源:whats-up-wordpress.php
示例6: update_right_now_message
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>";
}
开发者ID:par-orillonsoft,项目名称:elearning-wordpress,代码行数:11,代码来源:update.php
示例7: is_dev_version
private static function is_dev_version()
{
$cur = get_preferred_from_update_core();
return isset($cur->response) && $cur->response == 'development';
}
开发者ID:9pmStudios,项目名称:developer,代码行数:5,代码来源:developer.php
示例8: update_right_now_message
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>";
}
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:15,代码来源:update.php
示例9: send_email
/**
* 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) {
//.........这里部分代码省略.........
开发者ID:sunyang3721,项目名称:wp-for-sae,代码行数:101,代码来源:class-wp-upgrader.php
示例10: update_right_now_message
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>";
}
开发者ID:houzhenggang,项目名称:WordPress-on-BAE,代码行数:11,代码来源:update.php
示例11: scan_oldVersions
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);
}
开发者ID:vegardvelle,项目名称:radikalportal,代码行数:50,代码来源:wfScanEngine.php
示例12: custom_update_nag
/**
* 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:[email protected]">[email protected]</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>";
}
开发者ID:mikeselander,项目名称:travel-blog,代码行数:26,代码来源:class-clean-admin.php
示例13: settings_field_setting_development_version
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>';
}
}
开发者ID:nicoladj77,项目名称:developer,代码行数:9,代码来源:developer.php
示例14: save_update_data
/**
* 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);
}
开发者ID:popthestack,项目名称:jetpack,代码行数:47,代码来源:class.jetpack-autoupdate.php
示例15: update_right_now_message
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>";
}
开发者ID:ShankarVellal,项目名称:WordPress,代码行数:19,代码来源:update.php
示例16: save_update_data
/**
* 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);
}
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:35,代码来源:class.jetpack-autoupdate.php
示例17: _get_preferred_from_update_core
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;
}
开发者ID:pwillems,项目名称:mimosa-contents,代码行数:13,代码来源:wp-beta-tester.php
示例18: update_right_now_message
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>";
}
开发者ID:sunyang3721,项目名称:wp-for-sae,代码行数:15,代码来源:update.php
示例19: get_updates
/**
* 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();
}
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:29,代码来源:class.jetpack.php
示例20: update_right_now_message
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>";
}
开发者ID:BoldGrid,项目名称:WordPress,代码行数:28,代码来源:update.php
注:本文中的get_preferred_from_update_core函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论