public function alter_playerTemplate(org_tubepress_api_template_Template $template, org_tubepress_api_video_Video $video, $videoProviderName, $playerName)
 {
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $embedded = $ioc->get('org_tubepress_api_embedded_EmbeddedHtmlGenerator');
     $context = $ioc->get('org_tubepress_api_exec_ExecutionContext');
     $galleryId = $context->get(org_tubepress_api_const_options_names_Advanced::GALLERY_ID);
     $template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_SOURCE, $embedded->getHtml($video->getId()));
     $template->setVariable(org_tubepress_api_const_template_Variable::GALLERY_ID, $galleryId);
     $template->setVariable(org_tubepress_api_const_template_Variable::VIDEO, $video);
     $template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_WIDTH, $context->get(org_tubepress_api_const_options_names_Embedded::EMBEDDED_WIDTH));
     return $template;
 }
Пример #2
0
 public function alter_singleVideoTemplate(org_tubepress_api_template_Template $template, org_tubepress_api_video_Video $video, $providerName)
 {
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $context = $ioc->get(org_tubepress_api_exec_ExecutionContext::_);
     $embedded = $ioc->get(org_tubepress_api_embedded_EmbeddedHtmlGenerator::_);
     $embeddedString = $embedded->getHtml($video->getId());
     $width = $context->get(org_tubepress_api_const_options_names_Embedded::EMBEDDED_WIDTH);
     /* apply it to the template */
     $template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_SOURCE, $embeddedString);
     $template->setVariable(org_tubepress_api_const_template_Variable::EMBEDDED_WIDTH, $width);
     $template->setVariable(org_tubepress_api_const_template_Variable::VIDEO, $video);
     return $template;
 }
 public function getHtml(org_tubepress_api_video_Video $vid)
 {
     $ioc = org_tubepress_impl_ioc_IocContainer::getInstance();
     $context = $ioc->get(org_tubepress_api_exec_ExecutionContext::_);
     $pm = $ioc->get(org_tubepress_api_plugin_PluginManager::_);
     $themeHandler = $ioc->get(org_tubepress_api_theme_ThemeHandler::_);
     $pc = $ioc->get(org_tubepress_api_provider_ProviderCalculator::_);
     $playerName = $context->get(org_tubepress_api_const_options_names_Embedded::PLAYER_LOCATION);
     $template = $themeHandler->getTemplateInstance("players/{$playerName}.tpl.php");
     $providerName = $pc->calculateProviderOfVideoId($vid->getId());
     $template = $pm->runFilters(org_tubepress_api_const_plugin_FilterPoint::TEMPLATE_PLAYER, $template, $vid, $providerName, $playerName);
     $html = $pm->runFilters(org_tubepress_api_const_plugin_FilterPoint::HTML_PLAYER, $template->toString(), $vid, $providerName, $playerName);
     $html = $pm->runFilters(org_tubepress_api_const_plugin_FilterPoint::HTML_ANY, $html);
     return $html;
 }
Пример #4
0
 private function _buildVideos()
 {
     $v1 = new org_tubepress_api_video_Video();
     $v1->xxx = 1;
     $v1->setCommentCount(100);
     $v1->durationInSeconds = 10;
     $v1->timePublishedInUnixTime = 4000;
     $v1->setRatingAverage('1.5');
     $v1->setTitle('one');
     $v1->setViewCount(500);
     $v2 = new org_tubepress_api_video_Video();
     $v2->xxx = 2;
     $v2->setCommentCount(200);
     $v2->durationInSeconds = 30;
     $v2->timePublishedInUnixTime = 3000;
     $v2->setRatingAverage('3.5');
     $v2->setTitle('two');
     $v2->setViewCount(600);
     $v3 = new org_tubepress_api_video_Video();
     $v3->xxx = 3;
     $v3->setCommentCount(300);
     $v3->durationInSeconds = 20;
     $v3->timePublishedInUnixTime = 2000;
     $v3->setRatingAverage('2.5');
     $v3->setTitle('three');
     $v3->setViewCount(700);
     $this->_videos = array($v1, $v2, $v3);
     shuffle($this->_videos);
 }
 private function _buildVideo($index)
 {
     /* collect the pieces of the video */
     $authorDisplayName = $this->_getAuthorDisplayName($index);
     $authorUid = $this->_getAuthorUid($index);
     $category = $this->_getCategory($index);
     $commentCount = self::_fancyNumber($this->_getRawCommentCount($index));
     $description = $this->_trimDescription($this->_getDescription($index));
     $duration = org_tubepress_impl_util_TimeUtils::secondsToHumanTime($this->_getDurationInSeconds($index));
     $homeUrl = $this->_getHomeUrl($index);
     $id = $this->_getId($index);
     $keywordsArray = $this->_getKeywordsArray($index);
     $likesCount = self::_fancyNumber($this->_getRawLikeCount($index));
     $ratingAverage = $this->_getRatingAverage($index);
     $ratingCount = self::_fancyNumber($this->_getRawRatingCount($index));
     $thumbUrl = $this->_pickThumbnailUrl($this->_getThumbnailUrlsArray($index));
     $timeLastUpdated = $this->_fancyTime($this->_getTimeLastUpdatedInUnixTime($index));
     $timePublished = $this->_fancyTime($this->_getTimePublishedInUnixTime($index));
     $title = $this->_getTitle($index);
     $viewCount = self::_fancyNumber($this->_getRawViewCount($index));
     /* now build a video out of them */
     $vid = new org_tubepress_api_video_Video();
     $vid->setAuthorDisplayName($authorDisplayName);
     $vid->setAuthorUid($authorUid);
     $vid->setCategory($category);
     $vid->setCommentCount($commentCount);
     $vid->setDescription($description);
     $vid->setDuration($duration);
     $vid->setHomeUrl($homeUrl);
     $vid->setId($id);
     $vid->setKeywords($keywordsArray);
     $vid->setLikesCount($likesCount);
     $vid->setRatingAverage($ratingAverage);
     $vid->setRatingCount($ratingCount);
     $vid->setThumbnailUrl($thumbUrl);
     $vid->setTimeLastUpdated($timeLastUpdated);
     $vid->setTimePublished($timePublished);
     $vid->setTitle($title);
     $vid->setViewCount($viewCount);
     return $vid;
 }