3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2010, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if (!defined('STATUSNET') && !defined('LACONICA')) {
24 class User_urlshortener_prefs extends Memcached_DataObject
27 /* the code below is auto generated do not remove the above tag */
29 public $__table = 'user_urlshortener_prefs'; // table name
30 public $user_id; // int(4) primary_key not_null
31 public $urlshorteningservice; // varchar(50) default_ur1.ca
32 public $maxurllength; // int(4) not_null
33 public $maxnoticelength; // int(4) not_null
34 public $created; // datetime not_null default_0000-00-00%2000%3A00%3A00
35 public $modified; // timestamp not_null default_CURRENT_TIMESTAMP
38 function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_urlshortener_prefs',$k,$v); }
40 /* the code above is auto generated do not remove the tag below */
43 function sequenceKey()
45 return array(false, false, false);
48 static function maxUrlLength($user)
50 $def = common_config('url', 'maxlength');
52 $prefs = self::getPrefs($user);
57 return $prefs->maxurllength;
61 static function maxNoticeLength($user)
63 $def = common_config('url', 'maxnoticelength');
66 $def = Notice::maxContent();
69 $prefs = self::getPrefs($user);
74 return $prefs->maxnoticelength;
78 static function urlShorteningService($user)
80 $def = common_config('url', 'shortener');
82 $prefs = self::getPrefs($user);
86 return $user->urlshorteningservice;
91 return $prefs->urlshorteningservice;
95 static function getPrefs($user)
101 $prefs = User_urlshortener_prefs::staticGet('user_id', $user->id);