]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
methods for Message to check max content length
authorEvan Prodromou <evan@controlyourself.ca>
Fri, 21 Aug 2009 11:20:59 +0000 (07:20 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 21 Aug 2009 11:20:59 +0000 (07:20 -0400)
classes/Message.php

index 71362d9b75db25843f0e43d43830c114308d1314..979e6e87ccbdcb4d79de3c0fec07a19a239a6812 100644 (file)
@@ -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));
+    }
 }