|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00007 class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email 00008 { 00009 00010 public function validate($string, $config, $context) { 00011 // no support for named mailboxes i.e. "Bob <bob@example.com>" 00012 // that needs more percent encoding to be done 00013 if ($string == '') return false; 00014 $string = trim($string); 00015 $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string); 00016 return $result ? $string : false; 00017 } 00018 00019 } 00020 00021 // vim: et sw=4 sts=4