10 defined(
'JPATH_PLATFORM') or die;
38 public function test(SimpleXMLElement $element, $value, $group = null,
JRegistry $input = null,
JForm $form = null)
41 $required = ((string) $element[
'required'] ==
'true' || (
string) $element[
'required'] ==
'required');
42 if (!$required && empty($value))
50 if ($element[
'schemes'] ==
'')
52 $scheme = array(
'http',
'https',
'ftp',
'ftps',
'gopher',
'mailto',
'news',
'prospero',
'telnet',
'rlogin',
'tn3270',
'wais',
'url',
53 'mid',
'cid',
'nntp',
'tel',
'urn',
'ldap',
'file',
'fax',
'modem',
'git');
57 $scheme = explode(
',', $element[
'schemes']);
65 if ($urlParts && !array_key_exists(
'scheme', $urlParts))
69 $urlScheme = (string) $urlParts[
'scheme'];
70 $urlScheme = strtolower($urlScheme);
71 if (in_array($urlScheme, $scheme) ==
false)
76 if (($urlScheme ==
'http' || $urlScheme ==
'https' || $urlScheme ==
'ftp' || $urlScheme ==
'sftp' || $urlScheme ==
'gopher'
77 || $urlScheme ==
'wais' || $urlScheme ==
'gopher' || $urlScheme ==
'prospero' || $urlScheme ==
'telnet' || $urlScheme ==
'git')
78 && ((substr($value, strlen($urlScheme), 3)) !==
'://'))
84 if (array_key_exists(
'host', $urlParts) && !
JString::valid((
string) $urlParts[
'host']))
88 if (array_key_exists(
'port', $urlParts) && !is_int((
int) $urlParts[
'port']))
92 if (array_key_exists(
'path', $urlParts) && !
JString::valid((
string) $urlParts[
'path']))