当前位置: 首页>>代码示例>>PHP>>正文


PHP W3_Config类代码示例

本文整理汇总了PHP中W3_Config的典型用法代码示例。如果您正苦于以下问题:PHP W3_Config类的具体用法?PHP W3_Config怎么用?PHP W3_Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了W3_Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例12: 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

示例13:

 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

示例14:

 /**
  * 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

示例15: 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


注:本文中的W3_Config类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。