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;
}
}
private function is_long($url) {
- return strlen($url) >= 30;
+ return strlen($url) >= $this->long_limit;
}
protected function http_post($data) {
}
}
-class LilUrl extends ShortUrlApi {
- function __construct() {
+class LilUrl extends ShortUrlApi
+{
+ function __construct()
+ {
parent::__construct('http://ur1.ca/');
}
}
-class PtitUrl extends ShortUrlApi {
- function __construct() {
+class PtitUrl extends ShortUrlApi
+{
+ function __construct()
+ {
parent::__construct('http://ptiturl.com/?creer=oui&action=Reduire&url=');
}
}
}
-class TightUrl extends ShortUrlApi {
- function __construct() {
+class TightUrl extends ShortUrlApi
+{
+ function __construct()
+ {
parent::__construct('http://2tu.us/?save=y&url=');
}