Added makeAbsolute function
This commit is contained in:
parent
7f474c9856
commit
c068de8f70
1 changed files with 28 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ package WebGUI::URL;
|
||||||
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use URI;
|
||||||
use URI::Escape;
|
use URI::Escape;
|
||||||
use WebGUI::Session;
|
use WebGUI::Session;
|
||||||
use WebGUI::Utility;
|
use WebGUI::Utility;
|
||||||
|
|
@ -36,6 +37,7 @@ This package provides URL writing functionality. It is important that all WebGUI
|
||||||
$string = WebGUI::URL::escape($string);
|
$string = WebGUI::URL::escape($string);
|
||||||
$url = WebGUI::URL::gateway($url,$pairs);
|
$url = WebGUI::URL::gateway($url,$pairs);
|
||||||
$url = WebGUI::URL::makeCompliant($string);
|
$url = WebGUI::URL::makeCompliant($string);
|
||||||
|
$url = WebGUI::URL::makeAbsolute($url);
|
||||||
$url = WebGUI::URL::page($url,$pairs);
|
$url = WebGUI::URL::page($url,$pairs);
|
||||||
$string = WebGUI::URL::unescape($string);
|
$string = WebGUI::URL::unescape($string);
|
||||||
$url = WebGUI::URL::urlize($string);
|
$url = WebGUI::URL::urlize($string);
|
||||||
|
|
@ -158,6 +160,32 @@ sub gateway {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 makeAbsolute ( url , [ baseURL ] )
|
||||||
|
|
||||||
|
Returns an absolute url.
|
||||||
|
|
||||||
|
=over
|
||||||
|
|
||||||
|
=item url
|
||||||
|
|
||||||
|
The url to make absolute.
|
||||||
|
|
||||||
|
=item baseURL
|
||||||
|
|
||||||
|
The base URL to use. This defaults to current page url.
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub makeAbsolute {
|
||||||
|
my $url = shift;
|
||||||
|
my $baseURL = shift || page();
|
||||||
|
return URI->new_abs($url,$baseURL);
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 makeCompliant ( string )
|
=head2 makeCompliant ( string )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue