Esempio n. 1
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 check_api_key()
 {
     if (class_exists('SendPress_Option')) {
         $key = SendPress_Option::get('api_key');
         $state = SendPress_Pro_Manager::get_pro_state();
         if ($state !== 'valid' && !empty($key)) {
             //add_action('sendpress_notices', array('SendPress_Pro_Manager', 'key_notice'));
             //SendPress_Option::set('api_key','');
         }
     }
 }