protected function getTag(AssetInfo $assetInfo) { if ($assetInfo->getPath()) { $path = $this->getAssetPath($assetInfo->getPath()); $pubPath = $this->getPublicAssetPath($assetInfo->getPath()); if (file_exists($path)) { $pubPath .= '?c=' . substr(md5(filemtime($path)), 0, 6); } return sprintf('<link rel="stylesheet" type="text/css" href="%s" >', $pubPath); } else { return sprintf(<<<EOF <style type="text/css"> %s </style> EOF , $assetInfo->getContent()); } }
protected function getTag(AssetInfo $assetInfo) { if ($assetInfo->getPath()) { $path = $this->getAssetPath($assetInfo->getPath()); $pubPath = $this->getPublicAssetPath($assetInfo->getPath()); if (file_exists($path)) { $pubPath .= '?c=' . substr(md5(filemtime($path)), 0, 6); } return sprintf('<script type="text/javascript" src="%s"></script>', $pubPath); } else { return sprintf(<<<EOF <script type="text/javascript"> %s </script> EOF , $assetInfo->getContent()); } }
public function hasAsset(AssetInfo $assetInfo, $assets = null) { if (!$assets) { $assets = $this->assetsInfo; } $assets = $assets ? call_user_func_array('array_merge', $assets) : []; foreach ($assets as $asset) { if (!$assetInfo->getPath() && $assetInfo->getContent() === $asset->getContent() && $assetInfo->getContentType() === $asset->getContentType()) { return true; } if ($asset->getPath() && $asset->getPath() === $assetInfo->getPath()) { return true; } } return false; }