]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/Shorturl_api.php
Reduced form_notice margin bottom
[quix0rs-gnu-social.git] / lib / Shorturl_api.php
index 7beae0ec6446577ba9dc10b04afefaa6b6264e6b..6402dbc099615918d7ee777330b61abfe3c8873b 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('STATUSNET') && !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) >= common_config('site', 'shorturllength');
     }
 
     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=');
     }