/**
  * Checks if addins in wp-content is available and correct version.
  *
  * @param unknown $config
  * @param Util_Environment_Exceptions $exs
  */
 private function create_required_files($config, $exs)
 {
     $src = W3TC_INSTALL_FILE_ADVANCED_CACHE;
     $dst = W3TC_ADDIN_FILE_ADVANCED_CACHE;
     if ($this->advanced_cache_installed()) {
         if ($this->is_advanced_cache_add_in()) {
             $script_data = @file_get_contents($dst);
             if ($script_data == @file_get_contents($src)) {
                 return;
             }
         } else {
             if (get_transient('w3tc_remove_add_in_pgcache') == 'yes') {
                 // user already manually asked to remove another plugin's add in,
                 // we should try to apply ours
                 // (in case of missing permissions deletion could fail)
             } else {
                 if (!$this->advanced_cache_check_old_add_in()) {
                     $remove_url = Util_Ui::admin_url('admin.php?page=w3tc_dashboard&w3tc_default_remove_add_in=pgcache');
                     $exs->push(new Util_WpFile_FilesystemOperationException(sprintf(__('The Page Cache add-in file advanced-cache.php is not a W3 Total Cache drop-in.
                 It should be removed. %s', 'w3-total-cache'), Util_Ui::button_link(__('Yes, remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc')))));
                     return;
                 }
             }
         }
     }
     try {
         Util_WpFile::copy_file($src, $dst);
     } catch (Util_WpFile_FilesystemOperationException $ex) {
         $exs->push($ex);
     }
 }
 /**
  *
  *
  * @param Config  $config
  * @return string
  */
 function notifications($config)
 {
     $config_state = Dispatcher::config_state();
     if (!$config_state->get_boolean('newrelic.hide_note_pageload_slow')) {
         $pl = get_option('w3tc_nr_frontend_response_time');
         if ($pl !== false && $pl > 0.3) {
             $nr_recommends = array();
             if (!$config->get_boolean('pgcache.enabled')) {
                 $nr_recommends[] = __('Page Cache', 'w3-total-cache');
             }
             if (!$config->get_boolean('minify.enabled')) {
                 $nr_recommends[] = __('Minify', 'w3-total-cache');
             }
             if (!$config->get_boolean('cdn.enabled')) {
                 $nr_recommends[] = __('CDN', 'w3-total-cache');
             }
             if (!$config->get_boolean('browsercache.enabled')) {
                 $nr_recommends[] = __('Browser Cache and use compression', 'w3-total-cache');
             }
             if ($nr_recommends) {
                 $message = sprintf(__('Application monitoring has detected that your page load time is higher than 300ms. It is recommended that you enable the following features: %s %s', 'w3-total-cache'), implode(', ', $nr_recommends), Util_Ui::button_link('Hide this message', Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'newrelic.hide_note_pageload_slow', 'value' => 'true'))));
                 return array('newrelic_recommends' => $message);
             }
         }
     }
     return array();
 }
 private static function cloudflare_button_save($id = '')
 {
     $b1_id = 'w3tc_cloudflare_save_' . $id;
     echo '<p class="submit">';
     echo Util_Ui::nonce_field('w3tc');
     echo '<input type="submit" id="' . $b1_id . '" name="w3tc_cloudflare_save_settings" ' . ' class="w3tc-button-save button-primary" ' . ' value="' . __('Save CloudFlare settings', 'w3-total-cache') . '" />';
     echo '</p>';
 }
 public static function w3tc_notes_wordpress_seo($notes)
 {
     if (!self::show_notice()) {
         return $notes;
     }
     $extension_id = 'wordpress-seo';
     $notes[$extension_id] = sprintf(__('It appears that activating the <a href="%s">Yoast SEO</a> extension for W3 Total Cache will be helpful for your site. <a class="button" href="%s">Click here</a> to try it. %s', 'w3-total-cache'), Util_Ui::admin_url('admin.php?page=w3tc_extensions#' . $extension_id), Util_Ui::url(array('w3tc_extensions_activate' => $extension_id)), Util_Ui::button_link(__('Hide this message', 'w3-total-cache'), Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'wordpress_seo.hide_note_suggest_activation', 'value' => 'true'))));
     return $notes;
 }
 function admin_notices()
 {
     $plugins = get_plugins();
     if (array_key_exists('cloudflare/cloudflare.php', $plugins) && $this->_config->get_boolean('notes.cloudflare_plugin')) {
         echo sprintf('<div class="error"><p>%s %s</p></div>', __('CloudFlare plugin detected. We recommend removing the
         plugin as it offers no additional capabilities when W3 Total Cache is installed. This message will disappear
         when CloudFlare is removed.', 'w3-total-cache'), Util_Ui::button_hide_note('Hide this message', 'cloudflare_plugin'));
     }
 }
 /**
  * Display Purge from cache on Page/Post post.php.
  */
 function post_submitbox_start()
 {
     if (current_user_can('manage_options')) {
         global $post;
         if (!is_null($post)) {
             $url = Util_Ui::url(array('page' => 'w3tc_dashboard', 'w3tc_flush_post' => 'y', 'post_id' => $post->ID));
             echo sprintf('<div><a href="%s">%s</a></div>', $url, __('Purge from cache', 'w3-total-cache'));
         }
     }
 }
 public static function w3tc_notes_wpml($notes)
 {
     if (!self::show_notice()) {
         return $notes;
     }
     $extension_id = 'wpml';
     $config = Dispatcher::config();
     if (!Util_Environment::is_w3tc_pro($config)) {
         $activate_text = 'Available after <a href="#" class="button-buy-plugin">upgrade</a>. ';
     } else {
         $activate_text = sprintf('<a class="button" href="%s">Click here</a> to try it. ', Util_Ui::url(array('w3tc_extensions_activate' => $extension_id)));
     }
     $notes[$extension_id] = sprintf(__('Activating the <a href="%s">WPML</a> extension for W3 Total Cache may be helpful for your site. %s%s', 'w3-total-cache'), Util_Ui::admin_url('admin.php?page=w3tc_extensions#' . $extension_id), $activate_text, Util_Ui::button_link(__('Hide this message', 'w3-total-cache'), Util_Ui::url(array('w3tc_default_config_state' => 'y', 'key' => 'wpml.hide_note_suggest_activation', 'value' => 'true'))));
     return $notes;
 }
 /**
  * called from Generic_Plugin_Admin on action
  */
 public static function admin_print_scripts_w3tc_support()
 {
     $url = get_home_url();
     if (substr($url, 0, 7) == 'http://') {
         $url = substr($url, 7);
     } elseif (substr($url, 0, 8) == 'https://') {
         $url = substr($url, 8);
     }
     // aw3tc-options script is already queued so attach to it
     // just to make vars printed (while it's not related by semantics)
     wp_localize_script('w3tc-options', 'w3tc_support_postprocess', urlencode(urlencode(Util_Ui::admin_url(wp_nonce_url('admin.php', 'w3tc') . '&page=w3tc_support&done'))));
     wp_localize_script('w3tc-options', 'w3tc_support_home_url', $url);
     wp_localize_script('w3tc-options', 'w3tc_support_email', get_bloginfo('admin_email'));
     $u = wp_get_current_user();
     wp_localize_script('w3tc-options', 'w3tc_support_first_name', $u->first_name);
     wp_localize_script('w3tc-options', 'w3tc_support_last_name', $u->last_name);
 }
Exemplo n.º 9
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);
     }
 }
