当前位置: 首页>>代码示例>>PHP>>正文


PHP wp_update_plugins函数代码示例

本文整理汇总了PHP中wp_update_plugins函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_update_plugins函数的具体用法?PHP wp_update_plugins怎么用?PHP wp_update_plugins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wp_update_plugins函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_update_plugins_is_synced

 public function test_update_plugins_is_synced()
 {
     wp_update_plugins();
     $this->client->do_sync();
     $updates = $this->server_replica_storage->get_updates('plugins');
     $this->assertTrue(is_int($updates->last_checked));
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:7,代码来源:test_class.jetpack-sync-updates.php

示例2: handle_request

 protected function handle_request()
 {
     global $wp;
     $query = $wp->query_vars['query'];
     $access_token = self::haveAccess($wp->query_vars['access_token']);
     $plugin_data = get_plugin_data(plugin_dir_path(__FILE__) . '../watchtower.php');
     $plugin_version = $plugin_data['Version'];
     switch (true) {
         case $query === 'test' && $access_token:
             $this->send_response(array('status' => '200 OK'));
             break;
         case $query === 'auto_update' && $access_token:
             wp_update_plugins();
             $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version));
             break;
         case $query === 'core' && $access_token:
             $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'plugins' => WPCore_Model::getStat()));
             break;
         case $query === 'plugins' && $access_token:
             $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'plugins' => Plugin_Model::getStat()));
             break;
         case $query === 'themes' && $access_token:
             $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'plugins' => Theme_Model::getStat()));
             break;
         case $query === 'all' && $access_token:
             $this->send_response(array('status' => '200 OK', 'client_version' => $plugin_version, 'core' => WPCore_Model::getStat(), 'plugins' => Plugin_Model::getStat(), 'themes' => Theme_Model::getStat()));
             break;
         default:
             $this->send_response('Error', 'Invalid request or access token');
             break;
     }
 }
开发者ID:c2pdev,项目名称:WatchTower_Client,代码行数:32,代码来源:class-watchtower-api-endpoint.php

示例3: checkPluginUpdates

 /**
  * Check if any plugins need an update.
  *
  * @return $this
  */
 public function checkPluginUpdates()
 {
     $this->plugin_updates = array();
     if (!function_exists('wp_update_plugins')) {
         require_once ABSPATH . WPINC . '/update.php';
     }
     if (!function_exists('plugins_api')) {
         require_once ABSPATH . '/wp-admin/includes/plugin-install.php';
     }
     wp_update_plugins();
     // Check for Plugin updates
     $update_plugins = get_site_transient('update_plugins');
     if ($update_plugins && !empty($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['pluginFile'] = $pluginFile;
             $data['newVersion'] = $vals->new_version;
             $data['slug'] = $vals->slug;
             $data['wpURL'] = rtrim($vals->url, '/');
             //Check the vulnerability database
             $result = $this->api->call('plugin_vulnerability_check', array(), array('slug' => $vals->slug, 'fromVersion' => $data['Version'], 'toVersion' => $vals->new_version));
             $data['vulnerabilityPatched'] = isset($result['vulnerable']) && $result['vulnerable'];
             $this->plugin_updates[] = $data;
         }
     }
     return $this;
 }
开发者ID:TeamSubjectMatter,项目名称:juddfoundation,代码行数:36,代码来源:wfUpdateCheck.php

示例4: test_update_plugins_is_synced

 public function test_update_plugins_is_synced()
 {
     if (is_multisite()) {
         $this->markTestSkipped('Not compatible with multisite mode');
     }
     wp_update_plugins();
     $this->sender->do_sync();
     $updates = $this->server_replica_storage->get_updates('plugins');
     $this->assertFalse(isset($updates->no_update));
     $this->assertTrue(isset($updates->response));
     $this->assertTrue(is_int($updates->last_checked));
 }
开发者ID:automattic,项目名称:jetpack,代码行数:12,代码来源:test_class.jetpack-sync-updates.php

