src/Common/CodeIgniter/Core/Hooks.php
protected function runCustomHook($aData)
    {
        if (!is_array($aData)) {
            return false;
        }

        /** -----------------------------------
         * Safety - Prevents run-away loops
         * ------------------------------------
         * If the script being called happens to have the same
         * hook call within it a loop can happen
         */
        if ($this->bCustomHooksInProgress == true) {
            return;
        }

        // Set class/method name
        $oClass  = null;
        $sMethod = null;
        $aParams = [];

        if (isset($aData['classref'])) {
            $oClass =& $aData['classref'];
        }

        if (isset($aData['method'])) {
            $sMethod = $aData['method'];
        }
        if (isset($aData['params'])) {
            $aParams = $aData['params'];
        }

        if (!is_object($oClass) || !method_exists($oClass, $sMethod)) {
            return false;
        }

        // Set the in_progress flag
        $this->bCustomHooksInProgress = true;

        // Call the requested class and/or function
        $oClass->$sMethod($aParams);
        $this->bCustomHooksInProgress = false;
        return true;
    }
protected function runCustomHook($aData)
    {
        if (!is_array($aData)) {
            return false;
        }

        /** -----------------------------------
         * Safety - Prevents run-away loops
         * ------------------------------------
         * If the script being called happens to have the same
         * hook call within it a loop can happen
         */
        if ($this->bCustomHooksInProgress == true) {
            return;
        }

        // Set class/method name
        $oClass  = null;
        $sMethod = null;
        $aParams = [];

        if (isset($aData['classref'])) {
            $oClass =& $aData['classref'];
        }

        if (isset($aData['method'])) {
            $sMethod = $aData['method'];
        }
        if (isset($aData['params'])) {
            $aParams = $aData['params'];
        }

        if (!is_object($oClass) || !method_exists($oClass, $sMethod)) {
            return false;
        }

        // Set the in_progress flag
        $this->bCustomHooksInProgress = true;

        // Call the requested class and/or function
        $oClass->$sMethod($aParams);
        $this->bCustomHooksInProgress = false;
        return true;
    }
protected function runCustomHook ( $ aData ) { if ( ! is_array ( $ aData ) ) { return false ; } /** -----------------------------------
         * Safety - Prevents run-away loops
         * ------------------------------------
         * If the script being called happens to have the same
         * hook call within it a loop can happen
         */ if ( $ this -> bCustomHooksInProgress == true ) { return ; } // Set class/method name $ oClass = null ; $ sMethod = null ; $ aParams = [ ] ; if ( isset ( $ aData [ 'classref' ] ) ) { $ oClass = & $ aData [ 'classref' ] ; } if ( isset ( $ aData [ 'method' ] ) ) { $ sMethod = $ aData [ 'method' ] ; } if ( isset ( $ aData [ 'params' ] ) ) { $ aParams = $ aData [ 'params' ] ; } if ( ! is_object ( $ oClass ) || ! method_exists ( $ oClass , $ sMethod ) ) { return false ; } // Set the in_progress flag $ this -> bCustomHooksInProgress = true ; // Call the requested class and/or function $ oClass -> $ sMethod ( $ aParams ) ; $ this -> bCustomHooksInProgress = false ; return true ; }
Execute a cusotm hook

@param array $aData The hook data

@return bool|void
Execute a cusotm hook