Esempio n. 1
0
 /**
  * CDN tab
  *
  * @return void
  */
 function view()
 {
     $config = Dispatcher::config();
     $cdn_engine = $config->get_string('cdn.engine');
     if (Cdn_Util::is_engine_fsd($cdn_engine)) {
         do_action('w3tc_settings_cdn');
         return;
     }
     $cdn_enabled = $config->get_boolean('cdn.enabled');
     $cdn_mirror = Cdn_Util::is_engine_mirror($cdn_engine);
     $cdn_mirror_purge_all = Cdn_Util::can_purge_all($cdn_engine);
     $cdn_common = Dispatcher::component('Cdn_Core');
     $cdn = $cdn_common->get_cdn();
     $cdn_supports_header = $cdn->headers_support() == W3TC_CDN_HEADER_MIRRORING;
     $minify_enabled = $config->get_boolean('minify.enabled') && Util_Rule::can_check_rules() && $config->get_boolean('minify.rewrite') && (!$config->get_boolean('minify.auto') || Cdn_Util::is_engine_mirror($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 = $config->get_boolean('browsercache.enabled');
     $browsercache_update_media_qs = $config->get_boolean('browsercache.cssjs.replace') || $config->get_boolean('browsercache.other.replace');
     if (in_array($cdn_engine, array('netdna', 'maxcdn'))) {
         $pull_zones = array();
         $authorization_key = $config->get_string("cdn.{$cdn_engine}.authorization_key");
         $zone_id = $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) {
             require_once W3TC_LIB_NETDNA_DIR . '/NetDNA.php';
             try {
                 $api = new \NetDNA($alias, $consumerkey, $consumersecret);
                 $pull_zones = $api->get_zones_by_url(get_home_url());
             } catch (\Exception $ex) {
                 Util_Ui::error_box('<p>There is an error with your CDN settings: ' . $ex->getMessage() . '</p>');
             }
         }
     }
     include W3TC_INC_DIR . '/options/cdn.php';
 }
 /**
  * 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');
     }
     $incomp_plugins = $this->_get_incompatible_plugins();
     $message = '';
     $matches = array_intersect($active_plugins, $incomp_plugins);
     if ($matches) {
         $message = $this->_custom_message($matches);
     }
     if ($message) {
         Util_Ui::error_box($message);
     } else {
         set_transient('w3tc.verify_plugins', true, 7 * 24 * 3600);
     }
 }
 function admin_notices()
 {
     $api_key = $this->_config->get_string(array('newrelic', 'api_key'));
     if (empty($api_key)) {
         return;
     }
     $nerser = Dispatcher::component('Extension_NewRelic_Service');
     $verify_running_result = $nerser->verify_running();
     $not_running = is_array($verify_running_result);
     if ($not_running) {
         $message = '<p>' . __('New Relic is not running correctly. ', 'w3-total-cache') . '<a href="#" class="w3tc_link_more {for_class: \'w3tc_nr_admin_notice\'}">' . 'more</a> ' . '<div class="w3tc_none w3tc_nr_admin_notice">' . __('The plugin has detected the following issues:. ', 'w3-total-cache');
         $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>";
         $message .= "</div></p>\n";
         Util_Ui::error_box($message);
     }
 }
Esempio n. 4
0
if (!defined('W3TC')) {
    die;
}
/**
 *
 *
 * @var bool $authorized
 * @var bool $have_zone
 */
?>
<div id="netdna-widget" class="sign-up maxcdn-netdna-widget-base">
    <?php 
if ($error) {
    ?>
    <?php 
    Util_Ui::error_box('<p>' . sprintf(__('NetDNA encountered an error trying to retrieve data, make sure your host support cURL and outgoing requests: %s', 'w3-total-cache'), $error) . '</p>');
    ?>
    <?php 
}
?>
    <h4><?php 
_e('Current customers', 'w3-total-cache');
?>
</h4>
    <p><?php 
_e("Once you've signed up or if you're an existing NetDNA customer, to enable CDN:", 'w3-total-cache');
?>
</p>
    <?php 
if ($authorized && (!$have_zone || is_null($zone_info))) {
    ?>
 /**
  * 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;
     }
     if ($status == 'no_key') {
     } elseif ($this->_status_is($status, 'inactive.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') . '" />');
     } elseif ($this->_status_is($status, '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>';
     } elseif ($this->_status_is($status, 'inactive.by_rooturi.activations_limit_not_reached')) {
         $message = __('The W3 Total Cache license key is not active for this site.', 'w3-total-cache');
     } elseif ($this->_status_is($status, 'inactive.by_rooturi')) {
         $message = __('The W3 Total Cache license key is not active for this site. ', 'w3-total-cache') . sprintf(__('You can switch your license to this website following <a class="w3tc_licensing_reset_rooturi" href="%s">this link</a>', 'w3-total-cache'), Util_Ui::url(array('page' => 'w3tc_general', 'w3tc_licensing_reset_rooturi' => 'y')));
     } elseif ($this->_status_is($status, 'inactive')) {
         $message = __('The W3 Total Cache license key is not active.', 'w3-total-cache');
     } elseif ($this->_status_is($status, 'active')) {
     } else {
         $message = __('The W3 Total Cache license key can\'t be verified.', 'w3-total-cache');
         $transient_timeout = 60;
     }
     if ($set_transient) {
         set_transient('w3tc_license_status', $status, $transient_timeout);
     }
     if ($message) {
         Util_Ui::error_box(sprintf("<p>{$message}. <a class='w3tc_licensing_check' href='%s'>" . __('check again') . '</a></p>', Util_Ui::url(array('page' => 'w3tc_general', 'w3tc_licensing_check_key' => 'y'))));
     }
     if ($this->site_inactivated) {
         Util_Ui::error_box("<p>" . __('The W3 Total Cache license key is deactivated for this site.', 'w3-total-cache') . "</p>");
     }
     if ($this->site_activated) {
         Util_Ui::error_box("<p>" . __('The W3 Total Cache license key is activated for this site.', 'w3-total-cache') . "</p>");
     }
 }