Esempio n. 1
0
 /**
  * Runs plugin
  *
  * @return void
  */
 function run()
 {
     add_action('init', array(&$this, 'init'));
     if (w3tc_is_pro_dev_mode() && w3_is_pro($this->_config)) {
         add_action('wp_footer', array($this, 'pro_dev_mode'));
     }
     add_action('admin_bar_menu', array(&$this, 'admin_bar_menu'), 150);
     if (isset($_REQUEST['w3tc_theme']) && isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == W3TC_POWERED_BY) {
         add_filter('template', array(&$this, 'template_preview'));
         add_filter('stylesheet', array(&$this, 'stylesheet_preview'));
     } elseif ($this->_config->get_boolean('mobile.enabled') || $this->_config->get_boolean('referrer.enabled')) {
         add_filter('template', array(&$this, 'template'));
         add_filter('stylesheet', array(&$this, 'stylesheet'));
     }
     /**
      * Create cookies to flag if a pgcache role was loggedin
      */
     if (!$this->_config->get_boolean('pgcache.reject.logged') && $this->_config->get_array('pgcache.reject.logged_roles')) {
         add_action('set_logged_in_cookie', array(&$this, 'check_login_action'), 0, 5);
         add_action('clear_auth_cookie', array(&$this, 'check_login_action'), 0, 5);
     }
     if ($this->_config->get_string('common.support') == 'footer') {
         add_action('wp_footer', array(&$this, 'footer'));
     }
     if ($this->can_ob()) {
         ob_start(array(&$this, 'ob_callback'));
     }
 }
Esempio n. 2
0
/**
 * @var W3_Config $config
 * @return string
 */
function w3_w3tc_release_version($config = null)
{
    if (w3_is_enterprise($config)) {
        return 'enterprise';
    }
    if (w3_is_pro($config) && w3tc_is_pro_dev_mode()) {
        return 'pro development';
    }
    if (w3_is_pro($config)) {
        return 'pro';
    }
    return 'community';
}
Esempio n. 3
0
 /**
  * @return string
  */
 function update_license_status()
 {
     $status = '';
     $license_key = $this->get_license_key();
     if (!empty($license_key) || defined('W3TC_LICENSE_CHECK')) {
         $license = edd_w3edge_w3tc_check_license($license_key, W3TC_VERSION);
         $version = '';
         if ($license) {
             $status = $license->license;
             if (in_array($status, array('valid', 'host_valid'))) {
                 $version = 'pro';
             } elseif (in_array($status, array('site_inactive', 'valid')) && w3tc_is_pro_dev_mode()) {
                 $status = 'valid';
                 $version = 'pro_dev';
             }
         }
         $this->_config->set('plugin.type', $version);
     } else {
         $status = 'no_key';
         $this->_config->set('plugin.type', '');
     }
     try {
         $this->_config->save();
     } catch (Exception $ex) {
     }
     return $status;
 }