Exemplo n.º 12
0
 /**
  * called from Generic_Plugin_Admin on action
  */
 public static function admin_print_scripts_w3tc_support()
 {
     $url = get_home_url();
     if (substr($url, 0, 7) == 'http://') {
         $url = substr($url, 7);
     } elseif (substr($url, 0, 8) == 'https://') {
         $url = substr($url, 8);
     }
     // aw3tc-options script is already queued so attach to it
     // just to make vars printed (while it's not related by semantics)
     wp_localize_script('w3tc-options', 'w3tc_support_postprocess', urlencode(urlencode(Util_Ui::admin_url(wp_nonce_url('admin.php', 'w3tc') . '&page=w3tc_support&done'))));
     wp_localize_script('w3tc-options', 'w3tc_support_home_url', $url);
     wp_localize_script('w3tc-options', 'w3tc_support_email', get_bloginfo('admin_email'));
     $u = wp_get_current_user();
     wp_localize_script('w3tc-options', 'w3tc_support_first_name', $u->first_name);
     wp_localize_script('w3tc-options', 'w3tc_support_last_name', $u->last_name);
     // values from widget
     $w3tc_support_form_hash = 'm5pom8z0qy59rm';
     $w3tc_support_field_name = '';
     $w3tc_support_field_value = '';
     if (isset($_GET['service_item'])) {
         $pos = (int) $_GET['service_item'];
         $v = get_site_option('w3tc_generic_widgetservices');
         try {
             $v = json_decode($v, true);
             if (isset($v['items']) && isset($v['items'][$pos])) {
                 $i = $v['items'][$pos];
                 $w3tc_support_form_hash = $i['form_hash'];
                 $w3tc_support_field_name = $i['parameter_name'];
                 $w3tc_support_field_value = $i['parameter_value'];
             }
         } catch (\Exception $e) {
         }
     }
     wp_localize_script('w3tc-options', 'w3tc_support_form_hash', $w3tc_support_form_hash);
     wp_localize_script('w3tc-options', 'w3tc_support_field_name', $w3tc_support_field_name);
     wp_localize_script('w3tc-options', 'w3tc_support_field_value', $w3tc_support_field_value);
 }
