summaryrefslogtreecommitdiffstats
path: root/system/helpers/email_helper.php
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-05-16 21:41:05 +0200
committerTimothy Warren <tim@timshomepage.net>2012-05-16 21:41:05 +0200
commit40dd9b5ffa1a9e0b1b885d4b592636dcc04af023 (patch)
tree2ebcef6cdda3752d349ffe472063dd90884ed8be /system/helpers/email_helper.php
parentf7f44584c7acb8be6097445529f09255bfe34e5d (diff)
Added filter_var for newer versions of php
Diffstat (limited to 'system/helpers/email_helper.php')
-rw-r--r--system/helpers/email_helper.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/system/helpers/email_helper.php b/system/helpers/email_helper.php
index c7b3abada..449aadfc2 100644
--- a/system/helpers/email_helper.php
+++ b/system/helpers/email_helper.php
@@ -50,6 +50,13 @@ if ( ! function_exists('valid_email'))
*/
function valid_email($email)
{
+ // Use PHP's filters if they exist
+ if (function_exists('filter_var'))
+ {
+ return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
+ }
+
+ // Fallback based on RFC822
$qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';
$dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';