/**
  * General tab
  *
  * @return void
  */
 function view()
 {
     global $current_user;
     $config_master = $this->_config_master;
     /**
      *
      *
      * @var $modules W3_ModuleStatus
      */
     $modules = Dispatcher::component('ModuleStatus');
     $pgcache_enabled = $modules->is_enabled('pgcache');
     $dbcache_enabled = $modules->is_enabled('dbcache');
     $objectcache_enabled = $modules->is_enabled('objectcache');
     $browsercache_enabled = $modules->is_enabled('browsercache');
     $minify_enabled = $modules->is_enabled('minify');
     $cdn_enabled = $modules->is_enabled('cdn');
     $varnish_enabled = $modules->is_enabled('varnish');
     $enabled = $modules->plugin_is_enabled();
     $enabled_checkbox = $modules->all_modules_enabled();
     $check_rules = Util_Rule::can_check_rules();
     $disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && Util_Environment::is_wpmu() && $config_master->get_string('pgcache.engine') != 'file_generic');
     $can_empty_file = $modules->can_empty_file();
     $can_empty_varnish = $modules->can_empty_varnish();
     $cdn_mirror_purge = Cdn_Util::can_purge_all($modules->get_module_engine('cdn'));
     $file_nfs = $this->_config->get_boolean('pgcache.file.nfs') || $this->_config->get_boolean('minify.file.nfs');
     $file_locking = $this->_config->get_boolean('dbcache.file.locking') || $this->_config->get_boolean('objectcache.file.locking') || $this->_config->get_boolean('pgcache.file.locking') || $this->_config->get_boolean('minify.file.locking');
     $licensing_visible = (!Util_Environment::is_wpmu() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid';
     $custom_areas = apply_filters("w3tc_settings_general_anchors", array());
     include W3TC_INC_DIR . '/options/general.php';
 }
Ejemplo n.º 2
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';
 }
 /**
  * Dashboard tab
  */
 function view()
 {
     $module_status = Dispatcher::component('ModuleStatus');
     Util_Widget::setup();
     global $current_user;
     $config_master = $this->_config_master;
     $browsercache_enabled = $module_status->is_enabled('browsercache');
     $enabled = $module_status->plugin_is_enabled();
     $can_empty_memcache = $module_status->can_empty_memcache();
     $can_empty_opcode = $module_status->can_empty_opcode();
     $can_empty_file = $module_status->can_empty_file();
     $can_empty_varnish = $module_status->can_empty_varnish();
     $cdn_enabled = $module_status->is_enabled('cdn');
     $cdn_mirror_purge = Cdn_Util::can_purge_all($module_status->get_module_engine('cdn'));
     // Required for Update Media Query String button
     $browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace');
     include W3TC_INC_DIR . '/options/dashboard.php';
 }
<?php

namespace W3TC;

if (!defined('W3TC')) {
    die;
}
Util_Ui::postbox_header(__('<acronym title="Content Delivery Network">CDN</acronym>', 'w3-total-cache'), '', 'cdn');
Util_Ui::config_overloading_button(array('key' => 'cdn.configuration_overloaded'));
?>
<p><?php 
_e('Host static files with your content delivery network provider to reduce page load time.', 'w3-total-cache');
if (!$cdn_enabled) {
    printf(__('If you do not have a <acronym title="Content Delivery Network">CDN</acronym> provider try MaxCDN. <a href="%s" target="_blank">Sign up and save 25&#37;</a>.', 'w3-total-cache'), wp_nonce_url(Util_Ui::admin_url('admin.php?page=w3tc_dashboard&w3tc_cdn_maxcdn_signup'), 'w3tc'));
}
?>
</p>
<table class="form-table">
    <?php 
Util_Ui::config_item(array('key' => 'cdn.enabled', 'control' => 'checkbox', 'checkbox_label' => __('Enable', 'w3-total-cache'), 'description' => __('Theme files, media library attachments, <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym> files etc will appear to load instantly for site visitors.', 'w3-total-cache')));
Util_Ui::config_item(array('key' => 'cdn.engine', 'control' => 'selectbox', 'selectbox_values' => $engine_values, 'selectbox_optgroups' => $engine_optgroups, 'description' => __('Select the <acronym title="Content Delivery Network">CDN</acronym> type you wish to use.', 'w3-total-cache') . $cdn_engine_extra_description));
?>
</table>

<?php 
Util_Ui::button_config_save('general_cdn', '<input id="cdn_purge" type="button" value="' . __('Empty cache', 'w3-total-cache') . '" ' . ($cdn_enabled && Cdn_Util::can_purge_all($config->get_string('cdn.engine')) ? '' : ' disabled="disabled" ') . ' class="button {nonce: \'' . wp_create_nonce('w3tc') . '\'}" />');
Util_Ui::postbox_footer();
Ejemplo n.º 5
0
 public function w3tc_admin_bar_menu($menu_items)
 {
     $cdn_engine = $this->_config->get_string('cdn.engine');
     if (Cdn_Util::can_purge_all($cdn_engine)) {
         $menu_items['20710.cdn'] = array('id' => 'w3tc_cdn_flush_all', 'parent' => 'w3tc_flush', 'title' => __('CDN: All', 'w3-total-cache'), 'href' => wp_nonce_url(network_admin_url('admin.php?page=w3tc_cdn&amp;w3tc_flush_cdn'), 'w3tc'));
     }
     if (Cdn_Util::can_purge($cdn_engine)) {
         $menu_items['20790.cdn'] = array('id' => 'w3tc_cdn_flush', 'parent' => 'w3tc_flush', 'title' => __('CDN: Manual Purge', 'w3-total-cache'), 'href' => wp_nonce_url(network_admin_url('admin.php?page=w3tc_cdn&amp;w3tc_cdn_purge'), 'w3tc'), 'meta' => array('onclick' => "w3tc_popupadmin_bar(this.href); return false"));
     }
     return $menu_items;
 }