From: Michael J. Rubinsky Date: Sun, 28 Dec 2008 06:30:43 +0000 (-0500) Subject: The oEmbed interface is the same for both the advanced and simple API. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=395130f1c6db12b1786a580d363fb6d9db67f875;p=horde.git The oEmbed interface is the same for both the advanced and simple API. Put it in the base class. --- diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php index 9f723a03b..3d7fd0cd9 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php @@ -51,7 +51,49 @@ class Horde_Service_Vimeo { return self::$_httpClient; } + /** + * Get the raw JSON response containing the data to embed a single video. + * + * @param mixed $optons Either an array containing api parameters or the + * video id. If an array, if the url is not passed, + * we find it from the video_id. + * Parameters: + * url OR video_id + * width + * maxwidth + * byline + * title + * portrait + * color + * callback + * + * @return JSON encoded data + */ + public function getEmbedJSON($options) + { + if (!is_array($options)) { + // Assume it's a video id, need to get the video url + // @TODO + } + + // $options should be an array now + if (empty($options['url']) && !empty($options['video_id'])) { + // We were originally passed an array, but still need the url + // @TODO + } + + // We should have a url now, and possibly other options. + $url = Util::addParameter($this->_oembed_endpoint, $options, null, false); + $req = $this->getHttpClient(); + $response = $req->request('GET', $url); + $results = $response->getBody(); + + return $results; + } + + /** + */ public function factory($driver = 'Simple') { $driver = basename($driver); diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php index c8d5ac87c..a61aa8a28 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php @@ -63,46 +63,4 @@ class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo { { } - - /** - * Get the raw JSON response containing the data to embed a single video. - * - * @param mixed $optons Either an array containing api parameters or the - * video id. If an array, if the url is not passed, - * we find it from the video_id. - * Parameters: - * url OR video_id - * width - * maxwidth - * byline - * title - * portrait - * color - * callback - * - * @return JSON encoded data - */ - public function getEmbedJSON($options) - { - if (!is_array($options)) { - // Assume it's a video id, need to get the video url - // @TODO - } - - // $options should be an array now - if (empty($options['url']) && !empty($options['video_id'])) { - // We were originally passed an array, but still need the url - // @TODO - } - - // We should have a url now, and possibly other options. - $url = Util::addParameter($this->_oembed_endpoint, $options, null, false); - - $req = $this->getHttpClient(); - $response = $req->request('GET', $url); - $results = $response->getBody(); - - return $results; - } - } \ No newline at end of file