]> git.immae.eu Git - github/wallabag/wallabag.git/blame - inc/3rdparty/htmlpurifier/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php
remove autoload section in composer.json
[github/wallabag/wallabag.git] / inc / 3rdparty / htmlpurifier / HTMLPurifier / AttrDef / URI / Email / SimpleCheck.php
CommitLineData
d4949327
NL
1<?php\r
2\r
3/**\r
4 * Primitive email validation class based on the regexp found at\r
5 * http://www.regular-expressions.info/email.html\r
6 */\r
7class HTMLPurifier_AttrDef_URI_Email_SimpleCheck extends HTMLPurifier_AttrDef_URI_Email\r
8{\r
9\r
10 /**\r
11 * @param string $string\r
12 * @param HTMLPurifier_Config $config\r
13 * @param HTMLPurifier_Context $context\r
14 * @return bool|string\r
15 */\r
16 public function validate($string, $config, $context)\r
17 {\r
18 // no support for named mailboxes i.e. "Bob <bob@example.com>"\r
19 // that needs more percent encoding to be done\r
20 if ($string == '') {\r
21 return false;\r
22 }\r
23 $string = trim($string);\r
24 $result = preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $string);\r
25 return $result ? $string : false;\r
26 }\r
27}\r
28\r
29// vim: et sw=4 sts=4\r