From: Evan Prodromou Date: Fri, 21 Aug 2009 11:40:46 +0000 (-0400) Subject: Profile class has methods to check bio length X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d2d3418b8ae6986c14e8eda25779d621443e9e0a;p=quix0rs-gnu-social.git Profile class has methods to check bio length --- 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)); + } }