本文整理汇总了PHP中get_plugin_updates函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_updates函数的具体用法?PHP get_plugin_updates怎么用?PHP get_plugin_updates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_plugin_updates函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:ethitter,项目名称:shiny-updates,代码行数:41,代码来源:class-shiny-updates-list-table.php
示例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;
}
开发者ID:zepner,项目名称:wp_launch_check,代码行数:29,代码来源:plugins.php
示例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
}
}
}
}
开发者ID:Wordpress-Development,项目名称:Installation-Setup,代码行数:28,代码来源:updater.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;
}
开发者ID:roberto-alarcon,项目名称:Neuroglobal,代码行数:27,代码来源:class-cherry-plugin-update.php
示例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.');
}
}
开发者ID:aaemnnosttv,项目名称:wp-cli-updates-command,代码行数:13,代码来源:wp-cli-updates-command.php
示例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>';
}
}
开发者ID:sammykumar,项目名称:goodbeads,代码行数:14,代码来源:woocommerce-wpec-converter.php
示例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;
}
}
开发者ID:raqqun,项目名称:wordpress-oracle,代码行数:14,代码来源:class-wordpress-oracle-api-controllers.php
示例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);
}
开发者ID:kucrut,项目名称:WordPress-Importer,代码行数:18,代码来源:class-wxr-import-ui.php
示例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
}
}
}
开发者ID:RDePoppe,项目名称:luminaterealestate,代码行数:46,代码来源:notices.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'));
}
}
}
}
}
开发者ID:rbredow,项目名称:allyzabbacart,代码行数:42,代码来源:Cart66Dashboard.php
示例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
}
}
开发者ID:chowy1026,项目名称:jenny,代码行数:38,代码来源:notices.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
}
开发者ID:laiello,项目名称:cartonbank,代码行数:98,代码来源:update-core.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);
开发者ID:jexmex,项目名称:mainwp-child,代码行数:67,代码来源:class-mainwp-child.php
示例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;
}
开发者ID:ashissh200025,项目名称:store-locator-le,代码行数:19,代码来源:class.updates.php
示例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>';
}
}
开发者ID:Angelpm28,项目名称:ong-canada,代码行数:17,代码来源:wordpress-importer.php
示例16: get_plugin_updates
protected function get_plugin_updates($plugin_file)
{
$plugin_updates = get_plugin_updates();
if (isset($plugin_updates[$plugin_file])) {
return $plugin_updates[$plugin_file]->update;
}
return null;
}
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:8,代码来源:class.jetpack-json-api-plugins-endpoint.php
示例17: sucuriscan_posthack_updates_content
/**
* Retrieve the information for the available updates.
*
* @return string HTML code for a table with the updates information.
*/
function sucuriscan_posthack_updates_content($send_email = false)
{
if (!function_exists('wp_update_plugins') || !function_exists('get_plugin_updates') || !function_exists('wp_update_themes') || !function_exists('get_theme_updates')) {
return false;
}
$response = '';
$result = wp_update_plugins();
$updates = get_plugin_updates();
if (is_array($updates) && !empty($updates)) {
$counter = 0;
foreach ($updates as $data) {
$css_class = $counter % 2 == 0 ? '' : 'alternate';
$params = array('Update.CssClass' => $css_class, 'Update.IconType' => 'plugins', 'Update.Extension' => SucuriScan::excerpt($data->Name, 35), 'Update.Version' => $data->Version, 'Update.NewVersion' => 'Unknown', 'Update.TestedWith' => 'Unknown', 'Update.ArchiveUrl' => 'Unknown', 'Update.MarketUrl' => 'Unknown');
if (property_exists($data->update, 'new_version')) {
$params['Update.NewVersion'] = $data->update->new_version;
}
if (property_exists($data->update, 'tested')) {
$params['Update.TestedWith'] = "WordPress " . $data->update->tested;
}
if (property_exists($data->update, 'package')) {
$params['Update.ArchiveUrl'] = $data->update->package;
}
if (property_exists($data->update, 'url')) {
$params['Update.MarketUrl'] = $data->update->url;
}
$response .= SucuriScanTemplate::getSnippet('posthack-updates', $params);
$counter++;
}
}
// Check for available theme updates.
$result = wp_update_themes();
$updates = get_theme_updates();
if (is_array($updates) && !empty($updates)) {
$counter = 0;
foreach ($updates as $data) {
$css_class = $counter % 2 == 0 ? '' : 'alternate';
$response .= SucuriScanTemplate::getSnippet('posthack-updates', array('Update.CssClass' => $css_class, 'Update.IconType' => 'appearance', 'Update.Extension' => SucuriScan::excerpt($data->Name, 35), 'Update.Version' => $data->Version, 'Update.NewVersion' => $data->update['new_version'], 'Update.TestedWith' => 'Newest WordPress', 'Update.ArchiveUrl' => $data->update['package'], 'Update.MarketUrl' => $data->update['url']));
$counter++;
}
}
if (!is_string($response) || empty($response)) {
return false;
}
// Send an email notification with the affected files.
if ($send_email === true) {
$params = array('AvailableUpdates.Content' => $response);
$content = SucuriScanTemplate::getSection('posthack-updates-notification', $params);
$sent = SucuriScanEvent::notify_event('available_updates', $content);
return $sent;
}
return $response;
}
开发者ID:Sucuri,项目名称:sucuri-wordpress-plugin,代码行数:57,代码来源:sucuri.php
示例18: list_plugin_updates
/**
*
* @global string $wp_version
*/
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 '<h2>' . __('Plugins') . '</h2>';
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;
}
?>
<h2><?php
_e('Plugins');
?>
</h2>
<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 esc_url($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" id="update-plugins-table">
<thead>
<tr>
<td scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
<th scope="col" class="manage-column"><label for="plugins-select-all"><?php
_e('Select All');
?>
</label></th>
</tr>
</thead>
<tbody class="plugins">
<?php
foreach ((array) $plugins as $plugin_file => $plugin_data) {
$info = plugins_api('plugin_information', array('slug' => $plugin_data->update->slug, 'fields' => array('short_description' => false, 'sections' => false, 'requires' => false, 'rating' => false, 'ratings' => false, 'downloaded' => false, 'downloadlink' => false, 'last_updated' => false, 'added' => false, 'tags' => false, 'homepage' => false, 'donate_link' => false)));
if (is_wp_error($info)) {
$info = false;
}
// 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->tested) && version_compare($info->tested, $core_update_version, '>=')) {
$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $core_update_version);
} elseif (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 = '';
}
$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662');
$details_text = sprintf(__('View version %1$s details.'), $plugin_data->update->new_version);
$details = sprintf('<a href="%1$s" class="thickbox" title="%2$s">%3$s</a>', esc_url($details_url), esc_attr($plugin_data->Name), $details_text);
echo "\n\t<tr>\n\t\t<th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>\n\t\t<td><p><strong>{$plugin_data->Name}</strong><br />" . sprintf(__('You have version %1$s installed. Update to %2$s.'), $plugin_data->Version, $plugin_data->update->new_version) . ' ' . $details . $compat . $upgrade_notice . "</p></td>\n\t</tr>";
}
?>
</tbody>
<tfoot>
<tr>
<td scope="col" class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
<th scope="col" class="manage-column"><label for="plugins-select-all-2"><?php
_e('Select All');
?>
//.........这里部分代码省略.........
开发者ID:leonardopires,项目名称:projectnami,代码行数:101,代码来源:update-core.php
示例19: get_system_info
/**
* Get system info
*
* @since 2.0
* @access public
* @global object $wpdb Used to query the database using the WordPress Database API
* @return string $return A string containing the info to output
*/
public static function get_system_info()
{
global $wpdb;
// Get theme info
$theme_data = wp_get_theme();
$theme = $theme_data->Name . ' ' . $theme_data->Version;
// Try to identify the hosting provider
$host = self::get_host();
$return = '### Begin System Info ###' . "\n\n";
// Start with the basics...
$return .= '-- Site Info' . "\n\n";
$return .= 'Site URL: ' . site_url() . "\n";
$return .= 'Home URL: ' . home_url() . "\n";
$return .= 'Multisite: ' . (is_multisite() ? 'Yes' : 'No') . "\n";
// Can we determine the site's host?
if ($host) {
$return .= "\n" . '-- Hosting Provider' . "\n\n";
$return .= 'Host: ' . $host . "\n";
}
// WordPress configuration
$return .= "\n" . '-- WordPress Configuration' . "\n\n";
$return .= 'Version: ' . get_bloginfo('version') . "\n";
$return .= 'Language: ' . (defined('WPLANG') && WPLANG ? WPLANG : 'en_US') . "\n";
$return .= 'Permalink Structure: ' . (get_option('permalink_structure') ? get_option('permalink_structure') : 'Default') . "\n";
$return .= 'Active Theme: ' . $theme . "\n";
$return .= 'Show On Front: ' . get_option('show_on_front') . "\n";
// Only show page specs if frontpage is set to 'page'
if (get_option('show_on_front') == 'page') {
$front_page_id = get_option('page_on_front');
$blog_page_id = get_option('page_for_posts');
$return .= 'Page On Front: ' . ($front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset') . "\n";
$return .= 'Page For Posts: ' . ($blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset') . "\n";
}
$return .= 'ABSPATH: ' . ABSPATH . "\n";
// Make sure wp_remote_post() is working
$request['cmd'] = '_notify-validate';
$params = array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'SS_System_Info/', 'body' => $request);
$response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', $params);
if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
$WP_REMOTE_POST = 'wp_remote_post() works';
} else {
$WP_REMOTE_POST = 'wp_remote_post() does not work';
}
$return .= 'Remote Post: ' . $WP_REMOTE_POST . "\n";
$return .= 'Table Prefix: ' . 'Length: ' . strlen($wpdb->prefix) . ' Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable') . "\n";
$return .= 'WP_DEBUG: ' . (defined('WP_DEBUG') ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set') . "\n";
$return .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n";
$return .= 'Registered Post Stati: ' . implode(', ', get_post_stati()) . "\n";
// Get plugins that have an update
$updates = get_plugin_updates();
// Must-use plugins
// NOTE: MU plugins can't show updates!
$muplugins = get_mu_plugins();
if (count($muplugins) > 0) {
$return .= "\n" . '-- Must-Use Plugins' . "\n\n";
foreach ($muplugins as $plugin => $plugin_data) {
$return .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n";
}
$return = apply_filters('edd_sysinfo_after_wordpress_mu_plugins', $return);
}
// WordPress active plugins
$return .= "\n" . '-- WordPress Active Plugins' . "\n\n";
$plugins = get_plugins();
|
请发表评论