Replace deprecated Addon::callHooks with Hook::callAll

- Update documentation
This commit is contained in:
Hypolite Petovan 2018-12-26 01:06:24 -05:00
parent 895b3abf32
commit 55e54bb950
58 changed files with 450 additions and 475 deletions

View file

@ -6,7 +6,6 @@ namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Content\Pager;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
@ -1007,7 +1006,7 @@ class Contact extends BaseObject
$args = ['contact' => $contact, 'menu' => &$menu];
Addon::callHooks('contact_photo_menu', $args);
Hook::callAll('contact_photo_menu', $args);
$menucondensed = [];

View file

@ -7,7 +7,7 @@ namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
@ -311,7 +311,7 @@ class Event extends BaseObject
$item_id = 0;
}
Addon::callHooks('event_updated', $event['id']);
Hook::callAll('event_updated', $event['id']);
} else {
$event['guid'] = defaults($arr, 'guid', System::createUUID());
@ -361,7 +361,7 @@ class Event extends BaseObject
$item_id = Item::insert($item_arr);
}
Addon::callHooks("event_created", $event['id']);
Hook::callAll("event_created", $event['id']);
}
return $item_id;

View file

@ -9,8 +9,8 @@ namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\Lock;
use Friendica\Core\Logger;
use Friendica\Core\L10n;
@ -1608,11 +1608,11 @@ class Item extends BaseObject
if ($notify) {
$item['edit'] = false;
$item['parent'] = $parent_id;
Addon::callHooks('post_local', $item);
Hook::callAll('post_local', $item);
unset($item['edit']);
unset($item['parent']);
} else {
Addon::callHooks('post_remote', $item);
Hook::callAll('post_remote', $item);
}
// This array field is used to trigger some automatic reactions
@ -1785,9 +1785,9 @@ class Item extends BaseObject
$posted_item = self::selectFirst(self::ITEM_FIELDLIST, ['id' => $current_post]);
if (DBA::isResult($posted_item)) {
if ($notify) {
Addon::callHooks('post_local_end', $posted_item);
Hook::callAll('post_local_end', $posted_item);
} else {
Addon::callHooks('post_remote_end', $posted_item);
Hook::callAll('post_remote_end', $posted_item);
}
} else {
Logger::log('new item not found in DB, id ' . $current_post);
@ -2532,7 +2532,7 @@ class Item extends BaseObject
$arr = ['item' => $item, 'user' => $user];
Addon::callHooks('tagged', $arr);
Hook::callAll('tagged', $arr);
if (!$community_page && !$prvgroup) {
return;
@ -3090,7 +3090,7 @@ class Item extends BaseObject
$new_item['id'] = $new_item_id;
Addon::callHooks('post_local_end', $new_item);
Hook::callAll('post_local_end', $new_item);
return true;
}
@ -3255,7 +3255,7 @@ class Item extends BaseObject
$item["rendered-hash"] = hash("md5", $item["body"]);
$hook_data = ['item' => $item, 'rendered-html' => $item['rendered-html'], 'rendered-hash' => $item['rendered-hash']];
Addon::callHooks('put_item_in_cache', $hook_data);
Hook::callAll('put_item_in_cache', $hook_data);
$item['rendered-html'] = $hook_data['rendered-html'];
$item['rendered-hash'] = $hook_data['rendered-hash'];
unset($hook_data);
@ -3300,7 +3300,7 @@ class Item extends BaseObject
public static function prepareBody(array &$item, $attach = false, $is_preview = false)
{
$a = self::getApp();
Addon::callHooks('prepare_body_init', $item);
Hook::callAll('prepare_body_init', $item);
// In order to provide theme developers more possibilities, event items
// are treated differently.
@ -3326,7 +3326,7 @@ class Item extends BaseObject
'item' => $item,
'filter_reasons' => $filter_reasons
];
Addon::callHooks('prepare_body_content_filter', $hook_data);
Hook::callAll('prepare_body_content_filter', $hook_data);
$filter_reasons = $hook_data['filter_reasons'];
unset($hook_data);
}
@ -3348,7 +3348,7 @@ class Item extends BaseObject
'preview' => $is_preview,
'filter_reasons' => $filter_reasons
];
Addon::callHooks('prepare_body', $hook_data);
Hook::callAll('prepare_body', $hook_data);
$s = $hook_data['html'];
unset($hook_data);
@ -3456,7 +3456,7 @@ class Item extends BaseObject
$s = HTML::applyContentFilter($s, $filter_reasons);
$hook_data = ['item' => $item, 'html' => $s];
Addon::callHooks('prepare_body_final', $hook_data);
Hook::callAll('prepare_body_final', $hook_data);
return $hook_data['html'];
}

View file

@ -9,9 +9,9 @@ use Friendica\Content\Feature;
use Friendica\Content\ForumManager;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon;
use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
@ -300,7 +300,7 @@ class Profile
$profile['network_link'] = '';
}
Addon::callHooks('profile_sidebar_enter', $profile);
Hook::callAll('profile_sidebar_enter', $profile);
// don't show connect link to yourself
@ -548,7 +548,7 @@ class Profile
$arr = ['profile' => &$profile, 'entry' => &$o];
Addon::callHooks('profile_sidebar', $arr);
Hook::callAll('profile_sidebar', $arr);
return $o;
}
@ -992,7 +992,7 @@ class Profile
}
$arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $tab, 'tabs' => $tabs];
Addon::callHooks('profile_tabs', $arr);
Hook::callAll('profile_tabs', $arr);
$tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
@ -1033,7 +1033,7 @@ class Profile
}
$arr = ['zrl' => $my_url, 'url' => $a->cmd];
Addon::callHooks('zrl_init', $arr);
Hook::callAll('zrl_init', $arr);
// Try to find the public contact entry of the visitor.
$cid = Contact::getIdForURL($my_url);
@ -1144,7 +1144,7 @@ class Profile
* * \e array \b visitor
* * \e string \b url
*/
Addon::callHooks('magic_auth_success', $arr);
Hook::callAll('magic_auth_success', $arr);
$a->contact = $arr['visitor'];

View file

@ -7,7 +7,6 @@ namespace Friendica\Model;
use DivineOmega\PasswordExposed;
use Exception;
use Friendica\Core\Addon;
use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
@ -707,7 +706,7 @@ class User
}
}
Addon::callHooks('register_account', $uid);
Hook::callAll('register_account', $uid);
$return['user'] = $user;
return $return;