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


PHP Util_Environment::host方法代码示例

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


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

示例1: get_current_blog_data

 /**
  * Returns blog_id by home url
  * If database not initialized yet - returns 0
  *
  * @return integer
  */
 public static function get_current_blog_data()
 {
     $host = Util_Environment::host();
     // subdomain
     if (Util_Environment::is_wpmu_subdomain()) {
         $blog_data = Util_WpmuBlogmap::try_get_current_blog_data($host);
         if (is_null($blog_data)) {
             $GLOBALS['w3tc_blogmap_register_new_item'] = $host;
         }
         return $blog_data;
     } else {
         // try subdir blog
         $url = $host . $_SERVER['REQUEST_URI'];
         $pos = strpos($url, '?');
         if ($pos !== false) {
             $url = substr($url, 0, $pos);
         }
         $url = rtrim($url, '/');
         $start_url = $url;
         for (;;) {
             $blog_data = Util_WpmuBlogmap::try_get_current_blog_data($url);
             if (!is_null($blog_data)) {
                 return $blog_data;
             }
             $pos = strrpos($url, '/');
             if ($pos === false) {
                 break;
             }
             $url = rtrim(substr($url, 0, $pos), '/');
         }
         $GLOBALS['w3tc_blogmap_register_new_item'] = $start_url;
         return null;
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:40,代码来源:Util_WpmuBlogmap.php

示例2: action_payment_code

 function action_payment_code()
 {
     $request_type = Util_Request::get_string('request_type');
     $request_id = date('YmdHi');
     $return_url = admin_url('admin.php?page=w3tc_support&request_type=' . $request_type . '&payment=1&request_id=' . $request_id);
     $cancel_url = admin_url('admin.php?page=w3tc_dashboard');
     $form_values = array("cmd" => "_xclick", "business" => W3TC_PAYPAL_BUSINESS, "item_name" => esc_attr(sprintf('%s: %s (#%s)', ucfirst(Util_Environment::host()), $this->_json_request_types[$request_type], $request_id)), "amount" => sprintf('%.2f', $this->_request_prices[$request_type]), "currency_code" => "USD", "no_shipping" => "1", "rm" => "2", "return" => esc_attr($return_url), "cancel_return" => esc_attr($cancel_url));
     echo json_encode($form_values);
     die;
 }
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:10,代码来源:Generic_Plugin_WidgetServices.php

示例3: cleanup_local

 function cleanup_local()
 {
     $engine = $this->_config->get_string('pgcache.engine');
     switch ($engine) {
         case 'file':
             $w3_cache_file_cleaner = new Cache_File_Cleaner(array('cache_dir' => Util_Environment::cache_blog_dir('page'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner->clean();
             break;
         case 'file_generic':
             if (Util_Environment::blog_id() == 0) {
                 $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR;
             } else {
                 $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . Util_Environment::host();
             }
             $w3_cache_file_cleaner_generic = new Cache_File_Cleaner_Generic(array('exclude' => array('.htaccess'), 'cache_dir' => $flush_dir, 'expire' => $this->_config->get_integer('browsercache.html.lifetime'), 'clean_timelimit' => $this->_config->get_integer('timelimit.cache_gc')));
             $w3_cache_file_cleaner_generic->clean();
             break;
     }
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:19,代码来源:PgCache_Plugin_Admin.php

示例4: w3tc_extensions

 public static function w3tc_extensions($extensions, $config)
 {
     global $current_user;
     $message = array();
     $message[] = 'CloudFlare';
     $cloudflare_signup_email = '';
     $cloudflare_signup_user = '';
     if (is_a($current_user, 'WP_User')) {
         if ($current_user->user_email) {
             $cloudflare_signup_email = $current_user->user_email;
         }
         if ($current_user->user_login && $current_user->user_login != 'admin') {
             $cloudflare_signup_user = $current_user->user_login;
         }
     }
     $extensions['cloudflare'] = array('name' => 'CloudFlare', 'author' => 'W3 EDGE', 'description' => sprintf(__('CloudFlare protects and accelerates websites. <a href="%s" target="_blank">Sign up now for free</a> to get started,
         or if you have an account simply log in to obtain your <abbr title="Application Programming Interface">API</abbr> key from the <a target="_blank" href="https://www.cloudflare.com/my-account">account page</a> to enter it on the General Settings box that appears after plugin activation.
         Contact the CloudFlare <a href="http://www.cloudflare.com/help.html" target="_blank">support team</a> with any questions.', 'w3-total-cache'), 'https://www.cloudflare.com/sign-up.html?affiliate=w3edge&amp;seed_domain=' . Util_Environment::host() . '&amp;email=' . htmlspecialchars($cloudflare_signup_email) . '&amp;username=' . htmlspecialchars($cloudflare_signup_user)), 'author_uri' => 'https://www.w3-edge.com/', 'extension_uri' => 'https://www.w3-edge.com/', 'extension_id' => 'cloudflare', 'settings_exists' => true, 'version' => '0.3', 'enabled' => true, 'requirements' => implode(', ', $message), 'path' => 'w3-total-cache/Extension_CloudFlare_Plugin.php');
     return $extensions;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:20,代码来源:Extension_CloudFlare_Plugin_Admin.php

示例5: redirect_on_foreign_domain

 public function redirect_on_foreign_domain()
 {
     $request_host = Util_Environment::host();
     // host not known, potentially we are in console mode not http request
     if (empty($request_host)) {
         return;
     }
     $home_url = get_home_url();
     $parsed_url = @parse_url($home_url);
     if (isset($parsed_url['host']) && strtolower($parsed_url['host']) != strtolower($request_host)) {
         $redirect_url = $parsed_url['scheme'] . '://';
         if (!empty($parsed_url['user'])) {
             $redirect_url .= $parsed_url['user'];
             if (!empty($parsed_url['pass'])) {
                 $redirect_url .= ':' . $parsed_url['pass'];
             }
         }
         if (!empty($parsed_url['host'])) {
             $redirect_url .= $parsed_url['host'];
         }
         if (!empty($parsed_url['port']) && $parsed_url['port'] != 80) {
             $redirect_url .= ':' . (int) $parsed_url['port'];
         }
         $redirect_url .= $_SERVER['REQUEST_URI'];
         //echo $redirect_url;
         wp_redirect($redirect_url, 301);
         exit;
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:29,代码来源:PgCache_Plugin.php

示例6: _send_notification

 /**
  * Send E-mail notification when error occurred
  *
  * @return boolean
  */
 function _send_notification()
 {
     $from_email = 'wordpress@' . Util_Environment::host();
     $from_name = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     $to_name = $to_email = get_option('admin_email');
     $body = @file_get_contents(W3TC_INC_DIR . '/email/minify_error_notification.php');
     $headers = array(sprintf('From: "%s" <%s>', addslashes($from_name), $from_email), sprintf('Reply-To: "%s" <%s>', addslashes($to_name), $to_email), 'Content-Type: text/html; charset=utf-8');
     @set_time_limit($this->_config->get_integer('timelimit.email_send'));
     $result = @wp_mail($to_email, 'W3 Total Cache Error Notification', $body, implode("\n", $headers));
     return $result;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:16,代码来源:Minify_MinifiedFileRequestHandler.php

示例7: _get_cache

 /**
  * Returns cache object
  *
  * @return W3_Cache_Base
  */
 function _get_cache()
 {
     static $cache = array();
     if (!isset($cache[0])) {
         $engine = $this->_config->get_string('dbcache.engine');
         switch ($engine) {
             case 'memcached':
                 $engineConfig = array('servers' => $this->_config->get_array('dbcache.memcached.servers'), 'persistent' => $this->_config->get_boolean('dbcache.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('dbcache.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('dbcache.memcached.username'), 'password' => $this->_config->get_boolean('dbcache.memcached.password'));
                 break;
             case 'redis':
                 $engineConfig = array('servers' => $this->_config->get_array('dbcache.redis.servers'), 'persistent' => $this->_config->get_boolean('dbcache.redis.persistent'), 'dbid' => $this->_config->get_boolean('dbcache.redis.dbid'), 'password' => $this->_config->get_boolean('dbcache.redis.password'));
                 break;
             case 'file':
                 $engineConfig = array('use_wp_hash' => true, 'section' => 'db', 'locking' => $this->_config->get_boolean('dbcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'));
                 break;
             default:
                 $engineConfig = array();
         }
         $engineConfig['module'] = 'dbcache';
         $engineConfig['host'] = Util_Environment::host();
         $engineConfig['instance_id'] = Util_Environment::instance_id();
         $cache[0] = Cache::instance($engine, $engineConfig);
     }
     return $cache[0];
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:30,代码来源:DbCache_WpdbInjection_QueryCaching.php

示例8: get_server_info

 /**
  * Returns server info
  *
  * @return array
  */
 private function get_server_info()
 {
     global $wp_version, $wp_db_version, $wpdb;
     $wordpress_plugins = get_plugins();
     $wordpress_plugins_active = array();
     foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
         if (is_plugin_active($wordpress_plugin_file)) {
             $wordpress_plugins_active[$wordpress_plugin_file] = $wordpress_plugin;
         }
     }
     $mysql_version = $wpdb->get_var('SELECT VERSION()');
     $mysql_variables_result = (array) $wpdb->get_results('SHOW VARIABLES', ARRAY_N);
     $mysql_variables = array();
     foreach ($mysql_variables_result as $mysql_variables_row) {
         $mysql_variables[$mysql_variables_row[0]] = $mysql_variables_row[1];
     }
     $server_info = array('w3tc' => array('version' => W3TC_VERSION, 'server' => !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown', 'dir' => W3TC_DIR, 'cache_dir' => W3TC_CACHE_DIR, 'blog_id' => Util_Environment::blog_id(), 'home_domain_root_url' => Util_Environment::home_domain_root_url(), 'home_url_maybe_https' => Util_Environment::home_url_maybe_https(), 'site_path' => Util_Environment::site_path(), 'document_root' => Util_Environment::document_root(), 'site_root' => Util_Environment::site_root(), 'site_url_uri' => Util_Environment::site_url_uri(), 'home_url_host' => Util_Environment::home_url_host(), 'home_url_uri' => Util_Environment::home_url_uri(), 'network_home_url_uri' => Util_Environment::network_home_url_uri(), 'host_port' => Util_Environment::host_port(), 'host' => Util_Environment::host(), 'wp_config_path' => Util_Environment::wp_config_path()), 'wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'abspath' => ABSPATH, 'home' => get_option('home'), 'siteurl' => get_option('siteurl'), 'email' => get_option('admin_email'), 'upload_info' => (array) Util_Http::upload_info(), 'theme' => Util_Theme::get_current_theme(), 'wp_cache' => defined('WP_CACHE') && WP_CACHE ? 'true' : 'false', 'plugins' => $wordpress_plugins_active), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
     return $server_info;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:24,代码来源:Support_AdminActions.php

示例9: _get_cache

 /**
  * Returns cache object
  *
  * @param null    $blog_id
  * @param string  $group
  * @return W3_Cache_Base
  */
 function _get_cache($global = false)
 {
     static $cache = array();
     if (!$global) {
         $blog_id = $this->_blog_id;
     } else {
         $blog_id = 0;
     }
     if (!isset($cache[$blog_id])) {
         $engine = $this->_config->get_string(array('fragmentcache', 'engine'));
         switch ($engine) {
             case 'memcached':
                 $engineConfig = array('servers' => $this->_config->get_array(array('fragmentcache', 'memcached.servers')), 'persistent' => $this->_config->get_boolean(array('fragmentcache', 'memcached.persistent')), 'aws_autodiscovery' => $this->_config->get_boolean(array('fragmentcache', 'memcached.aws_autodiscovery')), 'username' => $this->_config->get_boolean(array('fragmentcache', 'memcached.username')), 'password' => $this->_config->get_boolean(array('fragmentcache', 'memcached.password')));
                 break;
             case 'redis':
                 $engineConfig = array('servers' => $this->_config->get_array(array('fragmentcache', 'redis.servers')), 'persistent' => $this->_config->get_boolean(array('fragmentcache', 'redis.persistent')), 'dbid' => $this->_config->get_boolean(array('fragmentcache', 'redis.dbid')), 'password' => $this->_config->get_boolean(array('fragmentcache', 'redis.password')));
                 break;
             case 'file':
                 $engineConfig = array('section' => 'fragment', 'locking' => $this->_config->get_boolean(array('fragmentcache', 'file.locking')), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'));
                 break;
             default:
                 $engineConfig = array();
         }
         $engineConfig['blog_id'] = $blog_id;
         $engineConfig['module'] = 'fragmentcache';
         $engineConfig['host'] = Util_Environment::host();
         $engineConfig['instance_id'] = Util_Environment::instance_id();
         $cache[$blog_id] = Cache::instance($engine, $engineConfig);
     }
     return $cache[$blog_id];
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:38,代码来源:Extension_FragmentCache_WpObjectCache.php

示例10: _flush_based_on_regex

 /**
  * Flush cache based on regex
  *
  * @param string  $regex
  */
 private function _flush_based_on_regex($regex)
 {
     if (Util_Environment::is_wpmu() && !Util_Environment::is_wpmu_subdomain()) {
         $domain = get_home_url();
         $parsed = parse_url($domain);
         $host = $parsed['host'];
         $path = isset($parsed['path']) ? '/' . trim($parsed['path'], '/') : '';
         $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . $host . $path;
     } else {
         $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . Util_Environment::host();
     }
     $dir = @opendir($flush_dir);
     if ($dir) {
         while (($entry = @readdir($dir)) !== false) {
             if ($entry == '.' || $entry == '..') {
                 continue;
             }
             if (preg_match('/' . $regex . '/', basename($entry))) {
                 Util_File::rmdir($flush_dir . DIRECTORY_SEPARATOR . $entry);
             }
         }
         @closedir($dir);
     }
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:29,代码来源:Cache_File_Generic.php

示例11: parse_path

 /**
  * Parses path
  *
  * @param string  $path
  * @return mixed
  */
 public static function parse_path($path)
 {
     $path = str_replace(array('%BLOG_ID%', '%POST_ID%', '%BLOG_ID%', '%HOST%'), array(isset($GLOBALS['blog_id']) ? (int) $GLOBALS['blog_id'] : 0, isset($GLOBALS['post_id']) ? (int) $GLOBALS['post_id'] : 0, Util_Environment::blog_id(), Util_Environment::host()), $path);
     return $path;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:11,代码来源:Util_Environment.php

示例12: _get_cache

 /**
  * Returns cache object
  *
  * @param int|null $blog_id
  * @param string  $group
  * @return W3_Cache_Base
  */
 function _get_cache($blog_id = null, $group = '')
 {
     static $cache = array();
     if (is_null($blog_id) && !in_array($group, $this->global_groups)) {
         $blog_id = $this->_blog_id;
     } elseif (is_null($blog_id)) {
         $blog_id = 0;
     }
     if (!isset($cache[$blog_id])) {
         $engine = $this->_config->get_string('objectcache.engine');
         switch ($engine) {
             case 'memcached':
                 $engineConfig = array('servers' => $this->_config->get_array('objectcache.memcached.servers'), 'persistent' => $this->_config->get_boolean('objectcache.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('objectcache.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('objectcache.memcached.username'), 'password' => $this->_config->get_boolean('objectcache.memcached.password'));
                 break;
             case 'redis':
                 $engineConfig = array('servers' => $this->_config->get_array('objectcache.redis.servers'), 'persistent' => $this->_config->get_boolean('objectcache.redis.persistent'), 'dbid' => $this->_config->get_boolean('objectcache.redis.dbid'), 'password' => $this->_config->get_boolean('objectcache.redis.password'));
                 break;
             case 'file':
                 $engineConfig = array('section' => 'object', 'locking' => $this->_config->get_boolean('objectcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'));
                 break;
             default:
                 $engineConfig = array();
         }
         $engineConfig['blog_id'] = $blog_id;
         $engineConfig['module'] = 'object';
         $engineConfig['host'] = Util_Environment::host();
         $engineConfig['instance_id'] = Util_Environment::instance_id();
         $cache[$blog_id] = Cache::instance($engine, $engineConfig);
     }
     return $cache[$blog_id];
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:38,代码来源:ObjectCache_WpObjectCache_Regular.php

示例13: _get_cache

 /**
  * Returns cache object
  *
  * @return W3_Cache_Base
  */
 function _get_cache()
 {
     static $cache = null;
     if (is_null($cache)) {
         $engine = $this->_config->get_string('pgcache.engine');
         switch ($engine) {
             case 'memcached':
                 $engineConfig = array('servers' => $this->_config->get_array('pgcache.memcached.servers'), 'persistent' => $this->_config->get_boolean('pgcache.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('pgcache.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('pgcache.memcached.username'), 'password' => $this->_config->get_boolean('pgcache.memcached.password'));
                 break;
             case 'redis':
                 $engineConfig = array('servers' => $this->_config->get_array('pgcache.redis.servers'), 'persistent' => $this->_config->get_boolean('pgcache.redis.persistent'), 'dbid' => $this->_config->get_boolean('pgcache.redis.dbid'), 'password' => $this->_config->get_boolean('pgcache.redis.password'));
                 break;
             case 'file':
                 $engineConfig = array('section' => 'page', 'flush_parent' => Util_Environment::blog_id() == 0, 'locking' => $this->_config->get_boolean('pgcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'));
                 break;
             case 'file_generic':
                 if (Util_Environment::blog_id() == 0) {
                     $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR;
                 } else {
                     $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . Util_Environment::host();
                 }
                 $engineConfig = array('exclude' => array('.htaccess'), 'expire' => $this->_lifetime, 'cache_dir' => W3TC_CACHE_PAGE_ENHANCED_DIR, 'locking' => $this->_config->get_boolean('pgcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'), 'flush_dir' => $flush_dir);
                 break;
             default:
                 $engineConfig = array();
         }
         $engineConfig['use_expired_data'] = true;
         $engineConfig['module'] = 'pgcache';
         $engineConfig['host'] = '';
         // host is always put to a key
         $engineConfig['instance_id'] = Util_Environment::instance_id();
         $cache = Cache::instance($engine, $engineConfig);
     }
     return $cache;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:40,代码来源:PgCache_ContentGrabber.php


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