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


PHP CSSMin::getLocalFileReferences方法代碼示例

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


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

示例1: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param $path String: File path of style file to read
  * @param $flip bool
  *
  * @return String: CSS data in script file
  * @throws MWException if the file doesn't exist
  */
 protected function readStyleFile($path, $flip)
 {
     $localPath = $this->getLocalPath($path);
     if (!file_exists($localPath)) {
         $msg = __METHOD__ . ": style file not found: \"{$localPath}\"";
         wfDebugLog('resourceloader', $msg);
         throw new MWException($msg);
     }
     $style = file_get_contents($localPath);
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $dirname = dirname($path);
     if ($dirname == '.') {
         // If $path doesn't have a directory component, don't prepend a dot
         $dirname = '';
     }
     $dir = $this->getLocalPath($dirname);
     $remoteDir = $this->getRemotePath($dirname);
     // Get and register local file references
     $this->localFileRefs = array_merge($this->localFileRefs, CSSMin::getLocalFileReferences($style, $dir));
     return CSSMin::remap($style, $dir, $remoteDir, true);
 }
開發者ID:nischayn22,項目名稱:mediawiki-core,代碼行數:34,代碼來源:ResourceLoaderFileModule.php

示例2: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param string $path File path of style file to read
  * @param bool $flip
  * @param ResourceLoaderContext $context
  *
  * @return string CSS data in script file
  * @throws MWException If the file doesn't exist
  */
 protected function readStyleFile($path, $flip, $context)
 {
     $localPath = $this->getLocalPath($path);
     $remotePath = $this->getRemotePath($path);
     if (!file_exists($localPath)) {
         $msg = __METHOD__ . ": style file not found: \"{$localPath}\"";
         wfDebugLog('resourceloader', $msg);
         throw new MWException($msg);
     }
     if ($this->getStyleSheetLang($localPath) === 'less') {
         $style = $this->compileLessFile($localPath, $context);
         $this->hasGeneratedStyles = true;
     } else {
         $style = file_get_contents($localPath);
     }
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $localDir = dirname($localPath);
     $remoteDir = dirname($remotePath);
     // Get and register local file references
     $localFileRefs = CSSMin::getLocalFileReferences($style, $localDir);
     foreach ($localFileRefs as $file) {
         if (file_exists($file)) {
             $this->localFileRefs[] = $file;
         } else {
             $this->missingLocalFileRefs[] = $file;
         }
     }
     // Don't cache this call. remap() ensures data URIs embeds are up to date,
     // and urls contain correct content hashes in their query string. (T128668)
     return CSSMin::remap($style, $localDir, $remoteDir, true);
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:45,代碼來源:ResourceLoaderFileModule.php

示例3: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param $path String: File path of style file to read
  * @param $flip bool
  *
  * @return String: CSS data in script file
  * @throws MWException if the file doesn't exist
  */
 protected function readStyleFile($path, $flip, ResourceLoaderContext $context)
 {
     $localPath = $this->getLocalPath($path);
     if (!file_exists($localPath)) {
         throw new MWException(__METHOD__ . ": style file not found: \"{$localPath}\"");
     }
     // Wikia - change begin - @author: wladek
     $style = self::getFileContents($localPath, $context);
     // Wikia - change end
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $dirname = dirname($path);
     if ($dirname == '.') {
         // If $path doesn't have a directory component, don't prepend a dot
         $dirname = '';
     }
     $dir = $this->getLocalPath($dirname);
     $remoteDir = $this->getRemotePath($dirname, $context);
     // Get and register local file references
     $this->localFileRefs = array_merge($this->localFileRefs, CSSMin::getLocalFileReferences($style, $dir));
     return CSSMin::remap($style, $dir, $remoteDir, true, $this->localBasePath);
 }
開發者ID:schwarer2006,項目名稱:wikia,代碼行數:34,代碼來源:ResourceLoaderFileModule.php

示例4: testCommentedLocalFileReferences

 /**
  * CSSMin::getLocalFileReferences should ignore url(...) expressions
  * that have been commented out.
  */
 public function testCommentedLocalFileReferences()
 {
     $basepath = __DIR__ . '/../data/css/';
     $css = file_get_contents($basepath . 'comments.css');
     $files = CSSMin::getLocalFileReferences($css, $basepath);
     $expected = [$basepath . 'not-commented.gif'];
     $this->assertArrayEquals($expected, $files, 'Url(...) expression in comment should be omitted.');
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:12,代碼來源:ResourcesTest.php

示例5: readStyleFile

 /**
  * Reads a style file.
  *
  * This method can be used as a callback for array_map()
  *
  * @param string $path File path of style file to read
  * @param bool $flip
  * @param ResourceLoaderContext $context (optional)
  *
  * @return string CSS data in script file
  * @throws MWException If the file doesn't exist
  */
 protected function readStyleFile($path, $flip, $context = null)
 {
     $localPath = $this->getLocalPath($path);
     $remotePath = $this->getRemotePath($path);
     if (!file_exists($localPath)) {
         $msg = __METHOD__ . ": style file not found: \"{$localPath}\"";
         wfDebugLog('resourceloader', $msg);
         throw new MWException($msg);
     }
     if ($this->getStyleSheetLang($localPath) === 'less') {
         $compiler = $this->getLessCompiler($context);
         $style = $this->compileLessFile($localPath, $compiler);
         $this->hasGeneratedStyles = true;
     } else {
         $style = file_get_contents($localPath);
     }
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $localDir = dirname($localPath);
     $remoteDir = dirname($remotePath);
     // Get and register local file references
     $this->localFileRefs = array_merge($this->localFileRefs, CSSMin::getLocalFileReferences($style, $localDir));
     return CSSMin::remap($style, $localDir, $remoteDir, true);
 }
開發者ID:ucfengzhun,項目名稱:mediawiki,代碼行數:37,代碼來源:ResourceLoaderFileModule.php

示例6: readStyleFile

 /**
  * Reads a style file.
  * 
  * This method can be used as a callback for array_map()
  * 
  * @param $path String: File path of script file to read
  * @return String: CSS data in script file
  */
 protected function readStyleFile($path, $flip)
 {
     $localPath = $this->getLocalPath($path);
     $style = file_get_contents($localPath);
     if ($style === false) {
         throw new MWException(__METHOD__ . ": style file not found: \"{$localPath}\"");
     }
     if ($flip) {
         $style = CSSJanus::transform($style, true, false);
     }
     $dir = $this->getLocalPath(dirname($path));
     $remoteDir = $this->getRemotePath(dirname($path));
     // Get and register local file references
     $this->localFileRefs = array_merge($this->localFileRefs, CSSMin::getLocalFileReferences($style, $dir));
     return CSSMin::remap($style, $dir, $remoteDir, true);
 }
開發者ID:GodelDesign,項目名稱:Godel,代碼行數:24,代碼來源:ResourceLoaderFileModule.php


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