当前位置: 首页>>代码示例>>PHP>>正文


PHP X_Env::encode方法代码示例

本文整理汇总了PHP中X_Env::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP X_Env::encode方法的具体用法?PHP X_Env::encode怎么用?PHP X_Env::encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在X_Env的用法示例。


在下文中一共展示了X_Env::encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getShareItems

 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     if ($location != '' && ($location == self::INDEX_NARUTO || $location == self::INDEX_ONEPIECE || $location == self::INDEX_BLEACH)) {
         $pageIndex = $this->config('index.url', 'http://www.dbforever.net/home.php') . "?page={$location}";
         $htmlString = $this->_loadPage($pageIndex);
         $dom = new Zend_Dom_Query($htmlString);
         $results = $dom->queryXpath('//div[@align="left"]/a');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
             $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'mode', 'l' => X_Env::encode($href)), 'default', false);
             $items->append($item);
         }
     } else {
         $item = new X_Page_Item_PItem($this->getId() . '-' . self::INDEX_NARUTO, X_Env::_('p_dbforever_naruto_ep'));
         $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', self::INDEX_NARUTO)->setThumbnail('http://www.dbforever.net/img/banner/naruto_banner_grande.jpg')->setLink(array('l' => X_Env::encode(self::INDEX_NARUTO)), 'default', false);
         $items->append($item);
         $item = new X_Page_Item_PItem($this->getId() . '-' . self::INDEX_ONEPIECE, X_Env::_('p_dbforever_onepiece_ep'));
         $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', self::INDEX_ONEPIECE)->setThumbnail('http://www.dbforever.net/img/banner/onepiece_banner_grande.jpg')->setLink(array('l' => X_Env::encode(self::INDEX_ONEPIECE)), 'default', false);
         $items->append($item);
         $item = new X_Page_Item_PItem($this->getId() . '-' . self::INDEX_BLEACH, X_Env::_('p_dbforever_bleach_ep'));
         $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', self::INDEX_BLEACH)->setThumbnail('http://www.dbforever.net/img/banner/bleach_banner_grande.jpg')->setLink(array('l' => X_Env::encode(self::INDEX_BLEACH)), 'default', false);
         $items->append($item);
     }
     return $items;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:41,代码来源:DBForever.php

示例2: getShareItems

 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     // try to disable SortItems plugin, so link are listed as in html page
     X_VlcShares_Plugins::broker()->unregisterPluginClass('X_VlcShares_Plugins_SortItems');
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     if ($location != '' && array_key_exists((int) $location, $this->seasons)) {
         // episodes list
         $url = $this->seasons[(int) $location];
         $html = $this->_loadPage($url);
         $dom = new Zend_Dom_Query($html);
         $results = $dom->queryXpath('//div[@id="randomVideos"]//div[@class="randomTab"]//a[@class="previewDescriptionTitle"]');
         $resultsImages = $dom->queryXpath('//div[@id="randomVideos"]//div[@class="randomTab"]//img[1]/attribute::src');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $id = explode('id=', $href, 2);
             $id = @$id[1];
             $thumb = null;
             try {
                 if ($resultsImages->valid()) {
                     $thumb = $resultsImages->current()->nodeValue;
                     $resultsImages->next();
                 }
             } catch (Exception $e) {
                 $thumb = null;
             }
             $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
             $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $id)->setLink(array('action' => 'mode', 'l' => X_Env::encode($id)), 'default', false);
             if ($thumb !== null) {
                 $item->setThumbnail($thumb);
             }
             $items->append($item);
         }
     } else {
         foreach ($this->seasons as $key => $seasons) {
             $item = new X_Page_Item_PItem($this->getId() . '-' . $key, X_Env::_('p_allsp_season_n') . ": {$key}");
             $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', $key)->setLink(array('action' => 'share', 'l' => X_Env::encode($key)), 'default', false);
             $items->append($item);
         }
     }
     return $items;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:55,代码来源:AllSp.php

