From d2d3418b8ae6986c14e8eda25779d621443e9e0a Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 21 Aug 2009 07:40:46 -0400 Subject: [PATCH] Profile class has methods to check bio length --- classes/Profile.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/classes/Profile.php b/classes/Profile.php index a34f4cf4bd..ff233666a2 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -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)); + } } -- 2.39.2