Ejemplo n.º 1
0
 /**
  * CDN tab
  *
  * @return void
  */
 function view()
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     $cdn_enabled = $this->_config->get_boolean('cdn.enabled');
     $cdn_engine = $this->_config->get_string('cdn.engine');
     $cdn_mirror = w3_is_cdn_mirror($cdn_engine);
     $cdn_mirror_purge_all = w3_cdn_can_purge_all($cdn_engine);
     $cdn_common = w3_instance('W3_Plugin_CdnCommon');
     $cdn = $cdn_common->get_cdn();
     $cdn_supports_header = $cdn->headers_support() == W3TC_CDN_HEADER_MIRRORING;
     $cdn_supports_full_page_mirroring = $cdn->supports_full_page_mirroring();
     $minify_enabled = $this->_config->get_boolean('minify.enabled') && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine')));
     $cookie_domain = $this->get_cookie_domain();
     $set_cookie_domain = $this->is_cookie_domain_enabled();
     // Required for Update Media Query String button
     $browsercache_enabled = $this->_config->get_boolean('browsercache.enabled');
     $browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace');
     if (in_array($cdn_engine, array('netdna', 'maxcdn'))) {
         $pull_zones = array();
         $authorization_key = $this->_config->get_string("cdn.{$cdn_engine}.authorization_key");
         $zone_id = $this->_config->get_integer("cdn.{$cdn_engine}.zone_id");
         $alias = $consumerkey = $consumersecret = '';
         if ($authorization_key) {
             $keys = explode('+', $authorization_key);
             if (sizeof($keys) == 3) {
                 list($alias, $consumerkey, $consumersecret) = $keys;
             }
         }
         $authorized = $authorization_key != '' && $alias && $consumerkey && $consumersecret;
         $have_zone = $zone_id != 0;
         if ($authorized) {
             w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
             try {
                 $api = new NetDNA($alias, $consumerkey, $consumersecret);
                 $pull_zones = $api->get_zones_by_url(w3_get_home_url());
             } catch (Exception $ex) {
                 w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
                 w3_e_error_box('<p>There is an error with your CDN settings: ' . $ex->getMessage() . '</p>');
             }
         }
     }
     include W3TC_INC_DIR . '/options/cdn.php';
 }
Ejemplo n.º 2
0
 /**
  * Check that activated plugins are not incompatible with the plugin
  */
 function verify()
 {
     if (is_network_admin()) {
         $active_plugins = (array) get_site_option('active_sitewide_plugins', array());
         $active_plugins = array_keys($active_plugins);
     } else {
         $active_plugins = (array) get_option('active_plugins');
     }
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     $incomp_plugins = $this->_get_incompatible_plugins();
     $message = '';
     $matches = array_intersect($active_plugins, $incomp_plugins);
     if ($matches) {
         $message = $this->_custom_message($matches);
     }
     if ($message) {
         w3_e_error_box($message);
     } else {
         set_transient('w3tc.verify_plugins', true, 7 * 24 * 3600);
     }
 }
Ejemplo n.º 3
0
 function admin_notices()
 {
     /**
      * @var $nerser W3_NewRelicService
      */
     $nerser = w3_instance('W3_NewRelicService');
     $new_relic_configured = $this->_config->get_string('newrelic.account_id') && $this->_config->get_string('newrelic.api_key');
     if (w3_get_blog_id() == 0 || !$this->_config->get_boolean('common.force_master')) {
         $new_relic_configured = $new_relic_configured && $this->_config->get_string('newrelic.application_id');
     }
     $verify_running_result = $nerser->verify_running();
     $not_running = is_array($verify_running_result);
     if ($not_running) {
         $message = '<p>' . __('New Relic is not running correctly. The plugin has detected the following issues:', 'w3-total-cache') . "</p>\n";
         $message .= "<ul class=\"w3-bullet-list\">\n";
         foreach ($verify_running_result as $cause) {
             $message .= "<li>{$cause}</li>";
         }
         $message .= "</ul>\n";
         $message .= "<p>" . sprintf(__('Please review the <a href="%s">settings</a>.', 'w3-total-cache'), network_admin_url('admin.php?page=w3tc_general#monitoring')) . "</p>";
         w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
         w3_e_error_box($message);
     }
 }
Ejemplo n.º 4
0
 /**
  * Run license status check and display messages
  */
 function admin_notices()
 {
     $message = '';
     $status = get_transient('w3tc_license_status');
     $set_transient = false;
     if (!$status) {
         $status = $this->update_license_status();
         $set_transient = true;
         $transient_timeout = 3600 * 24 * 5;
     }
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     switch ($status) {
         case 'expired':
             $message = sprintf(__('The W3 Total Cache license key has expired. Please renew it: %s', 'w3-total-cache'), '<input type="button" class="button-primary button-buy-plugin {nonce: \'' . wp_create_nonce('w3tc') . '\'}" value="' . __('Renew', 'w3-total-cache') . '" />');
             break;
         case 'invalid':
             $message = __('The W3 Total Cache license key you entered is not valid.', 'w3-total-cache') . '<a href="' . (is_network_admin() ? network_admin_url('admin.php?page=w3tc_general#licensing') : admin_url('admin.php?page=w3tc_general#licensing')) . '"> ' . __('Please enter it again.', 'w3-total-cache') . '</a>';
             break;
         case 'inactive':
             $message = __('The W3 Total Cache license key is not active.', 'w3-total-cache');
             break;
         case 'site_inactive':
             $message = __('The W3 Total Cache license key is not active for this site.', 'w3-total-cache');
             break;
         case 'valid':
             break;
         case 'host_valid':
             break;
         case 'no_key':
             break;
         default:
             $message = __('The W3 Total Cache license key cann\'t be verified.', 'w3-total-cache');
             $transient_timeout = 60;
             break;
     }
     if ($set_transient) {
         set_transient('w3tc_license_status', $status, $transient_timeout);
     }
     if ($message) {
         w3_e_error_box(sprintf("<p>{$message}. <a href='%s'>" . __('check again') . '</a></p>', network_admin_url('admin.php?page=w3tc_general&w3tc_licensing_check_key')));
     }
     if ($this->site_inactivated) {
         w3_e_error_box("<p>" . __('The W3 Total Cache license key is deactivated for this site.', 'w3-total-cache') . "</p>");
     }
     if ($this->site_activated) {
         w3_e_error_box("<p>" . __('The W3 Total Cache license key is activated for this site.', 'w3-total-cache') . "</p>");
     }
 }
Ejemplo n.º 5
0
<?php

if (!defined('W3TC')) {
    die;
}
?>
<div id="maxcdn-widget" class="sign-up maxcdn-netdna-widget-base">
    <?php 
if ($error) {
    ?>
    <?php 
    w3_e_error_box('<p>' . sprintf(__('MaxCDN encountered an error trying to retrieve data, make sure your host support cURL and outgoing requests: %s', 'w3-total-cache'), $error) . '</p>');
    ?>
    <?php 
}
?>
    <?php 
if (!$authorized) {
    ?>
    <p><?php 
    _e('Add the MaxCDN content delivery network to increase website speeds dramatically in just a few minutes!', 'w3-total-cache');
    ?>
</p>
    <h4><?php 
    _e('New customers', 'w3-total-cache');
    ?>
</h4>
    <p><?php 
    _e('MaxCDN is a service that lets you speed up your site even more with W3 Total Cache.', 'w3-total-cache');
    ?>
</p>