[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/htmlpurifier/library/HTMLPurifier/AttrDef/URI/Email/ -> SimpleCheck.php (source)

   1  <?php
   2  
   3  /**
   4   * Primitive email validation class based on the regexp found at
   5   * http://www.regular-expressions.info/email.html
   6   */
   7  class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email
   8  {
   9  
  10      public function validate($string, $config, $context) {
  11          // no support for named mailboxes i.e. "Bob <[email protected]>"
  12          // that needs more percent encoding to be done
  13          if ($string == '') return false;
  14          $string = trim($string);
  15          $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);
  16          return $result ? $string : false;
  17      }
  18  
  19  }
  20  
  21  // vim: et sw=4 sts=4


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1