$hookList) { foreach ($hookList as $callback) { if (call_user_func_array($callback, array_merge([$hookName], $args)) === self::ABORT) { return self::ABORT; } } } return self::CONTINUE; } // // Methods required for testing only. // /** * Set/query the flag that triggers storing of * called hooks. * * @param bool $askOnly When set to true, the flag will not * be changed but only returned. * @param bool $updateTo When $askOnly is set to 'true' then * this parameter defines the value of the flag. * * @return bool The current value of the flag. */ public static function rememberCalledHooks(bool $askOnly = false, bool $updateTo = true): bool { static $rememberCalledHooks = false; if (!$askOnly) { $rememberCalledHooks = $updateTo; } return $rememberCalledHooks; } /** * Switch off the function to store hooks and delete all stored hooks. * Always call this after using otherwise we get a severe memory. * * @param bool $leaveAlive Set this to true if you only want to * delete hooks stored so far but if you want to record future * hook calls, too. */ public static function resetCalledHooks(bool $leaveAlive = false): void { if (!$leaveAlive) { static::rememberCalledHooks(false, false); } $calledHooks = & static::getCalledHooks(); $calledHooks = []; } /** * Return a reference to the stored hooks. */ public static function &getCalledHooks(): array { static $calledHooks = []; return $calledHooks; } } if (!PKP_STRICT_MODE) { class_alias('\PKP\plugins\Hook', '\HookRegistry'); foreach (['SEQUENCE_CORE', 'SEQUENCE_NORMAL', 'SEQUENCE_LATE', 'SEQUENCE_LAST'] as $constantName) { define('HOOK_' . $constantName, constant('\HookRegistry::' . $constantName)); } }