public function menuLinks(X_Page_ItemList_PItem $items, $type, $filter, $title, $season, $episode, $pageN = 1) { $pageN = X_VlcShares_Plugins_Utils::isset_or($pageN, 1); if ($type == 'documentaries') { $page = X_PageParser_Page::getPage(sprintf(self::URL_INDEX_LINKS_DOCUMENTARIES, $type, $title, $pageN), new X_PageParser_Parser_TvLinks(X_PageParser_Parser_TvLinks::MODE_LINKS, $type, $filter, $title, $season, $episode, $pageN)); } else { $page = X_PageParser_Page::getPage(sprintf(self::URL_INDEX_LINKS, $type, $title, $season, $episode, $pageN), new X_PageParser_Parser_TvLinks(X_PageParser_Parser_TvLinks::MODE_LINKS, $type, $filter, $title, $season, $episode, $pageN)); } $this->preparePageLoader($page); $parsed = $page->getParsed(); if ($pageN > 1) { // add -previous-page- $previousPage = $pageN - 1; $items->append(X_VlcShares_Plugins_Utils::getPreviousPage("{$type}/{$filter}/{$title}/{$season}/{$episode}/{$previousPage}", $previousPage)); } foreach ($parsed as $match) { $id = $match['id']; $hoster = $match['hoster']; $label = X_Env::_('p_tvlinks_watchon', ucfirst($hoster)); $thumbnail = array_key_exists('thumbnail', $match) ? $match['thumbnail'] : null; $item = new X_Page_Item_PItem($this->getId() . "-{$type}-{$filter}-{$title}-{$season}-{$episode}-{$id}", $label); if (file_exists(APPLICATION_PATH . '/../public/images/icons/hosters/' . $hoster . '.png')) { $item->setIcon("/images/icons/hosters/{$hoster}.png"); } else { if (X_VlcShares::VERSION == "0.5.4") { $item->setIcon("/images/icons/file_32.png"); } else { // icons exists only in vlc-shares > 0.5.4 $item->setIcon("/images/icons/unknown-hoster.png"); } } $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$type}/{$filter}/{$title}/{$season}/{$episode}/{$pageN}/{$id}")->setDescription(APPLICATION_ENV == 'development' ? "{$type}/{$filter}/{$title}/{$season}/{$episode}/{$pageN}/{$id}" : null)->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$type}/{$filter}/{$title}/{$season}/{$episode}/{$pageN}/{$id}")), 'default', false); if ($thumbnail) { $item->setThumbnail($thumbnail); } $items->append($item); } if ($page->getParsed(new X_PageParser_Parser_TvLinks(X_PageParser_Parser_TvLinks::MODE_NEXTPAGE, $type, $filter, $title, $season, $episode, $pageN))) { $nextPage = $pageN + 1; $items->append(X_VlcShares_Plugins_Utils::getNextPage("{$type}/{$filter}/{$title}/{$season}/{$episode}/{$nextPage}", $nextPage)); } }