]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
static method for getting best URL shortening service
authorEvan Prodromou <evan@status.net>
Mon, 26 Apr 2010 06:37:41 +0000 (02:37 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 26 Apr 2010 06:37:41 +0000 (02:37 -0400)
classes/User_urlshortener_prefs.php

index 3eb008a672b70b53863b1e1b990ec928b503e3c3..e0f85af01237ef121fcde22408722df5272420ef 100755 (executable)
@@ -75,6 +75,23 @@ class User_urlshortener_prefs extends Memcached_DataObject
         }
     }
 
+    static function urlShorteningService($user)
+    {
+        $def = common_config('url', 'shortener');
+
+        $prefs = self::getPrefs($user);
+
+        if (empty($prefs)) {
+            if (!empty($user)) {
+                return $user->urlshorteningservice;
+            } else {
+                return $def;
+            }
+        } else {
+            return $prefs->urlshorteningservice;
+        }
+    }
+
     static function getPrefs($user)
     {
         if (empty($user)) {