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


PHP Util_Environment::network_home_url_uri方法代码示例

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


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

示例1: rules_core_generate_apache

 /**
  * Generates rules for WP dir
  *
  * @param Config  $config
  * @return string
  */
 private function rules_core_generate_apache($config)
 {
     $rewrite_base = Util_Environment::network_home_url_uri();
     $cache_dir = Util_Environment::normalize_path(W3TC_CACHE_PAGE_ENHANCED_DIR);
     $permalink_structure = get_option('permalink_structure');
     $current_user = get_currentuserinfo();
     /**
      * Auto reject cookies
      */
     $reject_cookies = array('comment_author', 'wp-postpass');
     if ($config->get_string('pgcache.engine') == 'file_generic') {
         $reject_cookies[] = 'w3tc_logged_out';
     }
     /**
      * Reject cache for logged in users
      * OR
      * Reject cache for roles if any
      */
     if ($config->get_boolean('pgcache.reject.logged')) {
         $reject_cookies = array_merge($reject_cookies, array('wordpress_logged_in'));
     } elseif ($config->get_boolean('pgcache.reject.logged_roles')) {
         $new_cookies = array();
         foreach ($config->get_array('pgcache.reject.roles') as $role) {
             $new_cookies[] = 'w3tc_logged_' . md5(NONCE_KEY . $role);
         }
         $reject_cookies = array_merge($reject_cookies, $new_cookies);
     }
     /**
      * Custom config
      */
     $reject_cookies = array_merge($reject_cookies, $config->get_array('pgcache.reject.cookie'));
     Util_Rule::array_trim($reject_cookies);
     $reject_user_agents = $config->get_array('pgcache.reject.ua');
     if ($config->get_boolean('pgcache.compatibility')) {
         $reject_user_agents = array_merge(array(W3TC_POWERED_BY), $reject_user_agents);
     }
     Util_Rule::array_trim($reject_user_agents);
     /**
      * Generate directives
      */
     $env_W3TC_UA = '';
     $env_W3TC_REF = '';
     $env_W3TC_SSL = '';
     $env_W3TC_ENC = '';
     $rules = '';
     $rules .= W3TC_MARKER_BEGIN_PGCACHE_CORE . "\n";
     $rules .= "<IfModule mod_rewrite.c>\n";
     $rules .= "    RewriteEngine On\n";
     $rules .= "    RewriteBase " . $rewrite_base . "\n";
     if ($config->get_boolean('pgcache.debug')) {
         $rules .= "    RewriteRule ^(.*\\/)?w3tc_rewrite_test([0-9]+)/?\$ \$1?w3tc_rewrite_test=1 [L]\n";
     }
     /**
      * Check for mobile redirect
      */
     if ($config->get_boolean('mobile.enabled')) {
         $mobile_groups = $config->get_array('mobile.rgroups');
         foreach ($mobile_groups as $mobile_group => $mobile_config) {
             $mobile_enabled = isset($mobile_config['enabled']) ? (bool) $mobile_config['enabled'] : false;
             $mobile_agents = isset($mobile_config['agents']) ? (array) $mobile_config['agents'] : '';
             $mobile_redirect = isset($mobile_config['redirect']) ? $mobile_config['redirect'] : '';
             if ($mobile_enabled && count($mobile_agents) && $mobile_redirect) {
                 $rules .= "    RewriteCond %{HTTP_USER_AGENT} (" . implode('|', $mobile_agents) . ") [NC]\n";
                 $rules .= "    RewriteRule .* " . $mobile_redirect . " [R,L]\n";
             }
         }
     }
     /**
      * Check for referrer redirect
      */
     if ($config->get_boolean('referrer.enabled')) {
         $referrer_groups = $config->get_array('referrer.rgroups');
         foreach ($referrer_groups as $referrer_group => $referrer_config) {
             $referrer_enabled = isset($referrer_config['enabled']) ? (bool) $referrer_config['enabled'] : false;
             $referrer_referrers = isset($referrer_config['referrers']) ? (array) $referrer_config['referrers'] : '';
             $referrer_redirect = isset($referrer_config['redirect']) ? $referrer_config['redirect'] : '';
             if ($referrer_enabled && count($referrer_referrers) && $referrer_redirect) {
                 $rules .= "    RewriteCond %{HTTP_COOKIE} w3tc_referrer=.*(" . implode('|', $referrer_referrers) . ") [NC]\n";
                 $rules .= "    RewriteRule .* " . $referrer_redirect . " [R,L]\n";
             }
         }
     }
     /**
      * Set mobile groups
      */
     if ($config->get_boolean('mobile.enabled')) {
         $mobile_groups = array_reverse($config->get_array('mobile.rgroups'));
         foreach ($mobile_groups as $mobile_group => $mobile_config) {
             $mobile_enabled = isset($mobile_config['enabled']) ? (bool) $mobile_config['enabled'] : false;
             $mobile_agents = isset($mobile_config['agents']) ? (array) $mobile_config['agents'] : '';
             $mobile_redirect = isset($mobile_config['redirect']) ? $mobile_config['redirect'] : '';
             if ($mobile_enabled && count($mobile_agents) && !$mobile_redirect) {
                 $rules .= "    RewriteCond %{HTTP_USER_AGENT} (" . implode('|', $mobile_agents) . ") [NC]\n";
                 $rules .= "    RewriteRule .* - [E=W3TC_UA:_" . $mobile_group . "]\n";
//.........这里部分代码省略.........
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:101,代码来源:PgCache_Environment.php

示例2: rules_generate_apache

 /**
  * Generates rules for WP dir
  *
  * @param Config  $config
  * @return string
  */
 private static function rules_generate_apache($config)
 {
     $rewrite_base = Util_Environment::network_home_url_uri();
     $a = Util_Environment::wp_upload_dir();
     $parse_url = @parse_url($a['baseurl']);
     if (empty($parse_url['path'])) {
         return '';
     }
     $uploads_path = $parse_url['path'];
     // cut off rewrite base since its already specified by rules
     if (substr($uploads_path, 0, strlen($rewrite_base)) == $rewrite_base) {
         $uploads_path_nobase = substr($uploads_path, strlen($rewrite_base));
     } else {
         $uploads_path_nobase = $uploads_path;
     }
     $rules = W3TC_MARKER_BEGIN_FEEDBURNER . "\n";
     $rules .= "<IfModule mod_rewrite.c>\n";
     $rules .= "    RewriteCond %{HTTP_USER_AGENT} FeedBurner\n";
     $rules .= "    RewriteRule ^{$uploads_path_nobase}/([0-9]+)/([0-9]+)/hotlink-ok/(.*)\$ {$uploads_path}/\$1/\$2/\$3 [L]\n";
     $rules .= "</IfModule>\n";
     $rules .= W3TC_MARKER_END_FEEDBURNER . "\n";
     return $rules;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:29,代码来源:Extension_FeedBurner_Environment.php

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


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