Changeset 678

Show
Ignore:
Timestamp:
10/06/2007 08:19:56 PM (14 months ago)
Author:
Shadowhand
Message:

Small changes:

  • Fixed a bug in html::
  • Updated Kohana::instance() to not catch exceptions, more verbosity is good
  • Fixed a bug in View that prevented set() from working properly
  • Fixed a bug in Router that would cause the arguments to be empty when using the segment[0] shortcut
Location:
trunk/system
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/core/Kohana.php

    r675 r678  
    198198                if (self::$instance == FALSE) 
    199199                { 
     200                        // Include the Controller file 
     201                        require Router::$directory.Router::$controller.EXT; 
     202 
    200203                        // Run system.pre_controller 
    201204                        Event::run('system.pre_controller'); 
    202205 
    203                         // Include the Controller file 
    204                         require Router::$directory.Router::$controller.EXT; 
    205  
    206206                        // Set controller class name 
    207207                        $controller = ucfirst(Router::$controller).'_Controller'; 
    208208 
    209                         try 
    210                         { 
    211                                 // Load the controller 
    212                                 $controller = new $controller(); 
    213                         } 
    214                         catch (Kohana_Exception $exception) 
    215                         { 
    216                                 Kohana::show_404(); 
    217                                 return; 
    218                         } 
     209                        // Load the controller 
     210                        $controller = new $controller(); 
    219211 
    220212                        if (method_exists($controller, '_remap')) 
     
    244236                        else 
    245237                        { 
    246                                 $controller->show_404(); 
    247                         } 
    248                         if (count(Router::$arguments) > 0) 
     238                                Kohana::show_404(); 
     239                        } 
     240 
     241                        if (is_array(Router::$arguments) AND ! empty(Router::$arguments)) 
    249242                        { 
    250243                                call_user_func_array(array(Kohana::instance(), Router::$method), Router::$arguments); 
     
    254247                                call_user_func(array(Kohana::instance(), Router::$method)); 
    255248                        } 
     249 
    256250 
    257251                        // Run system.pre_controller 
  • trunk/system/helpers/html.php

    r644 r678  
    144144        } 
    145145 
    146         public static function stylesheet($style, $index = FALSE, $media = FALSE) 
     146        public static function stylesheet($style, $media = FALSE) 
    147147        { 
    148148                $compiled = ''; 
     
    152152                        foreach($style as $name) 
    153153                        { 
    154                                 $compiled .= self::stylesheet($name, $index, $media)."\n"; 
     154                                $compiled .= self::stylesheet($name, $media)."\n"; 
    155155                        } 
    156156                } 
     
    159159                        $media = ($media == FALSE) ? '' : ' media="'.$media.'"'; 
    160160 
    161                         $compiled = '<link rel="stylesheet" href="'.url::base($index).$style.'.css"'.$media.' />'; 
     161                        $compiled = '<link rel="stylesheet" href="'.url::base(TRUE).$style.'.css"'.$media.' />'; 
    162162                } 
    163163 
     
    173173         * @return string 
    174174         */ 
    175         public static function script($script, $index = FALSE) 
     175        public static function script($script) 
    176176        { 
    177177                $compiled = ''; 
     
    186186                else 
    187187                { 
    188                         $compiled = '<script type="text/javascript" src="'.url::base($index).$script.'.js"></script>'; 
     188                        $compiled = '<script type="text/javascript" src="'.url::base(TRUE).$script.'.js"></script>'; 
    189189                } 
    190190 
  • trunk/system/libraries/Router.php

    r644 r678  
    197197                        self::$controller = self::$rsegments[0]; 
    198198                        self::$method     = isset(self::$rsegments[1]) ? self::$rsegments[1] : 'index'; 
     199                        self::$arguments  = isset(self::$rsegments[2]) ? array_slice(self::$rsegments, 2) : array(); 
    199200                } 
    200201                else 
  • trunk/system/libraries/View.php

    r673 r678  
    9090        } 
    9191 
    92         public function & __get($name) 
     92        public function __get($name) 
    9393        { 
    94                 if (isset($this->data)) 
    95                         return $this->data; 
    96  
    97                 return FALSE; 
     94                return empty($this->data[$name]) ? NULL : $this->data[$name]; 
    9895        } 
    9996