summaryrefslogtreecommitdiff
path: root/classes/Profile.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-20 14:57:56 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-20 14:57:56 -0400
commit5d1a6f0fef3b99167babfa304ceda9b67720f399 (patch)
tree451830a55e2cacac2d224ac85a6e2d74a57a36ac /classes/Profile.php
parenta9c57467e77f5420cca866d5e4c28b10da2f75fc (diff)
add validation methods to classes
darcs-hash:20080520185756-84dde-290bc12cddfc1738a96385e95821d466eff11196.gz
Diffstat (limited to 'classes/Profile.php')
-rw-r--r--classes/Profile.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index 686a79163..4119cd411 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -72,4 +72,33 @@ class Profile extends DB_DataObject
return NULL;
}
}
+
+ function validateNickname() {
+ return Validate::string($this->nickname, array('min_length' => 1, 'max_length' => 64,
+ 'format' => VALIDATE_ALPHA_LOWER . VALIDATE_NUM));
+ }
+
+ function validateProfileurl() {
+ return Validate::uri($this->profileurl, array('allowed_schemes' => array('http', 'https')));
+ }
+
+ function validateHomepage() {
+ return (is_null($this->homepage) ||
+ Validate::uri($this->homepage, array('allowed_schemes' => array('http', 'https'))));
+ }
+
+ function validateBio() {
+ return is_null($this->bio) ||
+ Validate::string($this->bio, array('min_length' => 1, 'max_length' => 140));
+ }
+
+ function validateLocation() {
+ return is_null($this->location) ||
+ Validate::string($this->location, array('min_length' => 1, 'max_length' => 255));
+ }
+
+ function validateFullname() {
+ return is_null($this->fullname) ||
+ Validate::string($this->fullname, array('min_length' => 1, 'max_length' => 255));
+ }
}