protected function _getEmbeddedDataUrl($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_exec_ExecutionContext $context)
 {
     $link = new org_tubepress_api_url_Url('http://www.youtube.com/embed/' . $videoId);
     $showRelated = $context->get(org_tubepress_api_const_options_names_Embedded::SHOW_RELATED);
     $autoPlay = $context->get(org_tubepress_api_const_options_names_Embedded::AUTOPLAY);
     $loop = $context->get(org_tubepress_api_const_options_names_Embedded::LOOP);
     $fullscreen = $context->get(org_tubepress_api_const_options_names_Embedded::FULLSCREEN);
     $playerColor = org_tubepress_impl_embedded_EmbeddedPlayerUtils::getSafeColorValue($context->get(org_tubepress_api_const_options_names_Embedded::PLAYER_COLOR), '999999');
     $playerHighlight = org_tubepress_impl_embedded_EmbeddedPlayerUtils::getSafeColorValue($context->get(org_tubepress_api_const_options_names_Embedded::PLAYER_HIGHLIGHT), 'FFFFFF');
     $showInfo = $context->get(org_tubepress_api_const_options_names_Embedded::SHOW_INFO);
     if (!($playerColor == '999999' && $playerHighlight == 'FFFFFF')) {
         $link->setQueryVariable('color2', '0x' . $playerColor);
         $link->setQueryVariable('color1', '0x' . $playerHighlight);
     }
     $link->setQueryVariable('rel', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showRelated));
     $link->setQueryVariable('autoplay', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($autoPlay));
     $link->setQueryVariable('loop', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($loop));
     $link->setQueryVariable('fs', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($fullscreen));
     $link->setQueryVariable('showinfo', org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     $link->setQueryVariable('wmode', 'transparent');
     if ($context->get(org_tubepress_api_const_options_names_Embedded::HIGH_QUALITY)) {
         $link->setQueryVariable('hd', '1');
     }
     return $link;
 }
