Changeset 444
- Timestamp:
- 08/29/2007 02:38:12 PM (15 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/URI.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/URI.php
r412 r444 3 3 class URI_Core extends Router { 4 4 5 public function segment($index = 1) 5 /** 6 * Retrieve a specific URI segment 7 * 8 * @access public 9 * @param int 10 * @param mixed 11 * @return mixed 12 */ 13 public function segment($index = 1, $default = FALSE) 6 14 { 7 15 $index = (int) $index - 1; 8 16 9 return isset(self::$segments[$index]) ? self::$segments[$index] : FALSE;17 return isset(self::$segments[$index]) ? self::$segments[$index] : $default; 10 18 } 11 19 20 /** 21 * Returns an array containing all the URI segments 22 * 23 * @access public 24 * @return array 25 */ 12 26 public function segment_array() 13 27 { … … 23 37 } 24 38 39 /** 40 * Returns the complete URI as a string 41 * 42 * @access public 43 * @return string 44 */ 25 45 public function string() 26 46 { 27 47 return implode('/', self::$segments); 28 48 } 49 50 /** 51 * Returns the total number of URI segments 52 * 53 * @access public 54 * @return integer 55 */ 56 public function total_segments() 57 { 58 return count(self::$segments); 59 } 29 60 30 61 } // End URI Class
