From: Michael J. Rubinsky Date: Sun, 28 Dec 2008 22:45:53 +0000 (-0500) Subject: Put the getEmbedJSON method into the Request object as well X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2e8c12724d466170d8ccd1762b7ad30c97d69889;p=horde.git Put the getEmbedJSON method into the Request object as well --- diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php index 923f4341e..aa6783e09 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php @@ -76,25 +76,8 @@ class Horde_Service_Vimeo { */ 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; + $request = new Horde_Service_Vimeo_Request(); + return $request->embed($options); } /** diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php index 797039e9e..1d6460766 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php @@ -12,10 +12,6 @@ */ class Horde_Service_Vimeo_Simple extends Horde_Service_Vimeo { - protected $_api_endpoint = 'http://www.vimeo.com/api/'; - protected $_oembed_endpoint = 'http://www.vimeo.com/api/oembed.json'; - - public function getActivity($criteria) { } @@ -50,9 +46,12 @@ class Horde_Service_Vimeo_Request { protected $_identifier; protected $_method; - public function __construct($args) + public function __construct($args = array()) { - $this->_identifier = $args['type']; + if (count($args) && !empty($args['type'])) { + $this->_identifier = $args['type']; + + } } public function __call($name, $args) @@ -64,6 +63,30 @@ class Horde_Service_Vimeo_Request { } } + public function embed($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 = Horde_Service_Vimeo::getHttpClient(); + $response = $req->request('GET', $url); + $results = $response->getBody(); + + return $results; + } + + public function run() { $req = Horde_Service_Vimeo::getHttpClient();