]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Profile class has methods to check bio length
authorEvan Prodromou <evan@controlyourself.ca>
Fri, 21 Aug 2009 11:40:46 +0000 (07:40 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 21 Aug 2009 11:40:46 +0000 (07:40 -0400)
classes/Profile.php

index a34f4cf4bd177b4a6dae4f69e0f63a9ac5267ebd..ff233666a21d9390e43671e0a67126e7c14bf8b4 100644 (file)
@@ -460,4 +460,20 @@ class Profile extends Memcached_DataObject
             $c->delete(common_cache_key('profile:notice_count:'.$this->id));
         }
     }
+
+    static function maxBio()
+    {
+        $biolimit = common_config('message', 'biolimit');
+        // null => use global limit (distinct from 0!)
+        if (is_null($biolimit)) {
+            $biolimit = common_config('site', 'textlimit');
+        }
+        return $biolimit;
+    }
+
+    static function bioTooLong($bio)
+    {
+        $biolimit = self::maxBio();
+        return ($biolimit > 0 && !empty($bio) && (mb_strlen($bio) > $biolimit));
+    }
 }