static method for getting best URL shortening service
This commit is contained in:
parent
a9c6a3bace
commit
4d29ca0b91
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user