示例5: wp_oracle_get_plugin_updates

 public function wp_oracle_get_plugin_updates()
 {
     if (!function_exists('get_plugin_updates')) {
         require_once ABSPATH . 'wp-admin/includes/update.php';
     }
     // force refresh
     wp_update_plugins();
     $updates = get_plugin_updates();
     if (empty($updates)) {
         return array('blog' => array('plugins' => 'no_updates'));
     } else {
         return $updates;
     }
 }
开发者ID:raqqun,项目名称:wordpress-oracle,代码行数:14,代码来源:class-wordpress-oracle-api-controllers.php

示例6: PluginBuddyUpdater

 function PluginBuddyUpdater(&$parent)
 {
     $this->_parent =& $parent;
     if (empty($this->_parent->_options)) {
         $this->_parent->load();
     }
     $this->_product = strtolower($this->_parent->_var);
     $this->_product = str_replace('ithemes-', '', $this->_product);
     $this->_product = str_replace('pluginbuddy-', '', $this->_product);
     $this->_product = str_replace('pluginbuddy_', '', $this->_product);
     if (!array_key_exists('updater', $this->_parent->_options)) {
         $this->_parent->_options['updater'] = $this->_defaults;
         $this->_parent->save();
     }
     // Generate GUID if needed.
     $this->_guid = get_option($this->_parent->_var . '-updater-guid');
     if ($this->_guid == '') {
         $this->_guid = uniqid('');
         // Empty string needed for PHP 4 compatability.
         add_option($this->_parent->_var . '-updater-guid', $this->_guid, '', false);
         // Create if needed.
         update_option($this->_parent->_var . '-updater-guid', $this->_guid);
         // Update.
     }
     add_action('wp_ajax_ithemes_updater', array(&$this, 'ajax'));
     // Dont put within plugins.php check.
     add_action('update_option__transient_update_plugins', array(&$this, 'old_update_transient_option'));
     // WP 2.8
     add_filter('pre_set_site_transient_update_plugins', array(&$this, 'update_transient_option'));
     // WP 3.0
     if ("plugins.php" == basename($_SERVER['PHP_SELF'])) {
         // Force refreshing of plugins despite last check time.
         if (isset($_GET['pluginbuddy_refresh'])) {
             $this->_parent->_options['updater']['last_check'] = mktime() - 9000;
             $this->_parent->save();
             $option = get_transient('update_plugins');
             $option->last_checked = '0';
             $option = '';
             set_transient('update_plugins', $option);
             set_site_transient('update_plugins', $option);
             wp_update_plugins();
         }
         add_action('after_plugin_row_' . $this->_product . '/' . $this->_product . '.php', array(&$this, 'plugin_row'));
         add_action('plugin_action_links_' . $this->_product . '/' . $this->_product . '.php', array(&$this, 'plugin_links'));
         add_filter('plugin_row_meta', array(&$this, 'plugin_right_links'), 10, 2);
     }
     add_action('install_plugins_pre_plugin-information', array(&$this, 'view_changelog'));
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:48,代码来源:updater.php

示例7: _wprp_get_plugins

/**
 * Return an array of installed plugins
 *
 * @return array
 */
function _wprp_get_plugins()
{
    require_once ABSPATH . '/wp-admin/includes/plugin.php';
    // Get all plugins
    $plugins = get_plugins();
    // Get the list of active plugins
    $active = get_option('active_plugins', array());
    // Delete the transient so wp_update_plugins can get fresh data
    if (function_exists('get_site_transient')) {
        delete_site_transient('update_plugins');
    } else {
        delete_transient('update_plugins');
    }
    // Force a plugin update check
    wp_update_plugins();
    // Different versions of wp store the updates in different places
    // TODO can we depreciate
    if (function_exists('get_site_transient') && ($transient = get_site_transient('update_plugins'))) {
        $current = $transient;
    } elseif ($transient = get_transient('update_plugins')) {
        $current = $transient;
    } else {
        $current = get_option('update_plugins');
    }
    foreach ((array) $plugins as $plugin_file => $plugin) {
        $new_version = isset($current->response[$plugin_file]) ? $current->response[$plugin_file]->new_version : null;
        if (is_plugin_active($plugin_file)) {
            $plugins[$plugin_file]['active'] = true;
        } else {
            $plugins[$plugin_file]['active'] = false;
        }
        if ($new_version) {
            $plugins[$plugin_file]['latest_version'] = $new_version;
            $plugins[$plugin_file]['latest_package'] = $current->response[$plugin_file]->package;
            $plugins[$plugin_file]['slug'] = $current->response[$plugin_file]->slug;
        } else {
            $plugins[$plugin_file]['latest_version'] = $plugin['Version'];
        }
    }
    return $plugins;
}
开发者ID:redferriswheel,项目名称:ZachFonville,代码行数:46,代码来源:wprp.plugins.php

示例8: 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

示例9: showUpdateNotification

 /**
  * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
  * @param string $file
  * @param array $plugin
  */
 public function showUpdateNotification($file, $plugin)
 {
     if (!current_user_can('update_plugins')) {
         return;
     }
     $update_cache = get_site_transient('update_plugins');
     if (!is_object($update_cache)) {
         // refresh update info
         wp_update_plugins();
     }
     $current = $this->getPluginData();
     $info = $this->getLatestVersionInfo();
     if ($info && version_compare($current['Version'], $info->new_version, '<')) {
         // build a plugin list row, with update notification
         $wp_list_table = _get_list_table('WP_Plugins_List_Table');
         echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
         $changelog_link = self_admin_url("index.php?em_import_export_changelog=1&plugin={$info->slug}&slug={$info->slug}&TB_iframe=true");
         printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%3$s">View version %4$s details</a> or <a href="%5$s">update now</a>.'), esc_html($info->name), esc_url($changelog_link), esc_html($info->name), esc_html($info->new_version), esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . EM_IMPEXP_PLUGIN_NAME), 'upgrade-plugin_' . EM_IMPEXP_PLUGIN_NAME)));
         echo '</div></td></tr>';
     }
 }
开发者ID:webaware,项目名称:events-manager-import-export,代码行数:26,代码来源:class.EM_ImpExpUpdates.php

示例10: checkPluginUpdates

 /**
  * Check if any plugins need an update.
  *
  * @return $this
  */
 public function checkPluginUpdates()
 {
     $this->plugin_updates = array();
     if (!function_exists('wp_update_plugins')) {
         require_once ABSPATH . WPINC . '/update.php';
     }
     wp_update_plugins();
     // Check for Plugin updates
     $update_plugins = get_site_transient('update_plugins');
     if ($update_plugins && !empty($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;
             $this->plugin_updates[] = $data;
         }
     }
     return $this;
 }
开发者ID:adams0917,项目名称:woocommerce_eht,代码行数:27,代码来源:wfUpdateCheck.php

示例11: update_page_options

 function update_page_options($args)
 {
     global $pp_default_options;
     do_action('pp_update_options', $args);
     $default_prefix = apply_filters('pp_options_apply_default_prefix', '', $args);
     foreach (explode(',', $_POST['all_options']) as $option_basename) {
         $value = isset($_POST[$option_basename]) ? $_POST[$option_basename] : '';
         if (!is_array($value)) {
             $value = trim($value);
         }
         if ('beta_updates' == $option_basename) {
             if (stripslashes_deep($value) != pp_get_option('beta_updates')) {
                 // force regeneration and buffering of file update urls
                 delete_site_transient('update_plugins');
                 pp_get_version_info(true, false, true);
                 wp_update_plugins();
             }
         }
         pp_update_option($default_prefix . $option_basename, stripslashes_deep($value), $args);
     }
     foreach (explode(',', $_POST['all_otype_options']) as $option_basename) {
         // support stored default values (to apply to any post type which does not have an explicit setting)
         if (isset($_POST[$option_basename][0])) {
             $_POST[$option_basename][''] = $_POST[$option_basename][0];
             unset($_POST[$option_basename][0]);
         }
         $value = isset($pp_default_options[$option_basename]) ? $pp_default_options[$option_basename] : array();
         if ($current = pp_get_option($option_basename)) {
             // retain setting for any types which were previously enabled for filtering but are currently not registered
             $value = array_merge($value, $current);
         }
         if (isset($_POST[$option_basename])) {
             $value = array_merge($value, $_POST[$option_basename]);
         }
         foreach (array_keys($value) as $key) {
             $value[$key] = stripslashes_deep($value[$key]);
         }
         pp_update_option($default_prefix . $option_basename, $value, $args);
     }
     if (!empty($_POST['post_blockage_priority'])) {
         // once this is switched on manually, don't ever default-disable it again
         if (get_option('ppperm_legacy_exception_handling')) {
             delete_option('ppperm_legacy_exception_handling');
             require_once dirname(__FILE__) . '/admin/admin-load_pp.php';
             _pp_dashboard_dismiss_msg();
         }
     }
     if (!empty($_POST['do_group_index_drop'])) {
         if (get_option('pp_need_group_index_drop')) {
             require_once dirname(__FILE__) . '/admin/update_pp.php';
             PP_Updated::do_index_drop(PP_Updated::drop_group_indexes_sql(), 'pp_did_group_index_drop');
             delete_option('pp_need_group_index_drop');
         }
     }
 }
开发者ID:severnrescue,项目名称:web,代码行数:55,代码来源:submittee_pp.php

示例12: update

 protected function update()
 {
     wp_clean_plugins_cache();
     ob_start();
     wp_update_plugins();
     // Check for Plugin updates
     ob_end_clean();
     $update_plugins = get_site_transient('update_plugins');
     if (isset($update_plugins->response)) {
         $plugin_updates_needed = array_keys($update_plugins->response);
     } else {
         $plugin_updates_needed = array();
     }
     $update_attempted = false;
     include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
     // unhook this functions that output things before we send our response header.
     remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20);
     remove_action('upgrader_process_complete', 'wp_version_check');
     remove_action('upgrader_process_complete', 'wp_update_themes');
     $result = false;
     foreach ($this->plugins as $plugin) {
         if (!in_array($plugin, $plugin_updates_needed)) {
             $this->log[$plugin][] = __('No update needed', 'jetpack');
             continue;
         }
         /**
          * Pre-upgrade action
          * 
          * @since 3.9.3
          * 
          * @param array $plugin Plugin data
          * @param array $plugin Array of plugin objects
          * @param bool $updated_attempted false for the first update, true subsequently
          */
         do_action('jetpack_pre_plugin_upgrade', $plugin, $this->plugins, $update_attempted);
         $update_attempted = true;
         // Object created inside the for loop to clean the messages for each plugin
         $skin = new Automatic_Upgrader_Skin();
         // The Automatic_Upgrader_Skin skin shouldn't output anything.
         $upgrader = new Plugin_Upgrader($skin);
         $upgrader->init();
         // This avoids the plugin to be deactivated.
         defined('DOING_CRON') or define('DOING_CRON', true);
         $result = $upgrader->upgrade($plugin);
         $this->log[$plugin][] = $upgrader->skin->get_upgrade_messages();
     }
     if (!$this->bulk && !$result && $update_attempted) {
         return new WP_Error('update_fail', __('There was an error updating your plugin', 'jetpack'), 400);
     }
     return $this->default_action();
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:51,代码来源:class.jetpack-json-api-plugins-modify-endpoint.php

示例13: mail_bank_plugin_autoUpdate

 function mail_bank_plugin_autoUpdate()
 {
     try {
         require_once ABSPATH . "wp-admin/includes/class-wp-upgrader.php";
         require_once ABSPATH . "wp-admin/includes/misc.php";
         define("FS_METHOD", "direct");
         require_once ABSPATH . "wp-includes/update.php";
         require_once ABSPATH . "wp-admin/includes/file.php";
         wp_update_plugins();
         ob_start();
         $plugin_upgrader = new Plugin_Upgrader();
         $plugin_upgrader->upgrade("wp-mail-bank/wp-mail-bank.php");
         $output = @ob_get_contents();
         @ob_end_clean();
     } catch (Exception $e) {
     }
 }
开发者ID:ntnvu,项目名称:tcb_online,代码行数:17,代码来源:wp-mail-bank.php

示例14: HtmlShowOptionsPage


//.........这里部分代码省略.........
			margin:5px;
		}
		
		</style>
	

		<style type="text/css">
	
			.sm-padded .inside {
				margin:12px!important;
			}
			.sm-padded .inside ul {
				margin:6px 0 12px 0;
			}
			
			.sm-padded .inside input {
				padding:1px;
				margin:0;
			}
		</style>


		<div class="wrap" id="sm_div">
			<form method="post" action="<?php 
        echo $this->sg->GetBackLink();
        ?>
