summaryrefslogtreecommitdiffstats
path: root/system/core/Router.php
diff options
context:
space:
mode:
authorJonatas Miguel <jonatas.df.miguel@gmail.com>2012-10-31 15:44:02 +0100
committerJonatas Miguel <jonatas.df.miguel@gmail.com>2012-10-31 15:44:02 +0100
commit3ccc386be4e0e1e4b3d47f1785e11d4b8613ef72 (patch)
treef1c8cd29775537b8da76143edeec5b6c8d659550 /system/core/Router.php
parenta9a1d2520493211ca35f7ab56866d0e154afc1c3 (diff)
parentf2b19fee7876708c7a7bb5cba6b7df682a9d2a53 (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Diffstat (limited to 'system/core/Router.php')
-rw-r--r--system/core/Router.php69
1 files changed, 36 insertions, 33 deletions
diff --git a/system/core/Router.php b/system/core/Router.php
index e8addf962..529cbb7c8 100644
--- a/system/core/Router.php
+++ b/system/core/Router.php
@@ -39,56 +39,56 @@
class CI_Router {
/**
- * Config class
+ * CI_Config class object
*
- * @var object
+ * @var object
*/
public $config;
/**
* List of routes
*
- * @var array
+ * @var array
*/
public $routes = array();
/**
* List of error routes
*
- * @var array
+ * @var array
*/
public $error_routes = array();
/**
* Current class name
*
- * @var string
+ * @var string
*/
public $class = '';
/**
* Current method name
*
- * @var string
+ * @var string
*/
public $method = 'index';
/**
* Sub-directory that contains the requested controller class
*
- * @var string
+ * @var string
*/
public $directory = '';
/**
* Default controller (and method if specific)
*
- * @var string
+ * @var string
*/
public $default_controller;
/**
- * Constructor
+ * Class constructor
*
* Runs the route mapping function.
*
@@ -104,9 +104,9 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Set the route mapping
+ * Set route mapping
*
- * This function determines what should be served based on the URI request,
+ * Determines what should be served based on the URI request,
* as well as any "routes" that have been set in the routing config file.
*
* @return void
@@ -179,7 +179,7 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Set the default controller
+ * Set default controller
*
* @return void
*/
@@ -213,12 +213,12 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Set the Route
+ * Set request route
*
- * This function takes an array of URI segments as
- * input, and sets the current class/method
+ * Takes an array of URI segments as input and sets the class/method
+ * to be called.
*
- * @param array
+ * @param array $segments URI segments
* @return void
*/
protected function _set_request($segments = array())
@@ -253,11 +253,12 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Validates the supplied segments.
- * Attempts to determine the path to the controller.
+ * Validate request
*
- * @param array
- * @return array
+ * Attempts validate the URI request and determine the controller path.
+ *
+ * @param array $segments URI segments
+ * @return array URI segments
*/
protected function _validate_request($segments)
{
@@ -347,9 +348,8 @@ class CI_Router {
/**
* Parse Routes
*
- * This function matches any routes that may exist in
- * the config/routes.php file against the URI to
- * determine if the class/method need to be remapped.
+ * Matches any routes that may exist in the config/routes.php file
+ * against the URI to determine if the class/method need to be remapped.
*
* @return void
*/
@@ -368,7 +368,7 @@ class CI_Router {
foreach ($this->routes as $key => $val)
{
// Convert wild-cards to RegEx
- $key = str_replace(array(':any', ':num'), array('.+', '[0-9]+'), $key);
+ $key = str_replace(array(':any', ':num'), array('[^/]+', '[0-9]+'), $key);
// Does the RegEx match?
if (preg_match('#^'.$key.'$#', $uri, $matches))
@@ -429,9 +429,9 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Set the class name
+ * Set class name
*
- * @param string
+ * @param string $class Class name
* @return void
*/
public function set_class($class)
@@ -454,9 +454,9 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Set the method name
+ * Set method name
*
- * @param string
+ * @param string $method Method name
* @return void
*/
public function set_method($method)
@@ -479,9 +479,9 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Set the directory name
+ * Set directory name
*
- * @param string
+ * @param string $dir Directory name
* @return void
*/
public function set_directory($dir)
@@ -492,7 +492,10 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Fetch the sub-directory (if any) that contains the requested controller class
+ * Fetch directory
+ *
+ * Feches the sub-directory (if any) that contains the requested
+ * controller class.
*
* @return string
*/
@@ -504,9 +507,9 @@ class CI_Router {
// --------------------------------------------------------------------
/**
- * Set the controller overrides
+ * Set controller overrides
*
- * @param array
+ * @param array $routing Route overrides
* @return void
*/
public function _set_overrides($routing)