--- a/web/lib/Zend/Service/ShortUrl/IsGd.php Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Service/ShortUrl/IsGd.php Thu Mar 21 19:50:53 2013 +0100
@@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_Service_ShortUrl
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: $
*/
@@ -29,7 +29,7 @@
*
* @category Zend
* @package Zend_Service_ShortUrl
- * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_ShortUrl_IsGd extends Zend_Service_ShortUrl_AbstractShortener
@@ -40,7 +40,7 @@
* @var string
*/
protected $_baseUri = 'http://is.gd';
-
+
/**
* This function shortens long url
*
@@ -51,15 +51,15 @@
public function shorten($url)
{
$this->_validateUri($url);
-
+
$serviceUri = 'http://is.gd/api.php';
-
+
$this->getHttpClient()->resetParameters(true);
$this->getHttpClient()->setUri($serviceUri);
$this->getHttpClient()->setParameterGet('longurl', $url);
-
+
$response = $this->getHttpClient()->request();
-
+
return $response->getBody();
}
@@ -75,21 +75,21 @@
$this->_validateUri($shortenedUrl);
$this->_verifyBaseUri($shortenedUrl);
-
+
$this->getHttpClient()->resetParameters(true);
$this->getHttpClient()->setUri($shortenedUrl);
$this->getHttpClient()->setConfig(array('maxredirects' => 0));
-
+
$response = $this->getHttpClient()->request();
if ($response->isError()) {
require_once 'Zend/Service/ShortUrl/Exception.php';
throw new Zend_Service_ShortUrl_Exception($response->getMessage());
}
-
+
if ($response->isRedirect()) {
return $response->getHeader('Location');
}
-
+
require_once 'Zend/Service/ShortUrl/Exception.php';
throw new Zend_Service_ShortUrl_Exception('Url unshortening was not successful');
}