/**
  * @param string $videoId The video ID to play.
  *
  * @return ehough_curly_Url The URL of the data for this video.
  */
 public final function getDataUrlForVideo($videoId)
 {
     $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext();
     $link = new ehough_curly_Url('https://www.youtube.com/embed/' . $videoId);
     $qss = tubepress_impl_patterns_sl_ServiceLocator::getQueryStringService();
     $url = new ehough_curly_Url($qss->getFullUrl($_SERVER));
     $origin = $url->getScheme() . '://' . $url->getHost();
     $autoPlay = $context->get(tubepress_api_const_options_names_Embedded::AUTOPLAY);
     $loop = $context->get(tubepress_api_const_options_names_Embedded::LOOP);
     $showInfo = $context->get(tubepress_api_const_options_names_Embedded::SHOW_INFO);
     $autoHide = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::AUTOHIDE);
     $enableJsApi = $context->get(tubepress_api_const_options_names_Embedded::ENABLE_JS_API);
     $fullscreen = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::FULLSCREEN);
     $modestBranding = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::MODEST_BRANDING);
     $showRelated = $context->get(tubepress_addons_youtube_api_const_options_names_Embedded::SHOW_RELATED);
     $link->setQueryVariable('wmode', 'opaque');
     $link->setQueryVariable('autohide', $this->_getAutoHideValue($autoHide));
     $link->setQueryVariable('autoplay', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($autoPlay));
     $link->setQueryVariable('enablejsapi', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($enableJsApi));
     $link->setQueryVariable('fs', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($fullscreen));
     $link->setQueryVariable('loop', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($loop));
     $link->setQueryVariable('modestbranding', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($modestBranding));
     $link->setQueryVariable('rel', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showRelated));
     $link->setQueryVariable('showinfo', tubepress_impl_embedded_EmbeddedPlayerUtils::booleanToOneOrZero($showInfo));
     $link->setQueryVariable('origin', $origin);
     return $link;
 }
 /**
  * Get the HTML for pagination.
  *
  * @param int $vidCount The total number of results in this gallery
  *
  * @return string The HTML for the pagination.
  */
 private function _getHtml($vidCount)
 {
     $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext();
     $messageService = tubepress_impl_patterns_sl_ServiceLocator::getMessageService();
     $qss = tubepress_impl_patterns_sl_ServiceLocator::getQueryStringService();
     $hrps = tubepress_impl_patterns_sl_ServiceLocator::getHttpRequestParameterService();
     $currentPage = $hrps->getParamValueAsInt(tubepress_spi_const_http_ParamName::PAGE, 1);
     $vidsPerPage = $context->get(tubepress_api_const_options_names_Thumbs::RESULTS_PER_PAGE);
     $newurl = new ehough_curly_Url($qss->getFullUrl($_SERVER));
     $newurl->unsetQueryVariable('tubepress_page');
     $result = $this->_diggStyle($vidCount, $messageService, $currentPage, $vidsPerPage, 1, $newurl->toString(), 'tubepress_page');
     return $result;
 }
 public function onSearchInputTemplate(tubepress_api_event_EventInterface $event)
 {
     $template = $event->getSubject();
     $context = tubepress_impl_patterns_sl_ServiceLocator::getExecutionContext();
     $qss = tubepress_impl_patterns_sl_ServiceLocator::getQueryStringService();
     $hrps = tubepress_impl_patterns_sl_ServiceLocator::getHttpRequestParameterService();
     $ms = tubepress_impl_patterns_sl_ServiceLocator::getMessageService();
     $resultsUrl = $context->get(tubepress_api_const_options_names_InteractiveSearch::SEARCH_RESULTS_URL);
     $url = '';
     try {
         $url = new ehough_curly_Url($resultsUrl);
     } catch (Exception $e) {
         //this is not a real problem, as the user might simply not supply a custom URL
     }
     /* if the user didn't request a certain page, just send the search results right back here */
     if ($url == '') {
         $url = new ehough_curly_Url($qss->getFullUrl($_SERVER));
     }
     /* clean up the search terms a bit */
     $searchTerms = $hrps->getParamValue(tubepress_spi_const_http_ParamName::SEARCH_TERMS);
     $searchTerms = urldecode($searchTerms);
     //TODO: get rid of this once we move to POST?
     /*
      * read http://stackoverflow.com/questions/1116019/submitting-a-get-form-with-query-string-params-and-hidden-params-disappear
      * if you're curious as to what's going on here
      */
     $params = $url->getQueryVariables();
     unset($params[tubepress_spi_const_http_ParamName::PAGE]);
     unset($params[tubepress_spi_const_http_ParamName::SEARCH_TERMS]);
     /* apply the template variables */
     $template->setVariable(tubepress_api_const_template_Variable::SEARCH_HANDLER_URL, $url->toString());
     $template->setVariable(tubepress_api_const_template_Variable::SEARCH_HIDDEN_INPUTS, $params);
     $template->setVariable(tubepress_api_const_template_Variable::SEARCH_TERMS, $searchTerms);
     $template->setVariable(tubepress_api_const_template_Variable::SEARCH_BUTTON, $ms->_('Search'));
     //>(translatable)<
 }