function module_deactivate_api_key()
 {
     if (false === SendPress_Pro_Manager::try_deactivate_key()) {
         add_action('sendpress_notices', array('SendPress_Pro_Manager', 'deactivate_key_notice'));
     }
 }
Exemplo n.º 2
0
 function init()
 {
     //add_action('register_form',array( $this , 'add_registration_fields'));
     SendPress_Ajax_Loader::init();
     //SendPress_Signup_Shortcode::init();
     SendPress_Sender::init();
     SendPress_Cron::get_instance();
     SendPress_Videos::init();
     sendpress_register_sender('SendPress_Sender_Website');
     sendpress_register_sender('SendPress_Sender_Gmail');
     add_action('sendpress_event', array('SendPress_Tracking', 'event'), 1, 1);
     do_action('sendpress_init');
     SendPress_Admin::add_cap('Emails_Send', 'sendpress_email_send');
     $indexer = "";
     $permalinks = get_option('permalink_structure');
     if ($permalinks) {
         $pos = strpos($permalinks, "index.php");
         if ($pos > 0) {
             // note: three equal signs
             $indexer = "index.php/";
         }
     }
     add_rewrite_rule("^{$indexer}sendpress/([^/]+)/?", 'index.php?sendpress=$matches[1]', "top");
     if (defined('WP_ADMIN') && WP_ADMIN == true) {
         $sendpress_screen_options = new SendPress_Screen_Options();
     }
     $this->add_custom_post();
     //add_filter( 'cron_schedules', array($this,'cron_schedule' ));
     //add_action( 'wp_loaded', array( $this, 'add_cron' ) );
     if (is_admin()) {
         SendPress_Pro_Manager::init();
         SendPress_Tracking::init();
         SendPress_Notifications_Manager::init();
         if (isset($_GET['spv'])) {
             SendPress_Option::set('version', $_GET['spv']);
         }
         if (isset($_GET['sp-admin-code']) && current_user_can('manage_options')) {
             switch ($_GET['sp-admin-code']) {
                 case 'install-tables':
                     $this->install_tables();
                     break;
                 case 'remove-key':
                     SendPress_Option::set('api_key', '');
                     SendPress_Pro_Manager::set_pro_state(false);
                     //this will delete the transient
                     break;
                 default:
                     # code...
                     break;
             }
         }
         $this->ready_for_sending();
         add_action('admin_menu', array($this, 'admin_menu'));
         add_action('admin_init', array($this, 'admin_init'));
         add_action('admin_notices', array($this, 'admin_notice'));
         add_action('admin_print_scripts', array($this, 'editor_insidepopup'));
         add_filter('gettext', array($this, 'change_button_text'), null, 2);
         add_action('sendpress_notices', array($this, 'sendpress_notices'));
         add_filter('user_has_cap', array($this, 'user_has_cap'), 10, 3);
         //SendPress_Option::set('default-signup-widget-settings',false);
     } else {
         if (SendPress_Option::get('sp_widget_shortdoces')) {
             add_filter('widget_text', 'do_shortcode');
         }
     }
     add_image_size('sendpress-max', 600, 600);
     add_filter('template_include', array($this, 'template_include'), 5);
     add_action('sendpress_cron_action', array($this, 'sendpress_cron_action_run'));
     //using this for now, might find a different way to include things later
     // global $load_signup_js;
     // $load_signup_js = false;
     add_action('wp_enqueue_scripts', array($this, 'add_front_end_scripts'));
     add_action('wp_enqueue_scripts', array($this, 'add_front_end_styles'));
     add_action('wp_head', array($this, 'handle_front_end_posts'));
 }
Exemplo n.º 3
0
    function page_end()
    {
        ?>
		</div>
		</div>
		
		<?php 
        //delete_transient( 'current_sp_pro_version' );
        //call api to get current version of pro if pro installed
        if (defined('SENDPRESS_PRO_VERSION')) {
            if (SendPress_Pro_Manager::get_pro_state() !== 'valid') {
                if (false === ($current_sp_pro_version = get_transient('current_sp_pro_version'))) {
                    // It wasn't there, so regenerate the data and save the transient
                    $remote = wp_remote_get('http://api.sendpress.com/pro/getversion');
                    $current_sp_pro_version = json_decode(wp_remote_retrieve_body($remote));
                    if (is_array($current_sp_pro_version)) {
                        $current_sp_pro_version = $current_sp_pro_version[0]->version;
                    } else {
                        $current_sp_pro_version = 0;
                    }
                    set_transient('current_sp_pro_version', $current_sp_pro_version, 24 * HOUR_IN_SECONDS);
                }
                if ($current_sp_pro_version > SENDPRESS_PRO_VERSION) {
                    ?>
<br>
					<div style="padding: 0 15px 0 0">
					<div class="sp-error sp-clear-top"><p><strong>SendPress Pro is out of date!</strong>&nbsp;&nbsp;Upgrade to get the latest updates, features, and bug fixes.  If your key has expired visit <a href="https://sendpress.com" target="_blank">SendPress.com</a> to renew.</p></div>
					</div>
					<?php 
                }
            }
        }
    }
 static function try_check_key()
 {
     $key = SendPress_Option::get('api_key');
     global $pro_names;
     $check = array('state' => 'valid', 'transient_time' => DAY_IN_SECONDS, 'sp_state' => 'failed');
     foreach ($pro_names as $name) {
         $check = SendPress_Pro_Manager::check_key($key, $name);
         if ($check['sp_state'] === 'passed') {
             return $check;
         }
     }
     return $check;
 }