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


PHP w3_instance函数代码示例

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


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

示例1: run

 function run()
 {
     add_action('w3tc_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
     add_action('w3tc_network_dashboard_setup', array(&$this, 'wp_dashboard_setup'));
     // Configure authorize and have_zone
     $this->_setup($this->_config);
     /**
      * Retry setup with main blog
      */
     if (w3_is_network() && is_network_admin() && !$this->authorized) {
         $this->_config = new W3_Config(false, 1);
         $this->_setup($this->_config);
     }
     if (w3_is_network()) {
         $conig_admin = w3_instance('W3_ConfigAdmin');
         $this->_sealed = $conig_admin->get_boolean('cdn.configuration_sealed');
     }
     if ($this->have_zone && $this->authorized && isset($_GET['page']) && strpos($_GET['page'], 'w3tc_dashboard') !== false) {
         w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
         w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNAPresentation.php');
         $authorization_key = $this->_config->get_string('cdn.maxcdn.authorization_key');
         $alias = $consumerkey = $consumersecret = '';
         $keys = explode('+', $authorization_key);
         if (sizeof($keys) == 3) {
             list($alias, $consumerkey, $consumersecret) = $keys;
         }
         $this->api = new NetDNA($alias, $consumerkey, $consumersecret);
         add_action('admin_head', array(&$this, 'admin_head'));
     }
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:30,代码来源:MaxCDN.php

示例2: view

 /**
  * Referrer tab
  *
  * @return void
  */
 function view()
 {
     $groups = $this->_config->get_array('referrer.rgroups');
     $w3_referrer = w3_instance('W3_Referrer');
     $themes = $w3_referrer->get_themes();
     include W3TC_INC_DIR . '/options/referrer.php';
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:12,代码来源:ReferrerGroupsAdminView.php

示例3: activate

 /**
  * Activate plugin action
  *
  * @return void
  */
 function activate($network_wide)
 {
     w3_require_once(W3TC_INC_DIR . '/functions/activation.php');
     if (w3_is_network()) {
         if ($network_wide) {
             // we are in network activation
         } else {
             if ($_GET['action'] == 'error_scrape' && strpos($_SERVER['REQUEST_URI'], '/network/') !== false) {
                 // workaround for error_scrape page called after error
                 // really we are in network activation and going to throw some error
             } else {
                 echo 'Please <a href="' . network_admin_url('plugins.php') . '">network activate</a> W3 Total Cache when using WordPress Multisite.';
                 die;
             }
         }
     }
     /**
      * Create cache folder and extension files
      */
     try {
         w3_activation_create_required_files();
         if (!$this->_config->own_config_exists()) {
             $this->_config->save();
         }
         // save admin config
         $admin_config = w3_instance('W3_ConfigAdmin');
         if (!$admin_config->own_config_exists()) {
             $admin_config->save();
         }
     } catch (Exception $e) {
         w3_activation_error_on_exception($e);
     }
     delete_option('w3tc_request_data');
     add_option('w3tc_request_data', '', null, 'no');
 }
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:40,代码来源:TotalCacheActivation.php

示例4: extension_header

 /**
  * Display if caching or not.
  */
 function extension_header()
 {
     $config = w3_instance('W3_Config');
     echo '<p>';
     printf(__('The NextGENGallery extension is currently %s ', 'w3-total-cache'), '<span class="w3tc-enabled">' . __('enabled', 'w3-total-cache') . '</span>');
     echo '.</p>';
 }
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:10,代码来源:NextGENGalleryAdmin.php

示例5: init

 /**
  * Init of class
  *
  * @since 1.0.0
  */
 public function init()
 {
     // get setting from theme options
     //$this->is_onfly_active = yit_get_option( 'onfly_resize_active' );
     // deactive if w3tc
     if (function_exists('w3_instance')) {
         $config = w3_instance('W3_Config');
         if ($config->get_boolean('cdn.enabled')) {
             $this->is_onfly_active = false;
             return;
         }
     }
     $this->is_retina_active = apply_filters('yit_is_retina_active', $this->is_retina_active);
     $this->use_fast_image = apply_filters('yit_use_fast_image', $this->use_fast_image);
     // retrocompatibility
     global $wp_version;
     if (version_compare($wp_version, YIT_MINIMUM_WP_VERSION, '<')) {
         $this->is_onfly_active = false;
     }
     if (is_admin() && isset($_GET['page']) && $_GET['page'] == 'w3tc_cdn') {
         return;
     }
     // add image size, if above option is true
     add_action('after_setup_theme', array($this, 'add_image_sizes'));
     // convert other add_image_sizes from other plugin, to the attribute of the class
     add_action('init', array($this, 'add_other_image_sizes'));
     // use yit_image() inside the function get_the_post_thumbnail()
     //add_filter( 'post_thumbnail_html', array( $this, 'convert_get_the_post_thumbnail' ), 10, 5 );
     // use yit_image() inside the function get_the_post_thumbnail()
     add_filter('image_downsize', array($this, 'convert_image_downsize'), 10, 3);
 }
开发者ID:jayeshnair,项目名称:ctp,代码行数:36,代码来源:Image.php

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

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

示例8: __construct

 /**
  * Checks W3_Config for the params if they are not provided in the constructor.
  * @param string $api_key
  * @param string $account_id
  * @param string $application_id
  */
 function __construct($api_key = '', $account_id = '', $application_id = '')
 {
     /**
      * @var $config W3_Config
      */
     $config = w3_instance('W3_Config');
     if ($api_key) {
         $this->_api_key = $api_key;
     } else {
         $this->_api_key = $config->get_string('newrelic.api_key');
     }
     if ($account_id) {
         $this->_account_id = $account_id;
     } else {
         $this->_account_id = $config->get_string('newrelic.account_id');
     }
     if ($application_id) {
         $this->_application_id = $application_id;
     } else {
         $this->_application_id = $config->get_integer('newrelic.application_id');
     }
     $this->_cache_time = $config->get_integer('newrelic.cache_time', 5);
     if ($this->_cache_time < 1) {
         $this->_cache_time = 5;
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:32,代码来源:NewRelicService.php

示例9: checkW3TotalCache

 function checkW3TotalCache()
 {
     if (!function_exists('w3_instance')) {
         return;
     }
     $agentgroups = array('wp2android_html5' => array('(iPhone|iPod).*Mac\\ OS\\ X', 'Mac\\ OS\\ X.*(iPhone|iPod)', 'Android.*AppleWebKit', 'AppleWebKit.*Android', 'Windows.*IEMobile.*Phone', 'Windows.*Phone.*IEMobile', 'IEMobile.*Windows.*Phone', 'IEMobile.*Phone.*Windows', 'Phone.*Windows.*IEMobile', 'Phone.*IEMobile.*Windows'), 'wp2android_android' => array('wp2android_user_agent=android_app', '72dcc186a8d3d7b3d8554a14256389a4'), 'wp2android_ipad' => array('wp2android_user_agent=ipad_app'));
     $needed = false;
     $config = w3_instance('W3_Config');
     $groups = $config->get_array('mobile.rgroups');
     foreach ($agentgroups as $groupname => $agents) {
         if (isset($groups[$groupname])) {
             $group = $groups[$groupname];
             if (count($group) === 4 && isset($group['theme']) && isset($group['enabled']) && isset($group['redirect']) && isset($group['agents']) && $group['theme'] === '' && $group['enabled'] === true && $group['redirect'] === '' && count($group['agents']) === count($agents)) {
                 $found = false;
                 foreach ($agents as $agent) {
                     if (!in_array($agent, $group['agents'])) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     /* This group is already present and enabled */
                     continue;
                 }
             }
         }
         $needed = true;
         $groups[$groupname] = array('theme' => '', 'enabled' => true, 'redirect' => '', 'agents' => $agents);
     }
     if ($needed) {
         $config->set('mobile.rgroups', $groups);
         $config->save(false);
     }
 }
开发者ID:apppressers,项目名称:apppressers.github.io,代码行数:34,代码来源:compatibility.php

示例10: instance

 /**
  * Returns onject instance. Called by WP engine
  *
  * @return W3_Db
  */
 static function instance()
 {
     static $instances = array();
     if (!isset($instances[0])) {
         $processors = array();
         $call_default_constructor = true;
         // no caching during activation
         $is_installing = defined('WP_INSTALLING') && WP_INSTALLING;
         $config = w3_instance('W3_Config');
         if (!$is_installing && $config->get_boolean('dbcache.enabled')) {
             $processors[] = w3_instance('W3_DbCache');
         }
         if (w3_is_dbcluster()) {
             $processors[] = w3_instance('W3_Enterprise_DbCluster');
         }
         $processors[] = new W3_DbProcessor();
         $class = __CLASS__;
         $o = new $class($processors);
         $underlying_manager = new W3_DbCallUnderlying($o);
         foreach ($processors as $processor) {
             $processor->manager = $o;
             $processor->underlying_manager = $underlying_manager;
         }
         // initialize after processors configured
         $o->initialize();
         @($instances[0] = $o);
     }
     return $instances[0];
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:34,代码来源:Db.php

示例11: view

 /**
  * Mobile tab
  *
  * @return void
  */
 function view()
 {
     $groups = $this->_config->get_array('mobile.rgroups');
     $w3_mobile = w3_instance('W3_Mobile');
     $themes = $w3_mobile->get_themes();
     include W3TC_INC_DIR . '/options/mobile.php';
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:12,代码来源:UserAgentGroupsAdminView.php

示例12: __construct

 function __construct()
 {
     $this->_config = w3_instance('W3_Config');
     $this->_request_types = array('bug_report' => __('Submit a Bug Report', 'w3-total-cache'), 'new_feature' => __('Suggest a New Feature', 'w3-total-cache'), 'email_support' => __('Less than 15 Minute Email Support Response (M-F 9AM - 5PM EDT): $75 USD', 'w3-total-cache'), 'phone_support' => __('Less than 15 Minute Phone Support Response (M-F 9AM - 5PM EDT): $150 USD', 'w3-total-cache'), 'plugin_config' => __('Professional Plugin Configuration: Starting @ $100 USD', 'w3-total-cache'), 'theme_config' => __('Theme Performance Optimization & Plugin Configuration: Starting @ $150 USD', 'w3-total-cache'), 'linux_config' => __('Linux Server Optimization & Plugin Configuration: Starting @ $200 USD', 'w3-total-cache'));
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/admin.php');
     $this->_page = w3tc_get_current_page();
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:7,代码来源:SupportActionsAdmin.php

示例13: view

 /**
  * New Relic tab
  */
 function view()
 {
     $applications = array();
     $dashboard = '';
     /**
      * @var $nerser W3_NewRelicService
      */
     $nerser = w3_instance('W3_NewRelicService');
     $new_relic_configured = $this->_config->get_string('newrelic.account_id') && $this->_config->get_string('newrelic.api_key') && $this->_config->get_string('newrelic.application_id');
     $view_application = $this->_config->get_string('newrelic.application_id');
     $new_relic_enabled = $this->_config->get_boolean('newrelic.enabled');
     $verify_running = $nerser->verify_running();
     $application_settings = array();
     if (!is_array($verify_running)) {
         try {
             $application_settings = $nerser->get_application_settings();
         } catch (Exception $ex) {
             $application_settings = array();
         }
     }
     if ($view_metric = W3_Request::get_boolean('view_metric', false)) {
         $metric_names = $nerser->get_metric_names(W3_Request::get_string('regex', ''));
     }
     include W3TC_INC_DIR . '/options/new_relic.php';
 }
开发者ID:rongandat,项目名称:sallumeh,代码行数:28,代码来源:MonitoringAdminView.php

示例14: view

 /**
  * Dashboard tab
  */
 function view()
 {
     w3_require_once(W3TC_INC_DIR . '/functions/widgets.php');
     /**
      * @var $module_status W3_ModuleStatus
      */
     $module_status = w3_instance('W3_ModuleStatus');
     w3tc_dashboard_setup();
     global $current_user;
     $config_master = $this->_config_master;
     $browsercache_enabled = $module_status->is_enabled('browsercache');
     $cloudflare_enabled = $module_status->is_enabled('cloudflare');
     $enabled = $module_status->plugin_is_enabled();
     $can_empty_memcache = $module_status->can_empty_memcache();
     $can_empty_opcode = $module_status->can_empty_opcode();
     $can_empty_apc_system = $module_status->can_empty_apc_system();
     $can_empty_file = $module_status->can_empty_file();
     $can_empty_varnish = $module_status->can_empty_varnish();
     $cdn_enabled = $module_status->is_enabled('cdn');
     $cdn_mirror_purge = w3_cdn_can_purge_all($module_status->get_module_engine('cdn'));
     if ($cloudflare_enabled && $this->_config->get_string('cloudflare.email') && $this->_config->get_string('cloudflare.key')) {
         $can_empty_cloudflare = true;
     } else {
         $can_empty_cloudflare = false;
     }
     // Required for Update Media Query String button
     $browsercache_update_media_qs = $this->_config->get_boolean('browsercache.cssjs.replace') || $this->_config->get_boolean('browsercache.other.replace');
     include W3TC_INC_DIR . '/options/dashboard.php';
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:32,代码来源:DashboardAdminView.php

示例15: deactivate

 /**
  * Deactivate plugin action
  *
  * @return void
  */
 function deactivate()
 {
     try {
         w3_enable_maintenance_mode();
     } catch (Exception $ex) {
     }
     try {
         $e = w3_instance('W3_AdminEnvironment');
         $config = w3_instance('W3_Config');
         $e->fix_after_deactivation($config);
         w3_instance('W3_AdminLinks')->link_delete();
     } catch (SelfTestExceptions $exs) {
         $r = w3_parse_selftest_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 {
         w3_disable_maintenance_mode();
     } catch (Exception $ex) {
     }
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:31,代码来源:RootAdminActivation.php


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