_run_hook() protected method

Runs a particular hook
protected _run_hook ( array $data ) : boolean
$data array Hook details
return boolean TRUE on success or FALSE on failure
Exemplo n.º 1
0
 function _run_hook($data)
 {
     if (is_callable($data)) {
         call_user_func_array($data, array());
     } else {
         return parent::_run_hook($data);
     }
 }
 /**
  * Run Hook
  *
  * Runs a particular hook
  *
  * @param	array	$data	Hook details
  * @return	bool	TRUE on success or FALSE on failure
  */
 protected function _run_hook($data)
 {
     if (is_array($data)) {
         $a_path = APPPATH . trim($data['filepath'], '/') . '/' . $data['filename'];
         if (!file_exists($a_path)) {
             // Let's try to load a hook outside
             $repeater = rtrim(str_repeat('../', substr_count(APPPATH, '/')), '/');
             $b_path = $repeater . '/' . trim($data['filepath'], '/');
             if (realpath(APPPATH . $b_path)) {
                 $data['filepath'] = rtrim($b_path, '/') . '/';
             }
         }
     }
     return parent::_run_hook($data);
 }