">
				<h2><?php 
        _e('XML Sitemap Generator for WordPress', 'sitemap');
        echo " " . $this->sg->GetVersion();
        ?>
 </h2>
				<?php 
        if (function_exists("wp_update_plugins") && (!defined('SM_NO_UPDATE') || SM_NO_UPDATE == false)) {
            wp_update_plugins();
            $file = GoogleSitemapGeneratorLoader::GetBaseName();
            $plugin_data = get_plugin_data(GoogleSitemapGeneratorLoader::GetPluginFile());
            $current = function_exists('get_transient') ? get_transient('update_plugins') : get_option('update_plugins');
            if (isset($current->response[$file])) {
                $r = $current->response[$file];
                ?>
<div id="update-nag" class="sm-update-nag"><?php 
                if (!current_user_can('edit_plugins')) {
                    printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
                } else {
                    if (empty($r->package)) {
                        printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version);
                    } else {
                        printf(__('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.', 'default'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&amp;plugin={$file}", 'upgrade-plugin_' . $file));
                    }
                }
                ?>
</div><?php 
            }
        }
        if (get_option('blog_public') != 1) {
            ?>
<div class="error"><p><?php 
            echo str_replace("%s", "options-privacy.php", __('Your blog is currently blocking search engines! Visit the <a href="%s">privacy settings</a> to change this.', 'sitemap'));
            ?>
</p></div><?php 
        }
        ?>

					<?php 
        if (!$snl) {
开发者ID:songsanren,项目名称:My-blog,代码行数:67,代码来源:sitemap-ui.php

示例15: install_plugin_install_status

/**
 * Determine the status we can perform on a plugin.
 *
 * @since 3.0.0
 */
function install_plugin_install_status($api, $loop = false)
{
    // this function is called recursively, $loop prevents further loops.
    if (is_array($api)) {
        $api = (object) $api;
    }
    //Default to a "new" plugin
    $status = 'install';
    $url = false;
    //Check to see if this plugin is known to be installed, and has an update awaiting it.
    $update_plugins = get_site_transient('update_plugins');
    if (isset($update_plugins->response)) {
        foreach ((array) $update_plugins->response as $file => $plugin) {
            if ($plugin->slug === $api->slug) {
                $status = 'update_available';
                $update_file = $file;
                $version = $plugin->new_version;
                if (current_user_can('update_plugins')) {
                    $url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
                }
                break;
            }
        }
    }
    if ('install' == $status) {
        if (is_dir(WP_PLUGIN_DIR . '/' . $api->slug)) {
            $installed_plugin = get_plugins('/' . $api->slug);
            if (empty($installed_plugin)) {
                if (current_user_can('install_plugins')) {
                    $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
                }
            } else {
                $key = array_shift($key = array_keys($installed_plugin));
                //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
                if (version_compare($api->version, $installed_plugin[$key]['Version'], '=')) {
                    $status = 'latest_installed';
                } elseif (version_compare($api->version, $installed_plugin[$key]['Version'], '<')) {
                    $status = 'newer_installed';
                    $version = $installed_plugin[$key]['Version'];
                } else {
                    //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
                    if (!$loop) {
                        delete_site_transient('update_plugins');
                        wp_update_plugins();
                        return install_plugin_install_status($api, true);
                    }
                }
            }
        } else {
            // "install" & no directory with that slug
            if (current_user_can('install_plugins')) {
                $url = wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
            }
        }
    }
    if (isset($_GET['from'])) {
        $url .= '&amp;from=' . urlencode(wp_unslash($_GET['from']));
    }
    return compact('status', 'url', 'version');
}
开发者ID:jcsilkey,项目名称:CodeReviewSecurityRepo,代码行数:65,代码来源:plugin-install.php


注:本文中的wp_update_plugins函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。