]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Notice class has methods to check content length
authorEvan Prodromou <evan@controlyourself.ca>
Fri, 21 Aug 2009 12:05:13 +0000 (08:05 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 21 Aug 2009 12:05:13 +0000 (08:05 -0400)
classes/Notice.php

index ba74a98a8f7b2869e22fa8417b5c526b4559ce90..e27f09c2c8526149414e3d2029bb2adee05e7e09 100644 (file)
@@ -1352,4 +1352,20 @@ class Notice extends Memcached_DataObject
             return $last->id;
         }
     }
+
+    static function maxContent()
+    {
+        $contentlimit = common_config('notice', 'contentlimit');
+        // null => use global limit (distinct from 0!)
+        if (is_null($contentlimit)) {
+            $contentlimit = common_config('site', 'textlimit');
+        }
+        return $contentlimit;
+    }
+
+    static function contentTooLong($content)
+    {
+        $contentlimit = self::maxContent();
+        return ($contentlimit > 0 && !empty($content) && (mb_strlen($content) > $contentlimit));
+    }
 }