summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-21 08:05:13 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-21 08:05:13 -0400
commit4d05afae302f1870af369a713ab7ed291c821165 (patch)
treec9311053d44b85b9b77a7962dfdec6833edb3b14
parent2b30d7fffb4deeee7d5391585692d76c59cd2ba9 (diff)
Notice class has methods to check content length
-rw-r--r--classes/Notice.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index ba74a98a8..e27f09c2c 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -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));
+ }
}