Skip to content

Commit

Permalink
Fixed _call_hook in CodeIgniter class and test
Browse files Browse the repository at this point in the history
Signed-off-by: dchill42 <dchill42@gmail.com>
  • Loading branch information
dchill42 committed Sep 25, 2012
1 parent 3fe0080 commit bbd3b98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions system/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ protected function _load_base()

// Load the hooks class and call pre_system (depends on Config)
$this->load_core_class('Hooks');
$this->hooks->_call_hook('pre_system');
$this->hooks->call_hook('pre_system');

// Load Loader as 'load' (depends on Config)
$this->load_core_class('Loader', 'load');
Expand Down Expand Up @@ -654,7 +654,7 @@ protected function _load_routing()
}

// Is there a valid cache file? If so, we're done...
if ($this->hooks->_call_hook('cache_override') === FALSE && $this->output->_display_cache() === TRUE)
if ($this->hooks->call_hook('cache_override') === FALSE && $this->output->_display_cache() === TRUE)
{
$this->_display_cache = TRUE;
static::_status_exit();
Expand Down Expand Up @@ -697,7 +697,7 @@ protected function _load_support()
protected function _run_controller()
{
// Call pre_controller hook
$this->hooks->_call_hook('pre_controller');
$this->hooks->call_hook('pre_controller');

// Get the parsed route and identify class, method, and arguments
$rtr_class = get_class($this->router);
Expand All @@ -719,7 +719,7 @@ protected function _run_controller()
$this->routed = $this->$class;

// Call post_controller_constructor hook
$this->hooks->_call_hook('post_controller_constructor');
$this->hooks->call_hook('post_controller_constructor');

if ($this->call_controller($class, $method, $args) == FALSE)
{
Expand Down Expand Up @@ -758,17 +758,17 @@ protected function _finalize()
// Call post_controller hook unless we're displaying a cache
if ( ! $this->_display_cache)
{
$this->hooks->_call_hook('post_controller');
$this->hooks->call_hook('post_controller');
}

// Send the final rendered output to the browser
if ($this->hooks->_call_hook('display_override') === FALSE && isset($this->output))
if ($this->hooks->call_hook('display_override') === FALSE && isset($this->output))
{
$this->output->_display();
}

// Call post_system hook
$this->hooks->_call_hook('post_system');
$this->hooks->call_hook('post_system');
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/codeigniter/core/CodeIgniter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public function test_load_base()
$classes = array(
'Benchmark' => array('methods' => array('mark($a)' => '$this->'.$marks.'[] = $a;')),
'Config' => array('methods' => array('get($a, $b)' => 'return TRUE;')),
'Hooks' => array('methods' => array('_call_hook($a)' => '$this->'.$hooks.'[] = $a; return FALSE;')),
'Hooks' => array('methods' => array('call_hook($a)' => '$this->'.$hooks.'[] = $a; return FALSE;')),
'Loader' => array('obj' => 'load')
);
$names = $this->_create_core($pre, $prop, $classes);
Expand Down Expand Up @@ -338,7 +338,7 @@ public function test_load_routing()
// The order here establishes the sequence that will be checked below
// We include Hooks first, as it was already loaded and is called in routing
$classes = array(
'Hooks' => array('methods' => array('_call_hook($a)' => '$this->'.$hooks.'[] = $a; return FALSE;')),
'Hooks' => array('methods' => array('call_hook($a)' => '$this->'.$hooks.'[] = $a; return FALSE;')),
'Utf8' => array(),
'URI' => array(),
'Output' => array('methods' => array('_display_cache()' => 'return FALSE;')),
Expand Down Expand Up @@ -396,7 +396,7 @@ public function test_load_cache()
// Create core classes in VFS
// This time, _display_cache will return TRUE as if it displayed the cache
$classes = array(
'Hooks' => array('methods' => array('_call_hook($a)' => 'return FALSE;')),
'Hooks' => array('methods' => array('call_hook($a)' => 'return FALSE;')),
'Utf8' => array(),
'URI' => array(),
'Output' => array('methods' => array('_display_cache()' => 'return TRUE;')),
Expand Down Expand Up @@ -706,7 +706,7 @@ private function _create_run_core($pre, $prop, $route, $marks = FALSE, $hooks =

// Create Hooks with optional hook tracking
$code = $hooks ? '$this->'.$hooks.'[] = $a; ' : '';
$this->_create_core($pre, $prop, 'Hooks', '', array('_call_hook($a)' => $code.'return FALSE;'));
$this->_create_core($pre, $prop, 'Hooks', '', array('call_hook($a)' => $code.'return FALSE;'));

// Create Loader with a simple controller loader to instantiate our class
// at the right time
Expand Down

0 comments on commit bbd3b98

Please sign in to comment.