本文整理汇总了PHP中Util_Environment::home_domain_root_url_regexp方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::home_domain_root_url_regexp方法的具体用法?PHP Util_Environment::home_domain_root_url_regexp怎么用?PHP Util_Environment::home_domain_root_url_regexp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::home_domain_root_url_regexp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ob_callback
/**
* Output buffer callback
*
* @param string $buffer
* @return mixed
*/
function ob_callback($buffer)
{
if ($buffer != '' && Util_Content::is_html($buffer)) {
$domain_url_regexp = Util_Environment::home_domain_root_url_regexp();
$buffer = preg_replace_callback('~(href|src|action|extsrc|asyncsrc|w3tc_load_js\\()=?([\'"])((' . $domain_url_regexp . ')?(/[^\'"]*\\.([a-z-_]+)(\\?[^\'"]*)?))[\'"]~Ui', array($this, 'link_replace_callback'), $buffer);
}
return $buffer;
}
示例2: 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;
}
示例3: normalize_file_minify
/**
* Normalizes file name for minify
*
* Relative to document root!
*
* @param string $file
* @return string
*/
public static function normalize_file_minify($file)
{
if (Util_Environment::is_url($file)) {
if (strstr($file, '?') === false) {
$domain_url_regexp = '~' . Util_Environment::home_domain_root_url_regexp() . '~i';
$file = preg_replace($domain_url_regexp, '', $file);
}
}
if (!Util_Environment::is_url($file)) {
$file = Util_Environment::normalize_path($file);
$file = str_replace(Util_Environment::document_root(), '', $file);
$file = ltrim($file, '/');
}
return $file;
}