本文整理汇总了PHP中Util_Environment::filename_to_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::filename_to_url方法的具体用法?PHP Util_Environment::filename_to_url怎么用?PHP Util_Environment::filename_to_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::filename_to_url方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filename_to_uri
public static function filename_to_uri($filename)
{
$url = Util_Environment::filename_to_url($filename);
$parsed = parse_url($url);
$uri = isset($parsed['path']) ? ltrim($parsed['path'], '/') : '';
$uri = '/' . $uri;
return $uri;
}
示例2: minified_url
public static function minified_url($minify_filename)
{
$path = Util_Environment::cache_blog_minify_dir();
$filename = $path . '/' . $minify_filename;
$c = Dispatcher::config();
if (Util_Rule::can_check_rules() && $c->get_boolean('minify.rewrite')) {
return Util_Environment::filename_to_url($filename);
}
return network_site_url('?w3tc_minify=' . $minify_filename);
}
示例3: init
public function init()
{
$url = Util_Environment::filename_to_url(W3TC_CACHE_MINIFY_DIR);
$parsed = parse_url($url);
$prefix = '/' . trim($parsed['path'], '/') . '/';
if (substr($_SERVER['REQUEST_URI'], 0, strlen($prefix)) == $prefix) {
$w3_minify = Dispatcher::component('Minify_MinifiedFileRequestHandler');
$w3_minify->process(substr($_SERVER['REQUEST_URI'], strlen($prefix)));
exit;
}
if (!empty($_REQUEST['w3tc_minify'])) {
$w3_minify = Dispatcher::component('Minify_MinifiedFileRequestHandler');
$w3_minify->process($_REQUEST['w3tc_minify']);
exit;
}
}
示例4: minify_url_regexp
/**
* Gets regexp for minified files
*
* @return string
*/
private function minify_url_regexp($filename_mask)
{
$minify_base_url = Util_Environment::filename_to_url(Util_Environment::cache_blog_minify_dir());
$matches = null;
if (!preg_match('~((https?://)?([^/]+))(.+)~i', $minify_base_url, $matches)) {
return '';
}
$protocol_domain_regexp = Util_Environment::get_url_regexp($matches[1]);
$path_regexp = Util_Environment::preg_quote($matches[4]);
$regexp = '(' . '(' . $protocol_domain_regexp . ')?' . '(' . $path_regexp . $filename_mask . ')' . ')';
return $regexp;
}