function testJoinpath()
 {
     $this->assertEquals('foo/bar', SimpleAssetUtil::joinpath('foo', 'bar'));
     $this->assertEquals('foo/bar', SimpleAssetUtil::joinpath('foo/', '/bar'));
     $this->assertEquals('foo/bar', SimpleAssetUtil::joinpath('foo', '', 'bar'));
     $this->assertEquals('foo/bar', SimpleAssetUtil::joinpath(null, 'foo', null, 'bar', null));
     $this->assertEquals('foo/bar', SimpleAssetUtil::joinpath('', 'foo', null, 'bar', ''));
 }
Esempio n. 2
0
 /**
  * @return array
  */
 function glob($dir = null)
 {
     if (!$dir) {
         $config = SimpleAsset::config();
         $dir = $config['asset_dir'];
     }
     $files = glob(SimpleAssetUtil::joinpath($dir, "*.{{$this->suffix_brace}}"), GLOB_BRACE);
     $dirs = array_filter(glob(SimpleAssetUtil::joinpath($dir, "*")), 'is_dir');
     if (sizeof($dirs) > 0) {
         foreach ($dirs as $dir) {
             $files = array_merge($files, $this->glob($dir));
         }
     }
     return array_map(array($this, '_strip_asset_dir'), $files);
 }
Esempio n. 3
0
 /**
  * @param  string $path
  * @return string
  */
 function _digestFile($path)
 {
     return SimpleAssetUtil::joinpath($this->config['store_dir'], $path . ".md5");
 }
Esempio n. 4
0
 /**
  * @param  string $path
  * @return string
  */
 function setDigest($path)
 {
     preg_match_all('/([A-Z][a-z]+)/', get_class($this), $capture);
     $method = "storeDigestTo" . end($capture[0]);
     return $this->{$method}($path, $this->calculateDigest(SimpleAssetUtil::assetFullpath($path)));
 }