summaryrefslogtreecommitdiffstats
path: root/system/libraries/URI.php
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-21 19:22:21 +0200
committeradmin <devnull@localhost>2006-09-21 19:22:21 +0200
commit05633d7348b85147a46a7396c3bee1928335fa7a (patch)
tree768d109a5094a58c135b3a59bae79c9e7d8bc8d9 /system/libraries/URI.php
parenta4d35347327c1e9a464696d153ad6f2ec4510283 (diff)
Diffstat (limited to 'system/libraries/URI.php')
-rw-r--r--system/libraries/URI.php41
1 files changed, 38 insertions, 3 deletions
diff --git a/system/libraries/URI.php b/system/libraries/URI.php
index 11562eb29..e831d9526 100644
--- a/system/libraries/URI.php
+++ b/system/libraries/URI.php
@@ -107,6 +107,41 @@ class CI_URI {
*/
function uri_to_assoc($n = 3, $default = array())
{
+ return $this->_uri_to_assoc($n, $default, 'segment');
+ }
+ /**
+ * Identical to above only it uses the re-routed segment array
+ *
+ */
+ function ruri_to_assoc($n = 3, $default = array())
+ {
+ return $this->_uri_to_assoc($n, $default, 'rsegment');
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Generate a key value pair from the URI string or Re-routed URI string
+ *
+ * @access private
+ * @param integer the starting segment number
+ * @param array an array of default values
+ * @param string which array we should use
+ * @return array
+ */
+ function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
+ {
+ if ($which == 'segment')
+ {
+ $total_segments = 'total_segments';
+ $segment_array = 'segment_array';
+ }
+ else
+ {
+ $total_segments = 'total_rsegments';
+ $segment_array = 'rsegment_array';
+ }
+
if ( ! is_numeric($n))
{
return $default;
@@ -117,7 +152,7 @@ class CI_URI {
return $this->keyval[$n];
}
- if ($this->total_segments() < $n)
+ if ($this->$total_segments() < $n)
{
if (count($default) == 0)
{
@@ -132,7 +167,7 @@ class CI_URI {
return $retval;
}
- $segments = array_slice($this->segment_array(), ($n - 1));
+ $segments = array_slice($this->$segment_array(), ($n - 1));
$i = 0;
$lastval = '';
@@ -322,7 +357,7 @@ class CI_URI {
* @access public
* @return string
*/
- function uri_rstring()
+ function ruri_string()
{
return '/'.implode('/', $this->rsegment_array()).'/';
}