示例3: getShareItems

 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     if ($location != '') {
         // try to disable SortItems plugin, so link are listed as in html page
         X_VlcShares_Plugins::broker()->unregisterPluginClass('X_VlcShares_Plugins_SortItems');
         $pageIndex = rtrim($this->config('base.url', 'http://www.animeland.it/'), '/') . "/{$location}";
         $htmlString = $this->_loadPage($pageIndex);
         $dom = new Zend_Dom_Query($htmlString);
         $results = $dom->queryXpath('//a[@href!="menu_streaming.html"]');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
             $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'mode', 'l' => X_Env::encode($href)), 'default', false);
             $items->append($item);
         }
     } else {
         $pageIndex = rtrim($this->config('base.url', 'http://www.animeland.it/'), '/') . "/" . $this->config('index.page', 'menu_streaming.html');
         $htmlString = $this->_loadPage($pageIndex);
         $dom = new Zend_Dom_Query($htmlString);
         $results = $dom->queryXpath('//a[@href!="menu_streaming.html"]');
         for ($i = 0; $i < $results->count(); $i++, $results->next()) {
             $node = $results->current();
             $href = $node->getAttribute('href');
             $label = $node->nodeValue;
             $target = $node->getAttribute('target');
             if ($target == '_blank') {
                 $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
                 $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'mode', 'l' => X_Env::encode($href)), 'default', false);
                 $items->append($item);
             } else {
                 $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
                 $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'share', 'l' => X_Env::encode($href)), 'default', false);
                 $items->append($item);
             }
         }
     }
     return $items;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:53,代码来源:AnimeLand.php

示例4: filterShareItems

 /**
  * Check the item in the collection should be filtered out
  * If return is false, the item will be discarded at 100%
  * If return is true, isn't sure that the item will be added
  * 'cause another plugin can prevent this
  * 
  * Plugins who check per-item acl or blacklist should hook here
  * 
  * @param X_Page_Item_PItem $item
  * @param string $provider
  * @param Zend_Controller_Action $controller
  * @return boolean true if item is ok, false if item should be discarded
  */
 public function filterShareItems(X_Page_Item_PItem $item, $provider, Zend_Controller_Action $controller)
 {
     $providerClass = X_VlcShares_Plugins::broker()->getPluginClass($provider);
     $providerObj = X_VlcShares_Plugins::broker()->getPlugins($provider);
     if (is_a($providerObj, 'X_VlcShares_Plugins_FileSystem')) {
         if ($item->getType() == X_Page_Item_PItem::TYPE_ELEMENT) {
             $itemLocation = $item->getCustom('X_VlcShares_Plugins_FileSystem:location');
             /* @var $urlHelper Zend_Controller_Action_Helper_Url */
             $urlHelper = $controller->getHelper('url');
             $path = $providerObj->resolveLocation($itemLocation);
             $thumb = new Application_Model_FsThumb();
             Application_Model_FsThumbsMapper::i()->fetchByPath($path, $thumb);
             if ($thumb->isNew()) {
                 $thumbUrl = X_Env::completeUrl($urlHelper->direct('thumb', 'fsthumbs', 'default', array('l' => X_Env::encode($itemLocation), 't' => 'dummy.jpg')));
             } else {
                 $thumbUrl = X_Env::completeUrl(Zend_Controller_Front::getInstance()->getBaseUrl() . $thumb->getUrl());
             }
             //$item->setDescription($itemLocation);
             $item->setThumbnail($thumbUrl);
         }
     }
     return true;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:36,代码来源:FsThumbs.php

示例5: menuChannels

 public function menuChannels(X_Page_ItemList_PItem $items)
 {
     /* @var $parsed SimpleXmlElement */
     $page = $this->getChannelsListRaw();
     $parser = new X_PageParser_Parser_Own3dLive();
     $parsed = $parser->parse($page);
     if (!$parsed) {
         return;
     }
     foreach ($parsed as $match) {
         /* @var $match array */
         $id = "{$match['hoster']}:{$match['id']}";
         $label = $match['label'];
         $item = new X_Page_Item_PItem($this->getId() . "-{$id}", $label);
         $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$id}")->setDescription(APPLICATION_ENV == 'development' ? "{$id}" : null)->setIcon("/images/icons/hosters/own3dlive.png")->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$id}")), 'default', false);
         $items->append($item);
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:18,代码来源:Own3d.php

示例6: menuChannels

 public function menuChannels(X_Page_ItemList_PItem $items)
 {
     /* @var $parsed SimpleXmlElement */
     $dom = simplexml_load_string($this->getChannelsList());
     $parsed = $dom->xpath('//stream');
     // failed xpath, no results
     if (!$parsed) {
         return;
     }
     foreach ($parsed as $match) {
         /* @var $match SimpleXmlElement */
         $id = (string) $match->title;
         $label = (string) $match->title . " [" . (string) $match->language . "]";
         $item = new X_Page_Item_PItem($this->getId() . "-{$id}", $label);
         $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$id}")->setDescription(APPLICATION_ENV == 'development' ? "{$id}" : null)->setIcon("/images/icons/hosters/direct-url.png")->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$id}")), 'default', false);
         $items->append($item);
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:18,代码来源:RtmpGui.php

