Show
Ignore:
Timestamp:
11/11/2007 12:59:10 AM (13 months ago)
Author:
Shadowhand
Message:

Small changes:

  • Hooks are now loaded *after* system events have been added
  • Hook loading changed to use Kohana::list_files(), rather than manually finding them (DRY!)
  • Kohana::auto_load() now uses require_once() instead of require(), to prevent duplicate file loads that will cause E_FATAL errors
  • Kohana::auto_load() will no longer try to auto-extend classes that end with _Core (eg: "class Special_Router extends Router_Core {}" will no longer try to auto-load "Router_Core_Core")
  • Kohana::key_string() will handle numerically indexed key strings now (thanks Armen!)
  • Added Event::add_before() and Event::add_after(), to add events before and after a given event, and supporting private function Event::insert_event()
  • Cleaned up Event::add() to use empty() instead of == FALSE
  • View::construct() uses array_merge($this->data, $data) instead of doing a foreach($data) (Duh!)
  • View::set() will now handle an associative array (Duh!)
  • Router::setup() split into Router::find_uri() and Router::setup(), for better Event extensibility
  • Cleaned up Router::setup() to use self::$current_uri instead of self::$segments as the default URI location

Phew!

Files:
1 modified

Legend:

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

    r1047 r1084  
    118118                setlocale(LC_ALL, Config::item('locale.language').'.UTF-8'); 
    119119 
     120                // Enable Kohana routing 
     121                Event::add('system.routing', array('Router', 'find_uri')); 
     122                Event::add('system.routing', array('Router', 'setup')); 
     123 
     124                // Enable Kohana controller initialization 
     125                Event::add('system.execute', array('Kohana', 'instance')); 
     126 
     127                // Enable Kohana output handling 
     128                Event::add('system.shutdown', array('Kohana', 'display')); 
     129 
    120130                if ($hooks = Config::item('hooks.enable')) 
    121131                { 
    122                         // All hooks are enabled, we must build an array of filenames 
    123132                        if ( ! is_array($hooks)) 
    124133                        { 
    125                                 $hooks = array(); 
    126                                 foreach(Config::include_paths() as $path) 
    127                                 { 
    128                                         // Find all the hooks in each path 
    129                                         if ($files = glob($path.'hooks/*'.EXT)) 
    130                                         { 
    131                                                 $hooks = array_merge($hooks, $files); 
    132                                         } 
    133                                 } 
     134                                // All hooks are enabled, find them 
     135                                $hooks = Kohana::list_files('hooks'); 
    134136                        } 
    135137 
     
    143145                        } 
    144146                } 
    145  
    146                 // Enable Kohana routing 
    147                 Event::add('system.routing', array('Router', 'setup')); 
    148  
    149                 // Enable Kohana controller initialization 
    150                 Event::add('system.execute', array('Kohana', 'instance')); 
    151  
    152                 // Enable Kohana output handling 
    153                 Event::add('system.shutdown', array('Kohana', 'display')); 
    154147 
    155148                if (Config::item('log.threshold') > 0) 
     
    491484                } 
    492485 
    493                 require self::find_file($type, $file, TRUE); 
     486                require_once self::find_file($type, $file, TRUE); 
    494487 
    495488                if ($type == 'libraries') 
     
    499492                                require $extension; 
    500493                        } 
    501                         else 
     494                        elseif (substr($class, -5) !== '_Core') 
    502495                        { 
    503496                                eval('class '.$class.' extends '.$class.'_Core { }'); 
     
    686679        { 
    687680                // No array to search 
    688                 if (empty($keys) OR empty($array)) 
     681                if ((empty($keys) AND is_array($keys)) OR (empty($array) AND is_array($array))) 
    689682                        return; 
    690683