summaryrefslogtreecommitdiff
path: root/classes/Message.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-21 07:20:59 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-21 07:20:59 -0400
commitd88839d167e136c5f585e3584b4fee5ba6e5795f (patch)
treea0411268957e5925f44b50f48078a9352f003709 /classes/Message.php
parent7a6827258032f9d082f093c741125262ddeb81da (diff)
methods for Message to check max content length
Diffstat (limited to 'classes/Message.php')
-rw-r--r--classes/Message.php16
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));
+ }
}