Exemplo n.º 1
0
/**
* Infuse plugin update details when WordPress runs its update checker.
*
* @since 1.8.5
*
* @param object $value  The WordPress update object.
* @return object $value Amended WordPress update object on success, default if object is empty.
*/
function pmpro_update_plugins_filter($value)
{
    // If no update object exists, return early.
    if (empty($value)) {
        return $value;
    }
    // get addon information
    $addons = pmpro_getAddons();
    // no addons?
    if (empty($addons)) {
        return $value;
    }
    //check addons
    foreach ($addons as $addon) {
        //skip wordpress.org plugins
        if (empty($addon['License']) || $addon['License'] == 'wordpress') {
            continue;
        }
        //get data for plugin
        $plugin_file = $addon['Slug'] . '/' . $addon['Slug'] . '.php';
        $plugin_file_abs = ABSPATH . 'wp-content/plugins/' . $plugin_file;
        //couldn't find plugin, skip
        if (!file_exists($plugin_file_abs)) {
            continue;
        } else {
            $plugin_data = get_plugin_data($plugin_file_abs, false, true);
        }
        //compare versions
        if (!empty($addon['License']) && version_compare($plugin_data['Version'], $addon['Version'], '<')) {
            $value->response[$plugin_file] = pmpro_getPluginAPIObjectFromAddon($addon);
            $value->response[$plugin_file]->new_version = $addon['Version'];
        }
    }
    // Return the update object.
    return $value;
}
Exemplo n.º 2
0
    die(__("You do not have permissions to perform this action.", "pmpro"));
}
global $wpdb, $msg, $msgt, $pmpro_addons;
wp_enqueue_script('plugin-install');
add_thickbox();
wp_enqueue_script('updates');
require_once dirname(__FILE__) . "/admin_header.php";
//force a check of plugin versions?
if (!empty($_REQUEST['force-check'])) {
    wp_version_check(array(), true);
    wp_update_plugins();
    $pmpro_license_key = get_option("pmpro_license_key", "");
    pmpro_license_isValid($pmpro_license_key, NULL, true);
}
//some vars
$addons = pmpro_getAddons();
$addons_timestamp = get_option("pmpro_addons_timestamp", false);
$plugin_info = get_site_transient('update_plugins');
$pmpro_license_key = get_option("pmpro_license_key", "");
//get plugin status for filters
if (!empty($_REQUEST['plugin_status'])) {
    $status = $_REQUEST['plugin_status'];
}
//make sure we have an approved status
$approved_statuses = array('all', 'active', 'inactive', 'update', 'uninstalled');
if (empty($status) || !in_array($status, $approved_statuses)) {
    $status = "all";
}
//split addons into groups for filtering
$addons_all = $addons;
$addons_active = array();