public static function instance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; }
private function _fetchVideos(X_Page_ItemList_PItem $items, $resourceType, $pageN, $resourceGroup, $resourceId) { X_Debug::i("Fetching videos for {$resourceType}, {$pageN}, {$resourceGroup}, {$resourceId}"); // as first thing we have to recreate the resource url from resourceId $url = sprintf(self::URL_BASE, $resourceId); $page = X_PageParser_Page::getPage($url, X_PageParser_Parser_StreamingOnlineVideos::instance()); $this->preparePageLoader($page); foreach ($page->getParsed() as $link) { $videoId = $link['videoId']; $hosterId = $link['hosterId']; $videoCode = $link['link']; $videoLabel = trim("{$link['label']} [{$link['hosterId']}]"); //$videoThumb = $link['thumbnail']; $item = new X_Page_Item_PItem("{$this->getId()}-hoster-{$hosterId}-{$videoId}", $videoLabel); $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$resourceType}/{$pageN}/{$resourceGroup}/{$resourceId}/{$videoCode}")->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$resourceType}/{$pageN}/{$resourceGroup}/{$resourceId}/{$videoCode}")), 'default', false); if (APPLICATION_ENV == 'development') { $item->setDescription("{$resourceType}/{$pageN}/{$resourceGroup}/{$resourceId}/{$videoCode}"); } /* if ( $videoThumb ) { $item->setThumbnail($videoThumb); } */ $items->append($item); } }