My Project
 All Data Structures Namespaces Functions Variables
Public Member Functions | Data Fields
CI_URI Class Reference

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

Constructor & Destructor Documentation

__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

Member Function Documentation

_explode_segments ( )

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

private

Returns
void
_fetch_uri_string ( )

Get the URI String

private

Returns
string
_filter_uri (   $str)

Filter segments for malicious characters

private

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

Returns
void
_remove_url_suffix ( )

Remove the suffix from the URL if needed

private

Returns
void
_set_uri_string (   $str)

Set the URI String

public

Parameters
string
Returns
string
_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
_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
integerthe starting segment number
arrayan array of default values
stringwhich array we should use
Returns
array
assoc_to_uri (   $array)

Generate a URI string from an associative array

public

Parameters
arrayan associative array of key/values
Returns
array
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
rsegment_array ( )

Routed Segment Array

public

Returns
array
ruri_string ( )

Fetch the entire Re-routed URI string

public

Returns
string
ruri_to_assoc (   $n = 3,
  $default = array() 
)

Identical to above only it uses the re-routed segment array

public

Parameters
integerthe starting segment number
arrayan array of default values
Returns
array
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
segment_array ( )

Segment Array

public

Returns
array
slash_rsegment (   $n,
  $where = 'trailing' 
)

Fetch a URI Segment and add a trailing slash

public

Parameters
integer
string
Returns
string
slash_segment (   $n,
  $where = 'trailing' 
)

Fetch a URI Segment and add a trailing slash

public

Parameters
integer
string
Returns
string
total_rsegments ( )

Total number of routed segments

public

Returns
integer
total_segments ( )

Total number of segments

public

Returns
integer
uri_string ( )

Fetch the entire URI string

public

Returns
string
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
integerthe starting segment number
arrayan array of default values
Returns
array

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