當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Minify_CSS_UriRewriter::_current_dir方法代碼示例

本文整理匯總了PHP中Minify_CSS_UriRewriter::_current_dir方法的典型用法代碼示例。如果您正苦於以下問題:PHP Minify_CSS_UriRewriter::_current_dir方法的具體用法?PHP Minify_CSS_UriRewriter::_current_dir怎麽用?PHP Minify_CSS_UriRewriter::_current_dir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Minify_CSS_UriRewriter的用法示例。


在下文中一共展示了Minify_CSS_UriRewriter::_current_dir方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: rewrite

 /**
  * Rewrite file relative URIs as root relative in CSS files
  * 
  * @param string $css
  * 
  * @param string $current_dir The directory of the current CSS file.
  * 
  * @param string $doc_root The document root of the web site in which 
  * the CSS file resides (default = $_SERVER['DOCUMENT_ROOT']).
  * 
  * @param array $symlinks (default = array()) If the CSS file is stored in 
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because 
  * paths need to be normalized for this to work, use "//" to substitute 
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  * 
  * @return string
  */
 public static function rewrite($css, $current_dir, $doc_root = null, $symlinks = array())
 {
     self::$_doc_root = self::_realpath($doc_root ? $doc_root : $_SERVER['DOCUMENT_ROOT']);
     self::$_current_dir = self::_realpath($current_dir);
     self::$_symlinks = array();
     // normalize symlinks
     foreach ($symlinks as $link => $target) {
         $link = $link === '//' ? self::$_doc_root : str_replace('//', self::$_doc_root . '/', $link);
         $link = strtr($link, '/', DIRECTORY_SEPARATOR);
         self::$_symlinks[$link] = self::_realpath($target);
     }
     self::$debug_text .= "doc_root    : " . self::$_doc_root . "\n" . "current_dir : " . self::$_current_dir . "\n";
     if (self::$_symlinks) {
         self::$debug_text .= "symlinks : " . var_export(self::$_symlinks, 1) . "\n";
     }
     self::$debug_text .= "\n";
     $css = self::_trim_urls($css);
     // rewrite
     $css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/', array(self::$class_name, '_process_uri_cb'), $css);
     $css = preg_replace_callback('/url\\(\\s*([^\\)\\s]+)\\s*\\)/', array(self::$class_name, '_process_uri_cb'), $css);
     $css = preg_replace_callback('/src=\'\\s*([^\\)\\s]+)\\s*\'/', array(self::$class_name, '_process_src_cb'), $css);
     return $css;
 }
開發者ID:nguyennv,項目名稱:kohana-minify,代碼行數:45,代碼來源:urirewriter.php


注:本文中的Minify_CSS_UriRewriter::_current_dir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。