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; }
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); /* 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)); return $link; }
protected function _canHandle($providerName, $videoId, org_tubepress_api_ioc_IocService $ioc, org_tubepress_api_exec_ExecutionContext $context) { return $providerName === org_tubepress_api_provider_Provider::YOUTUBE && $context->get(org_tubepress_api_const_options_names_Embedded::PLAYER_IMPL) === org_tubepress_api_const_options_values_PlayerImplementationValue::LONGTAIL; }
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 _verifyKeyAndSecretExists(org_tubepress_api_exec_ExecutionContext $execContext) { if ($execContext->get(org_tubepress_api_const_options_names_Feed::VIMEO_KEY) === '') { throw new Exception('Missing Vimeo API Consumer Key.'); } if ($execContext->get(org_tubepress_api_const_options_names_Feed::VIMEO_SECRET) === '') { throw new Exception('Missing Vimeo API Consumer Secret.'); } }
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); } }