Pass all parameters via the $options array. Figure out if we need to get a
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 28 Dec 2008 06:07:23 +0000 (01:07 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 28 Dec 2008 06:07:23 +0000 (01:07 -0500)
video url or not - and attach anyother parameters.

framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php

index 129d4b5..b45a1d0 100644 (file)
@@ -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();