From d88839d167e136c5f585e3584b4fee5ba6e5795f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 21 Aug 2009 07:20:59 -0400 Subject: [PATCH] methods for Message to check max content length --- classes/Message.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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)); + } }