示例7: deleteAction

 public function deleteAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id', null);
     $type = $request->getParam('type', 'video');
     if (!is_null($id)) {
         if ($type == 'video') {
             $video = new Application_Model_Video();
             Application_Model_VideosMapper::i()->find($id, $video);
             if ($video->getId()) {
                 $category = $video->getCategory();
                 Application_Model_VideosMapper::i()->delete($video);
                 $this->_helper->redirector('category', 'onlinelibrary', 'default', array('id' => X_Env::encode($category)));
             }
         } elseif ($type == 'category') {
             Application_Model_VideosMapper::i()->deleteCategory(X_Env::decode($id));
         }
     }
     $this->_helper->redirector('index', 'onlinelibrary');
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:20,代码来源:OnlinelibraryController.php

示例8: _prepareVideo

 private function _prepareVideo(X_Page_ItemList_PItem $items, Zend_Gdata_Media_Feed $feed, $locationPrefix)
 {
     foreach ($feed as $yvideo) {
         /* @var $yvideo Zend_Gdata_YouTube_VideoEntry */
         if ($yvideo->getVideoDuration() == 0) {
             continue;
         }
         // no duration = no video
         $item = new X_Page_Item_PItem('youtube-video-' . $yvideo->getVideoId(), $yvideo->getVideoTitle() . ' [' . X_Env::formatTime($yvideo->getVideoDuration()) . ']');
         $thumb = $yvideo->getVideoThumbnails();
         @($thumb = $thumb[0]['url']);
         $item->setDescription($yvideo->getVideoDescription())->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setIcon('/images/youtube/icons/video.png')->setThumbnail($thumb)->setCustom(__CLASS__ . ':location', "{$locationPrefix}/{$yvideo->getVideoId()}")->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$locationPrefix}/{$yvideo->getVideoId()}")), 'default', false)->setGenerator(__CLASS__);
         $items->append($item);
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:15,代码来源:Youtube.php

示例9: resolveLocation

 /**
  * @see X_VlcShares_Plugins_ResolverInterface::resolveLocation
  * @param string $location
  * @return string real address of a resource
  */
 function resolveLocation($location = null)
 {
     if ($location == '' || $location == null) {
         return false;
     }
     // if it isn't in the channels array it's an invalid location
     if (!array_search($location, $this->channels)) {
         return null;
     }
     // X_Env::routeLink should be deprecated, but now is the best option
     $linkUrl = X_Env::routeLink('spainradio', 'proxy', array('v' => X_Env::encode($location)));
     $return = $linkUrl;
     return $return;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:19,代码来源:Spainradio.php

示例10: menuChannels

 public function menuChannels(X_Page_ItemList_PItem $items)
 {
     $auth = '';
     if ($this->config('auth.enabled', false)) {
         $auth = "&username=" . rawurlencode($this->config('auth.username', '')) . "&userpassword=" . rawurlencode($this->config('auth.password', '')) . "&option=andback";
     }
     $page = X_PageParser_Page::getPage(sprintf(self::URL_CHANNELS, $auth), new X_PageParser_Parser_Preg('%<p style="font-size:12px;.+>(?P<label>.*?)</a></p>(.*\\n){5}.*<a href="http://weeb.tv/channel/(?P<href>.*?)" title="(.*?)"><img src="(?P<thumbnail>.*)" alt=".*?" height="100" width="100" /></a>%', X_PageParser_Parser_Preg::PREG_MATCH_ALL, PREG_SET_ORDER));
     $this->preparePageLoader($page);
     $parsed = $page->getParsed();
     foreach ($parsed as $match) {
         $thumbnail = $match['thumbnail'];
         $label = $match['label'];
         $href = $match['href'];
         $item = new X_Page_Item_PItem($this->getId() . "-{$label}", $label);
         $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$href}")->setDescription(APPLICATION_ENV == 'development' ? "{$href}" : null)->setThumbnail($thumbnail)->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$href}")), 'default', false);
         $items->append($item);
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:18,代码来源:WeebTv.php

