From: Evan Prodromou Date: Fri, 21 Aug 2009 11:20:59 +0000 (-0400) Subject: methods for Message to check max content length X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d88839d167e136c5f585e3584b4fee5ba6e5795f;p=quix0rs-gnu-social.git methods for Message to check max content length --- diff --git a/classes/Message.php b/classes/Message.php index 71362d9b75..979e6e87cc 100644 --- a/classes/Message.php +++ b/classes/Message.php @@ -67,4 +67,20 @@ class Message extends Memcached_DataObject return $msg; } + + static function maxContent() + { + $desclimit = common_config('message', 'contentlimit'); + // null => use global limit (distinct from 0!) + if (is_null($desclimit)) { + $desclimit = common_config('site', 'textlimit'); + } + return $desclimit; + } + + static function contentTooLong($content) + { + $contentlimit = self::maxContent(); + return ($contentlimit > 0 && !empty($content) && (mb_strlen($content) > $contentlimit)); + } }