
Provides functionality to retrieve and manipulate URL information
This class uses $_SERVER['REQUEST_URI'] for all operations, meaning that the original URL entered by the user will be used, or that any rewrites will not be reflected by this class.
1.0.0b10 | Fixed some method signatures 8/24/11 |
---|---|
1.0.0b9 | Fixed redirect() to handle no parameters properly 6/13/11 |
1.0.0b8 | Added the $delimiter parameter to makeFriendly() 6/3/11 |
1.0.0b7 | Fixed redirect() to be able to handle unqualified and relative paths 3/2/11 |
1.0.0b6 | Added the $max_length parameter to makeFriendly() 9/19/10 |
1.0.0b5 | Updated redirect() to not require a URL, using the current URL as the default 7/29/09 |
1.0.0b4 | getDomain() now includes the port number if non-standard 5/2/09 |
1.0.0b3 | makeFriendly() now changes _-_ to - and multiple _ to a single _ 3/24/09 |
1.0.0b2 | Fixed makeFriendly() so that _ doesn't appear at the beginning of URLs 3/22/09 |
1.0.0b | The initial implementation 6/14/07 |
Returns the requested URL, does no include the domain name or query string
This will return the original URL requested by the user - ignores all rewrites.
string get( )
The requested URL without the query string
Returns the current domain name, with protcol prefix. Port will be included if not 80 for HTTP or 443 for HTTPS.
string getDomain( )
The current domain name, prefixed by http:// or https://
Returns the current query string, does not include parameters added by rewrites
string getQueryString( )
The query string
Returns the current URL including query string, but without domain name - does not include query string parameters from rewrites
string getWithQueryString( )
The URL with query string
Changes a string into a URL-friendly string
string makeFriendly( string $string, integer $max_length=NULL, string $delimiter=NULL )
string makeFriendly( string $string, string $delimiter=NULL )
string | $string | The string to convert |
integer | $max_length | The maximum length of the friendly URL |
string | $delimiter | The delimiter to use between words, defaults to _ |
The URL-friendly version of the string
Redirects to the URL specified, without requiring a full-qualified URL
void redirect( string $url=NULL )
string | $url | The url to redirect to |
Removes one or more parameters from the query string
This method uses the query string from the original URL and will not contain any parameters that are from rewrites.
string removeFromQueryString( string $parameter [, ... ] )
string | $parameter [, ... ] | A parameter to remove from the query string |
The query string with the parameter(s) specified removed, first character is ?
Replaces a value in the query string
This method uses the query string from the original URL and will not contain any parameters that are from rewrites.
string replaceInQueryString( string|array $parameter, string|array $value )
string|array | $parameter | The query string parameter |
string|array | $value | The value to set the parameter to |
The full query string with the parameter replaced, first char is ?