From 4279223ced1179d434446f7f69efed4be7332774 Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 31 Dec 2012 08:57:12 -0700 Subject: 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 --- system/core/URI.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'system/core/URI.php') 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) { -- cgit v1.2.3-24-g4f1b