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


PHP Util_Environment::site_root方法代码示例

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


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

示例1: get_files_custom

 /**
  * Exports custom files to CDN
  *
  * @return array
  */
 function get_files_custom()
 {
     $files = array();
     $document_root = Util_Environment::document_root();
     $custom_files = $this->_config->get_array('cdn.custom.files');
     $custom_files = array_map(array('\\W3TC\\Util_Environment', 'parse_path'), $custom_files);
     $site_root = Util_Environment::site_root();
     $path = Util_Environment::site_url_uri();
     $site_root_dir = str_replace($document_root, '', $site_root);
     if (strstr(WP_CONTENT_DIR, Util_Environment::site_root()) === false) {
         $site_root = Util_Environment::document_root();
         $path = '';
     }
     $content_path = trim(str_replace(WP_CONTENT_DIR, '', $site_root), '/\\');
     foreach ($custom_files as $custom_file) {
         if ($custom_file != '') {
             $custom_file = Cdn_Util::replace_folder_placeholders($custom_file);
             $custom_file = Util_Environment::normalize_file($custom_file);
             if (!Util_Environment::is_wpmu()) {
                 $dir = trim(dirname($custom_file), '/\\');
                 $rel_path = trim(dirname($custom_file), '/\\');
             } else {
                 $rel_path = $dir = trim(dirname($custom_file), '/\\');
             }
             if (strpos($dir, '<currentblog>') != false) {
                 $rel_path = $dir = str_replace('<currentblog>', 'blogs.dir/' . Util_Environment::blog_id(), $dir);
             }
             if ($dir == '.') {
                 $rel_path = $dir = '';
             }
             $mask = basename($custom_file);
             $files = array_merge($files, Cdn_Util::search_files($document_root . '/' . $dir, $rel_path, $mask));
         }
     }
     return $files;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:41,代码来源:Cdn_Plugin.php

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

示例3: normalize_file

 /**
  * Normalizes file name
  *
  * Relative to site root!
  *
  * @param string  $file
  * @return string
  */
 public static function normalize_file($file)
 {
     if (Util_Environment::is_url($file)) {
         if (strstr($file, '?') === false) {
             $home_url_regexp = '~' . Util_Environment::home_url_regexp() . '~i';
             $file = preg_replace($home_url_regexp, '', $file);
         }
     }
     if (!Util_Environment::is_url($file)) {
         $file = Util_Environment::normalize_path($file);
         $file = str_replace(Util_Environment::site_root(), '', $file);
         $file = ltrim($file, '/');
     }
     return $file;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:23,代码来源:Util_Environment.php


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