Exemplo n.º 13
0
 public static function w3tc_ajax_cdn_highwinds_widgetdata()
 {
     try {
         $core = Dispatcher::component('Cdn_Core');
         $cdn = $core->get_cdn();
         $analytics = $cdn->service_analytics_transfer();
         $sum_mbytes = 0;
         $sum_mbps = 0;
         $sum_rps = 0;
         $graph = array(array('Date', 'Requests'));
         $count = count($analytics);
         foreach ($analytics as $item) {
             $sum_mbytes += $item['xferUsedTotalMB'];
             $sum_mbps += $item['xferRateMeanMbps'];
             $sum_rps += $item['rpsMean'];
             $graph[] = array(gmdate('d M', $item['usageTime'] / 1000), $item['requestsCountTotal']);
         }
         $response = array('transferred_size' => Util_Ui::format_mbytes($sum_mbytes / $count), 'average_mbps' => sprintf('%.2f', $sum_mbps / $count), 'average_rps' => sprintf('%.2f', $sum_rps / $count), 'graph' => $graph);
         echo json_encode($response);
     } catch (\Exception $e) {
         echo json_encode(array('error' => $e->getMessage()));
     }
 }
Exemplo n.º 14
0
 /**
  * Prints checkbox for debug option
  *
  * @param string  $option_id
  */
 protected function checkbox_debug($option_id)
 {
     if (is_array($option_id)) {
         $section = $option_id[0];
         $section_enabled = $this->_config->is_extension_active_frontend($section);
     } else {
         $section = substr($option_id, 0, strrpos($option_id, '.'));
         $section_enabled = $this->_config->get_boolean($section . '.enabled');
     }
     $disabled = $this->_config->is_sealed($option_id) || !$section_enabled;
     $name = Util_Ui::config_key_to_http_name($option_id);
     if (!$disabled) {
         echo '<input type="hidden" name="' . $name . '" value="0" />';
     }
     echo '<label>';
     echo '<input class="enabled" type="checkbox" name="' . $name . '" value="1" ';
     checked($this->_config->get_boolean($option_id), true);
     if ($disabled) {
         echo 'disabled="disabled" ';
     }
     echo ' />';
 }
