summaryrefslogtreecommitdiffstats
path: root/system/core/URI.php
diff options
context:
space:
mode:
authorDaniel Hunsaker <danhunsaker@gmail.com>2012-12-31 16:57:12 +0100
committerDaniel Hunsaker <danhunsaker@gmail.com>2012-12-31 17:20:38 +0100
commit4279223ced1179d434446f7f69efed4be7332774 (patch)
tree47273566762c7237b97171ab14e036682b031baf /system/core/URI.php
parent88257ce618483e4477cbfed0e2f0b4c429533e09 (diff)
Improved extensibility of the URI class by modifying `_uri_assoc()` to (1) not force a specific list of valid options for `$which`, and (2) build the `$segment_array` and `$total_segments` dynamically regardless of the contents of `$which`.
Signed-off-by: Daniel Hunsaker <danhunsaker@gmail.com>
Diffstat (limited to 'system/core/URI.php')
-rw-r--r--system/core/URI.php14
1 files changed, 2 insertions, 12 deletions
diff --git a/system/core/URI.php b/system/core/URI.php
index 900472b61..bb292c224 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -506,23 +506,13 @@ class CI_URI {
return $default;
}
- in_array($which, array('segment', 'rsegment'), TRUE) OR $which = 'segment';
-
if (isset($this->keyval[$which], $this->keyval[$which][$n]))
{
return $this->keyval[$which][$n];
}
- if ($which === 'segment')
- {
- $total_segments = 'total_segments';
- $segment_array = 'segment_array';
- }
- else
- {
- $total_segments = 'total_rsegments';
- $segment_array = 'rsegment_array';
- }
+ $total_segments = "total_{$which}s";
+ $segment_array = "{$which}_array";
if ($this->$total_segments() < $n)
{