Public Member Functions | |
CI_URI () | |
_fetch_uri_string () | |
_parse_request_uri () | |
_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 () | |
Public Attributes | |
$keyval = array() | |
$uri_string | |
$segments = array() | |
$rsegments = array() |
CI_URI::_explode_segments | ( | ) |
Explode the URI Segments. The individual segments will be stored in the $this->segments array.
private
CI_URI::_fetch_uri_string | ( | ) |
Get the URI String
private
CI_URI::_filter_uri | ( | $ | str | ) |
Filter segments for malicious characters
private
string |
CI_URI::_parse_request_uri | ( | ) |
Parse the REQUEST_URI
Due to the way REQUEST_URI works it usually contains path info that makes it unusable as URI data. We'll trim off the unnecessary data, hopefully arriving at a valid URI that we can use.
private
CI_URI::_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
CI_URI::_remove_url_suffix | ( | ) |
Remove the suffix from the URL if needed
private
CI_URI::_slash_segment | ( | $ | n, | |
$ | where = 'trailing' , |
|||
$ | which = 'segment' | |||
) |
Fetch a URI Segment and add a trailing slash - helper function
private
integer | ||
string | ||
string |
CI_URI::_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 |
CI_URI::assoc_to_uri | ( | $ | array | ) |
Generate a URI string from an associative array
public
array | an associative array of key/values |
CI_URI::CI_URI | ( | ) |
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
CI_URI::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 |
CI_URI::rsegment_array | ( | ) |
Routed Segment Array
public
CI_URI::ruri_string | ( | ) |
Fetch the entire Re-routed URI string
public
CI_URI::ruri_to_assoc | ( | $ | n = 3 , |
|
$ | default = array() | |||
) |
Identical to above only it uses the re-routed segment array
CI_URI::segment | ( | $ | n, | |
$ | no_result = FALSE | |||
) |
Fetch a URI Segment
This function returns the URI segment based on the number provided.
public
integer | ||
bool |
CI_URI::segment_array | ( | ) |
Segment Array
public
CI_URI::slash_rsegment | ( | $ | n, | |
$ | where = 'trailing' | |||
) |
Fetch a URI Segment and add a trailing slash
public
integer | ||
string |
CI_URI::slash_segment | ( | $ | n, | |
$ | where = 'trailing' | |||
) |
Fetch a URI Segment and add a trailing slash
public
integer | ||
string |
CI_URI::total_rsegments | ( | ) |
Total number of routed segments
public
CI_URI::total_segments | ( | ) |
Total number of segments
public
CI_URI::uri_string | ( | ) |
Fetch the entire URI string
public
CI_URI::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 |
CI_URI::$keyval = array() |
CI_URI::$rsegments = array() |
CI_URI::$segments = array() |
CI_URI::$uri_string |