ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
HTMLPurifier_AttrDef_URI_Email_SimpleCheck Class Reference

Primitive email validation class based on the regexp found at http://www.regular-expressions.info/email.html. More...

+ Inheritance diagram for HTMLPurifier_AttrDef_URI_Email_SimpleCheck:
+ Collaboration diagram for HTMLPurifier_AttrDef_URI_Email_SimpleCheck:

Public Member Functions

 validate ($string, $config, $context)
 
- Public Member Functions inherited from HTMLPurifier_AttrDef
 validate ($string, $config, $context)
 Validates and cleans passed string according to a definition. More...
 
 parseCDATA ($string)
 Convenience method that parses a string as if it were CDATA. More...
 
 make ($string)
 Factory method for creating this class from a string. More...
 

Additional Inherited Members

- Data Fields inherited from HTMLPurifier_AttrDef
 $minimized = false
 Tells us whether or not an HTML attribute is minimized. More...
 
 $required = false
 Tells us whether or not an HTML attribute is required. More...
 
- Protected Member Functions inherited from HTMLPurifier_AttrDef
 mungeRgb ($string)
 Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work properly. More...
 
 expandCSSEscape ($string)
 Parses a possibly escaped CSS string and returns the "pure" version of it. More...
 

Detailed Description

Primitive email validation class based on the regexp found at http://www.regular-expressions.info/email.html.

Definition at line 7 of file SimpleCheck.php.

Member Function Documentation

◆ validate()

HTMLPurifier_AttrDef_URI_Email_SimpleCheck::validate (   $string,
  $config,
  $context 
)
Parameters
string$string
HTMLPurifier_Config$config
HTMLPurifier_Context$context
Returns
bool|string

Definition at line 16 of file SimpleCheck.php.

References $result.

17  {
18  // no support for named mailboxes i.e. "Bob <bob@example.com>"
19  // that needs more percent encoding to be done
20  if ($string == '') {
21  return false;
22  }
23  $string = trim($string);
24  $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);
25  return $result ? $string : false;
26  }
$result

The documentation for this class was generated from the following file: