Changeset 3371

Show
Ignore:
Timestamp:
08/27/2008 06:04:33 PM (3 months ago)
Author:
Shadowhand
Message:

Follow up to r3366, :controller and :method params will now replace slashes with underscores, which allows multiple segments to be used as the controller or method name, eg (for an admin route):

':controller/:method/:id'
'regex' => array('controller' => 'admin/[a-z]+')

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/classes/router.php

    r3368 r3371  
    2525         * 
    2626         * [ref-esr]: http://docs.kohanaphp.com/events/system.routing 
     27         * 
    2728         * @return  boolean 
    2829         */ 
     
    8182                                                } 
    8283 
    83                                                 if (isset($route[$key])) 
     84                                                if ($key !== 'controller' AND $key !== 'method' AND isset($route[$key])) 
    8485                                                { 
    8586                                                        // Add the value to the arguments 
     
    9091 
    9192                                // Set controller name 
    92                                 self::$controller = $route['controller']; 
     93                                self::$controller = str_replace('/', '_', $route['controller']); 
    9394 
    9495                                if (isset($route['method'])) 
    9596                                { 
    9697                                        // Set controller method 
    97                                         self::$method = $route['method']; 
     98                                        self::$method = str_replace('/', '_', $route['method']); 
    9899                                } 
    99100                                else