X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FHook.php;h=3167464a790da9f46d5261e2bbf5ffcbabdd3678;hb=180b81c6e74bdc8d677f447fe796fb10783c96dd;hp=1145bd298321199e732d29ebdef042fe60df47e2;hpb=4faf08c0643d3e6bbe2a0a77be2ff8c1dbea4d5c;p=friendica.git diff --git a/src/Core/Hook.php b/src/Core/Hook.php index 1145bd2983..3167464a79 100644 --- a/src/Core/Hook.php +++ b/src/Core/Hook.php @@ -167,7 +167,7 @@ class Hook if ($hook[0] != $fork_hook[0]) { continue; } - self::callSingle(DI::app(), 'hook_fork', $fork_hook, $hookdata); + self::callSingle('hook_fork', $fork_hook, $hookdata); } if (!$hookdata['execute']) { @@ -195,7 +195,7 @@ class Hook { if (array_key_exists($name, self::$hooks)) { foreach (self::$hooks[$name] as $hook) { - self::callSingle(DI::app(), $name, $hook, $data); + self::callSingle($name, $hook, $data); } } } @@ -203,24 +203,23 @@ class Hook /** * Calls a single hook. * - * @param App $a * @param string $name of the hook to call * @param array $hook Hook data * @param string|array &$data to transmit to the callback handler * @return void * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function callSingle(App $a, string $name, array $hook, &$data = null) + public static function callSingle(string $name, array $hook, &$data = null) { // Don't run a theme's hook if the user isn't using the theme - if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . $a->getCurrentTheme()) === false) { + if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/' . DI::app()->getCurrentTheme()) === false) { return; } @include_once($hook[0]); if (function_exists($hook[1])) { $func = $hook[1]; - $func($a, $data); + $func($data); } else { // remove orphan hooks $condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]];