Exemplo n.º 15
0
 /**
  * Creates add-in
  *
  * @throws Util_WpFile_FilesystemOperationException
  */
 private function create_addin()
 {
     $src = W3TC_INSTALL_FILE_DB;
     $dst = W3TC_ADDIN_FILE_DB;
     if ($this->db_installed()) {
         if ($this->is_dbcache_add_in()) {
             $script_data = @file_get_contents($dst);
             if ($script_data == @file_get_contents($src)) {
                 return;
             }
         } else {
             if (get_transient('w3tc_remove_add_in_dbcache') == 'yes') {
                 // user already manually asked to remove another plugin's add in,
                 // we should try to apply ours
                 // (in case of missing permissions deletion could fail)
             } else {
                 if (!$this->db_check_old_add_in()) {
                     if (isset($_GET['page'])) {
                         $url = 'admin.php?page=' . $_GET['page'] . '&amp;';
                     } else {
                         $url = basename(Util_Environment::remove_query($_SERVER['REQUEST_URI'])) . '?page=w3tc_dashboard&amp;';
                     }
                     $remove_url = Util_Ui::admin_url($url . 'w3tc_default_remove_add_in=dbcache');
                     throw new Util_WpFile_FilesystemOperationException(sprintf(__('The Database add-in file db.php is not a W3 Total Cache drop-in.
                 Remove it or disable Database Caching. %s', 'w3-total-cache'), Util_Ui::button_link(__('Remove it for me', 'w3-total-cache'), wp_nonce_url($remove_url, 'w3tc'))));
                 }
             }
         }
     }
     Util_WpFile::copy_file($src, $dst);
 }
Exemplo n.º 16
0
</p>
    <?php 
if ($authorized && (!$have_zone || is_null($zone_info))) {
    ?>
        <button id="netdna-maxcdn-create-pull-zone" class="button-primary {type: 'netdna', nonce: '<?php 
    echo wp_create_nonce('w3tc');
    ?>
'}"><?php 
    _e('Create Pull Zone', 'w3-total-cache');
    ?>
</button>
    <?php 
} elseif (!$authorized) {
    ?>
        <a class="button-primary" href="<?php 
    echo wp_nonce_url(Util_Ui::admin_url('admin.php?page=w3tc_dashboard&w3tc_cdn_netdna_authorize'), 'w3tc');
    ?>
" target="_blank"><?php 
    _e('Authorize', 'w3-total-cache');
    ?>
</a>
        <form action="admin.php?page=w3tc_dashboard" method="post">
            <p>
                <label for="cdn_netdna_authorization_key"><?php 
    _e('Authorization key', 'w3-total-cache');
    ?>
:</label>
                <input name="netdna" value="1" type="hidden" />
                <input id="cdn_netdna_authorization_key" class="w3tc-ignore-change" type="text" <?php 
    echo $is_sealed ? 'disabled="disabled"' : '';
    ?>
Exemplo n.º 17
0
}
?>
</p>


<form action="admin.php?page=w3tc_cdn" method="post">
    <p><?php 
_e('Files to purge:', 'w3-total-cache');
?>
</p>
    <p>
        <textarea name="files" rows="10" cols="90"></textarea>
    </p>
    <p>
        <?php 
echo Util_Ui::nonce_field('w3tc');
?>
        <input class="button-primary" type="submit" name="w3tc_cdn_purge_files" value="<?php 
_e('Purge', 'w3-total-cache');
?>
" />
    </p>
</form>

<div class="log">
    <?php 
foreach ($results as $result) {
    ?>
        <div class="log-<?php 
    echo $result['result'] == W3TC_CDN_RESULT_OK ? 'success' : 'error';
    ?>
Exemplo n.º 18
0
            <?php 
Util_Ui::sealing_disabled($module);
?>
            value="<?php 
echo esc_attr(implode(',', $config->get_array(array($module, 'memcached.servers'))));
?>
" size="80" />
        <input id="memcached_test" class="button {nonce: '<?php 
echo wp_create_nonce('w3tc');
?>
'}"
            <?php 
Util_Ui::sealing_disabled($module);
?>
            type="button" value="<?php 
esc_attr_e('Test', 'w3-total-cache');
?>
" />
        <span id="memcached_test_status" class="w3tc-status w3tc-process"></span>
        <br /><span class="description"><?php 
_e('Multiple servers may be used and seperated by a comma; e.g. 192.168.1.100:11211, domain.com:22122', 'w3-total-cache');
?>
</span>
    </td>
</tr>
<?php 
Util_Ui::config_item(array('key' => array($module, 'memcached.persistent'), 'label' => __('Use persistent connection:', 'w3-total-cache'), 'control' => 'checkbox', 'checkbox_label' => Util_ConfigLabel::get('memcached.persistent'), 'description' => 'Using persistent connection doesn\'t reinitialize memcached driver on each request'));
Util_Ui::config_item(array('key' => array($module, 'memcached.aws_autodiscovery'), 'label' => __('Node Auto Discovery:', 'w3-total-cache'), 'control' => 'checkbox', 'checkbox_label' => 'Amazon Node Auto Discovery', 'disabled' => Util_Installed::memcached_aws() ? null : true, 'description' => !Util_Installed::memcached_aws() ? __('ElastiCache PHP module not found', 'w3-total-cache') : __('When Amazon ElastiCache used, specify configuration endpoint as Memecached host', 'w3-total-cache')));
Util_Ui::config_item(array('key' => array($module, 'memcached.username'), 'label' => Util_ConfigLabel::get('memcached.username'), 'control' => 'textbox', 'disabled' => Util_Installed::memcache_auth() ? null : true, 'description' => __('Specify memcached username, when SASL authentication used', 'w3-total-cache') . (Util_Installed::memcache_auth() ? '' : __('<br>Available when memcached extension installed, built with SASL, and memcached.use_sasl = 1 option is set in php.ini', 'w3-total-cache'))));
Util_Ui::config_item(array('key' => array($module, 'memcached.password'), 'label' => Util_ConfigLabel::get('memcached.password'), 'control' => 'textbox', 'disabled' => Util_Installed::memcache_auth() ? null : true, 'description' => __('Specify memcached password, when SASL authentication used', 'w3-total-cache')));
Exemplo n.º 19
0
namespace W3TC;

if (!defined('W3TC')) {
    die;
}
$is_pro = Util_Environment::is_w3tc_pro($this->_config);
$this->checkbox('minify.css.strip.comments', false, 'css_');
?>
 <?php 
Util_Ui::e_config_label('minify.css.strip.comments');
?>
</label><br />
<?php 
$this->checkbox('minify.css.strip.crlf', false, 'css_');
?>
 <?php 
Util_Ui::e_config_label('minify.css.strip.crlf');
?>
</label><br />
<?php 
$this->checkbox('minify.css.embed', !$is_pro, 'csse_', true, $is_pro ? null : false);
?>
 Eliminate render-blocking CSS by moving it to HTML body</label>
<?php 
if (!$is_pro) {
    echo ' (Available after <a href="#" class="button-buy-plugin">upgrade</a>)';
}
?>
<br />
<?php 
Exemplo n.º 20
0
<?php

namespace W3TC;

if (!defined('W3TC')) {
    die;
}
$this->checkbox('minify.yuijs.options.nomunge', false, 'js_');
?>
 <?php 
Util_Ui::e_config_label('minify.yuijs.options.nomunge');
?>
</label><br />
<?php 
$this->checkbox('minify.yuijs.options.preserve-semi', false, 'js_');
?>
 <?php 
Util_Ui::e_config_label('minify.yuijs.options.preserve-semi');
?>
</label><br />
<?php 
$this->checkbox('minify.yuijs.options.disable-optimizations', false, 'js_');
?>
 <?php 
Util_Ui::e_config_label('minify.yuijs.options.disable-optimizations');
?>
</label><br />
<?php 
    echo '<div class="error">' . $details['error_message'] . '</div>';
}
?>
    <div class="metabox-holder">
        <?php 
Util_Ui::postbox_header(__('CNAMEs to use', 'w3-total-cache'));
?>
        <?php 
$cname_class = 'w3tc-ignore-change';
include W3TC_INC_DIR . '/options/cdn/common/cnames.php';
?>
        <br />
        <span class="description"><?php 
_e('Enter hostname mapped to <acronym>CDN</acronym> host, this value will replace your site\'s hostname in the <acronym title="Hypertext Markup Language">HTML</acronym>.', 'w3-total-cache');
?>
</span>

        <p class="submit">
            <input type="button"
                class="w3tc_cdn_highwinds_configure_cnames w3tc-button-save button-primary"
                value="<?php 
_e('Apply', 'w3-total-cache');
?>
" />
        </p>
        <?php 
Util_Ui::postbox_footer();
?>
    </div>
</form>
<?php 
Exemplo n.º 22
0
    <th>&nbsp;</th>
    <td>
        <input class="minifier_test button js_enabled {type: 'yuijs', nonce: '<?php 
echo wp_create_nonce('w3tc');
?>
'}" type="button" value="<?php 
_e('Test YUI Compressor', 'w3-total-cache');
?>
" />
        <span class="minifier_test_status w3tc-status w3tc-process"></span>
    </td>
</tr>
<tr>
    <th><label for="minify_yuijs_options_line-break"><?php 
Util_Ui::e_config_label('minify.yuijs.options.line-break');
?>
</label></th>
    <td>
        <input id="minify_yuijs_options_line-break" class="js_enabled"
           type="text" <?php 
Util_Ui::sealing_disabled('minify.');
?>
           name="minify__yuijs__options__line-break" value="<?php 
echo esc_attr($this->_config->get_integer('minify.yuijs.options.line-break'));
?>
" size="8" style="text-align: right;" /> <?php 
_e('symbols (set to 0 to disable)', 'w3-total-cache');
?>
    </td>
</tr>
<?php 
 /**
  * Reads config from request
  *
  * @param Config  $config
  */
 function read_request($config)
 {
     $request = Util_Request::get_request();
     include W3TC_DIR . '/ConfigKeys.php';
     // define $keys
     foreach ($request as $request_key => $request_value) {
         if (is_array($request_value)) {
             array_map('stripslashes_deep', $request_value);
         } else {
             $request_value = stripslashes($request_value);
         }
         if (strpos($request_key, 'memcached_servers')) {
             $request_value = explode(',', $request_value);
         }
         $key = Util_Ui::config_key_from_http_name($request_key);
         if (is_array($key)) {
             $config->set($key, $request_value);
         } elseif (array_key_exists($key, $keys)) {
             $descriptor = $keys[$key];
             if (isset($descriptor['type']) && $descriptor['type'] == 'array') {
                 if (is_array($request_value)) {
                     $request_value = implode("\n", $request_value);
                 }
                 $request_value = explode("\n", str_replace("\r\n", "\n", $request_value));
             }
             $config->set($key, $request_value);
         }
     }
 }
<?php

namespace W3TC;

if (!defined('W3TC')) {
    die;
}
?>
<p>
	<?php 
echo Util_Ui::button_link(__('purge CDN completely', 'w3-total-cache'), Util_Ui::url(array('w3tc_cdn_flush' => 'y')));
?>
</p>
<?php 
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_usage_statistics', __('Usage Statistics', 'w3-total-cache'), array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
 function w3tc_widget_setup()
 {
     Util_Widget::add('w3tc_usage_statistics', '<div class="w3tc-widget-w3tc-logo"></div>' . '<div class="w3tc-widget-text">' . __('Caching Statistics', 'w3-total-cache') . '</div>', array($this, 'widget_form'), Util_Ui::admin_url('admin.php?page=w3tc_general#miscellaneous'), 'normal');
 }
<?php

namespace W3TC;

if (!defined('W3TC')) {
    die;
}
?>
<tr>
    <th colspan="2">
        <?php 
$c = Dispatcher::config();
$is_pro = Util_Environment::is_w3tc_pro($c);
$key = 'stats.enabled';
$value = $c->get($key);
if (!$is_pro) {
    $value = false;
}
$name = Util_Ui::config_key_to_http_name($key);
Util_Ui::checkbox($key, $name, $value, $c->is_sealed('common.') || !$is_pro, __('Enable caching statistics (on dashboard)', 'w3-total-cache'));
if (!$is_pro) {
    echo ' (Available after <a href="#" class="button-buy-plugin">upgrade</a>)';
}
?>
    </th>
</tr>
<?php 
Exemplo n.º 28
0
        <br />
        <span class="description"><?php 
_e('Select the pull zone to use with this site.', 'w3-total-cache');
?>
</span>
    </td>
</tr>

<tr>
	<th><label for="cdn_maxcdn_ssl"><?php 
_e('<acronym title="Secure Sockets Layer">SSL</acronym> support', 'w3-total-cache');
?>
:</label></th>
	<td>
		<select id="cdn_maxcdn_ssl" name="cdn__maxcdn__ssl" <?php 
Util_Ui::sealing_disabled('cdn.');
?>
>
			<option value="auto"<?php 
selected($this->_config->get_string('cdn.maxcdn.ssl'), 'auto');
?>
><?php 
_e('Auto (determine connection type automatically)', 'w3-total-cache');
?>
</option>
			<option value="enabled"<?php 
selected($this->_config->get_string('cdn.maxcdn.ssl'), 'enabled');
?>
><?php 
_e('Enabled (always use SSL)', 'w3-total-cache');
?>
 /**
  * Alters the active state of an extension
  */
 public function change_extension_status()
 {
     $action = Util_Request::get_string('action');
     if (in_array($action, array('activate', 'deactivate'))) {
         $extension = Util_Request::get_string('extension');
         if ('activate' == $action) {
             Extensions_Util::activate_extension($extension, $this->_config);
             wp_redirect(Util_Ui::admin_url(sprintf('admin.php?page=w3tc_extensions&activated=%s', $extension)));
         } elseif ('deactivate' == $action) {
             Extensions_Util::deactivate_extension($extension, $this->_config);
             wp_redirect(Util_Ui::admin_url(sprintf('admin.php?page=w3tc_extensions&deactivated=%s', $extension)));
         }
     }
 }
                        </div>
                    </label>
                </li>
                <li>
                    <label>Send a tweet:<br />
                        <?php 
$tweet_url = 'http://twitter.com/home/?status=' . urlencode(W3TC_SUPPORT_US_TWEET);
echo Util_Ui::action_button(__('Tell Your Friends', 'w3-total-cache'), $tweet_url, "btn w3tc-size image btn-default palette-twitter", true);
?>
                    </label>
                </li>
                <li>
                    <label>
                        Login to wordpress.org to give us a great rating:<br>
                        <?php 
echo Util_Ui::action_button(__('Login & Rate Us', 'w3-total-cache'), W3TC_SUPPORT_US_RATE_URL, "btn w3tc-size image btn-default palette-wordpress", true);
?>
                    </label>
                </li>
            </ul>
            <p>
            <label class="w3tc_signup_email" for="email">You can also sign up for our newsletter:<br />
                <input id="email" name="email" type="text" class="form-control w3tc-size" value="<?php 
esc_attr_e($email);
?>
"></label><br />
            <input type="checkbox" name="signmeup" id="signmeup" class="css-checkbox" value="1" checked="checked" /><label for="signmeup" class="css-label"> <?php 
_e('Yes, sign me up.', 'w3-total-cache');
?>
 </label>
            </p>