Пример #1
0
 private function _addFieldsParam(tubepress_api_url_QueryInterface $query)
 {
     $fields = array('id', 'access_error', 'allow_embed', 'private', 'private_id', 'published', 'channel.name', 'created_time', 'description', 'duration', 'owner.id', 'owner.screenname', 'owner.url', 'tags', 'thumbnail_60_url', 'thumbnail_120_url', 'thumbnail_180_url', 'thumbnail_240_url', 'thumbnail_360_url', 'thumbnail_480_url', 'thumbnail_720_url', 'thumbnail_url', 'title', 'url', 'views_total');
     $implodedFields = implode(',', $fields);
     $query->set('fields', $implodedFields);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function freeze()
 {
     $this->_query->freeze();
     $this->_isFrozen = true;
 }
Пример #3
0
 private function _urlBuildingPageSearch(tubepress_api_url_UrlInterface $url, tubepress_api_url_QueryInterface $query, $requestedMode)
 {
     $url->addPath(tubepress_youtube3_impl_ApiUtility::PATH_SEARCH);
     switch ($requestedMode) {
         case tubepress_youtube3_api_Constants::GALLERYSOURCE_YOUTUBE_RELATED:
             $videoId = $this->_context->get(tubepress_youtube3_api_Constants::OPTION_YOUTUBE_RELATED_VALUE);
             $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_RELATED, $videoId);
             break;
         case tubepress_youtube3_api_Constants::GALLERYSOURCE_YOUTUBE_SEARCH:
             $tags = $this->_context->get(tubepress_youtube3_api_Constants::OPTION_YOUTUBE_TAG_VALUE);
             $tags = str_replace(array('&#8216', '&#8217', '′', '&#34', '“', '”', '″'), '"', $tags);
             $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_Q, $tags);
             break;
         default:
             break;
     }
     $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_TYPE, 'video')->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_SYNDICATED, 'true');
     if ($this->_context->get(tubepress_youtube3_api_Constants::OPTION_EMBEDDABLE_ONLY)) {
         $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_EMBEDDABLE, 'true');
     }
     $restrictToUser = $this->_context->get(tubepress_api_options_Names::SEARCH_ONLY_USER);
     if ($restrictToUser) {
         $userChannelId = $this->_urlBuildingConvertUserOrChannelToChannelId($restrictToUser);
         $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_CHANNEL_ID, $userChannelId);
     }
     switch ($this->_context->get(tubepress_youtube3_api_Constants::OPTION_FILTER)) {
         case tubepress_youtube3_api_Constants::SAFESEARCH_STRICT:
             $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_SAFESEARCH, 'strict');
             break;
         case tubepress_youtube3_api_Constants::SAFESEARCH_MODERATE:
             $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_SAFESEARCH, 'moderate');
             break;
         default:
             $query->set(tubepress_youtube3_impl_ApiUtility::QUERY_SEARCH_SAFESEARCH, 'none');
     }
     $this->_urlBuildingPageSearchOrderBy($url);
 }