Changeset 1449 for trunk/system/libraries/URI.php
- Timestamp:
- 12/07/2007 03:04:05 PM (13 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/URI.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/URI.php
r1230 r1449 126 126 127 127 /** 128 * Method: rsegment_array 129 * Returns an array containing all the re-routed URI segments. 130 * 131 * Parameters: 132 * offset - rsegment offset 133 * associative - return an associative array 134 * 135 * Returns: 136 * Array of re-routed URI segments 137 */ 138 public function rsegment_array($offset = 0, $associative = FALSE) 139 { 140 $segment_array = self::$rsegments; 141 array_unshift($segment_array, 0); 142 $segment_array = array_slice($segment_array, $offset + 1, $this->total_segments(), TRUE); 143 144 if ( ! $associative) 145 return $segment_array; 146 147 $segment_array_assoc = array(); 148 149 foreach (array_chunk($segment_array, 2) as $pair) 150 { 151 $segment_array_assoc[$pair[0]] = isset($pair[1]) ? $pair[1] : ''; 152 } 153 154 return $segment_array_assoc; 155 } 156 157 /** 128 158 * Method: string 129 159 * Returns the complete URI as a string. … … 136 166 return self::$current_uri; 137 167 } 138 168 169 /** 170 * Method: __toString 171 * Magic method for converting an object to a string. 172 * 173 * Returns: 174 * Full URI as string 175 */ 139 176 public function __toString() 140 177 { … … 152 189 { 153 190 return count(self::$segments); 191 } 192 193 /** 194 * Method: total_rsegments 195 * Returns the total number of re-routed URI segments. 196 * 197 * Returns: 198 * Total number of re-routed URI segments 199 */ 200 public function total_rsegments() 201 { 202 return count(self::$rsegments); 154 203 } 155 204 … … 169 218 } 170 219 220 /** 221 * Method: last_rsegment 222 * Returns the last re-routed URI segment. 223 * 224 * Returns: 225 * Last re-routed URI segment 226 */ 227 public function last_rsegment($default = FALSE) 228 { 229 if ($this->total_rsegments() < 1) 230 return $default; 231 232 return end(self::$rsegments); 233 } 234 171 235 } // End URI Class
