本文整理汇总了PHP中W3_Config::get_boolean方法的典型用法代码示例。如果您正苦于以下问题:PHP W3_Config::get_boolean方法的具体用法?PHP W3_Config::get_boolean怎么用?PHP W3_Config::get_boolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类W3_Config
的用法示例。
在下文中一共展示了W3_Config::get_boolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->_config = w3_instance('W3_Config');
if ($this->_config->get_boolean('cdn.enabled')) {
add_filter('wpseo_xml_sitemap_img_src', array($this, 'wpseo_cdn_filter'));
}
}
示例2: notifications
/**
* @param W3_Config $config
* @param W3_ConfigAdmin $config_admin
* @return string
*/
function notifications($config)
{
/**
* @var $nerser W3_NewRelicService
*/
$nerser = w3_instance('W3_NewRelicService');
try {
$pl = $nerser->get_frontend_response_time();
if ($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), w3_button_hide_note('Hide this message', 'new_relic_page_load_notification', '', true));
return $message;
}
}
} catch (Exception $ex) {
}
return '';
}
示例3:
/**
* PHP5-style constructor
*/
function __construct()
{
$this->_config = w3_instance('W3_Config');
$this->_debug = $this->_config->get_boolean('varnish.debug');
$this->_servers = $this->_config->get_array('varnish.servers');
$this->_timeout = $this->_config->get_integer('timelimit.varnish_purge');
}
示例4:
function __construct()
{
$this->_config = w3_instance('W3_Config');
$this->_caches['objectcache'] = w3_instance('W3_ObjectCache');
if ($this->_config->get_boolean('fragmentcache.enabled')) {
$this->_caches['fragmentcache'] = w3_instance('W3_Pro_FragmentCache');
}
}
示例5: run
function run()
{
$this->_config = w3_instance('W3_Config');
if ($this->_config->get_boolean('cdn.enabled')) {
add_action('includes_url', array(&$this, 'filter_includes_url'), 10, 2);
add_action('ngg_get_image_url', array(&$this, 'action_ngg_get_image_url'), 10, 3);
}
}
示例6: list
/**
* Store the output buffer per page/post hook basis.
*/
function cache_genesis_end()
{
$keys = $this->_get_id_group(current_filter());
if (is_null($keys)) {
return;
}
list($id, $group) = $keys;
w3tc_fragmentcache_end($id, $group, $this->_config->get_boolean('fragmentcache.debug'));
}
示例7: generate
function generate()
{
$pages = $this->generate_menu_array();
add_menu_page(__('Performance', 'w3-total-cache'), __('Performance', 'w3-total-cache'), 'manage_options', 'w3tc_dashboard', '', 'div');
$submenu_pages = array();
foreach ($pages as $slug => $titles) {
if ($this->_config_admin->get_boolean('common.visible_by_master_only') && $titles['network_show'] || (!$this->_config_admin->get_boolean('common.visible_by_master_only') || is_super_admin() && (!w3_force_master() || is_network_admin()))) {
$submenu_pages[] = add_submenu_page('w3tc_dashboard', $titles[0] . ' | W3 Total Cache', $titles[1], 'manage_options', $slug, array(&$this, 'options'));
}
}
return $submenu_pages;
}
示例8: fix_on_wpadmin_request
/**
* Fixes environment in each wp-admin request
*
* @param W3_Config $config
* @param bool $force_all_checks
* @throws SelfTestExceptions
**/
public function fix_on_wpadmin_request($config, $force_all_checks)
{
$exs = new SelfTestExceptions();
if ($config->get_boolean('config.check') || $force_all_checks) {
if (!$config->get_boolean('newrelic.enabled') || $config->get_boolean('newrelic.enabled') && $config->get_boolean('newrelic.use_php_function')) {
$this->rules_remove($exs);
}
}
if (count($exs->exceptions()) > 0) {
throw $exs;
}
}
示例9:
function action_save_new_relic()
{
if ($this->_config->get_boolean('newrelic.enabled')) {
/**
* @var $nerser W3_NewRelicService
*/
$nerser = w3_instance('W3_NewRelicService');
$application = W3_Request::get_array('application');
$application['alerts_enabled'] = $application['alerts_enabled'] == 1 ? 'true' : 'false';
$application['rum_enabled'] = $application['rum_enabled'] == 1 ? 'true' : 'false';
$result = $nerser->update_application_settings($application);
w3_admin_redirect(array('w3tc_note' => 'new_relic_save'), true);
}
}
示例10: get_wordpress_appname
/**
* @param W3_Config $config
* @param W3_Config $config_master
* @param bool $do_merge if to merge with network main site
* @return string
*/
public static function get_wordpress_appname($config, $config_master, $do_merge = true)
{
if (w3_is_network()) {
if ($config_master->get_boolean('newrelic.use_network_wide_id')) {
$appname = $config_master->get_string('newrelic.appname');
} else {
$merge = $config->get_boolean('newrelic.merge_with_network');
$merge_name = '';
if ($do_merge && $merge && w3_get_blog_id() != 0) {
$merge_name = ';' . $config_master->get_string('newrelic.appname');
}
if (w3_get_blog_id() != 0 && !$config->get_boolean('common.force_master')) {
$appname = $config->get_string('newrelic.appname', '');
if (empty($appname)) {
$prefix = $config->get_string('newrelic.appname_prefix');
$appname = $prefix . trim(w3_get_home_domain() . w3_get_site_path(), '/');
}
} else {
if (w3_get_blog_id() != 0) {
$prefix = $config->get_string('newrelic.appname_prefix');
$appname = $prefix . trim(w3_get_home_domain() . w3_get_site_path(), '/');
} else {
$appname = $config->get_string('newrelic.appname');
}
}
$appname = $appname . $merge_name;
}
} else {
$appname = $config->get_string('newrelic.appname');
}
return $appname;
}
示例11: time
/**
* Flush browsers cache
*/
function flush_browser_cache()
{
if ($this->_config->get_boolean('browsercache.enabled')) {
$this->_config->set('browsercache.timestamp', time());
$this->_config->save();
}
}
示例12:
/**
* Check if caching allowed on init
*
* @return boolean
*/
function _can_cache()
{
/**
* Skip if disabled
*/
if (!$this->_config->get_boolean('objectcache.enabled')) {
if (function_exists('__')) {
$this->cache_reject_reason = __('Object caching is disabled', 'w3-total-cache');
} else {
$this->cache_reject_reason = 'Object caching is disabled';
}
return false;
}
/**
* Check for DONOTCACHEOBJECT constant
*/
if (defined('DONOTCACHEOBJECT') && DONOTCACHEOBJECT) {
if (function_exists('__')) {
$this->cache_reject_reason = __('DONOTCACHEOBJECT constant is defined', 'w3-total-cache');
} else {
$this->cache_reject_reason = 'DONOTCACHEOBJECT constant is defined';
}
return false;
}
return true;
}
示例13: array
/**
* Returns minify cache object
*
* @return object
*/
function &_get_cache()
{
static $cache = array();
if (!isset($cache[0])) {
switch ($this->_config->get_string('minify.engine')) {
case 'memcached':
require_once W3TC_LIB_W3_DIR . '/Cache/Memcached.php';
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/Memcache.php';
$this->_memcached =& new W3_Cache_Memcached(array('servers' => $this->_config->get_array('minify.memcached.servers'), 'persistant' => $this->_config->get_boolean('minify.memcached.persistant')));
$cache[0] =& new Minify_Cache_Memcache($this->_memcached);
break;
case 'apc':
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/APC.php';
$cache[0] =& new Minify_Cache_APC();
break;
case 'eaccelerator':
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/Eaccelerator.php';
$cache[0] =& new Minify_Cache_Eaccelerator();
break;
case 'xcache':
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/XCache.php';
$cache[0] =& new Minify_Cache_XCache();
break;
case 'file':
default:
require_once W3TC_LIB_MINIFY_DIR . '/Minify/Cache/File.php';
if (!is_dir(W3TC_CACHE_FILE_MINIFY_DIR)) {
$this->log(sprintf('Cache directory %s does not exist', W3TC_CACHE_FILE_MINIFY_DIR));
}
$cache[0] =& new Minify_Cache_File(W3TC_CACHE_FILE_MINIFY_DIR, $this->_config->get_boolean('minify.file.locking'));
break;
}
}
return $cache[0];
}
示例14: _criteria_matched
private function _criteria_matched($criteria)
{
if (is_array($criteria)) {
$enabled = true;
$compare = '&&';
foreach ($criteria as $val) {
if (is_array($val)) {
if ($val[1] == '!=') {
$enabled = $this->_compare_criteria_values($enabled, $this->_config->get_string($val[0]) != $val[2], $compare);
} elseif ($val[1] == '==') {
$enabled = $this->_compare_criteria_values($enabled, $this->_config->get_string($val[0]) == $val[2], $compare);
} else {
$enabled = $enabled || $this->_criteria_matched($val);
}
} elseif ($val != '||' && $val != '&&') {
$enabled = $this->_compare_criteria_values($enabled, $this->_config->get_boolean($val), $compare);
} else {
$compare = $val;
}
}
} else {
$enabled = is_null($criteria) || $this->_config->get_boolean($criteria);
}
return $enabled;
}
示例15:
/**
* Check if can cache sql, checks which have constant results during whole request
*
* @return boolean
*/
function _can_cache_once_per_request()
{
/**
* Skip if disabled
*/
if (!$this->_config->get_boolean('dbcache.enabled')) {
$this->cache_reject_reason = 'dbcache.disabled';
return false;
}
/**
* Skip if request URI is rejected
*/
if (!$this->_check_request_uri()) {
$this->cache_reject_reason = 'request';
return false;
}
/**
* Skip if cookie is rejected
*/
if (!$this->_check_cookies()) {
$this->cache_reject_reason = 'cookie';
return false;
}
return true;
}