예제 #1
0
 public function __callbackConvertToWpUrlString(tubepress_api_url_UrlInterface $url)
 {
     if ($url->isAbsolute()) {
         return $url->toString();
     }
     if (!isset($this->_urlCache)) {
         $this->_urlCache = new tubepress_internal_collection_Map();
         $this->_urlCache->put('url.base', rtrim($this->_environment->getBaseUrl()->toString(), '/'));
         $this->_urlCache->put('url.user', rtrim($this->_environment->getUserContentUrl()->toString(), '/'));
         $this->_urlCache->put('basename', basename(TUBEPRESS_ROOT));
     }
     $urlAsString = $url->toString();
     $tubePressBaseUrl = $this->_urlCache->get('url.base');
     $userContentUrl = $this->_urlCache->get('url.user');
     $baseName = $this->_urlCache->get('basename');
     $isSystem = false;
     if ($this->_stringUtils->startsWith($urlAsString, "{$tubePressBaseUrl}/web/")) {
         $isSystem = true;
     } else {
         if (!$this->_stringUtils->startsWith($urlAsString, "{$userContentUrl}/")) {
             //this should never happen
             return $urlAsString;
         }
     }
     if ($isSystem) {
         $path = str_replace($tubePressBaseUrl, '', $urlAsString);
         return $this->_wpFunctions->plugins_url($path, "{$baseName}/tubepress.php");
     }
     $path = str_replace($userContentUrl, '', $urlAsString);
     return $this->_wpFunctions->content_url('tubepress-content' . $path);
 }
 /**
  * {@inheritdoc}
  */
 public function getAttributesForInvocationAnchor(tubepress_api_media_MediaItem $mediaItem)
 {
     $id = $mediaItem->getId();
     $this->_url->getQuery()->set('tubepress_item', $id);
     return array('rel' => 'nofollow', 'href' => $this->_url->toString());
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function getTranslatedClientRegistrationInstructions(tubepress_api_translation_TranslatorInterface $translator, tubepress_api_url_UrlInterface $redirectUrl)
 {
     $step1 = $translator->trans('<a href="%client-registration-url%" target="_blank">Click here</a> to create a new Vimeo &quot;App&quot;.', array('%client-registration-url%' => 'https://developer.vimeo.com/apps/new'));
     $step1Subs = array($translator->trans('Use anything you\'d like for the App Name, App Description, and App URL.'), $translator->trans('In the field for &quot;App Callback URLs&quot;, enter:<br /><code>%redirect-uri%</code>', array('%redirect-uri%' => $redirectUrl->toString())));
     $step2 = $translator->trans('Under the &quot;OAuth2&quot; tab of your new Vimeo App, you will find your &quot;Client Identifier&quot; and &quot;Client Secret&quot;. Enter those values into the text boxes below.');
     //>(translatable)<
     $step3 = $translator->trans('Click the &quot;New token&quot; button below to authorize TubePress to communicate with Vimeo on your behalf. This step will take place in a popup window.');
     //>(translatable)<
     return array($step1, $step1Subs, $step2, $step3);
 }