X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2FShorturl_api.php;h=924aa93a8953ab7b0239660989cc1db849d43e97;hb=15eb0c020607d19ceda1149e830afb7033c18828;hp=7beae0ec6446577ba9dc10b04afefaa6b6264e6b;hpb=29146a13f295a13a4ee4470cffaaa7fde6858689;p=quix0rs-gnu-social.git diff --git a/lib/Shorturl_api.php b/lib/Shorturl_api.php index 7beae0ec64..924aa93a89 100644 --- a/lib/Shorturl_api.php +++ b/lib/Shorturl_api.php @@ -19,14 +19,18 @@ if (!defined('LACONICA')) { exit(1); } -class ShortUrlApi { +class ShortUrlApi +{ protected $service_url; + protected $long_limit = 27; - function __construct($service_url) { + function __construct($service_url) + { $this->service_url = $service_url; } - function shorten($url) { + function shorten($url) + { if ($this->is_long($url)) return $this->shorten_imp($url); return $url; } @@ -36,7 +40,7 @@ class ShortUrlApi { } private function is_long($url) { - return strlen($url) >= 30; + return strlen($url) >= $this->long_limit; } protected function http_post($data) { @@ -67,8 +71,10 @@ class ShortUrlApi { } } -class LilUrl extends ShortUrlApi { - function __construct() { +class LilUrl extends ShortUrlApi +{ + function __construct() + { parent::__construct('http://ur1.ca/'); } @@ -85,8 +91,10 @@ class LilUrl extends ShortUrlApi { } -class PtitUrl extends ShortUrlApi { - function __construct() { +class PtitUrl extends ShortUrlApi +{ + function __construct() + { parent::__construct('http://ptiturl.com/?creer=oui&action=Reduire&url='); } @@ -102,8 +110,10 @@ class PtitUrl extends ShortUrlApi { } } -class TightUrl extends ShortUrlApi { - function __construct() { +class TightUrl extends ShortUrlApi +{ + function __construct() + { parent::__construct('http://2tu.us/?save=y&url='); }