コード例 #1
0
 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
0
 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
0
 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
0
ファイル: Cdn_Plugin.php プロジェクト: developmentDM2/Whohaha
 /**
  * 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;
 }