* @deprecated use ItemMediaResolver directly */ class Loader { /** * The item to pack * @var core_kernel_classes_Resource */ private $item; /** * The lang of the item to pack * @var string */ private $lang; /** * The item service * @var taoItems_models_classes_ItemsService */ private $itemService; /** * Create a packer for an item * @param core_kernel_classes_Resource $item */ public function __construct(core_kernel_classes_Resource $item, $lang = '') { $this->item = $item; $this->lang = $lang; $this->itemService = taoItems_models_classes_ItemsService::singleton(); } /** * Get the content of an asset. * * @param string $assetPath the asset path * @return null|string the asset content or null if not stored locally * @throws common_Exception if the resource cannot be retrieved */ public function getAssetContent($assetPath) { $mediaAsset = $this->getItemMediaResolver()->resolve($assetPath); $mediaSource = $mediaAsset->getMediaSource(); $srcPath = $mediaSource->download($mediaAsset->getMediaIdentifier()); return file_get_contents($srcPath); } protected function getItemMediaResolver() { return new ItemMediaResolver($this->item, $this->lang); } }