CI_URI =============== URI Class Parses URIs and determines routing * Class name: CI_URI * Namespace: Properties ---------- ### $keyval public array $keyval = array() List of cached URI segments * Visibility: **public** ### $uri_string public string $uri_string = '' Current URI string * Visibility: **public** ### $segments public array $segments = array() List of URI segments Starts at 1 instead of 0. * Visibility: **public** ### $rsegments public array $rsegments = array() List of routed URI segments Starts at 1 instead of 0. * Visibility: **public** ### $_permitted_uri_chars protected string $_permitted_uri_chars Permitted URI chars PCRE character group allowed in URI segments * Visibility: **protected** Methods ------- ### __construct void CI_URI::__construct() Class constructor * Visibility: **public** ### _set_uri_string void CI_URI::_set_uri_string(string $str) Set URI String * Visibility: **protected** #### Arguments * $str **string** ### _parse_request_uri string CI_URI::_parse_request_uri() Parse REQUEST_URI Will parse REQUEST_URI and automatically detect the URI from it, while fixing the query string if necessary. * Visibility: **protected** ### _parse_query_string string CI_URI::_parse_query_string() Parse QUERY_STRING Will parse QUERY_STRING and automatically detect the URI from it. * Visibility: **protected** ### _parse_argv string CI_URI::_parse_argv() Parse CLI arguments Take each command line argument and assume it is a URI segment. * Visibility: **protected** ### _remove_relative_directory string CI_URI::_remove_relative_directory($uri) Remove relative directory (. ./) and multi slashes (///) Do some final cleaning of the URI and return it, currently only used in self::_parse_request_uri() * Visibility: **protected** #### Arguments * $uri **mixed** ### filter_uri void CI_URI::filter_uri(string $str) Filter URI Filters segments for malicious characters. * Visibility: **public** #### Arguments * $str **string** ### segment mixed CI_URI::segment(integer $n, mixed $no_result) Fetch URI Segment * Visibility: **public** #### Arguments * $n **integer** - <p>Index</p> * $no_result **mixed** - <p>What to return if the segment index is not found</p> ### rsegment mixed CI_URI::rsegment(integer $n, mixed $no_result) Fetch URI "routed" Segment Returns the re-routed URI segment (assuming routing rules are used) based on the index provided. If there is no routing, will return the same result as CI_URI::segment(). * Visibility: **public** #### Arguments * $n **integer** - <p>Index</p> * $no_result **mixed** - <p>What to return if the segment index is not found</p> ### uri_to_assoc array CI_URI::uri_to_assoc(integer $n, array $default) URI to assoc Generates an associative array of URI data starting at the supplied segment index. For example, if this is your URI: example.com/user/search/name/joe/location/UK/gender/male You can use this method to generate an array with this prototype: array ( name => joe location => UK gender => male ) * Visibility: **public** #### Arguments * $n **integer** - <p>Index (default: 3)</p> * $default **array** - <p>Default values</p> ### ruri_to_assoc array CI_URI::ruri_to_assoc(integer $n, array $default) Routed URI to assoc Identical to CI_URI::uri_to_assoc(), only it uses the re-routed segment array. * Visibility: **public** #### Arguments * $n **integer** - <p>Index (default: 3)</p> * $default **array** - <p>Default values</p> ### _uri_to_assoc array CI_URI::_uri_to_assoc(integer $n, array $default, string $which) Internal URI-to-assoc Generates a key/value pair from the URI string or re-routed URI string. * Visibility: **protected** #### Arguments * $n **integer** - <p>Index (default: 3)</p> * $default **array** - <p>Default values</p> * $which **string** - <p>Array name ('segment' or 'rsegment')</p> ### assoc_to_uri string CI_URI::assoc_to_uri(array $array) Assoc to URI Generates a URI string from an associative array. * Visibility: **public** #### Arguments * $array **array** - <p>Input array of key/value pairs</p> ### slash_segment string CI_URI::slash_segment(integer $n, string $where) Slash segment Fetches an URI segment with a slash. * Visibility: **public** #### Arguments * $n **integer** - <p>Index</p> * $where **string** - <p>Where to add the slash ('trailing' or 'leading')</p> ### slash_rsegment string CI_URI::slash_rsegment(integer $n, string $where) Slash routed segment Fetches an URI routed segment with a slash. * Visibility: **public** #### Arguments * $n **integer** - <p>Index</p> * $where **string** - <p>Where to add the slash ('trailing' or 'leading')</p> ### _slash_segment string CI_URI::_slash_segment(integer $n, string $where, string $which) Internal Slash segment Fetches an URI Segment and adds a slash to it. * Visibility: **protected** #### Arguments * $n **integer** - <p>Index</p> * $where **string** - <p>Where to add the slash ('trailing' or 'leading')</p> * $which **string** - <p>Array name ('segment' or 'rsegment')</p> ### segment_array array CI_URI::segment_array() Segment Array * Visibility: **public** ### rsegment_array array CI_URI::rsegment_array() Routed Segment Array * Visibility: **public** ### total_segments integer CI_URI::total_segments() Total number of segments * Visibility: **public** ### total_rsegments integer CI_URI::total_rsegments() Total number of routed segments * Visibility: **public** ### uri_string string CI_URI::uri_string() Fetch URI string * Visibility: **public** ### ruri_string string CI_URI::ruri_string() Fetch Re-routed URI string * Visibility: **public**