From 5d1a6f0fef3b99167babfa304ceda9b67720f399 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 20 May 2008 14:57:56 -0400 Subject: add validation methods to classes darcs-hash:20080520185756-84dde-290bc12cddfc1738a96385e95821d466eff11196.gz --- classes/Notice.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'classes/Notice.php') diff --git a/classes/Notice.php b/classes/Notice.php index 24c813330..3e6835ec9 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -52,4 +52,13 @@ class Notice extends DB_DataObject } return $this->profile; } + + function validateContent() { + return Validate::string($this->content, array('min_length' => 1, 'max_length' => 140)); + } + + function validateUrl() { + return is_null($this->url) || + Validate::uri($this->url, array('allowed_schemes' => array('http', 'https'))); + } } -- cgit v1.2.3-54-g00ecf