From 40946b11b2ecd9efe2b2863d1b928eeff51b9550 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Fri, 26 Dec 2008 20:42:51 -0500 Subject: [PATCH] H_S_Vimeo_Simple will extend H_S_Vimeo - and use Horde_Http_Client instead of the PEAR HTTP_Request class - not fully finished yet. --- .../Service_Vimeo/lib/Horde/Service/Vimeo.php | 69 ++++++++++++++++++++++ .../lib/Horde/Service/Vimeo/Simple.php | 14 +---- 2 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 framework/Service_Vimeo/lib/Horde/Service/Vimeo.php diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php new file mode 100644 index 000000000..1801f5df2 --- /dev/null +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo.php @@ -0,0 +1,69 @@ + + */ +class Service_Vimeo { + + protected $_format = 'php'; + + /** + * HTTP client object to use for accessing the Vimeo API. + * @var Horde_Http_Client + */ + protected static $_httpClient = null; + + /** + * Set the HTTP client instance + * + * Sets the HTTP client object to use for Vimeo requests. If none is set, + * the default Horde_Http_Client will be used. + * + * @param Horde_Http_Client $httpClient + */ + public static function setHttpClient($httpClient) + { + self::$_httpClient = $httpClient; + } + + /** + * Gets the HTTP client object. + * + * @return Horde_Http_Client + */ + public static function getHttpClient() + { + if (!self::$_httpClient) { + self::$_httpClient = new Horde_Http_Client; + } + + return self::$_httpClient; + } + + + public function factory($driver = 'Simple') + { + $driver = basename($driver); + + include_once dirname(__FILE__) . '/Vimeo/' . $driver . '.php'; + $class = 'Horde_Services_Vimeo_' . $driver; + if (class_exists($class)) { + return new $class($params); + } else { + // @TODO: Exceptions!!! + Horde::fatal(PEAR::raiseError(sprintf(_("Unable to load the definition of %s."), $class)), __FILE__, __LINE__); + } + } + +} \ No newline at end of file diff --git a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php index 285684528..b4cce91ff 100644 --- a/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php +++ b/framework/Service_Vimeo/lib/Horde/Service/Vimeo/Simple.php @@ -1,8 +1,4 @@ */ -class Service_VimeoSimple { +class Service_Vimeo_Simple extends Service_Vimeo { protected $_api_endpoint = 'http://www.vimeo.com/api/'; protected $_oembed_endpoint = 'http://www.vimeo.com/api/oembed.json'; - protected $_format = 'php'; - - - public function setReturnFormat($format) - { - // TODO: Validate (json, php, xml) - $this->_format = $format; - } /** * Return an array of clips data based on the search criteria. -- 2.11.0