From: Michael J. Rubinsky Date: Sat, 27 Dec 2008 01:42:51 +0000 (-0500) Subject: H_S_Vimeo_Simple will extend H_S_Vimeo - and use Horde_Http_Client X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=40946b11b2ecd9efe2b2863d1b928eeff51b9550;p=horde.git 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. --- 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.