示例11: preGetModeItems

 /**
  *	Add button -watch megavideo stream directly-
  * 
  * @param string $provider
  * @param string $location
  * @param Zend_Controller_Action $controller
  */
 public function preGetModeItems($provider, $location, Zend_Controller_Action $controller)
 {
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $url = $this->resolveLocation($location);
     if ($url != false) {
         $link = new X_Page_Item_PItem('core-directwatch', X_Env::_('p_onlinelibrary_watchdirectly'));
         $link->setIcon('/images/icons/play.png')->setType(X_Page_Item_PItem::TYPE_PLAYABLE)->setLink($url);
         return new X_Page_ItemList_PItem(array($link));
     } else {
         X_Debug::i('Setting priority to filterModeItems');
         $this->setPriority('filterModeItems', 99);
         $link = new X_Page_Item_PItem('invalidvideo-warning', X_Env::_('p_onlinelibrary_invalidlink'));
         $link->setIcon('/images/msg_error.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setLink(array('controller' => 'browse', 'action' => 'share', 'p' => $this->getId(), 'l' => X_Env::encode($location)), 'default', true);
         return new X_Page_ItemList_PItem(array($link));
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:26,代码来源:OnlineLibrary.php

示例12: menuLinks

 public function menuLinks(X_Page_ItemList_PItem $items, $category, $show, $type)
 {
     $i = 0;
     while (true) {
         $page = X_PageParser_Page::getPage(sprintf(self::URL_INDEX_LINKS, $type, $i++), new X_PageParser_Parser_Preg('/<a .*?href=\\"\\/dl\\/RaiTV\\/programmi\\/media\\/ContentItem-(?P<href>.*?).html#p=0\\".*?src=\\"(?P<thumbnail>.*?)\\".*?><h2>(?P<label>.*?)<\\/h2>/s', X_PageParser_Parser_Preg::PREG_MATCH_ALL, PREG_SET_ORDER));
         $this->preparePageLoader($page);
         $parsed = $page->getParsed();
         // exit first time no item found
         if (!count($parsed)) {
             return;
         }
         foreach ($parsed as $match) {
             $label = $match['label'];
             $href = $match['href'];
             $thumbnail = $match['thumbnail'];
             if ($thumbnail && !X_Env::startWith($thumbnail, 'http://')) {
                 $thumbnail = sprintf(self::URL_BASE, ltrim($thumbnail, '/'));
             }
             $item = new X_Page_Item_PItem($this->getId() . "-{$show}-{$type}-{$href}", $label);
             $item->setIcon("/images/icons/file_32.png");
             $item->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$category}/{$show}/{$type}/{$href}")->setThumbnail($thumbnail)->setDescription(APPLICATION_ENV == 'development' ? "{$category}/{$show}/{$type}/{$href}" : null)->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$category}/{$show}/{$type}/{$href}")), 'default', false);
             $items->append($item);
         }
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:25,代码来源:RaiClick.php

示例13: getShareItems

 /**
  * Get category/video list
  * @param unknown_type $provider
  * @param unknown_type $location
  * @param Zend_Controller_Action $controller
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     /*
     		if ( $location != '' ) {
     
     			
     			/*
     			if ( $location == self::INDEX_SHIPPUDEN ) {
     */
     //try to disable SortItems plugin, so link are listed as in html page
     X_VlcShares_Plugins::broker()->unregisterPluginClass('X_VlcShares_Plugins_SortItems');
     $pageIndex = $this->config('index.shippuden.url', 'http://www.narutoget.com/naruto-shippuden-episodes/');
     $htmlString = $this->_loadPage($pageIndex);
     $dom = new Zend_Dom_Query($htmlString);
     $results = $dom->queryXpath('//a[@class="movie"]');
     for ($i = 0; $i < $results->count(); $i++, $results->next()) {
         $node = $results->current();
         $href = $node->getAttribute('href');
         $label = $node->nodeValue;
         $item = new X_Page_Item_PItem($this->getId() . '-' . $label, $label);
         $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', $href)->setLink(array('action' => 'mode', 'l' => X_Env::encode($href)), 'default', false);
         $items->append($item);
     }
     /*
     	}  else {
     		
     		list($type, $cat) = @explode(':', $location, 2);
     		
     		if ( $cat != null ) {
     			
     			$htmlString = $this->_loadPage($cat);
     			
     			$dom = new Zend_Dom_Query($htmlString);
     			
     			$results = $dom->queryXpath('//a[@class="movie"]');
     			
     			for ( $i = 0; $i < $results->count(); $i++, $results->next()) {
     				
     				$node = $results->current();
     				$href = $node->getAttribute('href');
     				$label = $node->nodeValue;
     				
     				$items[] = array(
     					'label'		=>	"$label",
     					'link'		=>	X_Env::completeUrl(
     						$urlHelper->url(
     							array(
     								'action' => 'mode',
     								'l'	=>	X_Env::encode($href)
     							), 'default', false
     						)
     					),
     					__CLASS__.':location'	=>	$href
     				);
     				
     			}
     				
     			
     			
     		} else {
     			$pageIndex = $this->config('index.naruto.url', 'http://www.narutoget.com/page/10-naruto-episodes-subbed/');
     			
     			$htmlString = $this->_loadPage($pageIndex);
     			
     			$dom = new Zend_Dom_Query($htmlString);
     			
     			$results = $dom->queryXpath('//div[@id="side-a"]//div[@align="left"]//a');
     			
     			for ( $i = 0; $i < $results->count(); $i++, $results->next()) {
     				
     				$node = $results->current();
     				$href = $node->getAttribute('href');
     				$label = $node->nodeValue;
     				
     				$items[] = array(
     					'label'		=>	"$label",
     					'link'		=>	X_Env::completeUrl(
     						$urlHelper->url(
     							array(
     								'action' => 'share',
     								'l'	=>	X_Env::encode("$type:$href")
     							), 'default', false
     						)
     					),
     					__CLASS__.':location'	=>	"$type:$href"
     				);
     				
//.........这里部分代码省略.........
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:101,代码来源:NarutoGet.php

示例14: getShareItems

 /**
  * Return a list of page items for the current $location
  * if the $provider is this
  */
 public function getShareItems($provider, $location, Zend_Controller_Action $controller)
 {
     // this plugin add items only if it is the provider
     if ($provider != $this->getId()) {
         return;
     }
     X_Debug::i("Plugin triggered");
     // disabling cache plugin
     try {
         $cachePlugin = X_VlcShares_Plugins::broker()->getPlugins('cache');
         if (method_exists($cachePlugin, 'setDoNotCache')) {
             $cachePlugin->setDoNotCache();
         }
     } catch (Exception $e) {
         // cache plugin not registered, no problem
     }
     $urlHelper = $controller->getHelper('url');
     $items = new X_Page_ItemList_PItem();
     if ($location != '') {
         list($shareId, $path) = explode(':', $location, 2);
         $share = new Application_Model_FilesystemShare();
         Application_Model_FilesystemSharesMapper::i()->find($shareId, $share);
         // TODO prevent ../
         $browsePath = realpath($share->getPath() . $path);
         if (file_exists($browsePath)) {
             $dir = new DirectoryIterator($browsePath);
             foreach ($dir as $entry) {
                 if ($entry->isDot()) {
                     continue;
                 }
                 if ($entry->isDir()) {
                     $item = new X_Page_Item_PItem($this->getId() . '-' . $entry->getFilename() . '/', "{$entry->getFilename()}/");
                     $item->setIcon('/images/icons/folder_32.png')->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', "{$share->getId()}:{$path}{$entry->getFilename()}/")->setLink(array('l' => X_Env::encode("{$share->getId()}:{$path}{$entry->getFilename()}/")), 'default', false);
                     $items->append($item);
                 } else {
                     if ($entry->isFile()) {
                         $item = new X_Page_Item_PItem($this->getId() . '-' . $entry->getFilename(), "{$entry->getFilename()}");
                         $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$share->getId()}:{$path}{$entry->getFilename()}")->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$share->getId()}:{$path}{$entry->getFilename()}")), 'default', false);
                         $items->append($item);
                     } else {
                         // scarta i symlink
                         continue;
                     }
                 }
             }
         }
     } else {
         // if location is not specified,
         // show collections
         $shares = Application_Model_FilesystemSharesMapper::i()->fetchAll();
         foreach ($shares as $share) {
             /* @var $share Application_Model_FilesystemShare */
             $item = new X_Page_Item_PItem($this->getId() . '-' . $share->getLabel(), $share->getLabel());
             $item->setIcon('/images/icons/folder_32.png')->setDescription(APPLICATION_ENV == 'development' ? $share->getPath() : null)->setType(X_Page_Item_PItem::TYPE_CONTAINER)->setCustom(__CLASS__ . ':location', "{$share->getId()}:/")->setLink(array('l' => X_Env::encode("{$share->getId()}:/")), 'default', false);
             $items->append($item);
         }
     }
     return $items;
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:63,代码来源:FileSystem.php

