/**
  * Class constructor
  *
  * @global  array $mashsb_options
  * @param string  $_file
  * @param string  $_item_name
  * @param string  $_version
  * @param string  $_author
  * @param string  $_optname
  * @param string  $_api_url
  */
 function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null)
 {
     global $mashsb_options;
     $this->file = $_file;
     $this->item_name = $_item_name;
     $this->item_shortname = 'mashsb_' . preg_replace('/[^a-zA-Z0-9_\\s]/', '', str_replace(' ', '_', strtolower($this->item_name)));
     $this->version = $_version;
     $this->license = isset($mashsb_options[$this->item_shortname . '_license_key']) ? trim($mashsb_options[$this->item_shortname . '_license_key']) : '';
     $this->author = $_author;
     $this->api_url = is_null($_api_url) ? $this->api_url : $_api_url;
     /**
      * Allows for backwards compatibility with old license options,
      * i.e. if the plugins had license key fields previously, the license
      * handler will automatically pick these up and use those in lieu of the
      * user having to reactive their license.
      */
     if (!empty($_optname)) {
         $opt = mashsb_get_option($_optname, false);
         if (isset($opt) && empty($this->license)) {
             $this->license = trim($opt);
         }
     }
     // Setup hooks
     $this->includes();
     $this->hooks();
     //$this->auto_updater();
 }
Esempio n. 2
0
 * Uninstall Mashshare
 *
 * @package     MASHSB
 * @subpackage  Uninstall
 * @copyright   Copyright (c) 2014, René Hermenau
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       2.0.0
 */
// Exit if accessed directly
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
// Load MASHSB file
include_once 'mashshare.php';
global $wpdb, $mashsb_options;
if (mashsb_get_option('uninstall_on_delete')) {
    /** Delete all the Plugin Options */
    delete_option('mashsb_settings');
    delete_option('mashsb_networks');
    delete_option('mashsb_installDate');
    delete_option('mashsb_RatingDiv');
    delete_option('mashsb_version');
    delete_option('mashsb_version_upgraded_from');
    delete_option('mashsb_update_notice');
    delete_option('mashsb_tracking_notice');
    delete_option('widget_mashsb_mostshared_posts_widget');
    delete_option('mashsb_tracking_last_send');
    delete_option('mashsb_update_notice_101');
    /* Delete all post meta options */
    delete_post_meta_by_key('mashsb_timestamp');
    delete_post_meta_by_key('mashsb_shares');
Esempio n. 3
0
 /**
  * Display the admin notice to users that have not opted-in or out
  *
  * @access public
  * @return void
  */
 public function admin_notice()
 {
     if (!current_user_can('update_plugins')) {
         return;
     }
     $hide_notice = get_option('mashsb_tracking_notice');
     if ($hide_notice) {
         return;
     }
     if (mashsb_get_option('allow_tracking', false)) {
         return;
     }
     if (!current_user_can('manage_options')) {
         return;
     }
     if (stristr(network_site_url('/'), '_dev') !== false || stristr(network_site_url('/'), 'localhost') !== false || stristr(network_site_url('/'), ':8888') !== false) {
         if (!MASHSB_DEBUG) {
             update_option('mashsb_tracking_notice', '1');
         }
     } else {
         $optin_url = add_query_arg('mashsb_action', 'opt_into_tracking');
         $optout_url = add_query_arg('mashsb_action', 'opt_out_of_tracking');
         //$source         = substr( md5( get_bloginfo( 'name' ) ), 0, 10 );
         $source = substr(md5(get_bloginfo('admin_email')), 0, 10);
         $extensions_url = 'https://www.mashshare.net/add-ons/?utm_source=' . $source . '&utm_medium=admin&utm_term=notice&utm_campaign=MASHSBUsageTracking';
         echo '<div class="updated"><p>';
         echo sprintf(__('Allow Mashshare to track plugin usage? Opt-in to tracking and our newsletter and immediately be emailed a <strong>20%% discount to the Mashshare shop</strong>, valid towards the <a href="%s" target="_blank">purchase of Add-Ons</a>. No sensitive data is tracked.', 'mashsb'), $extensions_url);
         echo '&nbsp;<a href="' . esc_url($optin_url) . '" class="button-secondary">' . __('Allow', 'mashsb') . '</a>';
         echo '&nbsp;<a href="' . esc_url($optout_url) . '" class="button-secondary">' . __('Do not allow', 'mashsb') . '</a>';
         echo '</p></div>';
     }
 }