From d070eaba6c9b2e5f2148d95f04e8b22c0dde6dd4 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 28 Dec 2008 01:07:23 -0500 Subject: [PATCH] Pass all parameters via the $options array. Figure out if we need to get a video url or not - and attach anyother parameters. --- .../lib/Horde/Service/Vimeo/Simple.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php index 129d4b5b7..b45a1d086 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php @@ -67,13 +67,29 @@ class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo { /** * Get the raw JSON response containing the data to embed a single video. * - * @param string $clipUrl The URL of the video to embed. + * @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. + * * * @return JSON encoded data */ - public function getEmbedJSON($clipUrl) + public function getEmbedJSON($options) { - $url = $this->_oembed_endpoint . '?url=' . rawurlencode($clipUrl); + 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, true); + $req = $this->getHttpClient(); $response = $req->request('GET', $url); $results = $response->getBody(); -- 2.11.0