diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-08-21 07:20:59 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-08-21 07:20:59 -0400 |
commit | d88839d167e136c5f585e3584b4fee5ba6e5795f (patch) | |
tree | a0411268957e5925f44b50f48078a9352f003709 | |
parent | 7a6827258032f9d082f093c741125262ddeb81da (diff) |
methods for Message to check max content length
-rw-r--r-- | classes/Message.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/classes/Message.php b/classes/Message.php index 71362d9b7..979e6e87c 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)); + } } |