TLSelfURL Class Reference

Self-referring URL helper class This class provides various methods for refering to the current server/host/URL/etc. It provides abstractions against HTTP/HTTPS usage, ports and parameters. More...

List of all members.

Public Member Functions

 __construct ()
 Constructor.
 getServerURL ()
 getAbsolutePathURL ()
 getRelativePathURL ()
 getAbsoluteScriptURL ()
 getRelativeScriptURL ()
 getParams ($stripVarsPrefix=null)
 getAbsoluteFullURL ($stripVarsPrefix=null)
 getRelativeFullURL ($stripVarsPrefix=null)

Public Attributes

 $type = ""
 $host = ""
 $port = ""
 $path = ""
 $script = ""
 $params = null


Detailed Description

Self-referring URL helper class This class provides various methods for refering to the current server/host/URL/etc. It provides abstractions against HTTP/HTTPS usage, ports and parameters.

Examples:

 $s = new SelfURL();
 print ($s->getServerURL());
 print ($s->getAbsolutePathURL());
 print ($s->getAbsoluteScriptURL());
 print ($s->getAbsoluteFullURL());
 print ($s->getAbsoluteFullURL("strip_"));
 print ($s->getRelativePathURL());
 print ($s->getRelativeScriptURL());
 print ($s->getRelativeFullURL());
 print ($s->getRelativeFullURL("strip_"));

With the following URL: http://example.com/svcmon/class.url.php?name=ferry&age=26&strip_foo=bar Outputs:

 http://example.com
 http://example.com/svcmon
 http://example.com/svcmon/class.url.php
 http://example.com/svcmon/class.url.php?name=ferry&age=26&strip_foo=bar
 http://example.com/svcmon/class.url.php?name=ferry&age=26
 /svcmon
 /svcmon/class.url.php
 /svcmon/class.url.php?name=ferry&age=26&strip_foo=bar
 /svcmon/class.url.php?name=ferry&age=26
 

Definition at line 904 of file tlib.php.


Member Function Documentation

TLSelfURL::getAbsoluteFullURL ( stripVarsPrefix = null  ) 

Returns the absolute URL upto and including the serialized parameters. I.e. "http://example.com/svcmon/class.url.php?name=ferry&age=26&strip_foo=bar".

Returns:
(string) Server URL + Pathname + Scriptname + Serialized Params.

Definition at line 1044 of file tlib.php.

References getAbsoluteScriptURL(), and getParams().

TLSelfURL::getAbsolutePathURL (  ) 

Returns the absolute URL upto and including the path to the script (but not the script name itself). I.e. "http://example.com/svcmon". Does not append a trailing backslash.

Returns:
(string) Server URL + Pathname

Definition at line 970 of file tlib.php.

References getServerURL().

TLSelfURL::getAbsoluteScriptURL (  ) 

Returns the absolute URL upto and including the script name. I.e. "http://example.com/svcmon/class.url.php".

Returns:
(string) Server URL + Pathname + Scriptname.

Definition at line 992 of file tlib.php.

References getServerURL().

Referenced by getAbsoluteFullURL().

TLSelfURL::getParams ( stripVarsPrefix = null  ) 

Returns a serialized form of the parameters of the URL. I.e. : "name=ferry&age=26&strip_foo=bar". If stripVarsPrefix is set, any variable starting with $stripVarsPrefix will not be included in the serialized parameters.

Parameters:
stripVarsPrefix (string) Prefix of variables that need to be removed from the final result.
Returns:
Serialized parameters

Definition at line 1016 of file tlib.php.

Referenced by getAbsoluteFullURL(), and getRelativeFullURL().

TLSelfURL::getRelativeFullURL ( stripVarsPrefix = null  ) 

Returns the relative URL upto and including the serialized parameters. I.e. "/svcmon/class.url.php?name=ferry&age=26&strip_foo=bar". Always starts with a slash.

Returns:
(string) Pathname + Scriptname + Serialized Params.

Definition at line 1057 of file tlib.php.

References getParams(), and getRelativeScriptURL().

TLSelfURL::getRelativePathURL (  ) 

Returns the relative (to the Server URL) URL upto and including the path to the script (but not the script name itself). I.e. "/svcmon". Does not append a trailing slash. Always starts with a slash.

Returns:
(string) Pathname

Definition at line 982 of file tlib.php.

TLSelfURL::getRelativeScriptURL (  ) 

Returns the relative (to the Server URL) URL upto and including the script name. I.e. "/svcmon/class.url.php". Always starts with a slash.

Returns:
(string) Server URL + Pathname + Scriptname.

Definition at line 1003 of file tlib.php.

Referenced by getRelativeFullURL().

TLSelfURL::getServerURL (  ) 

Returns the server URL. I.e. "https://example.com". If a non-default port was used (not 80 for http or not 443 for https), the port number will be appended to the URL.

Returns:
(string) Server URL

Definition at line 956 of file tlib.php.

Referenced by getAbsolutePathURL(), and getAbsoluteScriptURL().


Member Data Documentation

TLSelfURL::$host = ""

The hostname as found in the URL

Definition at line 907 of file tlib.php.

TLSelfURL::$params = null

Any parameters that where given on the URL

Definition at line 911 of file tlib.php.

TLSelfURL::$path = ""

The full path to the script without the script name itself

Definition at line 909 of file tlib.php.

TLSelfURL::$port = ""

The port that was used to connect

Definition at line 908 of file tlib.php.

TLSelfURL::$script = ""

The script name

Definition at line 910 of file tlib.php.

TLSelfURL::$type = ""

Type of the URL (http or https)

Definition at line 906 of file tlib.php.


The documentation for this class was generated from the following file:
Generated on Sun Sep 24 22:05:25 2006 for TLib-PHP by  doxygen 1.4.7