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


PHP Util_Environment::site_url_uri方法代码示例

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


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

示例1: get_frontpage_urls

 /**
  * Returns full urls for frontpage including older pages
  *
  * @param int     $limit_post_pages default is 10
  * @return array
  */
 public static function get_frontpage_urls($limit_post_pages = 10)
 {
     static $frontpage_urls = array();
     if (!isset($frontpage_urls[$limit_post_pages])) {
         $front_page = get_option('show_on_front');
         $full_urls = array();
         $home_path = Util_Environment::home_url_uri();
         $site_path = Util_Environment::site_url_uri();
         $full_urls[] = get_home_url() . '/';
         if ($site_path != $home_path) {
             $full_urls[] = site_url() . '/';
         }
         $full_urls = array_merge($full_urls, self::get_older_pages($home_path, $limit_post_pages));
         $frontpage_urls[$limit_post_pages] = $full_urls;
     }
     return $frontpage_urls[$limit_post_pages];
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:23,代码来源:Util_PageUrls.php

示例2: remove_scripts

 /**
  * Remove script tags from the source
  *
  * @param string  $content
  * @param array   $files
  * @return void
  */
 function remove_scripts(&$content, $files)
 {
     $regexps = array();
     $home_url_regexp = Util_Environment::home_url_regexp();
     $path = '';
     if (Util_Environment::is_wpmu() && !Util_Environment::is_wpmu_subdomain()) {
         $path = ltrim(Util_Environment::home_url_uri(), '/');
     }
     foreach ($files as $file) {
         if ($path && strpos($file, $path) === 0) {
             $file = substr($file, strlen($path));
         }
         $this->replaced_scripts[] = $file;
         if (Util_Environment::is_url($file) && !preg_match('~' . $home_url_regexp . '~i', $file)) {
             // external JS files
             $regexps[] = Util_Environment::preg_quote($file);
         } else {
             // local JS files
             $file = ltrim($file, '/');
             if (home_url() == site_url() && ltrim(Util_Environment::site_url_uri(), '/') && strpos($file, ltrim(Util_Environment::site_url_uri(), '/')) === 0) {
                 $file = str_replace(ltrim(Util_Environment::site_url_uri(), '/'), '', $file);
             }
             $file = ltrim(preg_replace('~' . $home_url_regexp . '~i', '', $file), '/\\');
             $regexps[] = '(' . $home_url_regexp . ')?/?' . Util_Environment::preg_quote($file);
         }
     }
     foreach ($regexps as $regexp) {
         $content = preg_replace('~<script\\s+[^<>]*src=["\']?' . $regexp . '["\']?[^<>]*>\\s*</script>~Uis', '', $content);
     }
 }
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:37,代码来源:Minify_Plugin.php

示例3: _get_multisite_url_identifier

 /**
  * Returns the sitepath for multisite subfolder or subdomain path for multisite subdomain
  *
  * @return string
  */
 private function _get_multisite_url_identifier()
 {
     if (defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) {
         $parsedUrl = parse_url(site_url());
         return $parsedUrl['host'];
     } elseif (Util_Environment::is_wpmu_subdomain()) {
         $parsedUrl = parse_url(Util_Environment::home_domain_root_url());
         $urlparts = explode('.', $parsedUrl['host']);
         if (sizeof($urlparts) > 2) {
             $subdomain = array_shift($urlparts);
             return trim($subdomain, '/');
         }
     }
     return trim(Util_Environment::site_url_uri(), '/');
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:20,代码来源:Cdn_Core.php

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

示例5: fill_regexps

 private function fill_regexps()
 {
     $regexps = array();
     $site_path = Util_Environment::site_url_uri();
     $domain_url_regexp = Util_Environment::home_domain_root_url_regexp();
     $site_domain_url_regexp = false;
     if ($domain_url_regexp != Util_Environment::get_url_regexp(Util_Environment::url_to_host(site_url()))) {
         $site_domain_url_regexp = Util_Environment::get_url_regexp(Util_Environment::url_to_host(site_url()));
     }
     if ($this->_config->get_boolean('cdn.uploads.enable')) {
         $upload_info = Util_Http::upload_info();
         if ($upload_info) {
             $baseurl = $upload_info['baseurl'];
             if (defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) {
                 $parsed = @parse_url($upload_info['baseurl']);
                 $baseurl = home_url() . $parsed['path'];
             }
             $regexps = $this->make_uploads_regexes($domain_url_regexp, $baseurl, $upload_info, $regexps);
             if ($site_domain_url_regexp) {
                 $regexps = $this->make_uploads_regexes($site_domain_url_regexp, $baseurl, $upload_info, $regexps);
             }
         }
     }
     if ($this->_config->get_boolean('cdn.includes.enable')) {
         $mask = $this->_config->get_string('cdn.includes.files');
         if ($mask != '') {
             $regexps[] = '~(["\'(=])\\s*((' . $domain_url_regexp . ')?(' . Util_Environment::preg_quote($site_path . WPINC) . '/(' . Cdn_Util::get_regexp_by_mask($mask) . ')([^"\'() >]*)))~i';
             if ($site_domain_url_regexp) {
                 $regexps[] = '~(["\'(=])\\s*((' . $site_domain_url_regexp . ')?(' . Util_Environment::preg_quote($site_path . WPINC) . '/(' . Cdn_Util::get_regexp_by_mask($mask) . ')([^"\'() >]*)))~i';
             }
         }
     }
     if ($this->_config->get_boolean('cdn.theme.enable')) {
         $theme_dir = preg_replace('~' . $domain_url_regexp . '~i', '', get_theme_root_uri());
         $mask = $this->_config->get_string('cdn.theme.files');
         if ($mask != '') {
             $regexps[] = '~(["\'(=])\\s*((' . $domain_url_regexp . ')?(' . Util_Environment::preg_quote($theme_dir) . '/(' . Cdn_Util::get_regexp_by_mask($mask) . ')([^"\'() >]*)))~i';
             if ($site_domain_url_regexp) {
                 $theme_dir2 = preg_replace('~' . $site_domain_url_regexp . '~i', '', get_theme_root_uri());
                 $regexps[] = '~(["\'(=])\\s*((' . $site_domain_url_regexp . ')?(' . Util_Environment::preg_quote($theme_dir) . '/(' . Cdn_Util::get_regexp_by_mask($mask) . ')([^"\'() >]*)))~i';
                 $regexps[] = '~(["\'(=])\\s*((' . $site_domain_url_regexp . ')?(' . Util_Environment::preg_quote($theme_dir2) . '/(' . Cdn_Util::get_regexp_by_mask($mask) . ')([^"\'() >]*)))~i';
             }
         }
     }
     if ($this->_config->get_boolean('cdn.custom.enable')) {
         $masks = $this->_config->get_array('cdn.custom.files');
         $masks = array_map(array('\\W3TC\\Cdn_Util', 'replace_folder_placeholders'), $masks);
         $masks = array_map(array('\\W3TC\\Util_Environment', 'parse_path'), $masks);
         if (count($masks)) {
             $mask_regexps = array();
             foreach ($masks as $mask) {
                 if ($mask != '') {
                     $mask = Util_Environment::normalize_file($mask);
                     $mask_regexps[] = Cdn_Util::get_regexp_by_mask($mask);
                 }
             }
             $regexps[] = '~(["\'(=])\\s*((' . $domain_url_regexp . ')?(' . Util_Environment::preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')([^"\'() >]*)))~i';
             if ($site_domain_url_regexp) {
                 $regexps[] = '~(["\'(=])\\s*((' . $site_domain_url_regexp . ')?(' . Util_Environment::preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')([^"\'() >]*)))~i';
             }
         }
     }
     $this->_regexps = $regexps;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:64,代码来源:Cdn_Plugin.php

示例6: replace_folder_placeholders

 static function replace_folder_placeholders($file)
 {
     static $content_dir, $plugin_dir, $upload_dir;
     if (empty($content_dir)) {
         $content_dir = str_replace(Util_Environment::document_root(), '', WP_CONTENT_DIR);
         $content_dir = substr($content_dir, strlen(Util_Environment::site_url_uri()));
         $content_dir = trim($content_dir, '/');
         if (defined('WP_PLUGIN_DIR')) {
             $plugin_dir = str_replace(Util_Environment::document_root(), '', WP_PLUGIN_DIR);
             $plugin_dir = trim($plugin_dir, '/');
         } else {
             $plugin_dir = str_replace(Util_Environment::document_root(), '', WP_CONTENT_DIR . '/plugins');
             $plugin_dir = trim($plugin_dir, '/');
         }
         $upload_dir = Util_Environment::wp_upload_dir();
         $upload_dir = str_replace(Util_Environment::document_root(), '', $upload_dir['basedir']);
         $upload_dir = trim($upload_dir, '/');
     }
     $file = str_replace('{wp_content_dir}', $content_dir, $file);
     $file = str_replace('{plugins_dir}', $plugin_dir, $file);
     $file = str_replace('{uploads_dir}', $upload_dir, $file);
     return $file;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:23,代码来源:Cdn_Util.php


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