本文整理汇总了PHP中Zend_Gdata_YouTube::getPlaylistVideoFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube::getPlaylistVideoFeed方法的具体用法?PHP Zend_Gdata_YouTube::getPlaylistVideoFeed怎么用?PHP Zend_Gdata_YouTube::getPlaylistVideoFeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_YouTube
的用法示例。
在下文中一共展示了Zend_Gdata_YouTube::getPlaylistVideoFeed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: module_last_youtube_playlist_videos
/**
* @param $mod_reference
* @param $module_params
*/
function module_last_youtube_playlist_videos($mod_reference, $module_params)
{
global $smarty, $prefs;
$tikilib = TikiLib::lib('tiki');
$data = array();
if (!empty($module_params['id'])) {
$id = $module_params['id'];
require_once 'lib/wiki-plugins/wikiplugin_youtube.php';
if (!empty($module_params['orderby'])) {
$orderby = $module_params['orderby'];
$feedUrl = 'http://gdata.youtube.com/feeds/api/playlists/' . $id . '?orderby=' . $orderby;
} else {
$feedUrl = 'http://gdata.youtube.com/feeds/api/playlists/' . $id . '?orderby=position';
}
$yt = new Zend_Gdata_YouTube();
$yt->setMajorProtocolVersion(2);
$yt->setHttpClient($tikilib->get_http_client());
try {
$playlistVideoFeed = $yt->getPlaylistVideoFeed($feedUrl);
$data[$id]['info']['title'] = $playlistVideoFeed->title->text;
// Prepare params for video display
$params = array();
$params['width'] = isset($module_params['width']) ? $module_params['width'] : 425;
$params['height'] = isset($module_params['height']) ? $module_params['height'] : 350;
// Get information from all videos from playlist
// Limit to $module_rows first videos if $module_rows is set
$count_videos = 1;
foreach ($playlistVideoFeed as $videoEntry) {
$videoId = $videoEntry->getVideoId();
$data[$id]['videos'][$videoId]['title'] = $videoEntry->getVideoTitle();
$data[$id]['videos'][$videoId]['uploaded'] = $videoEntry->mediaGroup->uploaded->text;
$data[$id]['videos'][$videoId]['description'] = $videoEntry->getVideoDescription();
$params['movie'] = $videoId;
$pluginstr = wikiplugin_youtube('', $params);
$len = strlen($pluginstr);
//need to take off the ~np~ and ~/np~ at the beginning and end of the string returned by wikiplugin_youtube
$data[$id]['videos'][$videoId]['xhtml'] = substr($pluginstr, 4, $len - 4 - 5);
if (isset($module_rows) && $module_rows > 0 && $count_videos >= $module_rows) {
break;
}
$count_videos++;
}
} catch (Exception $e) {
$data[$id]['info']['title'] = tra('No Playlist found');
$data[$id]['videos'][0]['title'] = $e->getMessage();
}
} else {
$id = 0;
$data[$id]['info']['title'] = tra('No Playlist found');
$data[$id]['videos'][0]['title'] = tra('No Playlist ID was provided');
}
$smarty->assign('verbose', isset($module_params['verbose']) ? $module_params['verbose'] : 'y');
$smarty->assign('link_url', isset($module_params['link_url']) ? $module_params['link_url'] : '');
$smarty->assign('link_text', isset($module_params['link_text']) ? $module_params['link_text'] : 'More Videos');
$smarty->assign_by_ref('data', $data[$id]);
}
示例2: getVideosByPlaylist
public function getVideosByPlaylist($playlistId, $page = 0)
{
/* @var $ytq Zend_Gdata_YouTube_VideoQuery */
$ytq = $this->yt->newVideoQuery("http://gdata.youtube.com/feeds/api/playlists/" . $playlistId);
$page = $page * self::ITEMS_PER_PAGE;
$ytq->setStartIndex($page == 0 ? $page : $page + 1);
$ytq->setMaxResults(self::ITEMS_PER_PAGE);
$ytq->setOrderBy('position');
return $this->yt->getPlaylistVideoFeed($ytq);
}
示例3: list_containers
/**
*
* @param string $object
* @param int $offset_start
* @param int $quantity
* @return Bridge_Api_ContainerCollection
*/
public function list_containers($object, $offset_start = 0, $quantity = 10)
{
switch ($object) {
case self::CONTAINER_TYPE_PLAYLIST:
$playlist_feed = $this->get_user_object_list_feed($object, $offset_start, $quantity);
$container_collection = new Bridge_Api_ContainerCollection();
$container_collection->set_items_per_page($playlist_feed->getItemsPerPage()->getText());
$total = $playlist_feed->getTotalResults()->getText();
$current_page = floor((int) $playlist_feed->getStartIndex()->getText() / (int) $playlist_feed->getItemsPerPage()->getText());
$total_page = ceil((int) $total / (int) $playlist_feed->getItemsPerPage()->getText());
$container_collection->set_total_items($total);
$container_collection->set_current_page($current_page);
$container_collection->set_total_page($total_page);
foreach ($playlist_feed as $entry) {
$playlist_video_feed = $this->_api->getPlaylistVideoFeed($entry->getPlaylistVideoFeedUrl());
$thumbnail = null;
if (!is_null($playlist_video_feed)) {
foreach ($playlist_video_feed as $entry2) {
$playlist_thumbnails = $entry2->getVideoThumbnails();
foreach ($playlist_thumbnails as $playlist_thumbnail) {
if (120 == $playlist_thumbnail['width'] && 90 == $playlist_thumbnail['height']) {
$thumbnail = $playlist_thumbnail['url'];
break;
}
}
break;
}
}
$container_collection->add_element(new Bridge_Api_Youtube_Container($entry, $object, $thumbnail));
}
return $container_collection;
break;
default:
throw new Bridge_Exception_ElementUnknown('Unknown element ' . $object);
break;
}
}