10 defined(
'JPATH_PLATFORM') or die;
36 public function test(SimpleXMLElement $element, $value, $group = null,
JRegistry $input = null,
JForm $form = null)
39 $required = ((string) $element[
'required'] ==
'true' || (
string) $element[
'required'] ==
'required');
40 if (!$required && empty($value))
54 $regexarray = array(
'NANP' =>
'/^(?:\+?1[-. ]?)?\(?([2-9][0-8][0-9])\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$/',
55 'ITU-T' =>
'/^\+(?:[0-9] ?){6,14}[0-9]$/',
'EPP' =>
'/^\+[0-9]{1,3}\.[0-9]{4,14}(?:x.+)?$/');
56 if (isset($element[
'plan']))
59 $plan = (string) $element[
'plan'];
60 if ($plan ==
'northamerica' || $plan ==
'us')
64 elseif ($plan ==
'International' || $plan ==
'int' || $plan ==
'missdn' || !$plan)
68 elseif ($plan ==
'IETF')
73 $regex = $regexarray[$plan];
76 if (preg_match($regex, $value) ==
false)
89 $cleanvalue = preg_replace(
'/[+. \-(\)]/',
'', $value);
90 $regex =
'/^[0-9]{7,15}?$/';
91 if (preg_match($regex, $cleanvalue) ==
true)