From f9938a2cf9af2341b1f44e6c465852405fc15897 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 22:10:47 +0200 Subject: Improve core Hooks & Lang libraries --- system/core/Hooks.php | 41 ++++++++++++++--------------------------- system/core/Lang.php | 26 +++++++++----------------- 2 files changed, 23 insertions(+), 44 deletions(-) (limited to 'system') diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 174adcb19..e1ac58e6e 100755 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -1,13 +1,13 @@ -_initialize(); - log_message('debug', "Hooks Class Initialized"); + log_message('debug', 'Hooks Class Initialized'); } // -------------------------------------------------------------------- @@ -74,24 +70,20 @@ class CI_Hooks { /** * Initialize the Hooks Preferences * - * @access private * @return void */ - function _initialize() + private function _initialize() { $CFG =& load_class('Config', 'core'); // If hooks are not enabled in the config file // there is nothing else to do - if ($CFG->item('enable_hooks') == FALSE) { return; } // Grab the "hooks" definition file. - // If there are no hooks, we're done. - if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); @@ -101,7 +93,7 @@ class CI_Hooks { include(APPPATH.'config/hooks.php'); } - + // If there are no hooks, we're done. if ( ! isset($hook) OR ! is_array($hook)) { return; @@ -116,13 +108,12 @@ class CI_Hooks { /** * Call Hook * - * Calls a particular hook + * Calls a particular hook. Called by CodeIgniter.php. * - * @access private * @param string the hook name * @return mixed */ - function _call_hook($which = '') + public function _call_hook($which = '') { if ( ! $this->enabled OR ! isset($this->hooks[$which])) { @@ -151,11 +142,10 @@ class CI_Hooks { * * Runs a particular hook * - * @access private * @param array the hook details * @return bool */ - function _run_hook($data) + protected function _run_hook($data) { if ( ! is_array($data)) { @@ -168,7 +158,6 @@ class CI_Hooks { // If the script being called happens to have the same // hook call within it a loop can happen - if ($this->in_progress == TRUE) { return; @@ -254,7 +243,5 @@ class CI_Hooks { } -// END CI_Hooks class - /* End of file Hooks.php */ -/* Location: ./system/core/Hooks.php */ \ No newline at end of file +/* Location: ./system/core/Hooks.php */ diff --git a/system/core/Lang.php b/system/core/Lang.php index 5eb2801f6..088cb6c9c 100755 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -1,13 +1,13 @@ -language[$line])) ? FALSE : $this->language[$line]; @@ -166,7 +159,6 @@ class CI_Lang { } } -// END Language Class /* End of file Lang.php */ /* Location: ./system/core/Lang.php */ -- cgit v1.2.3-24-g4f1b