public function w3tc_errors($errors) { $c = Dispatcher::config(); if ($c->get_string('dbcache.engine') == 'memcached') { $memcached_servers = $c->get_array('dbcache.memcached.servers'); if (!Util_Installed::is_memcache_available($memcached_servers)) { if (!isset($errors['memcache_not_responding.details'])) { $errors['memcache_not_responding.details'] = array(); } $errors['memcache_not_responding.details'][] = sprintf(__('Database Cache: %s.', 'w3-total-cache'), implode(', ', $memcached_servers)); } } return $errors; }
public function w3tc_settings_general_boxarea_cdn() { $config = Dispatcher::config(); $engine_optgroups = array(); $engine_values = array(); $is_fsd = Util_Environment::is_w3tc_pro($config); if ($is_fsd) { $engine_optgroups[] = __('Full Site Delivery:', 'w3-total-cache'); $engine_values['cloudfront_fsd'] = array('label' => __('Amazon CloudFront', 'w3-total-cache'), 'optgroup' => 0); $engine_values['maxcdn_fsd'] = array('label' => __('MaxCDN (recommended)', 'w3-total-cache'), 'optgroup' => 0); $optgroup_pull = count($engine_optgroups); $engine_optgroups[] = __('Origin Pull / Mirror:', 'w3-total-cache'); } else { $optgroup_pull = count($engine_optgroups); $engine_optgroups[] = __('Origin Pull / Mirror:', 'w3-total-cache'); } $optgroup_push = count($engine_optgroups); $engine_optgroups[] = __('Origin Push:', 'w3-total-cache'); $engine_values['akamai'] = array('label' => __('Akamai', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['cf2'] = array('label' => __('Amazon CloudFront', 'w3-total-cache'), 'disabled' => !Util_Installed::curl() ? true : null, 'optgroup' => $optgroup_pull); $engine_values['att'] = array('label' => __('AT&T', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['cotendo'] = array('label' => __('Cotendo (Akamai)', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['mirror'] = array('label' => __('Generic Mirror', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['highwinds'] = array('label' => __('Highwinds', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['maxcdn'] = array('label' => __('MaxCDN', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['netdna'] = array('label' => __('MaxCDN Enterprise (NetDNA)', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['rackspace_cdn'] = array('label' => __('RackSpace CDN', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['edgecast'] = array('label' => __('Verizon Digital Media Services (EdgeCast) / Media Temple ProCDN', 'w3-total-cache'), 'optgroup' => $optgroup_pull); $engine_values['cf'] = array('disabled' => !Util_Installed::curl() ? true : null, 'label' => __('Amazon CloudFront', 'w3-total-cache'), 'optgroup' => $optgroup_push); $engine_values['s3'] = array('disabled' => !Util_Installed::curl() ? true : null, 'label' => __('Amazon Simple Storage Service (S3)', 'w3-total-cache'), 'optgroup' => $optgroup_push); $engine_values['s3_compatible'] = array('disabled' => !Util_Installed::curl() ? true : null, 'label' => __('Amazon Simple Storage Service (S3) Compatible', 'w3-total-cache'), 'optgroup' => $optgroup_push); $engine_values['google_drive'] = array('label' => __('Google Drive', 'w3-total-cache'), 'optgroup' => $optgroup_push); $engine_values['azure'] = array('label' => __('Microsoft Azure Storage', 'w3-total-cache'), 'optgroup' => $optgroup_push); $engine_values['rscf'] = array('disabled' => !Util_Installed::curl() ? true : null, 'label' => __('Rackspace Cloud Files', 'w3-total-cache'), 'optgroup' => $optgroup_push); $engine_values['ftp'] = array('disabled' => !Util_Installed::ftp() ? true : null, 'label' => __('Self-hosted / File Transfer Protocol Upload', 'w3-total-cache'), 'optgroup' => $optgroup_push); $cdn_enabled = $config->get_boolean('cdn.enabled'); $cdn_engine = $config->get_string('cdn.engine'); $tag = ''; if ($cdn_engine == 'cloudfront_fsd') { $tag = '#cdn-fsd-cloudfront'; } elseif ($cdn_engine == 'maxcdn_fsd') { $tag = '#cdn-fsd-maxcdn'; } if (empty($tag)) { $cdn_engine_extra_description = ''; } else { $cdn_engine_extra_description = ' See <a href="admin.php?page=w3tc_faq' . $tag . '">setup instructions</a>'; } include W3TC_DIR . '/Cdn_GeneralPage_View.php'; }
public function w3tc_settings_general_boxarea_system_opcache() { $opcode_engine = 'Not Available'; $validate_timestamps = false; if (Util_Installed::opcache()) { $opcode_engine = 'OPcache'; $validate_timestamps = Util_Installed::is_opcache_validate_timestamps(); } else { if (Util_Installed::apc_opcache()) { $opcode_engine = 'APC'; $engine_status = Util_Installed::is_apc_validate_timestamps(); } } include W3TC_DIR . '/SystemOpCache_GeneralPage_View.php'; }
public function flush() { if (Util_Installed::opcache()) { return opcache_reset(); } else { if (Util_Installed::apc_opcache()) { $result = apc_clear_cache(); // that doesnt clear user cache $result |= apc_clear_cache('opcode'); // extra return $result; } } return false; }
function w3tc_errors($errors) { $c = Dispatcher::config(); $state = Dispatcher::config_state_master(); /** * Minify error occured */ if ($state->get_boolean('minify.show_note_minify_error')) { $errors['minify_error_creating'] = sprintf(__('Recently an error occurred while creating the CSS / JS minify cache: %s. %s', 'w3-total-cache'), $state->get_string('minify.error.last'), Util_Ui::button_hide_note2(array('w3tc_default_config_state_master' => 'y', 'key' => 'minify.show_note_minify_error', 'value' => 'false'))); } if ($c->get_string('minify.engine') == 'memcached') { $memcached_servers = $c->get_array('minify.memcached.servers'); if (!Util_Installed::is_memcache_available($memcached_servers)) { if (!isset($errors['memcache_not_responding.details'])) { $errors['memcache_not_responding.details'] = array(); } $errors['memcache_not_responding.details'][] = sprintf(__('Minify: %s.', 'w3-total-cache'), implode(', ', $memcached_servers)); } } return $errors; }
<?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')));
?> <code><?php _e('Not installed', 'w3-total-cache'); ?> </code> <?php } ?> </li> <li> <?php _e('HTML Tidy extension:', 'w3-total-cache'); ?> <?php if (Util_Installed::tidy()) { ?> <code><?php _e('Installed', 'w3-total-cache'); ?> </code> <?php } else { ?> <code><?php _e('Not installed', 'w3-total-cache'); ?> </code> <?php } ?>
<?php Util_Ui::postbox_header(__('Minify', 'w3-total-cache'), '', 'minify'); Util_Ui::config_overloading_button(array('key' => 'minify.configuration_overloaded')); ?> <p><?php _e('Reduce load time by decreasing the size and number of <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> files. Automatically remove unncessary data from <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym>, feed, page and post <acronym title="Hypertext Markup Language">HTML</acronym>.', 'w3-total-cache'); ?> </p> <table class="form-table"> <?php Util_Ui::config_item(array('key' => 'minify.enabled', 'control' => 'checkbox', 'checkbox_label' => __('Enable', 'w3-total-cache'), 'description' => __('Minification can decrease file size of <acronym title="Hypertext Markup Language">HTML</acronym>, <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym> and feeds respectively by ~10% on average.', 'w3-total-cache'))); Util_Ui::config_item(array('key' => 'minify.auto', 'value' => $this->_config->get_boolean('minify.auto') ? 1 : 0, 'control' => 'radiogroup', 'radiogroup_values' => array('1' => __('Auto', 'w3-total-cache'), '0' => __('Manual', 'w3-total-cache')), 'description' => __('Select manual mode to use fields on the minify settings tab to specify files to be minified, otherwise files will be minified automatically.', 'w3-total-cache'))); Util_Ui::config_item_engine(array('key' => 'minify.engine')); Util_Ui::config_item(array('key' => 'minify.html.engine', 'control' => 'selectbox', 'selectbox_values' => array('html' => __('Minify (default)', 'w3-total-cache'), 'htmltidy' => array('disabled' => !Util_Installed::tidy(), 'label' => __('HTML Tidy', 'w3-total-cache'))))); Util_Ui::config_item(array('key' => 'minify.js.engine', 'control' => 'selectbox', 'selectbox_values' => array('js' => __('JSMin (default)', 'w3-total-cache'), 'googleccjs' => __('Google Closure Compiler (Web Service)', 'w3-total-cache'), 'ccjs' => __('Google Closure Compiler (Local Java)', 'w3-total-cache'), 'jsminplus' => __('Narcissus', 'w3-total-cache'), 'yuijs' => __('YUI Compressor', 'w3-total-cache')))); Util_Ui::config_item(array('key' => 'minify.css.engine', 'control' => 'selectbox', 'selectbox_values' => array('css' => __('Minify (default)', 'w3-total-cache'), 'csstidy' => __('CSS Tidy', 'w3-total-cache'), 'cssmin' => __('YUI Compressor (PHP)', 'w3-total-cache'), 'yuicss' => __('YUI Compressor', 'w3-total-cache')))); ?> </table> <?php Util_Ui::button_config_save('general_minify', '<input type="submit" name="w3tc_flush_minify" value="' . __('Empty cache', 'w3-total-cache') . '" ' . ($minify_enabled ? '' : ' disabled="disabled" ') . ' class="button" />'); ?> <?php Util_Ui::postbox_footer(); ?> <?php do_action('w3tc_settings_general_boxarea_system_opcache');
/** * Displays config item - caching engine selectbox */ public static function config_item_engine($a) { if (isset($a['empty_value']) && $a['empty_value']) { $values[''] = array('label' => 'Please select a method'); } $values['file'] = array('label' => __('Disk', 'w3-total-cache'), 'optgroup' => 0); $values['apc'] = array('disabled' => !Util_Installed::apc(), 'label' => __('Opcode: Alternative PHP Cache (APC / APCu)', 'w3-total-cache'), 'optgroup' => 1); $values['eaccelerator'] = array('disabled' => !Util_Installed::eaccelerator(), 'label' => __('Opcode: eAccelerator', 'w3-total-cache'), 'optgroup' => 1); $values['xcache'] = array('disabled' => !Util_Installed::xcache(), 'label' => __('Opcode: XCache', 'w3-total-cache'), 'optgroup' => 1); $values['wincache'] = array('disabled' => !Util_Installed::wincache(), 'label' => __('Opcode: WinCache', 'w3-total-cache'), 'optgroup' => 1); $values['memcached'] = array('disabled' => !Util_Installed::memcached(), 'label' => __('Memcached', 'w3-total-cache'), 'optgroup' => 2); $values['redis'] = array('disabled' => !Util_Installed::redis(), 'label' => __('Redis', 'w3-total-cache'), 'optgroup' => 2); Util_Ui::config_item(array('key' => $a['key'], 'label' => isset($a['label']) ? $a['label'] : null, 'disabled' => isset($a['disabled']) ? $a['disabled'] : null, 'control' => 'selectbox', 'selectbox_values' => $values, 'selectbox_optgroups' => array(__('Shared Server:', 'w3-total-cache'), __('Dedicated / Virtual Server:', 'w3-total-cache'), __('Multiple Servers:', 'w3-total-cache')))); }
if (!Util_Installed::memcached_auth()) { _e('<br>Available when memcached extension installed, built with SASL, and memcached.use_sasl = 1 option is set in php.ini', 'w3-total-cache'); } ?> </span> </td> </tr> <tr> <th><label for="memcached_password"><?php echo Util_ConfigLabel::get('memcached.password'); ?> </label></th> <td> <input id="memcached_password" name="<?php echo $module; ?> __memcached__password" type="text" <?php Util_Ui::sealing_disabled($module); ?> <?php $this->value_with_disabled($module . '.memcached.password', !Util_Installed::memcached_auth(), ''); ?> /><br /> <span class="description"><?php _e('Specify memcached password, when SASL authentication used', 'w3-total-cache'); ?> </span> </td> </tr> <?php