namespace Friendica\Core;
use Friendica\App;
-use Friendica\BaseObject;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Util\Strings;
/**
* Some functions to handle hooks
*/
-class Hook extends BaseObject
+class Hook
{
/**
* Array of registered hooks
*/
public static function register($hook, $file, $function, $priority = 0)
{
- $file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
+ $file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
if (DBA::exists('hook', $condition)) {
*/
public static function unregister($hook, $file, $function)
{
- $relative_file = str_replace(self::getApp()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
+ $relative_file = str_replace(DI::app()->getBasePath() . DIRECTORY_SEPARATOR, '', $file);
// This here is only needed for fixing a problem that existed on the develop branch
$condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
if ($hook[0] != $fork_hook[0]) {
continue;
}
- self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
+ self::callSingle(DI::app(), 'hook_fork', $fork_hook, $hookdata);
}
if (!$hookdata['execute']) {
{
if (array_key_exists($name, self::$hooks)) {
foreach (self::$hooks[$name] as $hook) {
- self::callSingle(self::getApp(), $name, $hook, $data);
+ self::callSingle(DI::app(), $name, $hook, $data);
}
}
}