本文整理汇总了PHP中W3_Config类的典型用法代码示例。如果您正苦于以下问题:PHP W3_Config类的具体用法?PHP W3_Config怎么用?PHP W3_Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了W3_Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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 '';
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:38,代码来源:NewRelicNotes.php
示例2: 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;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:38,代码来源:NewRelicWrapper.php
示例3: 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'));
}
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:7,代码来源:WordPressSEO.php
示例4:
/**
* @param W3_Config $config
* @param W3_Config $old_config
*/
function possible_state_change($config, $old_config)
{
if ($old_config->get_string('plugin.license_key') != '' && $config->get_string('plugin.license_key') == '') {
$result = edd_w3edge_w3tc_deactivate_license($old_config->get_string('plugin.license_key'));
if ($result) {
$this->site_inactivated = true;
}
delete_transient('w3tc_license_status');
} else {
if ($old_config->get_string('plugin.license_key') == '' && $config->get_string('plugin.license_key') != '') {
$result = edd_w3edge_w3tc_activate_license($config->get_string('plugin.license_key'));
if ($result) {
$this->site_activated = true;
}
delete_transient('w3tc_license_status');
} else {
if ($old_config->get_string('plugin.license_key') != $config->get_string('plugin.license_key')) {
$result = edd_w3edge_w3tc_activate_license($config->get_string('plugin.license_key'));
if ($result) {
$this->site_activated = true;
}
delete_transient('w3tc_license_status');
}
}
}
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:30,代码来源:Licensing.php
示例5: is_cache_configured
public function is_cache_configured()
{
$cache_configured = true;
if ($this->is_wp_super_cache_detected()) {
return $this->is_wp_super_cache_active() && $this->does_wp_super_cache_have_configured_uas() || !$this->is_wp_super_cache_active();
}
// Check W3
if ($this->is_w3_plugin_detected()) {
$w3_config = new W3_Config(true);
if ($w3_config) {
// Check to see if the Page Cache is enabled
if ($w3_config->get_cache_option('pgcache.enabled')) {
// If it's enabled, we need to make sure the user agents have been updated
$rejected_user_agents = $w3_config->get_cache_option('pgcache.reject.ua');
if (!$this->find_in_array_no_case('iphone', $rejected_user_agents)) {
$cache_configured = false;
}
if (!$cache_configured && ($user_groups = $w3_config->get_array('mobile.rgroups')) && is_array($user_groups) && count($user_groups) > 0) {
foreach ($user_groups as $group) {
if ($group['enabled'] && $this->find_in_array_no_case('iphone', $group['agents']) && $group['theme'] == '' && $group['redirect'] == '') {
$cache_configured = true;
add_filter('wptouch_show_mobile_switch_link', '__return_false');
}
}
}
}
}
return $cache_configured;
}
if ($this->is_wordfence_detected()) {
$cache_type = wfConfig::get('cacheType', false);
if (!$cache_type) {
$cache_configured = true;
} else {
$cookie_set = false;
$user_agents_set = false;
$exclusions = wfConfig::get('cacheExclusions', false);
if ($exclusions) {
$exclusions = unserialize($exclusions);
if ($exclusions) {
foreach ($exclusions as $exclusion) {
if ($exclusion['pt'] == 'cc' && ($exclusion['p'] = 'wptouch_switch_toggle')) {
$cookie_set = true;
} else {
if ($exclusion['pt'] == 'uac' && strtolower($exclusion['p']) == 'iphone') {
$user_agents_set = true;
}
}
if ($cookie_set && $user_agents_set) {
break;
}
}
}
}
$cache_configured = $cookie_set && $user_agents_set;
}
return $cache_configured;
}
return $cache_configured;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:60,代码来源:class-cache-smash.php
示例6: __construct
/**
* 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');
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:10,代码来源:Varnish.php
示例7: __construct
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');
}
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:8,代码来源:ObjectCacheBridge.php
示例8: 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);
}
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:8,代码来源:NextGENGallery.php
示例9: 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;
}
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:19,代码来源:NewRelicAdminEnvironment.php
示例10: __construct
/**
* PHP5-style constructor
*/
function __construct()
{
require_once W3TC_LIB_W3_DIR . '/Config.php';
$config =& W3_Config::instance();
$this->_debug = $config->get_boolean('varnish.debug');
$this->_servers = $config->get_array('varnish.servers');
$this->_timeout = $config->get_integer('timelimit.varnish_purge');
}
开发者ID:niko-lgdcom,项目名称:archives,代码行数:11,代码来源:Varnish.php
示例11: run
public function run()
{
$this->_config = w3_instance('W3_Config');
$this->_config_admin = w3_instance('W3_ConfigAdmin');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin_ui.php');
$this->_page = w3tc_get_current_page();
if (is_network_admin() || !w3_is_multisite()) {
$this->edge_notification();
}
if (is_w3tc_admin_page()) {
add_action('admin_head', array($this, 'admin_head'));
add_action('w3tc_hide_button_custom-edge_mode', array($this, 'hide_edge_mode_notification'));
$support_reminder = $this->_config->get_boolean('notes.support_us') && $this->_config_admin->get_integer('common.install') < time() - W3TC_SUPPORT_US_TIMEOUT && $this->_config->get_string('common.support') == '' && !$this->_config->get_boolean('common.tweeted');
if ($support_reminder || w3tc_show_notification('support_us_popup')) {
add_action('w3tc-dashboard-head', array($this, 'support_us_nag'));
}
add_action('w3tc-dashboard-head', array($this, 'edge_nag'));
}
}
开发者ID:yszar,项目名称:linuxwp,代码行数:20,代码来源:NotificationsAdmin.php
示例12: 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'));
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:12,代码来源:Genesis.php
示例13: 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;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:12,代码来源:Menus.php
示例14:
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);
}
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:14,代码来源:NewRelicActionsAdmin.php
示例15:
/**
* Bad Behavior support
* @return void
*/
function _bad_behavior()
{
$bb_file = $this->_config->get_cache_option('pgcache.bad_behavior_path');
if ($bb_file != '') {
require_once $bb_file;
}
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:11,代码来源:PgCache.php
示例16: foreach
/**
* Loads extensions stored in config
*/
function load_extensions()
{
$extensions = $this->_config->get_array('extensions.active');
foreach ($extensions as $extension => $path) {
include W3TC_EXTENSION_DIR . '/' . trim($path, '/');
}
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:10,代码来源:Root.php
示例17: update_ip_ranges
/**
* Check
* @throws FilesystemOperationException
* @throws FileOperationException
*/
public function update_ip_ranges()
{
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
$ip4_diff = $ip6_diff = false;
$response = w3_http_get(W3TC_CLOUDFLARE_IP4_URL);
$extensions_settings = $this->_config->get_array('extensions.settings', array());
if (!is_wp_error($response)) {
$ip4_data = $response['body'];
$ip4_data = explode("\n", $ip4_data);
$ip4_data_old = w3tc_get_extension_config('cloudflare', 'ips.ip4', $this->_config, array());
if ($ip4_diff = array_diff($ip4_data, $ip4_data_old)) {
$extensions_settings['cloudflare']['ips.ip4'] = $ip4_data;
$this->_config->set('extensions.settings', $extensions_settings);
}
}
$response = w3_http_get(W3TC_CLOUDFLARE_IP6_URL);
if (!is_wp_error($response)) {
$ip6_data = $response['body'];
$ip6_data = explode("\n", $ip6_data);
$ip6_data_old = w3tc_get_extension_config('cloudflare', 'ips.ip6', $this->_config, array());
if ($ip6_diff = array_diff($ip6_data, $ip6_data_old)) {
$extensions_settings['cloudflare']['ips.ip6'] = $ip6_data;
$this->_config->set('extensions.settings', $extensions_settings);
}
}
if ($ip4_diff || $ip6_diff) {
try {
$this->_config->save();
$this->_config->refresh_cache();
} catch (Exception $ex) {
}
}
}
开发者ID:jfbelisle,项目名称:magexpress,代码行数:38,代码来源:CloudFlareAPI.php
示例18: 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];
}
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:40,代码来源:Minify.php
示例19: time
/**
* Flush browsers cache
*/
function flush_browser_cache()
{
if ($this->_config->get_boolean('browsercache.enabled')) {
$this->_config->set('browsercache.timestamp', time());
$this->_config->save();
}
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:10,代码来源:FlushActionsAdmin.php
示例20: catch
/**
* @throws Exception
*/
function action_aws_sns_subscribe()
{
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$topic_arn = W3_Request::get_string('cluster_messagebus_sns_topic_arn_subscribe');
/**
* @var W3_Enterprise_SnsClient $sns_client
*/
$sns_client = w3_instance('W3_Enterprise_SnsClient');
$sns_client->subscribe(plugins_url('pub/sns.php', W3TC_FILE), $topic_arn);
try {
$this->_config->set('cluster.messagebus.sns.topic_arn', $topic_arn);
$this->_config->save();
} catch (Exception $ex) {
throw new Exception('<strong>Can\'t change configuration</strong>: ' . $ex->getMessage());
}
w3_admin_redirect(array('w3tc_note' => 'sns_subscribed'));
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:20,代码来源:AwsActionsAdmin.php
注:本文中的W3_Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论