Merge pull request #2106 from danhunsaker/feature/uri-extensibility

Improved extensibility of the URI class
diff --git a/system/core/URI.php b/system/core/URI.php
index e6f2832..fb85401 100644
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -506,23 +506,13 @@
 			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)
 		{