/** * Ean rule * if the value is not a valid EAN then catch an error * * @static * @param array $field Array of the field form (passed as reference) * @param array $tok Array of the rule parameters (rule_name, param1, param2...) * @param boolean $e Error status * @param array $_post _POST array * @param array $_files _FILES array * @return void */ private static function _ean(&$field, $tok, &$e, $_post, $_files) { if (!X4Checker_helper::isEAN(trim($_post[$field['name']]))) { $field['error'][] = '_invalid_ean'; $e = false; } }
/** * Check valid email address * * @static * @param string email address * @return boolean */ public static function check_email($mail) { $local = "0-9a-zA-Z\\-_#~!\$&'()*+,;=:%\"\\<>\\[\\]àèìòùéüñîçøð"; $domain = "((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,6}"; //"[a-z0-9]+([\-\.]{1,3}[a-z0-9]+)*\.[a-z]{2,6}"; $pattern = "/^[{$local}]+(\\.[{$local}]+)*@({$domain})\$/i"; if (preg_match($pattern, $mail)) { $parts = explode("@", $mail); $chk = !function_exists('checkdnsrr') ? X4Checker_helper::win_checkdnsrr($parts[1], "MX") : checkdnsrr($parts[1], "MX"); return $chk || DEBUG; } else { return false; // e-mail address contains invalid characters } }