Public Member Functions | |
__construct () | |
_fetch_uri_string () | |
_set_uri_string ($str) | |
_filter_uri ($str) | |
_remove_url_suffix () | |
_explode_segments () | |
_reindex_segments () | |
segment ($n, $no_result=FALSE) | |
rsegment ($n, $no_result=FALSE) | |
uri_to_assoc ($n=3, $default=array()) | |
ruri_to_assoc ($n=3, $default=array()) | |
_uri_to_assoc ($n=3, $default=array(), $which= 'segment') | |
assoc_to_uri ($array) | |
slash_segment ($n, $where= 'trailing') | |
slash_rsegment ($n, $where= 'trailing') | |
_slash_segment ($n, $where= 'trailing', $which= 'segment') | |
segment_array () | |
rsegment_array () | |
total_segments () | |
total_rsegments () | |
uri_string () | |
ruri_string () | |
Data Fields | |
$keyval = array() | |
$uri_string | |
$segments = array() | |
$rsegments = array() | |
__construct | ( | ) |
Constructor
Simply globalizes the $RTR object. The front loads the Router class early on so it's not available normally as other classes are.
public
_explode_segments | ( | ) |
Explode the URI Segments. The individual segments will be stored in the $this->segments array.
private
_fetch_uri_string | ( | ) |
Get the URI String
private
_filter_uri | ( | $str) |
Filter segments for malicious characters
private
string |
_reindex_segments | ( | ) |
Re-index Segments
This function re-indexes the $this->segment array so that it starts at 1 rather than 0. Doing so makes it simpler to use functions like $this->uri->segment(n) since there is a 1:1 relationship between the segment array and the actual segments.
private
_remove_url_suffix | ( | ) |
Remove the suffix from the URL if needed
private
_set_uri_string | ( | $str) |
Set the URI String
public
string |
_slash_segment | ( | $n, | |
$where = 'trailing' , |
|||
$which = 'segment' |
|||
) |
Fetch a URI Segment and add a trailing slash - helper function
private
integer | |
string | |
string |
_uri_to_assoc | ( | $n = 3 , |
|
$default = array() , |
|||
$which = 'segment' |
|||
) |
Generate a key value pair from the URI string or Re-routed URI string
private
integer | the starting segment number |
array | an array of default values |
string | which array we should use |
assoc_to_uri | ( | $array) |
Generate a URI string from an associative array
public
array | an associative array of key/values |
rsegment | ( | $n, | |
$no_result = FALSE |
|||
) |
Fetch a URI "routed" Segment
This function returns the re-routed URI segment (assuming routing rules are used) based on the number provided. If there is no routing this function returns the same result as $this->segment()
public
integer | |
bool |
rsegment_array | ( | ) |
Routed Segment Array
public
ruri_string | ( | ) |
Fetch the entire Re-routed URI string
public
ruri_to_assoc | ( | $n = 3 , |
|
$default = array() |
|||
) |
Identical to above only it uses the re-routed segment array
public
integer | the starting segment number |
array | an array of default values |
segment | ( | $n, | |
$no_result = FALSE |
|||
) |
Fetch a URI Segment
This function returns the URI segment based on the number provided.
public
integer | |
bool |
segment_array | ( | ) |
Segment Array
public
slash_rsegment | ( | $n, | |
$where = 'trailing' |
|||
) |
Fetch a URI Segment and add a trailing slash
public
integer | |
string |
slash_segment | ( | $n, | |
$where = 'trailing' |
|||
) |
Fetch a URI Segment and add a trailing slash
public
integer | |
string |
total_rsegments | ( | ) |
Total number of routed segments
public
total_segments | ( | ) |
Total number of segments
public
uri_string | ( | ) |
Fetch the entire URI string
public
uri_to_assoc | ( | $n = 3 , |
|
$default = array() |
|||
) |
Generate a key value pair from the URI string
This function generates and associative array of URI data starting at the supplied segment. For example, if this is your URI:
example.com/user/search/name/joe/location/UK/gender/male
You can use this function to generate an array with this prototype:
array ( name => joe location => UK gender => male )
public
integer | the starting segment number |
array | an array of default values |