Changeset 1249
- Timestamp:
- 11/23/2007 04:14:42 PM (11 months ago)
- Location:
- trunk/system
- Files:
-
- 5 modified
-
core/Event.php (modified) (1 diff)
-
core/Kohana.php (modified) (5 diffs)
-
libraries/Controller.php (modified) (2 diffs)
-
libraries/Encrypt.php (modified) (1 diff)
-
libraries/View.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/core/Event.php
r1230 r1249 260 260 public static function run($name, & $data = NULL) 261 261 { 262 if ($name == FALSE )262 if ($name == FALSE OR empty(self::$events[$name])) 263 263 return FALSE; 264 264 -
trunk/system/core/Kohana.php
r1230 r1249 186 186 Router::$method = '_remap'; 187 187 } 188 elseif (isset($methods[Router::$method]) AND Router::$method != 'kohana_include_view') 189 { 190 /** 191 * Do nothing. Exciting! Honestly, I am surprised having only 192 * a comment here works. 193 */ 188 elseif (isset($methods[Router::$method]) AND substr(Router::$method, 0, 1) != '_') 189 { 190 // A valid route has been found, and nothing needs to be done. 191 // Amazing that having nothing inside the statment still works. 194 192 } 195 193 elseif (method_exists($controller, '_default')) … … 217 215 ); 218 216 219 // Call the controller method 220 if (is_array(Router::$arguments) AND ! empty(Router::$arguments)) 221 { 222 call_user_func_array(array($controller, Router::$method), Router::$arguments); 217 // Run system.post_controller_constructor 218 Event::run('system.post_controller_constructor'); 219 220 // Controller method name, used for calling 221 $method = Router::$method; 222 223 if (empty(Router::$arguments)) 224 { 225 // Call the controller method with no arguments 226 $controller->$method(); 223 227 } 224 228 else 225 229 { 226 call_user_func(array($controller, Router::$method)); 227 } 228 229 // Run system.pre_controller 230 // Manually call the controller for up to 4 arguments. Why? Because 231 // call_user_func_array is ~3 times slower than direct method calls. 232 switch(count(Router::$arguments)) 233 { 234 case 1: 235 $controller->$method(Router::$arguments[0]); 236 break; 237 case 2: 238 $controller->$method(Router::$arguments[0], Router::$arguments[1]); 239 break; 240 case 3: 241 $controller->$method(Router::$arguments[0], Router::$arguments[1], Router::$arguments[2]); 242 break; 243 case 4: 244 $controller->$method(Router::$arguments[0], Router::$arguments[1], Router::$arguments[2], Router::$arguments[3]); 245 break; 246 default: 247 // Resort to using call_user_func_array for many segments 248 call_user_func_array(array($controller, $method), Router::$arguments); 249 break; 250 } 251 } 252 253 // Run system.post_controller 230 254 Event::run('system.post_controller'); 231 255 } … … 467 491 case 'Controller': 468 492 $type = 'controllers'; 469 $file = substr($class, 0, -11); 493 // Lowercase filename 494 $file = strtolower(substr($class, 0, -11)); 470 495 break; 471 496 case 'Model': 472 497 $type = 'models'; 473 $file = substr($class, 0, -6); 474 // Models are always lowercase 475 $file = strtolower($file); 498 // Lowercase filename 499 $file = strtolower(substr($class, 0, -6)); 476 500 break; 477 501 case 'Driver': … … 488 512 } 489 513 514 // Load the requested file 490 515 require_once self::find_file($type, $file, TRUE); 491 516 … … 525 550 526 551 $search = $directory.'/'.$filename; 527 $hash = md5($search);552 $hash = sha1($search); 528 553 529 554 if (isset($found[$hash])) -
trunk/system/libraries/Controller.php
r1230 r1249 30 30 31 31 /** 32 * Method: kohana_include_view 33 * Includes a View within the controller scope. 32 * Includes a View within the controller scope. 34 33 * 35 34 * Parameters: … … 40 39 * Output of view file 41 40 */ 42 public function kohana_include_view($kohana_view_filename, $kohana_input_data)41 public function _kohana_load_view($kohana_view_filename, $kohana_input_data) 43 42 { 44 43 if ($kohana_view_filename == '') -
trunk/system/libraries/Encrypt.php
r1230 r1249 40 40 41 41 // Different random seeds must be used for Windows and UNIX 42 $rand = (strpos(PHP_OS, 'WIN') !== FALSE) ? MCRYPT_RAND : MCRYPT_DEV_RANDOM;42 $rand = (strpos(PHP_OS, 'WIN') === FALSE) ? MCRYPT_DEV_RANDOM : MCRYPT_RAND; 43 43 44 44 // Create an initialization vector -
trunk/system/libraries/View.php
r1230 r1249 140 140 { 141 141 // Load the view in the controller for access to $this 142 $output = Kohana::instance()-> kohana_include_view($this->kohana_filename, $this->data);142 $output = Kohana::instance()->_kohana_load_view($this->kohana_filename, $this->data); 143 143 144 144 // Pass the output through the user defined renderer
