示例#1
0
 * Uninstall AffiliateWP
 *
 * @package     AffiliateWP
 * @subpackage  Uninstall
 * @copyright   Copyright (c) 2014, Pippin Williamson
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       1.0
 */
// Exit if accessed directly
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
// Load AffiliateWP file
include_once 'affiliate-wp.php';
global $wpdb, $wp_roles;
$affiliate_wp_settings = new Affiliate_WP_Settings();
if ($affiliate_wp_settings->get('uninstall_on_delete')) {
    // Remove the affiliate area page
    wp_delete_post($affiliate_wp_settings->get('affiliates_page'));
    // Remove all plugin settings
    delete_option('affwp_settings');
    // Remove all capabilities and roles
    $caps = new Affiliate_WP_Capabilities();
    $caps->remove_caps();
    // Remove all database tables
    $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "affiliate_wp_affiliates");
    $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "affiliate_wp_referrals");
    $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "affiliate_wp_visits");
    $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "affiliate_wp_creatives");
    $wpdb->query("DROP VIEW " . $wpdb->prefix . "affiliate_wp_campaigns");
}
示例#2
0
 /**
  * Plugin Updater
  *
  * @access private
  * @since 1.0
  * @return void
  */
 private function updater()
 {
     if (!is_admin() || !class_exists('AFFWP_Plugin_Updater')) {
         return;
     }
     $license_key = $this->settings->get('license_key');
     // setup the updater
     $affwp_updater = new AFFWP_Plugin_Updater('http://affiliatewp.com', __FILE__, array('version' => AFFILIATEWP_VERSION, 'license' => $license_key, 'item_name' => 'AffiliateWP', 'item_id' => 17, 'author' => 'Pippin Williamson'));
 }