static method for getting best URL shortening service

This commit is contained in:
Evan Prodromou 2010-04-26 02:37:41 -04:00
parent a9c6a3bace
commit 4d29ca0b91

View File

@ -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) static function getPrefs($user)
{ {
if (empty($user)) { if (empty($user)) {