Mecha CMS

Extract current URL data.

URL::long()

Convert relative URL into full URL.

2.0.02.2.0static
URL::long(string $path, $root = true);

Example:

$A = URL::long("");
$B = URL::long('foo');
$C = URL::long('?foo');
$D = URL::long('&foo');
$E = URL::long('#foo');
$F = URL::long('javascript:;');
$G = URL::long('data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
$H = URL::long('foo/bar');
$I = URL::long('?foo&bar');
$J = URL::long('&foo&bar');
$K = URL::long('//foo');
$L = URL::long('http://foo');
$M = URL::long('/');
$N = URL::long('/foo');
$O = URL::long('/?foo');
$P = URL::long('/&foo');
$Q = URL::long('/#foo');
$R = URL::long('/javascript:;');
$S = URL::long('/foo/bar');
$T = URL::long('/?foo&bar');
$U = URL::long('/&foo&bar');

Result:

$A = 'http://mecha-cms.com';
$B = 'http://mecha-cms.com/foo';
$C = '?foo';
$D = '?foo';
$E = '#foo';
$F = 'javascript:;';
$G = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
$H = 'http://mecha-cms.com/foo/bar';
$I = '?foo&bar';
$J = '?foo&bar';
$K = 'http://foo';
$L = 'http://foo';
$M = 'http://mecha-cms.com';
$N = 'http://mecha-cms.com/foo';
$O = '?foo';
$P = '?foo';
$Q = '#foo';
$R = 'javascript:;';
$S = 'http://mecha-cms.com/foo/bar';
$T = '?foo&bar';
$U = '?foo&bar';

Note: If $root is false, then a / character at the beginning of URL path will be ignored, and the result will always relative to the URL path where the CMS is being installed. The $root parameter changes makes sense only when Mecha is installed in a sub-directory.