예제 #2
0
 protected function _getEmbeddedDataUrl($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_exec_ExecutionContext $context)
 {
     $autoPlay = $context->get(org_tubepress_api_const_options_names_Embedded::AUTOPLAY);
     $color = $context->get(org_tubepress_api_const_options_names_Embedded::PLAYER_COLOR);
     $showInfo = $context->get(org_tubepress_api_const_options_names_Embedded::SHOW_INFO);
     $loop = $context->get(org_tubepress_api_const_options_names_Embedded::LOOP);
     $jsApi = $context->get(org_tubepress_api_const_options_names_Embedded::ENABLE_JS_API);
     /* build the data URL based on these options */
     $link = new org_tubepress_api_url_Url(self::VIMEO_EMBEDDED_PLAYER_URL . "video/{$videoId}");
     $link->setQueryVariable(self::VIMEO_QUERYPARAM_AUTOPLAY, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($autoPlay));
     $link->setQueryVariable(self::VIMEO_QUERYPARAM_COLOR, $color);
     $link->setQueryVariable(self::VIMEO_QUERYPARAM_LOOP, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($loop));
     $link->setQueryVariable(self::VIMEO_QUERYPARAM_TITLE, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     $link->setQueryVariable(self::VIMEO_QUERYPARAM_BYLINE, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     $link->setQueryVariable(self::VIMEO_QUERYPARAM_PORTRAIT, org_tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     if ($jsApi) {
         $link->setQueryVariable(self::$_paramJsApi, 1);
         $link->setQueryVariable(self::$_paramPlayerId, "tubepress-vimeo-player-{$videoId}");
     }
     return $link;
 }
예제 #3
0
 /**
  * Does the heavy lifting of generating pagination.
  *
  * @param int    $totalitems The total items in this gallery.
  * @param int    $page       The current page number.
  * @param int    $limit      How many videos per page.
  * @param int    $adjacents  How many adjacents.
  * @param string $targetpage The target page
  * @param string $pagestring The query parameter controlling the page number.
  *
  * @return The HTML for the pagination
  */
 private function _diggStyle($totalitems, org_tubepress_api_message_MessageService $messageService, $page = 1, $limit = 15, $adjacents = 1, $targetpage = '/', $pagestring = '?page=')
 {
     $prev = $page - 1;
     $next = $page + 1;
     $lastpage = ceil($totalitems / $limit);
     $lpm1 = $lastpage - 1;
     $pagination = '';
     $url = new org_tubepress_api_url_Url($targetpage);
     if ($lastpage > 1) {
         $pagination .= '<div class="pagination">';
         if ($page > 1) {
             $url->setQueryVariable($pagestring, $prev);
             $newurl = $url->toString();
             $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">&laquo; " . $messageService->_("prev") . '</a>';
         }
         if ($lastpage < 7 + $adjacents * 2) {
             for ($counter = 1; $counter <= $lastpage; $counter++) {
                 if ($counter == $page) {
                     $pagination .= "<span class=\"current\">{$counter}</span>";
                 } else {
                     $url->setQueryVariable($pagestring, $counter);
                     $newurl = $url->toString();
                     $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">{$counter}</a>";
                 }
             }
         } elseif ($lastpage >= 7 + $adjacents * 2) {
             if ($page < 1 + $adjacents * 3) {
                 for ($counter = 1; $counter < 4 + $adjacents * 2; $counter++) {
                     if ($counter == $page) {
                         $pagination .= "<span class=\"current\">{$counter}</span>";
                     } else {
                         $url->setQueryVariable($pagestring, $counter);
                         $newurl = $url->toString();
                         $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">{$counter}</a>";
                     }
                 }
                 $pagination .= self::DOTS;
                 $url->setQueryVariable($pagestring, $lpm1);
                 $newurl = $url->toString();
                 $pagination .= " <a rel=\"nofollow\" href=\"{$newurl}\">{$lpm1}</a>";
                 $url->setQueryVariable($pagestring, $lastpage);
                 $newurl = $url->toString();
                 $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">{$lastpage}</a>";
             } elseif ($lastpage - $adjacents * 2 > $page && $page > $adjacents * 2) {
                 $url->setQueryVariable($pagestring, 1);
                 $newurl = $url->toString();
                 $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">1</a>";
                 $url->setQueryVariable($pagestring, 2);
                 $newurl = $url->toString();
                 $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">2</a>";
                 $pagination .= self::DOTS;
                 for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) {
                     if ($counter == $page) {
                         $pagination .= "<span class=\"current\">{$counter}</span>";
                     } else {
                         $url->setQueryVariable($pagestring, $counter);
                         $newurl = $url->toString();
                         $pagination .= " <a rel=\"nofollow\" href=\"{$newurl}\">{$counter}</a>";
                     }
                 }
                 $pagination .= self::DOTS;
                 $url->setQueryVariable($pagestring, $lpm1);
                 $newurl = $url->toString();
                 $pagination .= " <a rel=\"nofollow\" href=\"{$newurl}\">{$lpm1}</a>";
                 $url->setQueryVariable($pagestring, $lastpage);
                 $newurl = $url->toString();
                 $pagination .= " <a rel=\"nofollow\" href=\"{$newurl}\">{$lastpage}</a>";
             } else {
                 $url->setQueryVariable($pagestring, 1);
                 $newurl = $url->toString();
                 $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">1</a>";
                 $url->setQueryVariable($pagestring, 2);
                 $newurl = $url->toString();
                 $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">2</a>";
                 $pagination .= self::DOTS;
                 for ($counter = $lastpage - (1 + $adjacents * 3); $counter <= $lastpage; $counter++) {
                     if ($counter == $page) {
                         $pagination .= "<span class=\"current\">{$counter}</span>";
                     } else {
                         $url->setQueryVariable($pagestring, $counter);
                         $newurl = $url->toString();
                         $pagination .= " <a rel=\"nofollow\" href=\"{$newurl}\">{$counter}</a>";
                     }
                 }
             }
         }
         if ($page < $counter - 1) {
             $url->setQueryVariable($pagestring, $next);
             $newurl = $url->toString();
             $pagination .= "<a rel=\"nofollow\" href=\"{$newurl}\">" . $messageService->_('next') . ' &raquo;</a>';
         } else {
             $pagination .= '<span class="disabled">' . $messageService->_('next') . ' &raquo;</span>';
         }
         $pagination .= "</div>\n";
     }
     return $pagination;
 }
 private function _setOrderBy(org_tubepress_api_exec_ExecutionContext $execContext, org_tubepress_api_url_Url $url)
 {
     $order = $execContext->get(org_tubepress_api_const_options_names_Feed::ORDER_BY);
     $mode = $execContext->get(org_tubepress_api_const_options_names_Output::GALLERY_SOURCE);
     if ($order == org_tubepress_api_const_options_values_OrderByValue::RANDOM) {
         return;
     }
     /* any feed can take these */
     if ($order == org_tubepress_api_const_options_values_OrderByValue::VIEW_COUNT) {
         $url->setQueryVariable(self::PARAM_ORDER, $order);
         return;
     }
     if ($order == org_tubepress_api_const_options_values_OrderByValue::NEWEST) {
         $url->setQueryVariable(self::PARAM_ORDER, 'published');
         return;
     }
     /* playlist specific stuff */
     if ($mode == org_tubepress_api_const_options_values_GallerySourceValue::YOUTUBE_PLAYLIST) {
         if (in_array($order, array(org_tubepress_api_const_options_values_OrderByValue::POSITION, org_tubepress_api_const_options_values_OrderByValue::COMMENT_COUNT, org_tubepress_api_const_options_values_OrderByValue::DURATION, org_tubepress_api_const_options_values_OrderByValue::TITLE))) {
             $url->setQueryVariable(self::PARAM_ORDER, $order);
         }
         return;
     }
     if (in_array($order, array(org_tubepress_api_const_options_values_OrderByValue::RELEVANCE, org_tubepress_api_const_options_values_OrderByValue::RATING))) {
         $url->setQueryVariable(self::PARAM_ORDER, $order);
     }
 }
 private function _setOrderBy(org_tubepress_api_exec_ExecutionContext $execContext, org_tubepress_api_url_Url $url)
 {
     $order = $execContext->get(org_tubepress_api_const_options_names_Display::ORDER_BY);
     $mode = $execContext->get(org_tubepress_api_const_options_names_Output::MODE);
     if ($order == org_tubepress_api_const_options_values_OrderValue::RANDOM) {
         return;
     }
     /* any feed can take these */
     if ($order == org_tubepress_api_const_options_values_OrderValue::VIEW_COUNT || $order == org_tubepress_api_const_options_values_OrderValue::DATE_PUBLISHED) {
         $url->setQueryVariable(self::PARAM_ORDER, $order);
         return;
     }
     /* playlist specific stuff */
     if ($mode == org_tubepress_api_const_options_values_ModeValue::PLAYLIST) {
         if (in_array($order, array(org_tubepress_api_const_options_values_OrderValue::POSITION, org_tubepress_api_const_options_values_OrderValue::COMMENT_COUNT, org_tubepress_api_const_options_values_OrderValue::DURATION, org_tubepress_api_const_options_values_OrderValue::TITLE))) {
             $url->setQueryVariable(self::PARAM_ORDER, $order);
         }
         return;
     }
     if (in_array($order, array(org_tubepress_api_const_options_values_OrderValue::RELEVANCE, org_tubepress_api_const_options_values_OrderValue::RATING))) {
         $url->setQueryVariable(self::PARAM_ORDER, $order);
     }
 }