Properties

$keyval

$keyval : array

List of cached uri segments

Type

array

$uri_string

$uri_string : string

Current uri string

Type

string

$segments

$segments : array

List of uri segments

Type

array

$rsegments

$rsegments : array

Re-indexed list of uri segments Starts at 1 instead of 0

Type

array

Methods

__construct()

__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.

_fetch_uri_string()

_fetch_uri_string() : string

Get the URI String

Returns

string

_set_uri_string()

_set_uri_string(  $str) : string

Set the URI String

Parameters

$str

Returns

string

_filter_uri()

_filter_uri(  $str) : string

Filter segments for malicious characters

Parameters

$str

Returns

string

_remove_url_suffix()

_remove_url_suffix() : void

Remove the suffix from the URL if needed

_explode_segments()

_explode_segments() : void

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

_reindex_segments()

_reindex_segments() : void

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.

segment()

segment(  $n,   $no_result = FALSE) : string

Fetch a URI Segment

This function returns the URI segment based on the number provided.

Parameters

$n
$no_result

Returns

string

rsegment()

rsegment(  $n,   $no_result = FALSE) : string

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

Parameters

$n
$no_result

Returns

string

uri_to_assoc()

uri_to_assoc(  $n = 3,   $default = array()) : 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 )

Parameters

$n
$default

Returns

array

ruri_to_assoc()

ruri_to_assoc(  $n = 3,   $default = array()) : array

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

Parameters

$n
$default

Returns

array

_uri_to_assoc()

_uri_to_assoc(  $n = 3,   $default = array(),   $which = 'segment') : array

Generate a key value pair from the URI string or Re-routed URI string

Parameters

$n
$default
$which

Returns

array

assoc_to_uri()

assoc_to_uri(  $array) : array

Generate a URI string from an associative array

Parameters

$array

Returns

array

slash_segment()

slash_segment(  $n,   $where = 'trailing') : string

Fetch a URI Segment and add a trailing slash

Parameters

$n
$where

Returns

string

slash_rsegment()

slash_rsegment(  $n,   $where = 'trailing') : string

Fetch a URI Segment and add a trailing slash

Parameters

$n
$where

Returns

string

_slash_segment()

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

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

Parameters

$n
$where
$which

Returns

string

segment_array()

segment_array() : array

Segment Array

Returns

array

rsegment_array()

rsegment_array() : array

Routed Segment Array

Returns

array

total_segments()

total_segments() : integer

Total number of segments

Returns

integer

total_rsegments()

total_rsegments() : integer

Total number of routed segments

Returns

integer

uri_string()

uri_string() : string

Fetch the entire URI string

Returns

string

ruri_string()

ruri_string() : string

Fetch the entire Re-routed URI string

Returns

string

_detect_uri()

_detect_uri() : string

Detects the URI

This function will detect the URI automatically and fix the query string if necessary.

Returns

string

_parse_cli_args()

_parse_cli_args() : string

Parse cli arguments

Take each command line argument and assume it is a URI segment.

Returns

string