\nIPv6: " . $ipv6 . "
\n";
// URL regular expressions
$pct_encoded = "%[\dA-F]{2}";
$unreserved = 'a-z0-9\-._~';
$sub_delims = '!$&\'()*+,;=';
$pchar = "(?:[$unreserved$sub_delims:@|]+|$pct_encoded)"; // rfc: no "|"
$scheme = '[a-z][a-z\d+\-.]*';
$reg_name = "(?:[$unreserved$sub_delims|@]+|$pct_encoded)+"; // rfc: * instead of + and no "|" and no "@" (included instead of userinfo
//$userinfo = "(?:(?:[$unreserved$sub_delims:]+|$pct_encoded))*";
$ipv4_simple = '[0-9.]+';
$ipv6_simple = '\[[a-z0-9.]+:[a-z0-9.]+:[a-z0-9.:]+\]';
$host = "(?:$reg_name|$ipv4_simple|$ipv6_simple)";
$port = '\d*';
//$authority = "(?:$userinfo@)?$host(?::$port)?";
$authority = "$host(?::$port)?";
$segment = "$pchar*";
$path_abempty = "(?:/$segment)*";
$hier_part = "/{2}$authority$path_abempty";
$query = "(?:[$unreserved$sub_delims:@/?|]+|$pct_encoded)*"; // pchar | "/" | "?", rfc: no "|"
$fragment = $query;
$url = "$scheme:$hier_part(?:\?$query)?(?:\#$fragment)?";
echo 'URL: ' . $url . "
\n";
// no scheme, shortened authority, but host has to start with www.
$www_url = "www\.$reg_name(?::$port)?$path_abempty(?:\?$query)?(?:\#$fragment)?";
echo 'www.URL: ' . $www_url . "
\n";
// no schema and no authority
$relative_url = "$segment$path_abempty(?:\?$query)?(?:\#$fragment)?";
echo 'relative URL: ' . $relative_url . "
\n";
?>context:
| author | 3D-I <marktravai@gmail.com> | 2018-11-11 21:49:34 +0100 |
|---|---|---|
| committer | 3D-I <marktravai@gmail.com> | 2018-11-11 21:49:51 +0100 |
| commit | b8f85325d86ca4478945fdd77da4e15b52d71a12 (patch) | |
| tree | bb2bb68a4dec8d6ad2b5487fa59bc91d8f5a189d /phpBB | |
| parent | dbb476d813ee45440e9ebddf7e3827a109186d4d (diff) | |
| download | forums-b8f85325d86ca4478945fdd77da4e15b52d71a12.tar forums-b8f85325d86ca4478945fdd77da4e15b52d71a12.tar.gz forums-b8f85325d86ca4478945fdd77da4e15b52d71a12.tar.bz2 forums-b8f85325d86ca4478945fdd77da4e15b52d71a12.tar.xz forums-b8f85325d86ca4478945fdd77da4e15b52d71a12.zip | |