summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-04-29 01:18:00 +0200
committerDerek Allard <derek.allard@ellislab.com>2008-04-29 01:18:00 +0200
commitb94b89c69195a0708add8dedb1721f12bcafbf8c (patch)
treebb431084a58830ffcc8dd6216bea8eb2c8372e13 /system/libraries
parent05f830c7105ef3cd4a8388bffe7cf73c35236105 (diff)
Added a valid_emails rule to the Validation class.
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Validation.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index d0714d040..18fdba2d3 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -488,6 +488,33 @@ class CI_Validation {
// --------------------------------------------------------------------
/**
+ * Valid Emails
+ *
+ * @access public
+ * @param string
+ * @return bool
+ */
+ function valid_emails($str)
+ {
+ if (strpos($str, ',') === FALSE)
+ {
+ return $this->valid_email(trim($str));
+ }
+
+ foreach(explode(',', $str) as $email)
+ {
+ if (trim($email) != '' && $this->valid_email(trim($email)) === FALSE)
+ {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Validate IP Address
*
* @access public