Profile class has methods to check bio length

This commit is contained in:
Evan Prodromou 2009-08-21 07:40:46 -04:00
parent 2b2541e4b4
commit d2d3418b8a
1 changed files with 16 additions and 0 deletions

View File

@ -460,4 +460,20 @@ class Profile extends Memcached_DataObject
$c->delete(common_cache_key('profile:notice_count:'.$this->id));
}
}
static function maxBio()
{
$biolimit = common_config('message', 'biolimit');
// null => use global limit (distinct from 0!)
if (is_null($biolimit)) {
$biolimit = common_config('site', 'textlimit');
}
return $biolimit;
}
static function bioTooLong($bio)
{
$biolimit = self::maxBio();
return ($biolimit > 0 && !empty($bio) && (mb_strlen($bio) > $biolimit));
}
}