phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
URI Class Reference

Public Member Functions

 __construct ()
 Constructor.
 
 _fetch_uri_string ()
 Get the URI String.
 
 _set_uri_string ($str)
 Set the URI String.
 
 _filter_uri ($str)
 Filter segments for malicious characters.
 
 _explode_segments ()
 Explode the URI Segments.
 
 _reindex_segments ()
 Re-index Segments.
 
 segment ($n, $no_result=FALSE)
 Fetch a URI Segment.
 
 rsegment ($n, $no_result=FALSE)
 Fetch a URI "routed" Segment.
 
 uri_to_assoc ($n=3, $default=array())
 Generate a key value pair from the URI string.
 
 ruri_to_assoc ($n=3, $default=array())
 Identical to above only it uses the re-routed segment array.
 
 _uri_to_assoc ($n=3, $default=array(), $which='segment')
 Generate a key value pair from the URI string or Re-routed URI string.
 
 assoc_to_uri ($array)
 Generate a URI string from an associative array.
 
 slash_segment ($n, $where='trailing')
 Fetch a URI Segment and add a trailing slash.
 
 slash_rsegment ($n, $where='trailing')
 Fetch a URI Segment and add a trailing slash.
 
 _slash_segment ($n, $where='trailing', $which='segment')
 Fetch a URI Segment and add a trailing slash - helper function.
 
 segment_array ()
 Segment Array.
 
 rsegment_array ()
 Routed Segment Array.
 
 total_segments ()
 Total number of segments.
 
 total_rsegments ()
 Total number of routed segments.
 
 uri_string ()
 Fetch the entire URI string.
 
 ruri_string ()
 Fetch the entire Re-routed URI string.
 

Data Fields

 $keyval =array ()
 
 $uri_string
 
 $segments =array ()
 
 $rsegments =array ()
 
 $permitted_uri_chars ="a-z 0-9~%.:_\-"
 
 $enable_query_strings =false
 
 $uri_protocol ="AUTO"
 | 'AUTO' Default - auto detects | 'PATH_INFO' Uses the PATH_INFO | 'QUERY_STRING' Uses the QUERY_STRING | 'REQUEST_URI' Uses the REQUEST_URI | 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO
 

Private Member Functions

 _detect_uri ()
 Detects the URI.
 
 _parse_cli_args ()
 Parse cli arguments.
 

Detailed Description

Definition at line 4 of file URI.php.

Constructor & Destructor Documentation

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

@access public

Definition at line 62 of file URI.php.

Member Function Documentation

◆ _detect_uri()

_detect_uri ( )
private

Detects the URI.

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

@access private

Returns
string

Definition at line 156 of file URI.php.

◆ _explode_segments()

_explode_segments ( )

Explode the URI Segments.

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

@access private

Returns
void

Definition at line 245 of file URI.php.

◆ _fetch_uri_string()

_fetch_uri_string ( )

Get the URI String.

@access private

Returns
string

Definition at line 76 of file URI.php.

◆ _filter_uri()

_filter_uri (   $str)

Filter segments for malicious characters.

@access private

Parameters
string
Returns
string

Definition at line 220 of file URI.php.

◆ _parse_cli_args()

_parse_cli_args ( )
private

Parse cli arguments.

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

@access private

Returns
string

Definition at line 204 of file URI.php.

◆ _reindex_segments()

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

@access private

Returns
void

Definition at line 269 of file URI.php.

◆ _set_uri_string()

_set_uri_string (   $str)

Set the URI String.

@access public

Parameters
string
Returns
string

Definition at line 136 of file URI.php.

◆ _slash_segment()

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

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

@access private

Parameters
integer
string
string
Returns
string

Definition at line 487 of file URI.php.

◆ _uri_to_assoc()

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

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

@access private

Parameters
integerthe starting segment number
arrayan array of default values
stringwhich array we should use
Returns
array

Definition at line 366 of file URI.php.

◆ assoc_to_uri()

assoc_to_uri (   $array)

Generate a URI string from an associative array.

@access public

Parameters
arrayan associative array of key/values
Returns
array

Definition at line 435 of file URI.php.

◆ rsegment()

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

@access public

Parameters
integer
bool
Returns
string

Definition at line 308 of file URI.php.

◆ rsegment_array()

rsegment_array ( )

Routed Segment Array.

@access public

Returns
array

Definition at line 522 of file URI.php.

◆ ruri_string()

ruri_string ( )

Fetch the entire Re-routed URI string.

@access public

Returns
string

Definition at line 574 of file URI.php.

◆ ruri_to_assoc()

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

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

@access public

Parameters
integerthe starting segment number
arrayan array of default values
Returns
array

Definition at line 350 of file URI.php.

◆ segment()

segment (   $n,
  $no_result = FALSE 
)

Fetch a URI Segment.

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

@access public

Parameters
integer
bool
Returns
string

Definition at line 289 of file URI.php.

◆ segment_array()

segment_array ( )

Segment Array.

@access public

Returns
array

Definition at line 509 of file URI.php.

◆ slash_rsegment()

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

Fetch a URI Segment and add a trailing slash.

@access public

Parameters
integer
string
Returns
string

Definition at line 471 of file URI.php.

◆ slash_segment()

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

Fetch a URI Segment and add a trailing slash.

@access public

Parameters
integer
string
Returns
string

Definition at line 456 of file URI.php.

◆ total_rsegments()

total_rsegments ( )

Total number of routed segments.

@access public

Returns
integer

Definition at line 548 of file URI.php.

◆ total_segments()

total_segments ( )

Total number of segments.

@access public

Returns
integer

Definition at line 535 of file URI.php.

◆ uri_string()

uri_string ( )

Fetch the entire URI string.

@access public

Returns
string

Definition at line 561 of file URI.php.

◆ uri_to_assoc()

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 )

@access public

Parameters
integerthe starting segment number
arrayan array of default values
Returns
array

Definition at line 336 of file URI.php.

Field Documentation

◆ $enable_query_strings

$enable_query_strings =false

Definition at line 40 of file URI.php.

◆ $keyval

$keyval =array ()

Definition at line 13 of file URI.php.

◆ $permitted_uri_chars

$permitted_uri_chars ="a-z 0-9~%.:_\-"

Definition at line 39 of file URI.php.

◆ $rsegments

$rsegments =array ()

Definition at line 38 of file URI.php.

◆ $segments

$segments =array ()

Definition at line 29 of file URI.php.

◆ $uri_protocol

$uri_protocol ="AUTO"

| 'AUTO' Default - auto detects | 'PATH_INFO' Uses the PATH_INFO | 'QUERY_STRING' Uses the QUERY_STRING | 'REQUEST_URI' Uses the REQUEST_URI | 'ORIG_PATH_INFO' Uses the ORIG_PATH_INFO

Definition at line 49 of file URI.php.

◆ $uri_string

Definition at line 21 of file URI.php.


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