本文整理汇总了PHP中get_plugin_updates函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_updates函数的具体用法?PHP get_plugin_updates怎么用?PHP get_plugin_updates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_plugin_updates函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare_items
/**
* Prepares the list of items for displaying.
*
* @access public
* @since 4.X.0
* @uses WP_List_Table::set_pagination_args()
*/
public function prepare_items()
{
global $wp_version;
$this->cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
$core_updates = (array) get_core_updates();
$plugins = (array) get_plugin_updates();
$themes = (array) get_theme_updates();
$translations = (array) wp_get_translation_updates();
if (!empty($core_updates)) {
$this->items[] = array('type' => 'core', 'slug' => 'core', 'data' => $core_updates);
}
foreach ($plugins as $plugin_file => $plugin_data) {
$this->items[] = array('type' => 'plugin', 'slug' => $plugin_file, 'data' => $plugin_data);
}
foreach ($themes as $stylesheet => $theme) {
$this->items[] = array('type' => 'theme', 'slug' => $stylesheet, 'data' => $theme);
}
if (!empty($translations)) {
$this->items[] = array('type' => 'translations', 'slug' => 'translations', 'data' => $translations);
}
if (!isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare($core_updates[0]->current, $this->cur_wp_version, '=')) {
$this->core_update_version = false;
} else {
$this->core_update_version = $core_updates[0]->current;
}
if ($this->core_update_version || !empty($plugins) || !empty($themes) || !empty($translations)) {
$this->has_available_updates = true;
}
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->set_pagination_args(array('total_items' => count($this->items), 'per_page' => count($this->items), 'total_pages' => 1));
}
示例2: run
public function run()
{
if (!function_exists('get_plugins')) {
require_once \WP_CLI::get_config('path') . '/wp-admin/includes/plugin.php';
}
$all_plugins = get_plugins();
$update = get_plugin_updates();
$report = array();
foreach ($all_plugins as $plugin_path => $data) {
$slug = $plugin_path;
if (stripos($plugin_path, '/')) {
$slug = substr($plugin_path, 0, stripos($plugin_path, '/'));
}
$vulnerable = $this->is_vulnerable($slug, $data['Version']);
$needs_update = 0;
$available = '-';
if (isset($update[$plugin_path])) {
$needs_update = 1;
$available = $update[$plugin_path]->update->new_version;
}
if (false === $vulnerable) {
$vulnerable = "None";
} else {
$vulnerable = sprintf('<a href="https://wpvulndb.com/plugins/%s" target="_blank" >more info</a>', $slug);
}
$report[$slug] = array('slug' => $slug, 'installed' => (string) $data['Version'], 'available' => (string) $available, 'needs_update' => (string) $needs_update, 'vulnerable' => $vulnerable);
}
$this->alerts = $report;
}
示例3: ubermenu_updater_check_download_notice
function ubermenu_updater_check_download_notice()
{
global $pagenow;
if ($pagenow == 'update-core.php') {
if (!UBERMENU_AUTO_UPDATES) {
//echo 'no ups';
$plugin_updates = get_plugin_updates();
//uberp( $plugin_updates , 3 );
if (isset($plugin_updates['ubermenu/ubermenu.php'])) {
?>
<div class="notice notice-warning">
<p><strong>UberMenu</strong> automatic updates are in beta. To test them out, please see <a target="_blank" href="http://sevenspark.com/docs/ubermenu-3/updates/automatic">Automatic Updates</a>. Make sure to run a backup first!</p>
</div>
<?php
}
} else {
$plugin_updates = get_plugin_updates();
//uberp( $plugin_updates , 3 );
if (isset($plugin_updates['ubermenu/ubermenu.php'])) {
?>
<div class="notice notice-success">
<p><strong>UberMenu</strong> Automatic Update Beta Testing has been activated. <a target="_blank" href="http://sevenspark.com/docs/ubermenu-3/updates/automatic">Make sure to run a backup first to be safe!</a></p>
</div>
<?php
}
}
}
}
示例4: change_details_url
public function change_details_url()
{
global $change_details_plugin_url_script, $pagenow;
$plugins = get_plugin_updates();
if (!$change_details_plugin_url_script && in_array($pagenow, array('update-core.php', 'plugins.php')) && !empty($plugins)) {
$plugins_string = '';
foreach ($plugins as $plugin_key => $plugin_value) {
if (strpos($plugin_key, 'cherry-') !== false) {
$plugins_string .= '"' . $plugin_value->update->slug . '" : "' . $plugin_value->update->url . '", ';
}
}
?>
<script>
( function( $ ){
var plugin_updates = {<?php
echo $plugins_string;
?>
};
for ( var plugin in plugin_updates ) {
$('[href*="' + plugin + '"].thickbox').removeClass('thickbox').attr( {'href': plugin_updates[plugin], 'target' : "_blank" } );
};
}( jQuery ) )
</script>
<?php
}
$change_details_plugin_url_script = true;
}
示例5: check_plugins
function check_plugins()
{
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$plugins = get_plugin_updates();
if (!empty($plugins)) {
foreach ((array) $plugins as $plugin_file => $plugin_data) {
plugins_api('plugin_information', array('slug' => $plugin_data->update->slug));
}
WP_CLI::success('Plugin updates refreshed.');
} else {
WP_CLI::log('All plugins are up to date.');
}
}
示例6: header
function header()
{
echo '<div class="wrap">';
screen_icon();
echo '<h2>' . __('WP E-Commerce To WooCommerce Converter', 'woo_wpec') . '</h2>';
$updates = get_plugin_updates();
$basename = plugin_basename(__FILE__);
if (isset($updates[$basename])) {
$update = $updates[$basename];
echo '<div class="error"><p><strong>';
printf(__('A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files.', 'woo_wpec'), $update->update->new_version);
echo '</strong></p></div>';
}
}
示例7: 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;
}
}
示例8: show_updates_in_header
/**
* Show an update notice in the importer header.
*/
public function show_updates_in_header()
{
// Check for updates too.
$updates = get_plugin_updates();
$basename = plugin_basename(__FILE__);
if (empty($updates[$basename])) {
return;
}
$message = sprintf(esc_html__('A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files.', 'wordpress-importer'), $updates[$basename]->update->new_version);
$args = array('action' => 'upgrade-plugin', 'plugin' => $basename);
$url = add_query_arg($args, self_admin_url('update.php'));
$url = wp_nonce_url($url, 'upgrade-plugin_' . $basename);
$link = sprintf('<a href="%s" class="button">%s</a>', $url, esc_html__('Update Now', 'wordpress-importer'));
printf('<div class="error"><p>%s</p><p>%s</p></div>', $message, $link);
}
示例9: layerslider_update_notice
function layerslider_update_notice()
{
if (get_option('layerslider-authorized-site', false)) {
// Get plugin updates
$updates = get_plugin_updates();
// Check for update
if (isset($updates[LS_PLUGIN_BASE]) && isset($updates[LS_PLUGIN_BASE]->update)) {
$update = $updates[LS_PLUGIN_BASE];
add_thickbox();
?>
<div class="layerslider_notice">
<img src="<?php
echo LS_ROOT_URL . '/static/img/ls_80x80.png';
?>
" alt="LayerSlider icon">
<h1><?php
_e('An update is available for LayerSlider WP!', 'LayerSlider');
?>
</h1>
<p>
<?php
echo sprintf(__('You have version %1$s. Update to version %2$s.', 'LayerSlider'), $update->Version, $update->update->new_version);
?>
<br>
<i><?php
echo $update->update->upgrade_notice;
?>
</i>
<a href="<?php
echo wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=' . LS_PLUGIN_BASE), 'upgrade-plugin_' . LS_PLUGIN_BASE);
?>
" class="button button-primary button-hero" title="<?php
_e('Install now', 'LayerSlider');
?>
">
<?php
_e('Install now', 'LayerSlider');
?>
</a>
</p>
<div class="clear"></div>
</div>
<?php
}
}
}
示例10: cart66_add_dashboard_widgets
public static function cart66_add_dashboard_widgets()
{
if (Cart66Common::cart66UserCan('orders')) {
wp_add_dashboard_widget('cart66_recent_orders_widget', __('Cart66 Recent Orders', 'cart66'), array('Cart66Dashboard', 'cart66_recent_orders_widget'), array('Cart66Dashboard', 'cart66_recent_orders_setup'));
}
if (Cart66Common::cart66UserCan('reports')) {
wp_add_dashboard_widget('cart66_statistics_widget', __('Cart66 Statistics', 'cart66'), array('Cart66Dashboard', 'cart66_statistics_widget'));
}
global $wp_meta_boxes;
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
$cart66_recent_orders_widget_backup = array();
$cart66_statistics_widget_backup = array();
if (Cart66Common::cart66UserCan('orders')) {
$cart66_recent_orders_widget_backup = array('cart66_recent_orders_widget' => $normal_dashboard['cart66_recent_orders_widget']);
unset($normal_dashboard['cart66_recent_orders_widget']);
}
if (Cart66Common::cart66UserCan('reports')) {
$cart66_statistics_widget_backup = array('cart66_statistics_widget' => $normal_dashboard['cart66_statistics_widget']);
unset($normal_dashboard['cart66_statistics_widget']);
}
$sorted_dashboard = array_merge($cart66_recent_orders_widget_backup, $cart66_statistics_widget_backup, $normal_dashboard);
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
if (CART66_PRO) {
$updater = new Cart66ProCommon();
$newVersion = get_transient('_cart66_version_request');
if (!$newVersion) {
$newVersion = $updater->getVersionInfo();
set_transient('_cart66_version_request', $newVersion, 43200);
}
$dismissVersion = Cart66Setting::getValue('dismiss_version');
$currentVersion = Cart66Setting::getValue('version');
if (version_compare($currentVersion, $newVersion['version'], '<') && version_compare($newVersion['version'], $dismissVersion, '>')) {
if (current_user_can('update_plugins')) {
$plugins = get_plugin_updates();
if (isset($plugins[basename(CART66_PATH) . '/cart66.php'])) {
add_action('admin_footer', array('Cart66Dashboard', 'cart66_upgrade_message_jquery'));
add_action('admin_notices', array('Cart66Dashboard', 'cart66_upgrade_message'));
}
}
}
}
}
示例11: layerslider_update_notice
function layerslider_update_notice()
{
// Get plugin updates
$updates = get_plugin_updates();
// Check for update
if (isset($updates[LS_PLUGIN_BASE]) && isset($updates[LS_PLUGIN_BASE]->update)) {
$update = $updates[LS_PLUGIN_BASE];
add_thickbox();
?>
<div class="layerslider_notice">
<img src="<?php
echo LS_ROOT_URL . '/static/img/ls_80x80.png';
?>
" alt="LayerSlider icon">
<h1><?php
_e('An update is available for LayerSlider WP!', 'LayerSlider');
?>
</h1>
<p>
<?php
echo sprintf(__('You have version %1$s. Update to version %2$s.', 'LayerSlider'), $update->Version, $update->update->new_version);
?>
<br>
<i><?php
echo $update->update->upgrade_notice;
?>
</i>
<a href="plugin-install.php?tab=plugin-information&plugin=LayerSlider§ion=changelog&TB_iframe=true&width=640&height=747" class="thickbox">
<?php
_e('Review changes & Install', 'LayerSlider');
?>
</a>
</p>
<div class="clear"></div>
</div>
<?php
}
}
示例12: list_plugin_updates
function list_plugin_updates()
{
global $wp_version;
$cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$plugins = get_plugin_updates();
if (empty($plugins)) {
echo '<h3>' . __('Plugins') . '</h3>';
echo '<p>' . __('Your plugins are all up to date.') . '</p>';
return;
}
$form_action = 'update-core.php?action=do-plugin-upgrade';
$core_updates = get_core_updates();
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, '=')) {
$core_update_version = false;
} else {
$core_update_version = $core_updates[0]->current;
}
?>
<h3><?php
_e('Plugins');
?>
</h3>
<p><?php
_e('The following plugins have new versions available. Check the ones you want to update and then click “Update Plugins”.');
?>
</p>
<form method="post" action="<?php
echo $form_action;
?>
" name="upgrade-plugins" class="upgrade">
<?php
wp_nonce_field('upgrade-core');
?>
<p><input id="upgrade-plugins" class="button" type="submit" value="<?php
esc_attr_e('Update Plugins');
?>
" name="upgrade" /></p>
<table class="widefat" cellspacing="0" id="update-plugins-table">
<thead>
<tr>
<th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></th>
<th scope="col" class="manage-column"><label for="plugins-select-all"><?php
_e('Select All');
?>
</label></th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></th>
<th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php
_e('Select All');
?>
</label></th>
</tr>
</tfoot>
<tbody class="plugins">
<?php
foreach ((array) $plugins as $plugin_file => $plugin_data) {
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug));
// Get plugin compat for running version of WordPress.
if (isset($info->tested) && version_compare($info->tested, $cur_wp_version, '>=')) {
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
} elseif (isset($info->compatibility[$cur_wp_version][$plugin_data->update->new_version])) {
$compat = $info->compatibility[$cur_wp_version][$plugin_data->update->new_version];
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat[0], $compat[2], $compat[1]);
} else {
$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
}
// Get plugin compat for updated version of WordPress.
if ($core_update_version) {
if (isset($info->compatibility[$core_update_version][$plugin_data->update->new_version])) {
$update_compat = $info->compatibility[$core_update_version][$plugin_data->update->new_version];
$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat[0], $update_compat[2], $update_compat[1]);
} else {
$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
}
}
// Get the upgrade notice for the new plugin version.
if (isset($plugin_data->update->upgrade_notice)) {
$upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
} else {
$upgrade_notice = '';
}
echo "\r\n\t<tr class='active'>\r\n\t\t<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>\r\n\t\t<td class='plugin-title'><strong>{$plugin_data->Name}</strong>" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . $compat . $upgrade_notice . "</td>\r\n\t</tr>";
}
?>
</tbody>
</table>
<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php
esc_attr_e('Update Plugins');
?>
" name="upgrade" /></p>
</form>
<?php
}
示例13: getSiteStats
//.........这里部分代码省略.........
$informationPremiumUpdatesLength = count($informationPremiumUpdates);
for ($i = 0; $i < $informationPremiumUpdatesLength; $i++) {
if (!isset($informationPremiumUpdates[$i]['new_version'])) {
continue;
}
$slug = isset($informationPremiumUpdates[$i]['slug']) ? $informationPremiumUpdates[$i]['slug'] : $informationPremiumUpdates[$i]['Name'];
if ('plugin' === $informationPremiumUpdates[$i]['type']) {
$premiumPlugins[] = $slug;
} else {
if ('theme' === $informationPremiumUpdates[$i]['type']) {
$premiumThemes[] = $slug;
}
}
$new_version = $informationPremiumUpdates[$i]['new_version'];
unset($informationPremiumUpdates[$i]['old_version']);
unset($informationPremiumUpdates[$i]['new_version']);
$information['premium_updates'][$slug] = $informationPremiumUpdates[$i];
$information['premium_updates'][$slug]['update'] = (object) array('new_version' => $new_version, 'premium' => true, 'slug' => $slug);
if (!in_array($slug, $premiumUpdates)) {
$premiumUpdates[] = $slug;
}
}
MainWP_Helper::update_option('mainwp_premium_updates', $premiumUpdates);
}
remove_filter('default_option_active_plugins', array(&$this, 'default_option_active_plugins'));
remove_filter('option_active_plugins', array(&$this, 'default_option_active_plugins'));
if (null !== $this->filterFunction) {
add_filter('pre_site_transient_update_plugins', $this->filterFunction, 99);
}
global $wp_current_filter;
$wp_current_filter[] = 'load-plugins.php';
@wp_update_plugins();
include_once ABSPATH . '/wp-admin/includes/plugin.php';
$plugin_updates = get_plugin_updates();
if (is_array($plugin_updates)) {
$information['plugin_updates'] = array();
foreach ($plugin_updates as $slug => $plugin_update) {
if (in_array($plugin_update->Name, $premiumPlugins)) {
continue;
}
$information['plugin_updates'][$slug] = $plugin_update;
}
}
if (null !== $this->filterFunction) {
remove_filter('pre_site_transient_update_plugins', $this->filterFunction, 99);
}
if (null !== $this->filterFunction) {
add_filter('pre_site_transient_update_themes', $this->filterFunction, 99);
}
@wp_update_themes();
include_once ABSPATH . '/wp-admin/includes/theme.php';
$theme_updates = $this->upgrade_get_theme_updates();
if (is_array($theme_updates)) {
$information['theme_updates'] = array();
foreach ($theme_updates as $slug => $theme_update) {
$name = is_array($theme_update) ? $theme_update['Name'] : $theme_update->Name;
if (in_array($name, $premiumThemes)) {
continue;
}
$information['theme_updates'][$slug] = $theme_update;
}
}
if (null !== $this->filterFunction) {
remove_filter('pre_site_transient_update_themes', $this->filterFunction, 99);
}
$information['recent_comments'] = $this->get_recent_comments(array('approve', 'hold'), 5);
示例14: set_plugin_version
/**
* Set the plugin version if not a registered plugin with options['installed_version'] set.
*
* @param $slug
* @return string
*/
function set_plugin_version($slug)
{
$version = '00.00.001';
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$plugins = get_plugin_updates();
foreach ((array) $plugins as $plugin_file => $plugin_data) {
if ($plugin_data->update->slug === $slug) {
$version = $plugin_data->Version;
break;
}
}
return $version;
}
示例15: header
function header()
{
echo '<div class="wrap">';
global $wp_version;
if (version_compare($wp_version, '3.8', '<')) {
//sc reen_icon();
}
echo '<h2>' . __('Import WordPress', 'wordpress-importer') . '</h2>';
$updates = get_plugin_updates();
$basename = plugin_basename(__FILE__);
if (isset($updates[$basename])) {
$update = $updates[$basename];
echo '<div class="error"><p><strong>';
printf(__('A new version of this importer is available. Please update to version %s to ensure compatibility with newer export files.', 'wordpress-importer'), $update->update->new_version);
echo '</strong></p></div>';
}
}