本文整理汇总了PHP中Dispatcher::component方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::component方法的具体用法?PHP Dispatcher::component怎么用?PHP Dispatcher::component使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::component方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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';
}
示例2: view
/**
* Referrer tab
*
* @return void
*/
function view()
{
$groups = $this->_config->get_array('referrer.rgroups');
$w3_referrer = Dispatcher::component('Mobile_Referrer');
$themes = $w3_referrer->get_themes();
include W3TC_INC_DIR . '/options/referrer.php';
}
示例3: 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) {
}
}
示例4: view
/**
* General tab
*
* @return void
*/
function view()
{
global $current_user;
$config_master = $this->_config_master;
/**
*
*
* @var $modules W3_ModuleStatus
*/
$modules = Dispatcher::component('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');
$enabled = $modules->plugin_is_enabled();
$enabled_checkbox = $modules->all_modules_enabled();
$check_rules = Util_Rule::can_check_rules();
$disc_enhanced_enabled = !(!$check_rules || !$this->is_master() && Util_Environment::is_wpmu() && $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 = Cdn_Util::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');
$licensing_visible = (!Util_Environment::is_wpmu() || is_network_admin()) && !ini_get('w3tc.license_key') && get_transient('w3tc_license_status') != 'host_valid';
$custom_areas = apply_filters("w3tc_settings_general_anchors", array());
include W3TC_INC_DIR . '/options/general.php';
}
示例5: run
public function run()
{
$core = Dispatcher::component('UsageStatistics_Core');
$core->add_shutdown_handler();
// usage default statistics handling
add_action('w3tc_usage_statistics_of_request', array($this, 'w3tc_usage_statistics_of_request'), 10, 1);
add_filter('w3tc_usage_statistics_metrics', array($this, 'w3tc_usage_statistics_metrics'));
}
示例6: 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';
}
示例7: 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';
}
示例8: w3tc_save_new_relic
function w3tc_save_new_relic()
{
$service = Dispatcher::component('Extension_NewRelic_Service');
$application = Util_Request::get_array('application');
$application['alerts_enabled'] = $application['alerts_enabled'] == 1 ? 'true' : 'false';
$application['rum_enabled'] = $application['rum_enabled'] == 1 ? 'true' : 'false';
$result = $service->update_application_settings($application);
Util_Admin::redirect(array('w3tc_note' => 'new_relic_save'), true);
}
示例9: __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');
}
}
示例10: w3tc_opcache_flush
function w3tc_opcache_flush()
{
$core = Dispatcher::component('SystemOpCache_Core');
$success = $core->flush();
if ($success) {
Util_Admin::redirect_with_custom_messages2(array('notes' => array('OPCache was flushed successfully')), true);
} else {
Util_Admin::redirect_with_custom_messages2(array('errors' => array('Failed to flush OPCache')), true);
}
}
示例11: view
/**
* Install tab
*
* @return void
*/
function view()
{
$rewrite_rules_descriptors = array();
if (Util_Rule::can_check_rules()) {
$e = Dispatcher::component('Root_Environment');
$rewrite_rules_descriptors = $e->get_required_rules($this->_config);
$other_areas = $e->get_other_instructions($this->_config);
}
include W3TC_INC_DIR . '/options/install.php';
}
示例12: wpseo_cdn_filter
/**
* Hook into Yoast SEO sitemap image filter.
*
* @param unknown $uri
* @return string
*/
public function wpseo_cdn_filter($uri)
{
$common = Dispatcher::component('Cdn_Core');
$cdn = $common->get_cdn();
$parsed = parse_url($uri);
$path = $parsed['path'];
$remote_path = $common->uri_to_cdn_uri($path);
$new_url = $cdn->format_url($remote_path);
return $new_url;
}
示例13: purge_post_cleanup
/**
* Clears global and repeated urls
*/
function purge_post_cleanup()
{
if ($this->flush_operation_requested) {
$common = Dispatcher::component('Cdn_Core');
$results = array();
$common->purge_all($results);
$count = 999;
$this->flush_operation_requested = false;
}
return $count;
}
示例14: w3tc_cdn_rackspace_cdn_domains_reload
function w3tc_cdn_rackspace_cdn_domains_reload()
{
$c = Dispatcher::config();
$core = Dispatcher::component('Cdn_Core');
$cdn = $core->get_cdn();
try {
// try to obtain CNAMEs
$domains = $cdn->service_domains_get();
} catch (\Exception $ex) {
Util_Admin::redirect_with_custom_messages2(array('errors' => array('Failed to obtain CNAMEs: ' . $ex->getMessage())), true);
return;
}
$c->set('cdn.rackspace_cdn.domains', $domains);
$c->save();
Util_Admin::redirect_with_custom_messages2(array('notes' => array('CNAMEs are reloaded successfully')), true);
}
示例15: view
/**
* CDN tab
*
* @return void
*/
function view()
{
$config = Dispatcher::config();
$cdn_engine = $config->get_string('cdn.engine');
if (Cdn_Util::is_engine_fsd($cdn_engine)) {
do_action('w3tc_settings_cdn');
return;
}
$cdn_enabled = $config->get_boolean('cdn.enabled');
$cdn_mirror = Cdn_Util::is_engine_mirror($cdn_engine);
$cdn_mirror_purge_all = Cdn_Util::can_purge_all($cdn_engine);
$cdn_common = Dispatcher::component('Cdn_Core');
$cdn = $cdn_common->get_cdn();
$cdn_supports_header = $cdn->headers_support() == W3TC_CDN_HEADER_MIRRORING;
$minify_enabled = $config->get_boolean('minify.enabled') && Util_Rule::can_check_rules() && $config->get_boolean('minify.rewrite') && (!$config->get_boolean('minify.auto') || Cdn_Util::is_engine_mirror($config->get_string('cdn.engine')));
$cookie_domain = $this->get_cookie_domain();
$set_cookie_domain = $this->is_cookie_domain_enabled();
// Required for Update Media Query String button
$browsercache_enabled = $config->get_boolean('browsercache.enabled');
$browsercache_update_media_qs = $config->get_boolean('browsercache.cssjs.replace') || $config->get_boolean('browsercache.other.replace');
if (in_array($cdn_engine, array('netdna', 'maxcdn'))) {
$pull_zones = array();
$authorization_key = $config->get_string("cdn.{$cdn_engine}.authorization_key");
$zone_id = $config->get_integer("cdn.{$cdn_engine}.zone_id");
$alias = $consumerkey = $consumersecret = '';
if ($authorization_key) {
$keys = explode('+', $authorization_key);
if (sizeof($keys) == 3) {
list($alias, $consumerkey, $consumersecret) = $keys;
}
}
$authorized = $authorization_key != '' && $alias && $consumerkey && $consumersecret;
$have_zone = $zone_id != 0;
if ($authorized) {
require_once W3TC_LIB_NETDNA_DIR . '/NetDNA.php';
try {
$api = new \NetDNA($alias, $consumerkey, $consumersecret);
$pull_zones = $api->get_zones_by_url(get_home_url());
} catch (\Exception $ex) {
Util_Ui::error_box('<p>There is an error with your CDN settings: ' . $ex->getMessage() . '</p>');
}
}
}
include W3TC_INC_DIR . '/options/cdn.php';
}