本文整理匯總了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;
}