summaryrefslogtreecommitdiffstats
path: root/system/core/Hooks.php
diff options
context:
space:
mode:
authorJamie Rumbelow <jamie@jamierumbelow.net>2012-04-26 14:27:35 +0200
committerJamie Rumbelow <jamie@jamierumbelow.net>2012-04-26 14:27:35 +0200
commitd6ce1e936d60487ad8ddd099a040fba7d8f88367 (patch)
tree31dcdda9a24e2ed12135659a4e38cb4f35b0af31 /system/core/Hooks.php
parentbcee50ff3247dee71d83bf273e52bc10096cd48c (diff)
parent9e2d5d130eff40592b49337a8ba4d8c170934de1 (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
Conflicts: system/core/Loader.php system/database/DB_query_builder.php system/database/drivers/cubrid/cubrid_driver.php system/database/drivers/mssql/mssql_driver.php system/database/drivers/mysql/mysql_driver.php system/database/drivers/mysqli/mysqli_driver.php system/database/drivers/oci8/oci8_driver.php system/database/drivers/odbc/odbc_driver.php system/database/drivers/pdo/pdo_driver.php system/database/drivers/postgre/postgre_driver.php system/database/drivers/sqlite/sqlite_driver.php user_guide_src/source/changelog.rst user_guide_src/source/database/query_builder.rst
Diffstat (limited to 'system/core/Hooks.php')
-rwxr-xr-xsystem/core/Hooks.php34
1 files changed, 13 insertions, 21 deletions
diff --git a/system/core/Hooks.php b/system/core/Hooks.php
index e1ac58e6e..68e30ef0f 100755
--- a/system/core/Hooks.php
+++ b/system/core/Hooks.php
@@ -2,7 +2,7 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.1.6 or newer
+ * An open source application development framework for PHP 5.2.4 or newer
*
* NOTICE OF LICENSE
*
@@ -25,8 +25,6 @@
* @filesource
*/
-// ------------------------------------------------------------------------
-
/**
* CodeIgniter Hooks Class
*
@@ -51,7 +49,7 @@ class CI_Hooks {
*
* @var array
*/
- public $hooks = array();
+ public $hooks = array();
/**
* Determines wether hook is in progress, used to prevent infinte loops
*
@@ -59,23 +57,17 @@ class CI_Hooks {
*/
public $in_progress = FALSE;
- public function __construct()
- {
- $this->_initialize();
- log_message('debug', 'Hooks Class Initialized');
- }
-
- // --------------------------------------------------------------------
-
/**
* Initialize the Hooks Preferences
*
* @return void
*/
- private function _initialize()
+ public function __construct()
{
$CFG =& load_class('Config', 'core');
+ log_message('debug', 'Hooks Class Initialized');
+
// If hooks are not enabled in the config file
// there is nothing else to do
if ($CFG->item('enable_hooks') == FALSE)
@@ -84,7 +76,7 @@ class CI_Hooks {
}
// Grab the "hooks" definition file.
- if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
+ if (defined('ENVIRONMENT') && is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php');
}
@@ -113,14 +105,14 @@ class CI_Hooks {
* @param string the hook name
* @return mixed
*/
- public function _call_hook($which = '')
+ public function call_hook($which = '')
{
if ( ! $this->enabled OR ! isset($this->hooks[$which]))
{
return FALSE;
}
- if (isset($this->hooks[$which][0]) AND is_array($this->hooks[$which][0]))
+ if (isset($this->hooks[$which][0]) && is_array($this->hooks[$which][0]))
{
foreach ($this->hooks[$which] as $val)
{
@@ -167,7 +159,7 @@ class CI_Hooks {
// Set file path
// -----------------------------------
- if ( ! isset($data['filepath']) OR ! isset($data['filename']))
+ if ( ! isset($data['filepath'], $data['filename']))
{
return FALSE;
}
@@ -187,12 +179,12 @@ class CI_Hooks {
$function = FALSE;
$params = '';
- if (isset($data['class']) AND $data['class'] != '')
+ if ( ! empty($data['class']))
{
$class = $data['class'];
}
- if (isset($data['function']))
+ if ( ! empty($data['function']))
{
$function = $data['function'];
}
@@ -202,7 +194,7 @@ class CI_Hooks {
$params = $data['params'];
}
- if ($class === FALSE AND $function === FALSE)
+ if ($class === FALSE && $function === FALSE)
{
return FALSE;
}
@@ -244,4 +236,4 @@ class CI_Hooks {
}
/* End of file Hooks.php */
-/* Location: ./system/core/Hooks.php */
+/* Location: ./system/core/Hooks.php */ \ No newline at end of file