package.xml0000664000175000017500000001247412453736214011316 0ustar janjan Horde_Service_UrlShortener pear.horde.org Horde_Service_UrlShortener Class Interfaces to various URL shortening services. Michael J Rubinsky mrubinsk mrubinsk@horde.org yes 2015-01-09 2.0.2 1.0.0 stable stable LGPL-2.1 * [jan] Add Composer definition. 5.3.0 6.0.0alpha1 6.0.0alpha1 1.7.0 Horde_Exception pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Url pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 Horde_Http pear.horde.org 2.0.0 3.0.0alpha1 3.0.0alpha1 1.0.0alpha1 1.0.0alpha1 alpha alpha 2011-10-11 LGPL-2.1 * First alpha release. 1.0.0RC1 1.0.0RC1 beta beta 2011-10-19 LGPL-2.1 * [jan] Fix dependency. 1.0.0 1.0.0 stable stable 2011-11-02 LGPL-2.1 * First stable release. 2.0.0alpha1 1.0.0 alpha stable 2012-07-05 LGPL-2.1 * First alpha release for Horde 5. 2.0.0beta1 1.0.0 beta stable 2012-07-19 LGPL-2.1 * First beta release for Horde 5. 2.0.0 1.0.0 stable stable 2012-10-30 LGPL-2.1 * First stable release for Horde 5. 2.0.1 1.0.0 stable stable 2012-11-22 LGPL-2.1 * [jan] Re-packaged 2.0.0 release. 2.0.2 1.0.0 stable stable 2015-01-09 LGPL-2.1 * [jan] Add Composer definition. Horde_Service_UrlShortener-2.0.2/lib/Horde/Service/UrlShortener/Base.php0000664000175000017500000000225112453736214024311 0ustar janjan * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @category Horde * @package Service_UrlShortener */ /** * Horde_Service_UrlShortener Base class * * @author Michael J Rubinsky * @category Horde * @package Service_UrlShortener */ abstract class Horde_Service_UrlShortener_Base { /** * @var array */ protected $_params; /** * @var Horde_Http_Client */ protected $_http; /** * Constructor * * @param Horde_Http_Client $http [description] * @param array $params = array() [description] * * @return Horde_UrlShorten */ public function __construct(Horde_Http_Client $http, $params = array()) { $this->_http = $http; $this->_params = $params; } abstract public function shorten($url); }Horde_Service_UrlShortener-2.0.2/lib/Horde/Service/UrlShortener/Exception.php0000664000175000017500000000102512453736214025373 0ustar janjan * @category Horde * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @package Service_UrlShortener */ class Horde_Service_UrlShortener_Exception extends Horde_Exception_Wrapped { } Horde_Service_UrlShortener-2.0.2/lib/Horde/Service/UrlShortener/TinyUrl.php0000664000175000017500000000243412453736214025050 0ustar janjan * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 * @category Horde * @package Service_UrlShortener */ /** * UrlShortener class for TinyUrl. * * @author Michael J Rubinsky * @category Horde * @package Service_UrlShortener */ class Horde_Service_UrlShortener_TinyUrl extends Horde_Service_UrlShortener_Base { const API_URL = 'http://tinyurl.com/api-create.php'; /** * * @param string $url The URL to shorten * * @return string The shortened URL * @throws Horde_UrlShorten_Exception */ public function shorten($url) { $u = new Horde_Url(self::API_URL); $u = $u->setRaw(true)->add('url', $url); try { $response = $this->_http->get($u); } catch (Horde_Http_Exception $e) { throw new Horde_Service_UrlShortener_Exception($e); } return $response->getBody(); } }