CI_URI Class Reference

List of all members.

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()


Member Function Documentation

CI_URI::_explode_segments (  ) 

Explode the URI Segments. The individual segments will be stored in the $this->segments array.

private

Returns:
void

CI_URI::_fetch_uri_string (  ) 

Get the URI String

private

Returns:
string

CI_URI::_filter_uri ( str  ) 

Filter segments for malicious characters

private

Parameters:
string 
Returns:
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

Returns:
string

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

Returns:
void

CI_URI::_remove_url_suffix (  ) 

Remove the suffix from the URL if needed

private

Returns:
void

CI_URI::_slash_segment ( n,
where = 'trailing',
which = 'segment' 
)

Fetch a URI Segment and add a trailing slash - helper function

private

Parameters:
integer 
string 
string 
Returns:
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

Parameters:
integer the starting segment number
array an array of default values
string which array we should use
Returns:
array

CI_URI::assoc_to_uri ( array  ) 

Generate a URI string from an associative array

public

Parameters:
array an associative array of key/values
Returns:
array

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

Parameters:
integer 
bool 
Returns:
string

CI_URI::rsegment_array (  ) 

Routed Segment Array

public

Returns:
array

CI_URI::ruri_string (  ) 

Fetch the entire Re-routed URI string

public

Returns:
string

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

Parameters:
integer 
bool 
Returns:
string

CI_URI::segment_array (  ) 

Segment Array

public

Returns:
array

CI_URI::slash_rsegment ( n,
where = 'trailing' 
)

Fetch a URI Segment and add a trailing slash

public

Parameters:
integer 
string 
Returns:
string

CI_URI::slash_segment ( n,
where = 'trailing' 
)

Fetch a URI Segment and add a trailing slash

public

Parameters:
integer 
string 
Returns:
string

CI_URI::total_rsegments (  ) 

Total number of routed segments

public

Returns:
integer

CI_URI::total_segments (  ) 

Total number of segments

public

Returns:
integer

CI_URI::uri_string (  ) 

Fetch the entire URI string

public

Returns:
string

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

Parameters:
integer the starting segment number
array an array of default values
Returns:
array


Member Data Documentation

CI_URI::$keyval = array()

CI_URI::$rsegments = array()

CI_URI::$segments = array()

CI_URI::$uri_string


The documentation for this class was generated from the following file:

Generated on Sun Nov 16 16:09:18 2008 for CodeIgniter by  doxygen 1.5.7.1