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()); }
/** * {@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 "App".', 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 "App Callback URLs", enter:<br /><code>%redirect-uri%</code>', array('%redirect-uri%' => $redirectUrl->toString()))); $step2 = $translator->trans('Under the "OAuth2" tab of your new Vimeo App, you will find your "Client Identifier" and "Client Secret". Enter those values into the text boxes below.'); //>(translatable)< $step3 = $translator->trans('Click the "New token" 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); }