本文整理汇总了PHP中w3_can_check_rules函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_can_check_rules函数的具体用法?PHP w3_can_check_rules怎么用?PHP w3_can_check_rules使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_can_check_rules函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
/**
* General tab
*
* @return void
*/
function view()
{
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
global $current_user;
$config_master = $this->_config_master;
/**
* @var $modules W3_ModuleStatus
*/
$modules = w3_instance('W3_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');
$fragmentcache_enabled = $modules->is_enabled('fragmentcache');
$enabled = $modules->plugin_is_enabled();
$enabled_checkbox = $modules->all_modules_enabled();
$check_rules = w3_can_check_rules();
$check_apc = function_exists('apc_store');
$check_eaccelerator = function_exists('eaccelerator_put');
$check_xcache = function_exists('xcache_set');
$check_wincache = function_exists('wincache_ucache_set');
$check_curl = function_exists('curl_init');
$check_memcached = class_exists('Memcache');
$check_ftp = function_exists('ftp_connect');
$check_tidy = class_exists('tidy');
$disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && w3_is_network() && $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 = w3_cdn_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');
w3_require_once(W3TC_LIB_NEWRELIC_DIR . '/NewRelicWrapper.php');
$newrelic_conf_appname = NewRelicWrapper::get_wordpress_appname($this->_config, $this->_config_master, false);
$newrelic_applications = array();
$nerser = w3_instance('W3_NewRelicService');
$new_relic_installed = $nerser->module_is_enabled();
$new_relic_running = true;
if ($this->_config->get_boolean('newrelic.enabled')) {
$new_relic_configured = $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.account_id');
$newrelic_prefix = '';
if ($new_relic_configured) {
if (w3_is_network()) {
$newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix');
}
try {
$newrelic_applications = $nerser->get_applications();
} catch (Exception $ex) {
}
$newrelic_application = $this->_config->get_string('newrelic.application_id');
}
}
$licensing_visible = (!w3_is_multisite() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid';
$custom_areas = apply_filters("{$this->_page}_anchors", array());
include W3TC_INC_DIR . '/options/general.php';
}
示例2: view
/**
* Install tab
*
* @return void
*/
function view()
{
$rewrite_rules_descriptors = array();
if (w3_can_check_rules()) {
/**
* @var W3_AdminEnvironment $e
*/
$e = w3_instance('W3_AdminEnvironment');
$rewrite_rules_descriptors = $e->get_required_rules($this->_config);
$other_areas = $e->get_other_instructions($this->_config);
}
include W3TC_INC_DIR . '/options/install.php';
}
示例3:
)</code>
<?php
} else {
?>
<code>Not defined</code>
<?php
}
?>
</li>
<li>
URL rewrite:
<?php
if (w3_can_check_rules()) {
?>
<code>Enabled</code>
<?php
} else {
?>
<code>Disabled</code>
<?php
}
?>
</li>
<li>
示例4: view
/**
* General tab
*
* @return void
*/
function view()
{
global $current_user;
$config_master = $this->_config_master;
/**
* @var $modules W3_ModuleStatus
*/
$modules = w3_instance('W3_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');
$cloudflare_enabled = $modules->is_enabled('cloudflare');
$varnish_enabled = $modules->is_enabled('varnish');
$fragmentcache_enabled = $modules->is_enabled('fragmentcache');
$enabled = $modules->plugin_is_enabled();
$enabled_checkbox = $modules->all_modules_enabled();
$check_rules = w3_can_check_rules();
$check_apc = function_exists('apc_store');
$check_eaccelerator = function_exists('eaccelerator_put');
$check_xcache = function_exists('xcache_set');
$check_wincache = function_exists('wincache_ucache_set');
$check_curl = function_exists('curl_init');
$check_memcached = class_exists('Memcache');
$check_ftp = function_exists('ftp_connect');
$check_tidy = class_exists('tidy');
$disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && w3_is_network() && $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 = w3_cdn_can_purge_all($modules->get_module_engine('cdn'));
$cloudflare_signup_email = '';
$cloudflare_signup_user = '';
if (is_a($current_user, 'WP_User')) {
if ($current_user->user_email) {
$cloudflare_signup_email = $current_user->user_email;
}
if ($current_user->user_login && $current_user->user_login != 'admin') {
$cloudflare_signup_user = $current_user->user_login;
}
}
/**
* @var $w3_cloudflare W3_CloudFlare
*/
$w3_cloudflare = w3_instance('W3_CloudFlare');
$cf_options = $w3_cloudflare->get_options();
$cloudflare_seclvls = $cf_options['sec_lvl'];
$cloudflare_devmodes = $cf_options['dev_mode'];
$cloudflare_rocket_loaders = $cf_options['async'];
$cloudflare_minifications = $cf_options['minify'];
$cloudflare_seclvl = 'med';
$cloudflare_devmode_expire = 0;
$cloudflare_devmode = 0;
$cloudflare_rocket_loader = 0;
$cloudflare_minify = 0;
if ($cloudflare_enabled && $this->_config->get_string('cloudflare.email') && $this->_config->get_string('cloudflare.key')) {
$settings = $w3_cloudflare->get_settings();
$cloudflare_seclvl = $settings['sec_lvl'];
$cloudflare_devmode_expire = $settings['devmode'];
$cloudflare_rocket_loader = $settings['async'];
$cloudflare_devmode = $cloudflare_devmode_expire ? 1 : 0;
$cloudflare_minify = $settings['minify'];
$can_empty_cloudflare = true;
} else {
$can_empty_cloudflare = false;
}
$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');
w3_require_once(W3TC_LIB_NEWRELIC_DIR . '/NewRelicWrapper.php');
$newrelic_conf_appname = NewRelicWrapper::get_wordpress_appname($this->_config, $this->_config_master, false);
$newrelic_applications = array();
$nerser = w3_instance('W3_NewRelicService');
$new_relic_installed = $nerser->module_is_enabled();
$new_relic_running = true;
if ($this->_config->get_boolean('newrelic.enabled')) {
$new_relic_configured = $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.account_id');
$newrelic_prefix = '';
if ($new_relic_configured) {
if (w3_is_network()) {
$newrelic_prefix = $this->_config->get_string('newrelic.appname_prefix');
}
try {
$newrelic_applications = $nerser->get_applications();
} catch (Exception $ex) {
}
$newrelic_application = $this->_config->get_string('newrelic.application_id');
}
}
$licensing_visible = (!w3_is_multisite() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid';
include W3TC_INC_DIR . '/options/general.php';
}
示例5: options_install
/**
* Install tab
*
* @return void
*/
function options_install()
{
$rewrite_rules = array();
if (w3_can_check_rules()) {
if ($this->_config->get_boolean('minify.enabled') && $this->_config->get_string('minify.engine') == 'file') {
require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
$w3_plugin_minify =& W3_Plugin_Minify::instance();
$minify_rules_cache_path = w3_get_minify_rules_cache_path();
if (!isset($rewrite_rules[$minify_rules_cache_path])) {
$rewrite_rules[$minify_rules_cache_path] = '';
}
$rewrite_rules[$minify_rules_cache_path] .= $w3_plugin_minify->generate_rules_cache();
}
if ($this->_config->get_boolean('pgcache.enabled')) {
require_once W3TC_LIB_W3_DIR . '/Plugin/PgCache.php';
$w3_plugin_pgcache =& W3_Plugin_PgCache::instance();
$pgcache_rules_cache_path = w3_get_pgcache_rules_cache_path();
if (!isset($rewrite_rules[$pgcache_rules_cache_path])) {
$rewrite_rules[$pgcache_rules_cache_path] = '';
}
$rewrite_rules[$pgcache_rules_cache_path] .= $w3_plugin_pgcache->generate_rules_cache();
}
if ($this->_config->get_boolean('browsercache.enabled')) {
require_once W3TC_LIB_W3_DIR . '/Plugin/BrowserCache.php';
$w3_plugin_browsercache =& W3_Plugin_BrowserCache::instance();
$browsercache_rules_cache_path = w3_get_browsercache_rules_cache_path();
if (!isset($rewrite_rules[$browsercache_rules_cache_path])) {
$rewrite_rules[$browsercache_rules_cache_path] = '';
}
$rewrite_rules[$browsercache_rules_cache_path] .= $w3_plugin_browsercache->generate_rules_cache();
}
if ($this->_config->get_boolean('minify.enabled')) {
require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
$w3_plugin_minify =& W3_Plugin_Minify::instance();
$minify_rules_core_path = w3_get_minify_rules_core_path();
if (!isset($rewrite_rules[$minify_rules_core_path])) {
$rewrite_rules[$minify_rules_core_path] = '';
}
$rewrite_rules[$minify_rules_core_path] .= $w3_plugin_minify->generate_rules_core();
}
if ($this->_config->get_boolean('pgcache.enabled')) {
require_once W3TC_LIB_W3_DIR . '/Plugin/PgCache.php';
$w3_plugin_pgcache =& W3_Plugin_PgCache::instance();
$pgcache_rules_core_path = w3_get_pgcache_rules_core_path();
if (!isset($rewrite_rules[$pgcache_rules_core_path])) {
$rewrite_rules[$pgcache_rules_core_path] = '';
}
$rewrite_rules[$pgcache_rules_core_path] .= $w3_plugin_pgcache->generate_rules_core();
}
if ($this->_config->get_boolean('browsercache.enabled') && $this->_config->get_boolean('browsercache.no404wp')) {
require_once W3TC_LIB_W3_DIR . '/Plugin/BrowserCache.php';
$w3_plugin_browsercache =& W3_Plugin_BrowserCache::instance();
$browsercache_rules_no404wp_path = w3_get_browsercache_rules_no404wp_path();
if (!isset($rewrite_rules[$browsercache_rules_no404wp_path])) {
$rewrite_rules[$browsercache_rules_no404wp_path] = '';
}
$rewrite_rules[$browsercache_rules_no404wp_path] .= $w3_plugin_browsercache->generate_rules_no404wp();
}
if ($this->_config->get_boolean('browsercache.enabled') && $this->_config->get_boolean('cdn.enabled') && $this->_config->get_string('cdn.engine') == 'ftp') {
require_once W3TC_LIB_W3_DIR . '/Plugin/Cdn.php';
$w3_plugin_cdn =& W3_Plugin_Cdn::instance();
$cdn =& $w3_plugin_cdn->get_cdn();
$domain = $cdn->get_domain();
if ($domain) {
$cdn_rules_path = sprintf('ftp://%s/%s', $domain, w3_get_cdn_rules_path());
if (!isset($rewrite_rules[$cdn_rules_path])) {
$rewrite_rules[$cdn_rules_path] = '';
}
$rewrite_rules[$cdn_rules_path] .= $w3_plugin_browsercache->generate_rules_cache();
}
}
ksort($rewrite_rules);
reset($rewrite_rules);
}
include W3TC_DIR . '/inc/options/install.phtml';
}
示例6: checked
checked($browsercache_nocookies, true);
?>
/> <?php
_e("Don't set cookies for static files", 'w3-total-cache');
?>
</label>
<br /><span class="description"><?php
_e('Removes Set-Cookie header for responses.');
?>
</span>
</th>
</tr>
<tr>
<th colspan="2">
<?php
$this->checkbox('browsercache.no404wp', !w3_can_check_rules());
?>
<?php
w3_e_config_label('browsercache.no404wp');
?>
</label>
<br /><span class="description"><?php
_e('Reduce server load by allowing the web server to handle 404 (not found) errors for static files (images etc).', 'w3-total-cache');
?>
</span>
<br /><span class="description"><?php
_e('If enabled - tou may get 404 File Not Found response for some files generated on-the-fly by WordPress plugins. You may add those file URIs to 404 error exception list below to avoid that.', 'w3-total-cache');
?>
</span>
</th>
</tr>
示例7:
</p>
</form>
<form id="minify_form" action="admin.php?page=<?php
echo $this->_page;
?>
" method="post">
<div class="metabox-holder">
<?php
echo $this->postbox_header(__('General', 'w3-total-cache'), '', 'general');
?>
<table class="form-table">
<tr>
<th colspan="2">
<?php
$this->checkbox('minify.rewrite', !w3_can_check_rules() || $minify_rewrite_disabled);
?>
<?php
_e('Rewrite <acronym title="Uniform Resource Locator">URL</acronym> structure', 'w3-total-cache');
?>
</label><br />
<span class="description"><?php
_e('If disabled, <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> embeddings will use GET variables instead of "fancy" links.', 'w3-total-cache');
?>
</span>
</th>
</tr>
<tr>
<th colspan="2">
<?php
$this->checkbox('minify.reject.logged');
示例8: get
/**
* Returns config value
*
* @param string $key
* @param mixed $default
* @return mixed
*/
function get($key, $default = null)
{
if (array_key_exists($key, $this->_keys) && array_key_exists($key, $this->_config)) {
$value = $this->_config[$key];
} else {
if ($default === null && array_key_exists($key, $this->_defaults)) {
$value = $this->_defaults[$key];
} else {
$value = $default;
}
}
switch ($key) {
/**
* Check cache engines
*/
case 'pgcache.engine':
case 'dbcache.engine':
case 'minify.engine':
case 'objectcache.engine':
/**
* Legacy support
*/
if ($value == 'file_pgcache') {
$value = 'file_generic';
}
switch (true) {
case $value == 'file_generic' && !w3_can_check_rules():
case $value == 'apc' && !function_exists('apc_store'):
case $value == 'eaccelerator' && !function_exists('eaccelerator_put'):
case $value == 'xcache' && !function_exists('xcache_set'):
case $value == 'wincache' && !function_exists('wincache_ucache_set'):
case $value == 'memcached' && !class_exists('Memcache'):
return 'file';
}
break;
/**
* Check HTML minifier
*/
/**
* Check HTML minifier
*/
case 'minify.html.engine':
if ($value == 'htmltidy' && !class_exists('tidy')) {
return 'html';
}
break;
/**
* Disabled some page cache options when enhanced mode enabled
*/
/**
* Disabled some page cache options when enhanced mode enabled
*/
case 'pgcache.cache.query':
if ($this->get_string('pgcache.engine') == 'file_generic') {
return false;
}
break;
/**
* Set default value to sitemap file
*/
/**
* Set default value to sitemap file
*/
case 'pgcache.prime.sitemap':
if (!$value) {
$value = w3_get_home_url() . '/sitemap.xml';
}
break;
/**
* Disabled minify when PHP5 is not installed
*/
/**
* Disabled minify when PHP5 is not installed
*/
case 'minify.enabled':
if (!W3TC_PHP5) {
return false;
}
break;
/**
* Disable minify rewrite when server rules are not supported
*/
/**
* Disable minify rewrite when server rules are not supported
*/
case 'minify.rewrite':
if (!w3_can_check_rules()) {
return false;
}
break;
/**
* Disable minify options for auto mode
*/
//.........这里部分代码省略.........
示例9: options_install
/**
* Install tab
*
* @return void
*/
function options_install()
{
$rewrite_rules_descriptors = array();
if (w3_can_check_rules()) {
$e = w3_instance('W3_AdminEnvironment');
$rewrite_rules_descriptors = $e->get_required_rules($this->_config);
}
include W3TC_INC_DIR . '/options/install.php';
}
示例10: options_install
/**
* Install tab
*
* @return void
*/
function options_install()
{
$rewrite_rules_descriptors = array();
if (w3_can_check_rules()) {
$plugins = w3_instance('W3_Plugins');
$rewrite_rules_descriptors = $plugins->get_required_rules();
}
include W3TC_INC_DIR . '/options/install.php';
}