本文整理汇总了PHP中Util_Environment::url_to_host方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::url_to_host方法的具体用法?PHP Util_Environment::url_to_host怎么用?PHP Util_Environment::url_to_host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::url_to_host方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}