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


PHP Dispatcher::config方法代码示例

本文整理汇总了PHP中Dispatcher::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::config方法的具体用法?PHP Dispatcher::config怎么用?PHP Dispatcher::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dispatcher的用法示例。


在下文中一共展示了Dispatcher::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: w3tc_ajax_extension_cloudflare_zones_done

 public function w3tc_ajax_extension_cloudflare_zones_done()
 {
     $email = $_REQUEST['email'];
     $key = $_REQUEST['key'];
     $zone_id = Util_Request::get('zone_id');
     if (empty($zone_id)) {
         return $this->_render_extension_cloudflare_zones(array('email' => $email, 'key' => $key, 'error_message' => 'Please select zone'));
     }
     $zone_name = '';
     // get zone name
     try {
         $api = new Extension_CloudFlare_Api(array('email' => $email, 'key' => $key));
         $zone = $api->zone($zone_id);
         $zone_name = $zone['name'];
     } catch (\Exception $ex) {
         $details['error_message'] = 'Can\'t authenticate: ' . $ex->getMessage();
         include W3TC_DIR . '/Extension_CloudFlare_Popup_View_Intro.php';
         exit;
     }
     $c = Dispatcher::config();
     $c->set(array('cloudflare', 'email'), $email);
     $c->set(array('cloudflare', 'key'), $key);
     $c->set(array('cloudflare', 'zone_id'), $zone_id);
     $c->set(array('cloudflare', 'zone_name'), $zone_name);
     $c->save();
     delete_transient('w3tc_cloudflare_stats');
     $postfix = Util_Admin::custom_message_id(array(), array('extension_cloudflare_configuration_saved' => 'CloudFlare credentials are saved successfully'));
     echo 'Location admin.php?page=w3tc_extensions&extension=cloudflare&' . 'action=view&' . $postfix;
     exit;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:30,代码来源:Extension_CloudFlare_Popup.php

示例2: run

 function run()
 {
     $c = Dispatcher::config();
     $this->api = new Extension_CloudFlare_Api(array('email' => $c->get_string(array('cloudflare', 'email')), 'key' => $c->get_string(array('cloudflare', 'key')), 'zone_id' => $c->get_string(array('cloudflare', 'zone_id')), 'timelimit_api_request' => $c->get_integer(array('cloudflare', 'timelimit.api_request'))));
     $this->_config = $c;
     add_filter('w3tc_dashboard_actions', array($this, 'w3tc_dashboard_actions'));
     $widget = new Extension_CloudFlare_Widget();
     $widget->init();
     // modify settings page
     add_filter('w3tc_settings_general_anchors', array($this, 'w3tc_settings_general_anchors'));
     add_action('w3tc_settings_general_boxarea_cloudflare', array($this, 'w3tc_settings_general_boxarea_cloudflare'));
     add_action('wp_ajax_w3tc_cloudflare_api_request', array($this, 'action_cloudflare_api_request'));
     // modify main menu
     add_action('w3tc_extension_page_cloudflare', array('\\W3TC\\Extension_CloudFlare_Page', 'w3tc_extension_page_cloudflare'));
     add_filter('w3tc_admin_bar_menu', array($this, 'w3tc_admin_bar_menu'));
     // dashboard
     add_action('admin_print_scripts-toplevel_page_w3tc_dashboard', array($this, 'admin_print_scripts_w3tc_dashboard'));
     add_filter('w3tc_admin_actions', array($this, 'w3tc_admin_actions'));
     // own settings page
     add_action('admin_print_scripts-performance_page_w3tc_extensions', array('\\W3TC\\Extension_CloudFlare_Page', 'admin_print_scripts_w3tc_extensions'));
     add_action('w3tc_ajax', array('\\W3TC\\Extension_CloudFlare_Popup', 'w3tc_ajax'));
     // add check to comments page
     add_filter('comment_row_actions', array($this, 'comment_row_actions'), 10, 2);
     add_action('admin_print_styles-edit-comments.php', array($this, 'admin_print_styles_edit_comments'));
     add_action('admin_print_scripts-edit-comments.php', array($this, 'admin_print_scripts_edit_comments'));
     add_action('wp_ajax_w3tc_cloudflare_ip_check', array($this, 'w3tc_cloudflare_ip_check'));
     // add notices about api health
     if (Util_Admin::is_w3tc_admin_page()) {
         add_action('admin_notices', array($this, 'admin_notices'));
         add_action('network_admin_notices', array($this, 'admin_notices'));
     }
     $this->check_ip_versions();
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:33,代码来源:Extension_CloudFlare_Plugin_Admin.php

示例3: render_content

 /**
  * Extensions view
  *
  * @return void
  */
 function render_content()
 {
     $extension = '';
     $extension_status = 'all';
     if (isset($_GET['extension_status'])) {
         if (in_array($_GET['extension_status'], array('all', 'active', 'inactive', 'core'))) {
             $extension_status = $_GET['extension_status'];
         }
     }
     if (isset($_GET['extension'])) {
         $extension = $_GET['extension'];
     }
     $view = isset($_GET['action']) && $_GET['action'] == 'view';
     $extensions_active = Extensions_Util::get_active_extensions($this->_config);
     if ($extension && $view) {
         $all_settings = $this->_config->get_array('extensions.settings');
         $meta = $extensions_active[$extension];
         $sub_view = 'settings';
     } else {
         $extensions_all = Extensions_Util::get_extensions($this->_config);
         $extensions_inactive = Extensions_Util::get_inactive_extensions($this->_config);
         $var = "extensions_{$extension_status}";
         $extensions = ${$var};
         $extension_keys = array_keys($extensions);
         sort($extension_keys);
         $sub_view = 'list';
         $page = 1;
     }
     $config = Dispatcher::config();
     include W3TC_INC_OPTIONS_DIR . '/extensions.php';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:36,代码来源:Extensions_Page.php

示例4: render_content

 function render_content()
 {
     $config = Dispatcher::config();
     $core = Dispatcher::component('Extension_FragmentCache_Core');
     $registered_groups = $core->get_registered_fragment_groups();
     include W3TC_DIR . '/Extension_FragmentCache_Page_View.php';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:7,代码来源:Extension_FragmentCache_Page.php

示例5: deactivate

 /**
  * Deactivate plugin action
  *
  * @return void
  */
 public static function deactivate()
 {
     try {
         Util_Activation::enable_maintenance_mode();
     } catch (\Exception $ex) {
     }
     try {
         $e = Dispatcher::component('Root_Environment');
         $config = Dispatcher::config();
         $e->fix_after_deactivation($config);
         Generic_AdminLinks::link_delete();
     } catch (Util_Environment_Exceptions $exs) {
         $r = Util_Activation::parse_environment_exceptions($exs);
         if (strlen($r['required_changes']) > 0) {
             $changes_style = 'border: 1px solid black; ' . 'background: white; ' . 'margin: 10px 30px 10px 30px; ' . 'padding: 10px;';
             $error = '<strong>W3 Total Cache Error:</strong> ' . 'Files and directories could not be automatically ' . 'removed to complete the deactivation. ' . '<br />Please execute commands manually:<br />' . '<div style="' . $changes_style . '">' . $r['required_changes'] . '</div>';
             // this is not shown since wp redirects from that page
             // not solved now
             echo '<div class="error"><p>' . $error . '</p></div>';
         }
     }
     try {
         Util_Activation::disable_maintenance_mode();
     } catch (\Exception $ex) {
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:31,代码来源:Root_AdminActivation.php

示例6: run

 function run()
 {
     add_filter('w3tc_config_default_values', array($this, 'w3tc_config_default_values'));
     add_action('w3tc_register_fragment_groups', array($this, 'register_groups'));
     $this->_config = Dispatcher::config();
     if (Util_Environment::is_w3tc_pro($this->_config)) {
         if (!is_admin()) {
             /**
              * Register the caching of content to specific hooks
              */
             foreach (array('genesis_header', 'genesis_footer', 'genesis_sidebar', 'genesis_loop', 'wp_head', 'wp_footer', 'genesis_comments', 'genesis_pings') as $hook) {
                 add_action($hook, array($this, 'cache_genesis_start'), -999999999);
                 add_action($hook, array($this, 'cache_genesis_end'), 999999999);
             }
             foreach (array('genesis_do_subnav', 'genesis_do_nav') as $filter) {
                 add_filter($filter, array($this, 'cache_genesis_filter_start'), -999999999);
                 add_filter($filter, array($this, 'cache_genesis_filter_end'), 999999999);
             }
         }
         /**
          * Since posts pages etc are cached individually need to be able to flush just those and not all fragment
          */
         add_action('clean_post_cache', array($this, 'flush_post_fragment'));
         add_action('clean_post_cache', array($this, 'flush_terms_fragment'), 0, 0);
         $this->_request_uri = $_SERVER['REQUEST_URI'];
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:27,代码来源:Extension_Genesis_Plugin.php

示例7: get_effective_browser_application

 public function get_effective_browser_application()
 {
     $c = Dispatcher::config();
     $api_key = $c->get(array('newrelic', 'api_key'));
     $id = $c->get(array('newrelic', 'browser.application_id'));
     if (empty($api_key) || empty($id)) {
         return null;
     }
     $applications_string = get_option('w3tc_nr_browser_applications');
     $applications = @json_decode($applications_string, true);
     if (!is_array($applications)) {
         $applications = array();
     }
     if (isset($applications[$id])) {
         return $applications[$id];
     }
     try {
         $api = new Extension_NewRelic_Api($api_key);
         $app = $api->get_browser_application($id);
         if (!is_null($app)) {
             $applications[$id] = $app;
             update_option('w3tc_nr_browser_applications', json_encode($applications));
         }
         return $app;
     } catch (\Exception $ex) {
         return null;
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:28,代码来源:Extension_NewRelic_Core.php

示例8: __construct

 /**
  * PHP5-style constructor
  */
 function __construct()
 {
     $this->_config = Dispatcher::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:developmentDM2,项目名称:Whohaha,代码行数:10,代码来源:Varnish_Flush.php

示例9: get_active_extensions

 /**
  * Returns the active extensions
  *
  * @param unknown $config
  * @return array
  */
 public static function get_active_extensions($config)
 {
     $extensions = Extensions_Util::get_extensions($config);
     $extensions_keys = array_keys($extensions);
     $config = Dispatcher::config();
     $active_extensions = $config->get_array('extensions.active');
     return array_intersect_key($extensions, $active_extensions);
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:14,代码来源:Extensions_Util.php

示例10: w3tc_settings_general_boxarea_monitoring

 public function w3tc_settings_general_boxarea_monitoring()
 {
     $config = Dispatcher::config();
     $nerser = Dispatcher::component('Extension_NewRelic_Service');
     $new_relic_installed = $nerser->module_is_enabled();
     $effective_appname = $nerser->get_effective_appname();
     include W3TC_DIR . '/Extension_NewRelic_GeneralPage_View.php';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:8,代码来源:Extension_NewRelic_GeneralPage.php

示例11: w3tc_admin_menu

 public function w3tc_admin_menu($menu)
 {
     $c = Dispatcher::config();
     $monitoring_type = $c->get_string(array('newrelic', 'monitoring_type'));
     if ($monitoring_type == 'apm') {
         $menu = array_merge($menu, array('w3tc_monitoring' => array('page_title' => __('Monitoring', 'w3-total-cache'), 'menu_text' => __('Monitoring', 'w3-total-cache'), 'visible_always' => false)));
     }
     return $menu;
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:9,代码来源:Extension_NewRelic_Plugin_Admin.php

示例12: get_nginx_rules_path

 /**
  * Returns nginx rules path
  *
  * @return string
  */
 public static function get_nginx_rules_path()
 {
     $config = Dispatcher::config();
     $path = $config->get_string('config.path');
     if (!$path) {
         $path = Util_Environment::site_path() . 'nginx.conf';
     }
     return $path;
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:14,代码来源:Util_Rule.php

示例13: view

 /**
  * Mobile tab
  *
  * @return void
  */
 function view()
 {
     $c = Dispatcher::config();
     $groups = array('value' => $c->get_array('mobile.rgroups'), 'disabled' => $c->is_sealed('mobile.rgroups'), 'description' => '<li>' . __('Enabling even a single user agent group will set a cookie called "w3tc_referrer." It is used to ensure a consistent user experience across page views. Make sure any reverse proxy servers etc respect this cookie for proper operation.', 'w3-total-cache') . '</li>' . '<li>' . __('Per the above, make sure that visitors are notified about the cookie as per any regulations in your market.', 'w3-total-cache') . '</li>');
     $groups = apply_filters('w3tc_ui_config_item_mobile.rgroups', $groups);
     $w3_mobile = Dispatcher::component('Mobile_UserAgent');
     $themes = $w3_mobile->get_themes();
     include W3TC_INC_DIR . '/options/mobile.php';
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:14,代码来源:Mobile_Page_UserAgentGroups.php

示例14: __construct

 function __construct()
 {
     $c = Dispatcher::config();
     $this->_config = $c;
     $this->_lifetime = $c->get_integer('dbcache.lifetime');
     $this->debug = $c->get_boolean('dbcache.debug');
     $this->reject_logged = $c->get_boolean('dbcache.reject.logged');
     $this->reject_constants = $c->get_array('dbcache.reject.constants');
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:9,代码来源:DbCache_WpdbInjection_QueryCaching.php

示例15: __construct

 /**
  * PHP5 Constructor
  */
 function __construct()
 {
     $config = Dispatcher::config();
     if ($config->get_boolean('mobile.enabled')) {
         $this->_mobile = Dispatcher::component('Mobile_UserAgent');
     }
     if ($config->get_boolean('referrer.enabled')) {
         $this->_referrer = Dispatcher::component('Mobile_Referrer');
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:13,代码来源:Mobile_Redirect.php


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