示例15: _fetchVideos

 private function _fetchVideos(X_Page_ItemList_PItem $items, $resourceType, $resourceGroup, $page, $resourceId)
 {
     X_Debug::i("Fetching videos for {$resourceType}, {$resourceGroup}, {$page}, {$resourceId}");
     // as first thing we have to recreate the resource url from resourceId
     $url = self::URL_BASE;
     // in _fetchResources we converted / in : inside $resourceId and removed the last /
     // so to come back to the real address we have to undo this changes
     $url .= str_replace(':', '/', $resourceId) . '/';
     // now url is something like http://film-stream.tv/01/01/2010/resource-name/
     // loading page
     $htmlString = $this->_loadPage($url);
     // it's useless to execute pattern search in the whole page
     // so we stip from $htmlString only the usefull part
     $mainContentStart = '<div id="maincontent">';
     $mainContentEnd = '<div id="sidebar">';
     $mainContentStart = strpos($htmlString, $mainContentStart);
     if ($mainContentStart === false) {
         $mainContentStart = 0;
     }
     $mainContentEnd = strpos($htmlString, $mainContentEnd, $mainContentStart);
     // substr get a substring of $htmlString from $mainContentStart position to $mainContentEnd position - $mainContentStart position (is the fragment length)
     $htmlString = $mainContentEnd === false ? substr($htmlString, $mainContentStart) : substr($htmlString, $mainContentStart, $mainContentEnd - $mainContentStart);
     // let's define some pattern
     // $ytPattern will try to intercept
     // youtube trailer link
     // <param name="movie" value="http://www.youtube.com/v/VIDEOID?version=3">
     // match[1] = video id
     $ytPattern = '/<param name\\=\\"movie\\" value\\=\\"http\\:\\/\\/www\\.youtube\\.com\\/v\\/([^\\?\\"\\&]+)([^\\>]*)>/';
     $matches = array();
     // first let's search for youtube videos
     if (preg_match_all($ytPattern, $htmlString, $matches, PREG_SET_ORDER)) {
         foreach ($matches as $match) {
             $videoId = self::VIDEO_YOUTUBE . ':' . $match[1];
             $videoLabel = X_Env::_("p_filmstream_video_youtubetrailer");
             $item = new X_Page_Item_PItem("{$this->getId()}-youtube-{$videoId}", $videoLabel);
             $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$resourceType}/{$resourceGroup}/{$page}/{$resourceId}/{$videoId}")->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$resourceType}/{$resourceGroup}/{$page}/{$resourceId}/{$videoId}")), 'default', false);
             if (APPLICATION_ENV == 'development') {
                 $item->setDescription("{$resourceType}/{$resourceGroup}/{$page}/{$resourceId}/{$videoId}");
             }
             $items->append($item);
         }
     } else {
         X_Debug::e("Youtube pattern failure {{$ytPattern}}");
     }
     $matches = array();
     if (preg_match_all('/href\\=\\"(?P<LINK>[^\\"]+)"([^\\>]*)>(?P<LABEL>[^\\<]+)<\\/a>/', $htmlString, $matches, PREG_SET_ORDER)) {
         X_Debug::i(var_export($matches, true));
         foreach ($matches as $match) {
             try {
                 $link = $match['LINK'];
                 $hoster = $this->helpers()->hoster()->findHoster($link);
                 $videoLabel = trim(strip_tags($match['LABEL'])) . " [" . ucfirst($hoster->getId()) . "]";
                 $videoId = "{$hoster->getId()}:{$hoster->getResourceId($link)}";
                 $item = new X_Page_Item_PItem("{$this->getId()}-hoster-{$videoId}", $videoLabel);
                 $item->setIcon('/images/icons/file_32.png')->setType(X_Page_Item_PItem::TYPE_ELEMENT)->setCustom(__CLASS__ . ':location', "{$resourceType}/{$resourceGroup}/{$page}/{$resourceId}/{$videoId}")->setLink(array('action' => 'mode', 'l' => X_Env::encode("{$resourceType}/{$resourceGroup}/{$page}/{$resourceId}/{$videoId}")), 'default', false);
                 if (APPLICATION_ENV == 'development') {
                     $item->setDescription("{$resourceType}/{$resourceGroup}/{$page}/{$resourceId}/{$videoId}");
                 }
                 $items->append($item);
             } catch (Exception $e) {
                 // no hoster for the link, skipped
             }
         }
     } else {
         X_Debug::e("General pattern failure");
     }
 }
开发者ID:google-code-backups,项目名称:vlc-shares,代码行数:67,代码来源:FilmStream.php


注:本文中的X_Env::encode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。