当前位置: 首页>>代码示例>>PHP>>正文


PHP CSSMin::getAllLocalFileReferences方法代码示例

本文整理汇总了PHP中CSSMin::getAllLocalFileReferences方法的典型用法代码示例。如果您正苦于以下问题:PHP CSSMin::getAllLocalFileReferences方法的具体用法?PHP CSSMin::getAllLocalFileReferences怎么用?PHP CSSMin::getAllLocalFileReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSSMin的用法示例。


在下文中一共展示了CSSMin::getAllLocalFileReferences方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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
     $localFileRefs = CSSMin::getAllLocalFileReferences($style, $localDir);
     foreach ($localFileRefs as $file) {
         if (file_exists($file)) {
             $this->localFileRefs[] = $file;
         } else {
             $this->missingLocalFileRefs[] = $file;
         }
     }
     return CSSMin::remap($style, $localDir, $remoteDir, true);
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:44,代码来源:ResourceLoaderFileModule.php

示例2: testCommentedLocalFileReferences

 /**
  * CSSMin::getAllLocalFileReferences 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::getAllLocalFileReferences($css, $basepath);
     $expected = array($basepath . 'not-commented.gif');
     $this->assertArrayEquals($expected, $files, 'Url(...) expression in comment should be omitted.');
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:12,代码来源:ResourcesTest.php


注:本文中的CSSMin::getAllLocalFileReferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。