From 55e54bb9500f54bb075dcbc2054018de0969d9e7 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 26 Dec 2018 01:06:24 -0500 Subject: [PATCH] Replace deprecated Addon::callHooks with Hook::callAll - Update documentation --- doc/Addons.md | 270 +++++++++++++-------------- doc/de/Addons.md | 262 +++++++++++++------------- include/api.php | 8 +- include/conversation.php | 14 +- include/enotify.php | 10 +- include/items.php | 4 +- mod/acl.php | 4 +- mod/directory.php | 4 +- mod/editpost.php | 1 - mod/friendica.php | 3 +- mod/home.php | 6 +- mod/item.php | 8 +- mod/lockview.php | 4 +- mod/manage.php | 5 +- mod/network.php | 5 +- mod/parse_url.php | 4 +- mod/photos.php | 19 +- mod/ping.php | 5 +- mod/poke.php | 10 +- mod/profile.php | 5 +- mod/profiles.php | 6 +- mod/register.php | 6 +- mod/settings.php | 18 +- mod/subthread.php | 4 +- mod/tagger.php | 4 +- mod/uexport.php | 4 +- mod/xrd.php | 4 +- src/App.php | 20 +- src/Content/ContactSelector.php | 14 +- src/Content/Feature.php | 6 +- src/Content/Nav.php | 9 +- src/Content/OEmbed.php | 4 +- src/Content/Smilies.php | 5 +- src/Content/Text/BBCode.php | 6 +- src/Content/Text/HTML.php | 7 +- src/Core/ACL.php | 14 +- src/Core/Authentication.php | 7 +- src/Core/L10n.php | 5 +- src/Core/Worker.php | 3 +- src/Model/Contact.php | 3 +- src/Model/Event.php | 6 +- src/Model/Item.php | 24 +-- src/Model/Profile.php | 12 +- src/Model/User.php | 3 +- src/Module/Contact.php | 6 +- src/Module/Login.php | 6 +- src/Module/Logout.php | 6 +- src/Network/FKOAuth1.php | 4 +- src/Object/Post.php | 5 +- src/Protocol/DFRN.php | 8 +- src/Render/FriendicaSmartyEngine.php | 4 +- src/Util/Crypto.php | 7 +- src/Util/Emailer.php | 6 +- src/Util/Map.php | 8 +- src/Util/Network.php | 5 +- src/Util/ParseUrl.php | 5 +- src/Worker/Directory.php | 4 +- src/Worker/Queue.php | 6 +- 58 files changed, 450 insertions(+), 475 deletions(-) diff --git a/doc/Addons.md b/doc/Addons.md index bf139aea7f..3aee9b7384 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -417,281 +417,281 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep- ### index.php - Addon::callHooks('init_1'); - Addon::callHooks('app_menu', $arr); - Addon::callHooks('page_content_top', $a->page['content']); - Addon::callHooks($a->module.'_mod_init', $placeholder); - Addon::callHooks($a->module.'_mod_init', $placeholder); - Addon::callHooks($a->module.'_mod_post', $_POST); - Addon::callHooks($a->module.'_mod_afterpost', $placeholder); - Addon::callHooks($a->module.'_mod_content', $arr); - Addon::callHooks($a->module.'_mod_aftercontent', $arr); - Addon::callHooks('page_end', $a->page['content']); + Hook::callAll('init_1'); + Hook::callAll('app_menu', $arr); + Hook::callAll('page_content_top', $a->page['content']); + Hook::callAll($a->module.'_mod_init', $placeholder); + Hook::callAll($a->module.'_mod_init', $placeholder); + Hook::callAll($a->module.'_mod_post', $_POST); + Hook::callAll($a->module.'_mod_afterpost', $placeholder); + Hook::callAll($a->module.'_mod_content', $arr); + Hook::callAll($a->module.'_mod_aftercontent', $arr); + Hook::callAll('page_end', $a->page['content']); ### include/api.php - Addon::callHooks('logged_in', $a->user); - Addon::callHooks('authenticate', $addon_auth); - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); + Hook::callAll('authenticate', $addon_auth); + Hook::callAll('logged_in', $a->user); ### include/enotify.php - Addon::callHooks('enotify', $h); - Addon::callHooks('enotify_store', $datarray); - Addon::callHooks('enotify_mail', $datarray); - Addon::callHooks('check_item_notification', $notification_data); + Hook::callAll('enotify', $h); + Hook::callAll('enotify_store', $datarray); + Hook::callAll('enotify_mail', $datarray); + Hook::callAll('check_item_notification', $notification_data); ### include/conversation.php - Addon::callHooks('conversation_start', $cb); - Addon::callHooks('render_location', $locate); - Addon::callHooks('display_item', $arr); - Addon::callHooks('display_item', $arr); - Addon::callHooks('item_photo_menu', $args); - Addon::callHooks('jot_tool', $jotplugins); + Hook::callAll('conversation_start', $cb); + Hook::callAll('render_location', $locate); + Hook::callAll('display_item', $arr); + Hook::callAll('display_item', $arr); + Hook::callAll('item_photo_menu', $args); + Hook::callAll('jot_tool', $jotplugins); ### include/text.php - Addon::callHooks('contact_block_end', $arr); - Addon::callHooks('poke_verbs', $arr); - Addon::callHooks('put_item_in_cache', $hook_data); - Addon::callHooks('prepare_body_init', $item); - Addon::callHooks('prepare_body_content_filter', $hook_data); - Addon::callHooks('prepare_body', $hook_data); - Addon::callHooks('prepare_body_final', $hook_data); + Hook::callAll('contact_block_end', $arr); + Hook::callAll('poke_verbs', $arr); + Hook::callAll('put_item_in_cache', $hook_data); + Hook::callAll('prepare_body_init', $item); + Hook::callAll('prepare_body_content_filter', $hook_data); + Hook::callAll('prepare_body', $hook_data); + Hook::callAll('prepare_body_final', $hook_data); ### include/items.php - Addon::callHooks('page_info_data', $data); + Hook::callAll('page_info_data', $data); ### mod/directory.php - Addon::callHooks('directory_item', $arr); + Hook::callAll('directory_item', $arr); ### mod/xrd.php - Addon::callHooks('personal_xrd', $arr); + Hook::callAll('personal_xrd', $arr); ### mod/ping.php - Addon::callHooks('network_ping', $arr); + Hook::callAll('network_ping', $arr); ### mod/parse_url.php - Addon::callHooks("parse_link", $arr); + Hook::callAll("parse_link", $arr); ### mod/manage.php - Addon::callHooks('home_init', $ret); + Hook::callAll('home_init', $ret); ### mod/acl.php - Addon::callHooks('acl_lookup_end', $results); + Hook::callAll('acl_lookup_end', $results); ### mod/network.php - Addon::callHooks('network_content_init', $arr); - Addon::callHooks('network_tabs', $arr); + Hook::callAll('network_content_init', $arr); + Hook::callAll('network_tabs', $arr); ### mod/friendica.php - Addon::callHooks('about_hook', $o); + Hook::callAll('about_hook', $o); ### mod/subthread.php - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); ### mod/profiles.php - Addon::callHooks('profile_post', $_POST); - Addon::callHooks('profile_edit', $arr); + Hook::callAll('profile_post', $_POST); + Hook::callAll('profile_edit', $arr); ### mod/settings.php - Addon::callHooks('addon_settings_post', $_POST); - Addon::callHooks('connector_settings_post', $_POST); - Addon::callHooks('display_settings_post', $_POST); - Addon::callHooks('settings_post', $_POST); - Addon::callHooks('addon_settings', $settings_addons); - Addon::callHooks('connector_settings', $settings_connectors); - Addon::callHooks('display_settings', $o); - Addon::callHooks('settings_form', $o); + Hook::callAll('addon_settings_post', $_POST); + Hook::callAll('connector_settings_post', $_POST); + Hook::callAll('display_settings_post', $_POST); + Hook::callAll('settings_post', $_POST); + Hook::callAll('addon_settings', $settings_addons); + Hook::callAll('connector_settings', $settings_connectors); + Hook::callAll('display_settings', $o); + Hook::callAll('settings_form', $o); ### mod/photos.php - Addon::callHooks('photo_post_init', $_POST); - Addon::callHooks('photo_post_file', $ret); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', intval($item_id)); - Addon::callHooks('photo_upload_form', $ret); + Hook::callAll('photo_post_init', $_POST); + Hook::callAll('photo_post_file', $ret); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', intval($item_id)); + Hook::callAll('photo_upload_form', $ret); ### mod/profile.php - Addon::callHooks('profile_advanced', $o); + Hook::callAll('profile_advanced', $o); ### mod/home.php - Addon::callHooks('home_init', $ret); - Addon::callHooks("home_content", $content); + Hook::callAll('home_init', $ret); + Hook::callAll("home_content", $content); ### mod/poke.php - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); ### mod/contacts.php - Addon::callHooks('contact_edit_post', $_POST); - Addon::callHooks('contact_edit', $arr); + Hook::callAll('contact_edit_post', $_POST); + Hook::callAll('contact_edit', $arr); ### mod/tagger.php - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); ### mod/lockview.php - Addon::callHooks('lockview_content', $item); + Hook::callAll('lockview_content', $item); ### mod/uexport.php - Addon::callHooks('uexport_options', $options); + Hook::callAll('uexport_options', $options); ### mod/register.php - Addon::callHooks('register_post', $arr); - Addon::callHooks('register_form', $arr); + Hook::callAll('register_post', $arr); + Hook::callAll('register_form', $arr); ### mod/item.php - Addon::callHooks('post_local_start', $_REQUEST); - Addon::callHooks('post_local', $datarray); - Addon::callHooks('post_local_end', $datarray); + Hook::callAll('post_local_start', $_REQUEST); + Hook::callAll('post_local', $datarray); + Hook::callAll('post_local_end', $datarray); ### mod/editpost.php - Addon::callHooks('jot_tool', $jotplugins); + Hook::callAll('jot_tool', $jotplugins); ### src/Network/FKOAuth1.php - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); ### src/Render/FriendicaSmartyEngine.php - Addon::callHooks("template_vars", $arr); + Hook::callAll("template_vars", $arr); ### src/App.php - Addon::callHooks('load_config'); - Addon::callHooks('head'); - Addon::callHooks('footer'); + Hook::callAll('load_config'); + Hook::callAll('head'); + Hook::callAll('footer'); ### src/Model/Item.php - Addon::callHooks('post_local', $item); - Addon::callHooks('post_remote', $item); - Addon::callHooks('post_local_end', $posted_item); - Addon::callHooks('post_remote_end', $posted_item); - Addon::callHooks('tagged', $arr); - Addon::callHooks('post_local_end', $new_item); + Hook::callAll('post_local', $item); + Hook::callAll('post_remote', $item); + Hook::callAll('post_local_end', $posted_item); + Hook::callAll('post_remote_end', $posted_item); + Hook::callAll('tagged', $arr); + Hook::callAll('post_local_end', $new_item); ### src/Model/Contact.php - Addon::callHooks('contact_photo_menu', $args); - Addon::callHooks('follow', $arr); + Hook::callAll('contact_photo_menu', $args); + Hook::callAll('follow', $arr); ### src/Model/Profile.php - Addon::callHooks('profile_sidebar_enter', $profile); - Addon::callHooks('profile_sidebar', $arr); - Addon::callHooks('profile_tabs', $arr); - Addon::callHooks('zrl_init', $arr); - Addon::callHooks('magic_auth_success', $arr); + Hook::callAll('profile_sidebar_enter', $profile); + Hook::callAll('profile_sidebar', $arr); + Hook::callAll('profile_tabs', $arr); + Hook::callAll('zrl_init', $arr); + Hook::callAll('magic_auth_success', $arr); ### src/Model/Event.php - Addon::callHooks('event_updated', $event['id']); - Addon::callHooks("event_created", $event['id']); + Hook::callAll('event_updated', $event['id']); + Hook::callAll("event_created", $event['id']); ### src/Model/User.php - Addon::callHooks('register_account', $uid); - Addon::callHooks('remove_user', $user); + Hook::callAll('register_account', $uid); + Hook::callAll('remove_user', $user); ### src/Content/Text/BBCode.php - Addon::callHooks('bbcode', $text); - Addon::callHooks('bb2diaspora', $text); + Hook::callAll('bbcode', $text); + Hook::callAll('bb2diaspora', $text); ### src/Content/Text/HTML.php - Addon::callHooks('html2bbcode', $message); + Hook::callAll('html2bbcode', $message); ### src/Content/Smilies.php - Addon::callHooks('smilie', $params); + Hook::callAll('smilie', $params); ### src/Content/Feature.php - Addon::callHooks('isEnabled', $arr); - Addon::callHooks('get', $arr); + Hook::callAll('isEnabled', $arr); + Hook::callAll('get', $arr); ### src/Content/ContactSelector.php - Addon::callHooks('network_to_name', $nets); - Addon::callHooks('gender_selector', $select); - Addon::callHooks('sexpref_selector', $select); - Addon::callHooks('marital_selector', $select); + Hook::callAll('network_to_name', $nets); + Hook::callAll('gender_selector', $select); + Hook::callAll('sexpref_selector', $select); + Hook::callAll('marital_selector', $select); ### src/Content/OEmbed.php - Addon::callHooks('oembed_fetch_url', $embedurl, $j); + Hook::callAll('oembed_fetch_url', $embedurl, $j); ### src/Content/Nav.php - Addon::callHooks('page_header', $a->page['nav']); - Addon::callHooks('nav_info', $nav); + Hook::callAll('page_header', $a->page['nav']); + Hook::callAll('nav_info', $nav); ### src/Worker/Directory.php - Addon::callHooks('globaldir_update', $arr); + Hook::callAll('globaldir_update', $arr); ### src/Worker/Notifier.php - Addon::callHooks('notifier_end', $target_item); + Hook::callAll('notifier_end', $target_item); ### src/Worker/Queue.php - Addon::callHooks('queue_predeliver', $r); - Addon::callHooks('queue_deliver', $params); + Hook::callAll('queue_predeliver', $r); + Hook::callAll('queue_deliver', $params); ### src/Module/Login.php - Addon::callHooks('authenticate', $addon_auth); - Addon::callHooks('login_hook', $o); + Hook::callAll('authenticate', $addon_auth); + Hook::callAll('login_hook', $o); ### src/Module/Logout.php - Addon::callHooks("logging_out"); + Hook::callAll("logging_out"); ### src/Object/Post.php - Addon::callHooks('render_location', $locate); - Addon::callHooks('display_item', $arr); + Hook::callAll('render_location', $locate); + Hook::callAll('display_item', $arr); ### src/Core/ACL.php - Addon::callHooks('contact_select_options', $x); - Addon::callHooks($a->module.'_pre_'.$selname, $arr); - Addon::callHooks($a->module.'_post_'.$selname, $o); - Addon::callHooks($a->module.'_pre_'.$selname, $arr); - Addon::callHooks($a->module.'_post_'.$selname, $o); - Addon::callHooks('jot_networks', $jotnets); + Hook::callAll('contact_select_options', $x); + Hook::callAll($a->module.'_pre_'.$selname, $arr); + Hook::callAll($a->module.'_post_'.$selname, $o); + Hook::callAll($a->module.'_pre_'.$selname, $arr); + Hook::callAll($a->module.'_post_'.$selname, $o); + Hook::callAll('jot_networks', $jotnets); ### src/Core/Authentication.php - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); ### src/Core/Hook.php @@ -699,31 +699,31 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep- ### src/Core/Worker.php - Addon::callHooks("proc_run", $arr); + Hook::callAll("proc_run", $arr); ### src/Util/Emailer.php - Addon::callHooks('emailer_send_prepare', $params); - Addon::callHooks("emailer_send", $hookdata); + Hook::callAll('emailer_send_prepare', $params); + Hook::callAll("emailer_send", $hookdata); ### src/Util/Map.php - Addon::callHooks('generate_map', $arr); - Addon::callHooks('generate_named_map', $arr); - Addon::callHooks('Map::getCoordinates', $arr); + Hook::callAll('generate_map', $arr); + Hook::callAll('generate_named_map', $arr); + Hook::callAll('Map::getCoordinates', $arr); ### src/Util/Network.php - Addon::callHooks('avatar_lookup', $avatar); + Hook::callAll('avatar_lookup', $avatar); ### src/Util/ParseUrl.php - Addon::callHooks("getsiteinfo", $siteinfo); + Hook::callAll("getsiteinfo", $siteinfo); ### src/Protocol/DFRN.php - Addon::callHooks('atom_feed_end', $atom); - Addon::callHooks('atom_feed_end', $atom); + Hook::callAll('atom_feed_end', $atom); + Hook::callAll('atom_feed_end', $atom); ### view/js/main.js diff --git a/doc/de/Addons.md b/doc/de/Addons.md index eb825c0729..d63f0aa37b 100644 --- a/doc/de/Addons.md +++ b/doc/de/Addons.md @@ -193,299 +193,299 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap ### index.php - Addon::callHooks('init_1'); - Addon::callHooks('app_menu', $arr); - Addon::callHooks('page_content_top', $a->page['content']); - Addon::callHooks($a->module.'_mod_init', $placeholder); - Addon::callHooks($a->module.'_mod_init', $placeholder); - Addon::callHooks($a->module.'_mod_post', $_POST); - Addon::callHooks($a->module.'_mod_afterpost', $placeholder); - Addon::callHooks($a->module.'_mod_content', $arr); - Addon::callHooks($a->module.'_mod_aftercontent', $arr); - Addon::callHooks('page_end', $a->page['content']); + Hook::callAll('init_1'); + Hook::callAll('app_menu', $arr); + Hook::callAll('page_content_top', $a->page['content']); + Hook::callAll($a->module.'_mod_init', $placeholder); + Hook::callAll($a->module.'_mod_init', $placeholder); + Hook::callAll($a->module.'_mod_post', $_POST); + Hook::callAll($a->module.'_mod_afterpost', $placeholder); + Hook::callAll($a->module.'_mod_content', $arr); + Hook::callAll($a->module.'_mod_aftercontent', $arr); + Hook::callAll('page_end', $a->page['content']); ### include/api.php - Addon::callHooks('logged_in', $a->user); - Addon::callHooks('authenticate', $addon_auth); - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); + Hook::callAll('authenticate', $addon_auth); + Hook::callAll('logged_in', $a->user); ### include/enotify.php - Addon::callHooks('enotify', $h); - Addon::callHooks('enotify_store', $datarray); - Addon::callHooks('enotify_mail', $datarray); - Addon::callHooks('check_item_notification', $notification_data); + Hook::callAll('enotify', $h); + Hook::callAll('enotify_store', $datarray); + Hook::callAll('enotify_mail', $datarray); + Hook::callAll('check_item_notification', $notification_data); ### include/conversation.php - Addon::callHooks('conversation_start', $cb); - Addon::callHooks('render_location', $locate); - Addon::callHooks('display_item', $arr); - Addon::callHooks('display_item', $arr); - Addon::callHooks('item_photo_menu', $args); - Addon::callHooks('jot_tool', $jotplugins); + Hook::callAll('conversation_start', $cb); + Hook::callAll('render_location', $locate); + Hook::callAll('display_item', $arr); + Hook::callAll('display_item', $arr); + Hook::callAll('item_photo_menu', $args); + Hook::callAll('jot_tool', $jotplugins); ### include/text.php - Addon::callHooks('contact_block_end', $arr); - Addon::callHooks('poke_verbs', $arr); - Addon::callHooks('put_item_in_cache', $hook_data); - Addon::callHooks('prepare_body_init', $item); - Addon::callHooks('prepare_body_content_filter', $hook_data); - Addon::callHooks('prepare_body', $hook_data); - Addon::callHooks('prepare_body_final', $hook_data); + Hook::callAll('contact_block_end', $arr); + Hook::callAll('poke_verbs', $arr); + Hook::callAll('put_item_in_cache', $hook_data); + Hook::callAll('prepare_body_init', $item); + Hook::callAll('prepare_body_content_filter', $hook_data); + Hook::callAll('prepare_body', $hook_data); + Hook::callAll('prepare_body_final', $hook_data); ### include/items.php - Addon::callHooks('page_info_data', $data); + Hook::callAll('page_info_data', $data); ### mod/directory.php - Addon::callHooks('directory_item', $arr); + Hook::callAll('directory_item', $arr); ### mod/xrd.php - Addon::callHooks('personal_xrd', $arr); + Hook::callAll('personal_xrd', $arr); ### mod/ping.php - Addon::callHooks('network_ping', $arr); + Hook::callAll('network_ping', $arr); ### mod/parse_url.php - Addon::callHooks("parse_link", $arr); + Hook::callAll("parse_link", $arr); ### mod/manage.php - Addon::callHooks('home_init', $ret); + Hook::callAll('home_init', $ret); ### mod/acl.php - Addon::callHooks('acl_lookup_end', $results); + Hook::callAll('acl_lookup_end', $results); ### mod/network.php - Addon::callHooks('network_content_init', $arr); - Addon::callHooks('network_tabs', $arr); + Hook::callAll('network_content_init', $arr); + Hook::callAll('network_tabs', $arr); ### mod/friendica.php - Addon::callHooks('about_hook', $o); + Hook::callAll('about_hook', $o); ### mod/subthread.php - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); ### mod/profiles.php - Addon::callHooks('profile_post', $_POST); - Addon::callHooks('profile_edit', $arr); + Hook::callAll('profile_post', $_POST); + Hook::callAll('profile_edit', $arr); ### mod/settings.php - Addon::callHooks('addon_settings_post', $_POST); - Addon::callHooks('connector_settings_post', $_POST); - Addon::callHooks('display_settings_post', $_POST); - Addon::callHooks('settings_post', $_POST); - Addon::callHooks('addon_settings', $settings_addons); - Addon::callHooks('connector_settings', $settings_connectors); - Addon::callHooks('display_settings', $o); - Addon::callHooks('settings_form', $o); + Hook::callAll('addon_settings_post', $_POST); + Hook::callAll('connector_settings_post', $_POST); + Hook::callAll('display_settings_post', $_POST); + Hook::callAll('settings_post', $_POST); + Hook::callAll('addon_settings', $settings_addons); + Hook::callAll('connector_settings', $settings_connectors); + Hook::callAll('display_settings', $o); + Hook::callAll('settings_form', $o); ### mod/photos.php - Addon::callHooks('photo_post_init', $_POST); - Addon::callHooks('photo_post_file', $ret); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', $foo); - Addon::callHooks('photo_post_end', intval($item_id)); - Addon::callHooks('photo_upload_form', $ret); + Hook::callAll('photo_post_init', $_POST); + Hook::callAll('photo_post_file', $ret); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); + Hook::callAll('photo_post_end', intval($item_id)); + Hook::callAll('photo_upload_form', $ret); ### mod/profile.php - Addon::callHooks('profile_advanced', $o); + Hook::callAll('profile_advanced', $o); ### mod/home.php - Addon::callHooks('home_init', $ret); - Addon::callHooks("home_content", $content); + Hook::callAll('home_init', $ret); + Hook::callAll("home_content", $content); ### mod/poke.php - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); ### mod/contacts.php - Addon::callHooks('contact_edit_post', $_POST); - Addon::callHooks('contact_edit', $arr); + Hook::callAll('contact_edit_post', $_POST); + Hook::callAll('contact_edit', $arr); ### mod/tagger.php - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); ### mod/lockview.php - Addon::callHooks('lockview_content', $item); + Hook::callAll('lockview_content', $item); ### mod/uexport.php - Addon::callHooks('uexport_options', $options); + Hook::callAll('uexport_options', $options); ### mod/register.php - Addon::callHooks('register_post', $arr); - Addon::callHooks('register_form', $arr); + Hook::callAll('register_post', $arr); + Hook::callAll('register_form', $arr); ### mod/item.php - Addon::callHooks('post_local_start', $_REQUEST); - Addon::callHooks('post_local', $datarray); - Addon::callHooks('post_local_end', $datarray); + Hook::callAll('post_local_start', $_REQUEST); + Hook::callAll('post_local', $datarray); + Hook::callAll('post_local_end', $datarray); ### mod/editpost.php - Addon::callHooks('jot_tool', $jotplugins); + Hook::callAll('jot_tool', $jotplugins); ### src/Network/FKOAuth1.php - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); ### src/Render/FriendicaSmartyEngine.php - Addon::callHooks("template_vars", $arr); + Hook::callAll("template_vars", $arr); ### src/Model/Item.php - Addon::callHooks('post_local', $item); - Addon::callHooks('post_remote', $item); - Addon::callHooks('post_local_end', $posted_item); - Addon::callHooks('post_remote_end', $posted_item); - Addon::callHooks('tagged', $arr); - Addon::callHooks('post_local_end', $new_item); + Hook::callAll('post_local', $item); + Hook::callAll('post_remote', $item); + Hook::callAll('post_local_end', $posted_item); + Hook::callAll('post_remote_end', $posted_item); + Hook::callAll('tagged', $arr); + Hook::callAll('post_local_end', $new_item); ### src/Model/Contact.php - Addon::callHooks('contact_photo_menu', $args); - Addon::callHooks('follow', $arr); + Hook::callAll('contact_photo_menu', $args); + Hook::callAll('follow', $arr); ### src/Model/Profile.php - Addon::callHooks('profile_sidebar_enter', $profile); - Addon::callHooks('profile_sidebar', $arr); - Addon::callHooks('profile_tabs', $arr); - Addon::callHooks('zrl_init', $arr); + Hook::callAll('profile_sidebar_enter', $profile); + Hook::callAll('profile_sidebar', $arr); + Hook::callAll('profile_tabs', $arr); + Hook::callAll('zrl_init', $arr); ### src/Model/Event.php - Addon::callHooks('event_updated', $event['id']); - Addon::callHooks("event_created", $event['id']); + Hook::callAll('event_updated', $event['id']); + Hook::callAll("event_created", $event['id']); ### src/Model/User.php - Addon::callHooks('register_account', $uid); - Addon::callHooks('remove_user', $user); + Hook::callAll('register_account', $uid); + Hook::callAll('remove_user', $user); ### src/Content/Text/BBCode.php - Addon::callHooks('bbcode', $text); - Addon::callHooks('bb2diaspora', $text); + Hook::callAll('bbcode', $text); + Hook::callAll('bb2diaspora', $text); ### src/Content/Text/HTML.php - Addon::callHooks('html2bbcode', $message); + Hook::callAll('html2bbcode', $message); ### src/Content/Smilies.php - Addon::callHooks('smilie', $params); + Hook::callAll('smilie', $params); ### src/Content/Feature.php - Addon::callHooks('isEnabled', $arr); - Addon::callHooks('get', $arr); + Hook::callAll('isEnabled', $arr); + Hook::callAll('get', $arr); ### src/Content/ContactSelector.php - Addon::callHooks('network_to_name', $nets); - Addon::callHooks('gender_selector', $select); - Addon::callHooks('sexpref_selector', $select); - Addon::callHooks('marital_selector', $select); + Hook::callAll('network_to_name', $nets); + Hook::callAll('gender_selector', $select); + Hook::callAll('sexpref_selector', $select); + Hook::callAll('marital_selector', $select); ### src/Content/OEmbed.php - Addon::callHooks('oembed_fetch_url', $embedurl, $j); + Hook::callAll('oembed_fetch_url', $embedurl, $j); ### src/Content/Nav.php - Addon::callHooks('page_header', $a->page['nav']); - Addon::callHooks('nav_info', $nav); + Hook::callAll('page_header', $a->page['nav']); + Hook::callAll('nav_info', $nav); ### src/Core/Authentication.php - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); ### src/Worker/Directory.php - Addon::callHooks('globaldir_update', $arr); + Hook::callAll('globaldir_update', $arr); ### src/Worker/Notifier.php - Addon::callHooks('notifier_end', $target_item); + Hook::callAll('notifier_end', $target_item); ### src/Worker/Queue.php - Addon::callHooks('queue_predeliver', $r); - Addon::callHooks('queue_deliver', $params); + Hook::callAll('queue_predeliver', $r); + Hook::callAll('queue_deliver', $params); ### src/Module/Login.php - Addon::callHooks('authenticate', $addon_auth); - Addon::callHooks('login_hook', $o); + Hook::callAll('authenticate', $addon_auth); + Hook::callAll('login_hook', $o); ### src/Module/Logout.php - Addon::callHooks("logging_out"); + Hook::callAll("logging_out"); ### src/Object/Post.php - Addon::callHooks('render_location', $locate); - Addon::callHooks('display_item', $arr); + Hook::callAll('render_location', $locate); + Hook::callAll('display_item', $arr); ### src/Core/ACL.php - Addon::callHooks('contact_select_options', $x); - Addon::callHooks($a->module.'_pre_'.$selname, $arr); - Addon::callHooks($a->module.'_post_'.$selname, $o); - Addon::callHooks($a->module.'_pre_'.$selname, $arr); - Addon::callHooks($a->module.'_post_'.$selname, $o); - Addon::callHooks('jot_networks', $jotnets); + Hook::callAll('contact_select_options', $x); + Hook::callAll($a->module.'_pre_'.$selname, $arr); + Hook::callAll($a->module.'_post_'.$selname, $o); + Hook::callAll($a->module.'_pre_'.$selname, $arr); + Hook::callAll($a->module.'_post_'.$selname, $o); + Hook::callAll('jot_networks', $jotnets); ### src/Core/Worker.php - Addon::callHooks("proc_run", $arr); + Hook::callAll("proc_run", $arr); ### src/Util/Emailer.php - Addon::callHooks('emailer_send_prepare', $params); - Addon::callHooks("emailer_send", $hookdata); + Hook::callAll('emailer_send_prepare', $params); + Hook::callAll("emailer_send", $hookdata); ### src/Util/Map.php - Addon::callHooks('generate_map', $arr); - Addon::callHooks('generate_named_map', $arr); - Addon::callHooks('Map::getCoordinates', $arr); + Hook::callAll('generate_map', $arr); + Hook::callAll('generate_named_map', $arr); + Hook::callAll('Map::getCoordinates', $arr); ### src/Util/Network.php - Addon::callHooks('avatar_lookup', $avatar); + Hook::callAll('avatar_lookup', $avatar); ### src/Util/ParseUrl.php - Addon::callHooks("getsiteinfo", $siteinfo); + Hook::callAll("getsiteinfo", $siteinfo); ### src/Protocol/DFRN.php - Addon::callHooks('atom_feed_end', $atom); - Addon::callHooks('atom_feed_end', $atom); + Hook::callAll('atom_feed_end', $atom); + Hook::callAll('atom_feed_end', $atom); diff --git a/include/api.php b/include/api.php index 6993cb6889..f28f182532 100644 --- a/include/api.php +++ b/include/api.php @@ -11,9 +11,9 @@ use Friendica\Content\ContactSelector; use Friendica\Content\Feature; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; -use Friendica\Core\Addon; use Friendica\Core\Authentication; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\NotificationsManager; @@ -174,7 +174,7 @@ function api_login(App $a) list($consumer, $token) = $oauth1->verify_request($request); if (!is_null($token)) { $oauth1->loginUser($token->uid); - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); return; } echo __FILE__.__LINE__.__FUNCTION__ . "
";
@@ -224,7 +224,7 @@ function api_login(App $a)
 	* Addons should never set 'authenticated' except to indicate success - as hooks may be chained
 	* and later addons should not interfere with an earlier one that succeeded.
 	*/
-	Addon::callHooks('authenticate', $addon_auth);
+	Hook::callAll('authenticate', $addon_auth);
 
 	if ($addon_auth['authenticated'] && count($addon_auth['user_record'])) {
 		$record = $addon_auth['user_record'];
@@ -247,7 +247,7 @@ function api_login(App $a)
 
 	$_SESSION["allow_api"] = true;
 
-	Addon::callHooks('logged_in', $a->user);
+	Hook::callAll('logged_in', $a->user);
 }
 
 /**
diff --git a/include/conversation.php b/include/conversation.php
index 1059941b9e..e15ac3f71a 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -8,8 +8,8 @@ use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
 use Friendica\Content\Pager;
 use Friendica\Content\Text\BBCode;
-use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
@@ -543,7 +543,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
 	}
 
 	$cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview];
-	Addon::callHooks('conversation_start',$cb);
+	Hook::callAll('conversation_start',$cb);
 
 	$items = $cb['items'];
 
@@ -615,7 +615,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
 				}
 
 				$locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
-				Addon::callHooks('render_location',$locate);
+				Hook::callAll('render_location',$locate);
 
 				$location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
 
@@ -706,7 +706,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
 				];
 
 				$arr = ['item' => $item, 'output' => $tmp_item];
-				Addon::callHooks('display_item', $arr);
+				Hook::callAll('display_item', $arr);
 
 				$threads[$threadsid]['id'] = $item['id'];
 				$threads[$threadsid]['network'] = $item['network'];
@@ -743,7 +743,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
 
 				/// @todo Check if this call is needed or not
 				$arr = ['item' => $item];
-				Addon::callHooks('display_item', $arr);
+				Hook::callAll('display_item', $arr);
 
 				$item['pagedrop'] = $page_dropping;
 
@@ -892,7 +892,7 @@ function item_photo_menu($item) {
 
 	$args = ['item' => $item, 'menu' => $menu];
 
-	Addon::callHooks('item_photo_menu', $args);
+	Hook::callAll('item_photo_menu', $args);
 
 	$menu = $args['menu'];
 
@@ -1097,7 +1097,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
 	]);
 
 	$jotplugins = '';
-	Addon::callHooks('jot_tool', $jotplugins);
+	Hook::callAll('jot_tool', $jotplugins);
 
 	// Private/public post links for the non-JS ACL form
 	$private_post = 1;
diff --git a/include/enotify.php b/include/enotify.php
index 9edfaaca82..e2b5105feb 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -4,8 +4,8 @@
  */
 
 use Friendica\Content\Text\BBCode;
-use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
@@ -441,7 +441,7 @@ function notification($params)
 		'itemlink'  => $itemlink
 	];
 
-	Addon::callHooks('enotify', $h);
+	Hook::callAll('enotify', $h);
 
 	$subject   = $h['subject'];
 
@@ -481,7 +481,7 @@ function notification($params)
 		$datarray['otype'] = $params['otype'];
 		$datarray['abort'] = false;
 
-		Addon::callHooks('enotify_store', $datarray);
+		Hook::callAll('enotify_store', $datarray);
 
 		if ($datarray['abort']) {
 			L10n::popLang();
@@ -584,7 +584,7 @@ function notification($params)
 		$datarray['subject'] = $subject;
 		$datarray['headers'] = $additional_mail_header;
 
-		Addon::callHooks('enotify_mail', $datarray);
+		Hook::callAll('enotify_mail', $datarray);
 
 		// check whether sending post content in email notifications is allowed
 		// always true for SYSTEM_EMAIL
@@ -677,7 +677,7 @@ function check_user_notification($itemid) {
  */
 function check_item_notification($itemid, $uid, $defaulttype = "") {
 	$notification_data = ["uid" => $uid, "profiles" => []];
-	Addon::callHooks('check_item_notification', $notification_data);
+	Hook::callAll('check_item_notification', $notification_data);
 
 	$profiles = $notification_data["profiles"];
 
diff --git a/include/items.php b/include/items.php
index db60519a2c..3dd405e786 100644
--- a/include/items.php
+++ b/include/items.php
@@ -5,8 +5,8 @@
 
 use Friendica\BaseObject;
 use Friendica\Content\Feature;
-use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
@@ -27,7 +27,7 @@ use Friendica\Util\Temporal;
 require_once 'mod/share.php';
 function add_page_info_data(array $data, $no_photos = false)
 {
-	Addon::callHooks('page_info_data', $data);
+	Hook::callAll('page_info_data', $data);
 
 	if (empty($data['type'])) {
 		return '';
diff --git a/mod/acl.php b/mod/acl.php
index 9f93b76a9b..fc67556739 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -5,7 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Widget;
 use Friendica\Core\ACL;
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
 use Friendica\Database\DBA;
@@ -305,7 +305,7 @@ function acl_content(App $a)
 		'search'   => $search,
 	];
 
-	Addon::callHooks('acl_lookup_end', $results);
+	Hook::callAll('acl_lookup_end', $results);
 
 	$o = [
 		'tot'   => $results['tot'],
diff --git a/mod/directory.php b/mod/directory.php
index fa5ce73d4c..0a37c1dc04 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -7,8 +7,8 @@ use Friendica\App;
 use Friendica\Content\Nav;
 use Friendica\Content\Pager;
 use Friendica\Content\Widget;
-use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
@@ -190,7 +190,7 @@ function directory_content(App $a)
 
 			$arr = ['contact' => $rr, 'entry' => $entry];
 
-			Addon::callHooks('directory_item', $arr);
+			Hook::callAll('directory_item', $arr);
 
 			unset($profile);
 			unset($location);
diff --git a/mod/editpost.php b/mod/editpost.php
index 1e53285830..bf103cf23c 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -4,7 +4,6 @@
  */
 use Friendica\App;
 use Friendica\Content\Feature;
-use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Hook;
 use Friendica\Core\L10n;
diff --git a/mod/friendica.php b/mod/friendica.php
index 4466211607..686e2e804b 100644
--- a/mod/friendica.php
+++ b/mod/friendica.php
@@ -6,6 +6,7 @@
 use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
@@ -126,7 +127,7 @@ function friendica_content(App $a)
 		$o .= '' . PHP_EOL;
 	}
 
-	Addon::callHooks('about_hook', $o);
+	Hook::callAll('about_hook', $o);
 
 	return $o;
 }
diff --git a/mod/home.php b/mod/home.php
index 02ec51dc0b..8e53c24f3d 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -3,8 +3,8 @@
  * @file mod/home.php
  */
 use Friendica\App;
-use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
@@ -14,7 +14,7 @@ if(! function_exists('home_init')) {
 function home_init(App $a) {
 
 	$ret = [];
-	Addon::callHooks('home_init',$ret);
+	Hook::callAll('home_init',$ret);
 
 	if (local_user() && ($a->user['nickname'])) {
 		$a->internalRedirect('network');
@@ -51,7 +51,7 @@ function home_content(App $a) {
 	$login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
 
 	$content = '';
-	Addon::callHooks("home_content",$content);
+	Hook::callAll("home_content",$content);
 
 
 	$tpl = Renderer::getMarkupTemplate('home.tpl');
diff --git a/mod/item.php b/mod/item.php
index 5e6f88bac7..3d6d886eeb 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -19,8 +19,8 @@ use Friendica\App;
 use Friendica\Content\Pager;
 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\L10n;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
@@ -54,7 +54,7 @@ function item_post(App $a) {
 		exit();
 	}
 
-	Addon::callHooks('post_local_start', $_REQUEST);
+	Hook::callAll('post_local_start', $_REQUEST);
 
 	Logger::log('postvars ' . print_r($_REQUEST, true), Logger::DATA);
 
@@ -679,7 +679,7 @@ function item_post(App $a) {
 		exit();
 	}
 
-	Addon::callHooks('post_local',$datarray);
+	Hook::callAll('post_local',$datarray);
 
 	if (!empty($datarray['cancel'])) {
 		Logger::log('mod_item: post cancelled by addon.');
@@ -795,7 +795,7 @@ function item_post(App $a) {
 		}
 	}
 
-	Addon::callHooks('post_local_end', $datarray);
+	Hook::callAll('post_local_end', $datarray);
 
 	if (strlen($emailcc) && $profile_uid == local_user()) {
 		$erecips = explode(',', $emailcc);
diff --git a/mod/lockview.php b/mod/lockview.php
index ef97cc91d0..35c4b04332 100644
--- a/mod/lockview.php
+++ b/mod/lockview.php
@@ -3,7 +3,7 @@
  * @file mod/lockview.php
  */
 use Friendica\App;
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Database\DBA;
 use Friendica\Model\Item;
@@ -40,7 +40,7 @@ function lockview_content(App $a)
 		exit();
 	}
 
-	Addon::callHooks('lockview_content', $item);
+	Hook::callAll('lockview_content', $item);
 
 	if ($item['uid'] != local_user()) {
 		echo L10n::t('Remote privacy information not available.') . '
'; diff --git a/mod/manage.php b/mod/manage.php index 4d0b65de15..52ddfdf032 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -4,10 +4,9 @@ */ use Friendica\App; use Friendica\Core\Authentication; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Renderer; -use Friendica\Core\System; use Friendica\Database\DBA; function manage_post(App $a) { @@ -116,7 +115,7 @@ function manage_post(App $a) { } $ret = []; - Addon::callHooks('home_init',$ret); + Hook::callAll('home_init',$ret); $a->internalRedirect('profile/' . $a->user['nickname'] ); // NOTREACHED diff --git a/mod/network.php b/mod/network.php index ef53be4715..015be2b17c 100644 --- a/mod/network.php +++ b/mod/network.php @@ -12,7 +12,6 @@ use Friendica\Content\Pager; use Friendica\Content\Widget; use Friendica\Content\Text\HTML; use Friendica\Core\ACL; -use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; @@ -355,7 +354,7 @@ function network_content(App $a, $update = 0, $parent = 0) /// @TODO Is this really necessary? $a is already available to hooks $arr = ['query' => $a->query_string]; - Addon::callHooks('network_content_init', $arr); + Hook::callAll('network_content_init', $arr); $flat_mode = false; @@ -1024,7 +1023,7 @@ function network_tabs(App $a) } $arr = ['tabs' => $tabs]; - Addon::callHooks('network_tabs', $arr); + Hook::callAll('network_tabs', $arr); $tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); diff --git a/mod/parse_url.php b/mod/parse_url.php index 02fbfa1b7d..14ec4d42ce 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -10,7 +10,7 @@ * @see ParseUrl::getSiteinfo() for more information about scraping embeddable content */ use Friendica\App; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Util\Network; use Friendica\Util\ParseUrl; @@ -97,7 +97,7 @@ function parse_url_content(App $a) $arr = ['url' => $url, 'text' => '']; - Addon::callHooks('parse_link', $arr); + Hook::callAll('parse_link', $arr); if (strlen($arr['text'])) { echo $arr['text']; diff --git a/mod/photos.php b/mod/photos.php index aff8041a9f..3a92774654 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -9,13 +9,12 @@ use Friendica\Content\Nav; use Friendica\Content\Pager; use Friendica\Content\Text\BBCode; use Friendica\Core\ACL; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Core\System; -use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Group; @@ -666,7 +665,7 @@ function photos_post(App $a) // default post action - upload a photo - Addon::callHooks('photo_post_init', $_POST); + Hook::callAll('photo_post_init', $_POST); // Determine the album to use $album = !empty($_REQUEST['album']) ? Strings::escapeTags(trim($_REQUEST['album'])) : ''; @@ -714,7 +713,7 @@ function photos_post(App $a) $ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => '']; - Addon::callHooks('photo_post_file', $ret); + Hook::callAll('photo_post_file', $ret); if (!empty($ret['src']) && !empty($ret['filesize'])) { $src = $ret['src']; @@ -754,7 +753,7 @@ function photos_post(App $a) } @unlink($src); $foo = 0; - Addon::callHooks('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); return; } @@ -770,7 +769,7 @@ function photos_post(App $a) notice(L10n::t('Image exceeds size limit of %s', Strings::formatBytes($maximagesize)) . EOL); @unlink($src); $foo = 0; - Addon::callHooks('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); return; } @@ -778,7 +777,7 @@ function photos_post(App $a) notice(L10n::t('Image file is empty.') . EOL); @unlink($src); $foo = 0; - Addon::callHooks('photo_post_end', $foo); + Hook::callAll('photo_post_end', $foo); return; } @@ -793,7 +792,7 @@ function photos_post(App $a) notice(L10n::t('Unable to process image.') . EOL); @unlink($src); $foo = 0; - Addon::callHooks('photo_post_end',$foo); + Hook::callAll('photo_post_end',$foo); exit(); } @@ -879,7 +878,7 @@ function photos_post(App $a) // Update the photo albums cache Photo::clearAlbumCache($page_owner_uid); - Addon::callHooks('photo_post_end', $item_id); + Hook::callAll('photo_post_end', $item_id); // addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook // if they do not wish to be redirected @@ -1042,7 +1041,7 @@ function photos_content(App $a) 'addon_text' => $uploader, 'default_upload' => true]; - Addon::callHooks('photo_upload_form',$ret); + Hook::callAll('photo_upload_form',$ret); $default_upload_box = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_box.tpl'), []); $default_upload_submit = Renderer::replaceMacros(Renderer::getMarkupTemplate('photos_default_uploader_submit.tpl'), [ diff --git a/mod/ping.php b/mod/ping.php index 9d8311f1c4..872e9f935b 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -4,12 +4,11 @@ */ use Friendica\App; -use Friendica\Content\Feature; use Friendica\Content\ForumManager; use Friendica\Content\Text\BBCode; -use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\System; @@ -129,7 +128,7 @@ function ping_init(App $a) if (DBA::isResult($items)) { $items_unseen = Item::inArray($items); $arr = ['items' => $items_unseen]; - Addon::callHooks('network_ping', $arr); + Hook::callAll('network_ping', $arr); foreach ($items_unseen as $item) { if ($item['wall']) { diff --git a/mod/poke.php b/mod/poke.php index fb1fae85d6..b8a1ba7bfd 100644 --- a/mod/poke.php +++ b/mod/poke.php @@ -14,12 +14,11 @@ */ use Friendica\App; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Core\System; -use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Item; use Friendica\Util\Strings; @@ -129,9 +128,9 @@ function poke_init(App $a) $arr['object'] .= XML::escape('' . "\n"); $arr['object'] .= '' . "\n"; - $item_id = Item::insert($arr); + Item::insert($arr); - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); return; } @@ -143,9 +142,6 @@ function poke_content(App $a) return; } - $name = ''; - $id = ''; - if (empty($_GET['c'])) { return; } diff --git a/mod/profile.php b/mod/profile.php index 51f8ca7534..f7d665334d 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -8,10 +8,9 @@ use Friendica\Content\Nav; use Friendica\Content\Pager; use Friendica\Content\Widget; use Friendica\Core\ACL; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; -use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\System; use Friendica\Database\DBA; @@ -167,7 +166,7 @@ function profile_content(App $a, $update = 0) if ($tab === 'profile') { $o .= Profile::getAdvanced($a); - Addon::callHooks('profile_advanced', $o); + Hook::callAll('profile_advanced', $o); return $o; } diff --git a/mod/profiles.php b/mod/profiles.php index b30739b304..74a3d91f07 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -8,8 +8,8 @@ use Friendica\BaseModule; use Friendica\Content\ContactSelector; use Friendica\Content\Feature; use Friendica\Content\Nav; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\Renderer; @@ -186,7 +186,7 @@ function profiles_post(App $a) { $namechanged = false; - Addon::callHooks('profile_post', $_POST); + Hook::callAll('profile_post', $_POST); if (($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) { $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", @@ -645,7 +645,7 @@ function profiles_content(App $a) { ]); $arr = ['profile' => $r[0], 'entry' => $o]; - Addon::callHooks('profile_edit', $arr); + Hook::callAll('profile_edit', $arr); return $o; } else { diff --git a/mod/register.php b/mod/register.php index b13ec22509..0125ae417e 100644 --- a/mod/register.php +++ b/mod/register.php @@ -6,8 +6,8 @@ use Friendica\App; use Friendica\BaseModule; use Friendica\Content\Text\BBCode; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; @@ -26,7 +26,7 @@ function register_post(App $a) $blocked = 1; $arr = ['post' => $_POST]; - Addon::callHooks('register_post', $arr); + Hook::callAll('register_post', $arr); $max_dailies = intval(Config::get('system', 'max_daily_registrations')); if ($max_dailies) { @@ -241,7 +241,7 @@ function register_content(App $a) $arr = ['template' => $tpl]; - Addon::callHooks('register_form', $arr); + Hook::callAll('register_form', $arr); $tpl = $arr['template']; diff --git a/mod/settings.php b/mod/settings.php index 048abff731..14c0cc64d7 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -8,8 +8,8 @@ use Friendica\BaseModule; use Friendica\Content\Feature; use Friendica\Content\Nav; use Friendica\Core\ACL; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; @@ -215,7 +215,7 @@ function settings_post(App $a) if (($a->argc > 1) && ($a->argv[1] == 'addon')) { BaseModule::checkFormSecurityTokenRedirectOnError('/settings/addon', 'settings_addon'); - Addon::callHooks('addon_settings_post', $_POST); + Hook::callAll('addon_settings_post', $_POST); return; } @@ -297,7 +297,7 @@ function settings_post(App $a) } } - Addon::callHooks('connector_settings_post', $_POST); + Hook::callAll('connector_settings_post', $_POST); return; } @@ -372,7 +372,7 @@ function settings_post(App $a) intval(local_user()) ); - Addon::callHooks('display_settings_post', $_POST); + Hook::callAll('display_settings_post', $_POST); $a->internalRedirect('settings/display'); return; // NOTREACHED } @@ -385,7 +385,7 @@ function settings_post(App $a) $a->internalRedirect('settings'); } - Addon::callHooks('settings_post', $_POST); + Hook::callAll('settings_post', $_POST); if (!empty($_POST['password']) || !empty($_POST['confirm'])) { $newpass = $_POST['password']; @@ -743,7 +743,7 @@ function settings_content(App $a) $settings_addons = L10n::t('No Addon settings configured'); } - Addon::callHooks('addon_settings', $settings_addons); + Hook::callAll('addon_settings', $settings_addons); $tpl = Renderer::getMarkupTemplate('settings/addons.tpl'); @@ -790,7 +790,7 @@ function settings_content(App $a) } $settings_connectors = ''; - Addon::callHooks('connector_settings', $settings_connectors); + Hook::callAll('connector_settings', $settings_connectors); if (is_site_admin()) { $diasp_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? L10n::t('enabled') : L10n::t('disabled'))); @@ -863,7 +863,7 @@ function settings_content(App $a) '$submit' => L10n::t('Save Settings'), ]); - Addon::callHooks('display_settings', $o); + Hook::callAll('display_settings', $o); return $o; } @@ -1262,7 +1262,7 @@ function settings_content(App $a) ]); - Addon::callHooks('settings_form', $o); + Hook::callAll('settings_form', $o); $o .= '' . "\r\n"; diff --git a/mod/subthread.php b/mod/subthread.php index 3d71673033..23ebf4fe48 100644 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -3,7 +3,7 @@ * @file mod/subthread.php */ use Friendica\App; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\System; @@ -149,7 +149,7 @@ EOT; $arr['id'] = $post_id; - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); exit(); diff --git a/mod/tagger.php b/mod/tagger.php index 87895e16f8..7cb43e330c 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -3,7 +3,7 @@ * @file mod/tagger.php */ use Friendica\App; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\System; @@ -199,7 +199,7 @@ EOT; $arr['id'] = $post_id; - Addon::callHooks('post_local_end', $arr); + Hook::callAll('post_local_end', $arr); Worker::add(PRIORITY_HIGH, "Notifier", "tag", $post_id); diff --git a/mod/uexport.php b/mod/uexport.php index 11ed4b67ea..523e2fef85 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -3,7 +3,7 @@ * @file mod/uexport.php */ use Friendica\App; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\Core\System; @@ -45,7 +45,7 @@ function uexport_content(App $a) { ['uexport/account', L10n::t('Export account'), L10n::t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')], ['uexport/backup', L10n::t('Export all'), L10n::t("Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account \x28photos are not exported\x29")], ]; - Addon::callHooks('uexport_options', $options); + Hook::callAll('uexport_options', $options); $tpl = Renderer::getMarkupTemplate("uexport.tpl"); return Renderer::replaceMacros($tpl, [ diff --git a/mod/xrd.php b/mod/xrd.php index b470197a2e..1b3b4f3cc1 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -4,7 +4,7 @@ */ use Friendica\App; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Database\DBA; @@ -127,7 +127,7 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r) ); $arr = ['user' => $r, 'xml' => $o]; - Addon::callHooks('personal_xrd', $arr); + Hook::callAll('personal_xrd', $arr); echo $arr['xml']; exit(); diff --git a/src/App.php b/src/App.php index c41cfdc6c0..df350542ad 100644 --- a/src/App.php +++ b/src/App.php @@ -781,7 +781,7 @@ class App $touch_icon = 'images/friendica-128.png'; } - Core\Addon::callHooks('head', $this->page['htmlhead']); + Core\Hook::callAll('head', $this->page['htmlhead']); $tpl = Core\Renderer::getMarkupTemplate('head.tpl'); /* put the head template at the beginning of page['htmlhead'] @@ -840,7 +840,7 @@ class App ]); } - Core\Addon::callHooks('footer', $this->page['footer']); + Core\Hook::callAll('footer', $this->page['footer']); $tpl = Core\Renderer::getMarkupTemplate('footer.tpl'); $this->page['footer'] = Core\Renderer::replaceMacros($tpl, [ @@ -1534,7 +1534,7 @@ class App } Core\Session::init(); - Core\Addon::callHooks('init_1'); + Core\Hook::callAll('init_1'); } // Exclude the backend processes from the session management @@ -1725,7 +1725,7 @@ class App $this->page['page_title'] = $this->module; $placeholder = ''; - Core\Addon::callHooks($this->module . '_mod_init', $placeholder); + Core\Hook::callAll($this->module . '_mod_init', $placeholder); call_user_func([$this->module_class, 'init']); @@ -1749,28 +1749,28 @@ class App if ($this->module_loaded) { if (! $this->error && $_SERVER['REQUEST_METHOD'] === 'POST') { - Core\Addon::callHooks($this->module . '_mod_post', $_POST); + Core\Hook::callAll($this->module . '_mod_post', $_POST); call_user_func([$this->module_class, 'post']); } if (! $this->error) { - Core\Addon::callHooks($this->module . '_mod_afterpost', $placeholder); + Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder); call_user_func([$this->module_class, 'afterpost']); } if (! $this->error) { $arr = ['content' => $content]; - Core\Addon::callHooks($this->module . '_mod_content', $arr); + Core\Hook::callAll($this->module . '_mod_content', $arr); $content = $arr['content']; $arr = ['content' => call_user_func([$this->module_class, 'content'])]; - Core\Addon::callHooks($this->module . '_mod_aftercontent', $arr); + Core\Hook::callAll($this->module . '_mod_aftercontent', $arr); $content .= $arr['content']; } } // initialise content region if ($this->getMode()->isNormal()) { - Core\Addon::callHooks('page_content_top', $this->page['content']); + Core\Hook::callAll('page_content_top', $this->page['content']); } $this->page['content'] .= $content; @@ -1797,7 +1797,7 @@ class App } // Report anything which needs to be communicated in the notification area (before the main body) - Core\Addon::callHooks('page_end', $this->page['content']); + Core\Hook::callAll('page_end', $this->page['content']); // Add the navigation (menu) template if ($this->module != 'install' && $this->module != 'maintenance') { diff --git a/src/Content/ContactSelector.php b/src/Content/ContactSelector.php index 6a5ee9112b..4ba579b514 100644 --- a/src/Content/ContactSelector.php +++ b/src/Content/ContactSelector.php @@ -4,10 +4,9 @@ */ namespace Friendica\Content; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Protocol; -use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Util\Network; use Friendica\Util\Strings; @@ -96,7 +95,7 @@ class ContactSelector Protocol::PNUT => L10n::t('pnut'), ]; - Addon::callHooks('network_to_name', $nets); + Hook::callAll('network_to_name', $nets); $search = array_keys($nets); $replace = array_values($nets); @@ -141,6 +140,7 @@ class ContactSelector /** * @param string $current optional, default empty * @param string $suffix optionsl, default empty + * @return string */ public static function gender($current = "", $suffix = "") { @@ -163,7 +163,7 @@ class ContactSelector 'Undecided' => L10n::t('Undecided'), ]; - Addon::callHooks('gender_selector', $select); + Hook::callAll('gender_selector', $select); $o .= ""; foreach ($select as $neutral => $selection) { @@ -215,6 +216,7 @@ class ContactSelector /** * @param string $current optional, default empty + * @return string */ public static function maritalStatus($current = "") { @@ -254,7 +256,7 @@ class ContactSelector 'Ask me' => L10n::t('Ask me'), ]; - Addon::callHooks('marital_selector', $select); + Hook::callAll('marital_selector', $select); $o .= '' . PHP_EOL; - Addon::callHooks($a->module . '_post_' . $selname, $o); + Hook::callAll($a->module . '_post_' . $selname, $o); return $o; } @@ -176,7 +174,7 @@ class ACL extends BaseObject $arr = ['contact' => $contacts, 'entry' => $o]; // e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow' - Addon::callHooks($a->module . '_pre_' . $selname, $arr); + Hook::callAll($a->module . '_pre_' . $selname, $arr); $receiverlist = []; @@ -202,7 +200,7 @@ class ACL extends BaseObject $o .= implode(', ', $receiverlist); } - Addon::callHooks($a->module . '_post_' . $selname, $o); + Hook::callAll($a->module . '_post_' . $selname, $o); return $o; } @@ -285,7 +283,7 @@ class ACL extends BaseObject $jotnets .= '
' . L10n::t("Post to Email") . '
'; } - Addon::callHooks('jot_networks', $jotnets); + Hook::callAll('jot_networks', $jotnets); } else { $jotnets .= L10n::t('Connectors disabled, since "%s" is enabled.', L10n::t('Hide your profile details from unknown viewers?')); diff --git a/src/Core/Authentication.php b/src/Core/Authentication.php index ca5ec3fd08..235b99f8f7 100644 --- a/src/Core/Authentication.php +++ b/src/Core/Authentication.php @@ -6,11 +6,6 @@ namespace Friendica\Core; use Friendica\BaseObject; -use Friendica\Core\Addon; -use Friendica\Core\Config; -use Friendica\Core\L10n; -use Friendica\Core\Logger; -use Friendica\Core\PConfig; use Friendica\Database\DBA; use Friendica\Model\User; use Friendica\Util\DateTimeFormat; @@ -154,7 +149,7 @@ class Authentication extends BaseObject } if ($login_initial) { - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); if (($a->module !== 'home') && isset($_SESSION['return_path'])) { $a->internalRedirect($_SESSION['return_path']); diff --git a/src/Core/L10n.php b/src/Core/L10n.php index aa36c2e4f9..73042c7c26 100644 --- a/src/Core/L10n.php +++ b/src/Core/L10n.php @@ -6,9 +6,6 @@ namespace Friendica\Core; use Friendica\BaseObject; use Friendica\Database\DBA; -use Friendica\Core\Addon; -use Friendica\Core\Logger; -use Friendica\Core\System; /** * Provide Language, Translation, and Localization functions to the application @@ -402,7 +399,7 @@ class L10n extends BaseObject 'rebuff' => ['rebuffed', self::t('rebuff'), self::t('rebuffed')], ]; - Addon::callHooks('poke_verbs', $arr); + Hook::callAll('poke_verbs', $arr); return $arr; } diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 3a4be04381..aae3e85d08 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -5,7 +5,6 @@ namespace Friendica\Core; use Friendica\BaseObject; -use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\Model\Process; use Friendica\Util\DateTimeFormat; @@ -1070,7 +1069,7 @@ class Worker $arr = ['args' => $args, 'run_cmd' => true]; - Addon::callHooks("proc_run", $arr); + Hook::callAll("proc_run", $arr); if (!$arr['run_cmd'] || !count($args)) { return true; } diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 1dac5dbf41..3c9071b9fe 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -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 = []; diff --git a/src/Model/Event.php b/src/Model/Event.php index ce77ee7a93..5f0238aad2 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -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; diff --git a/src/Model/Item.php b/src/Model/Item.php index 2222d71f55..0451e95b37 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -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']; } diff --git a/src/Model/Profile.php b/src/Model/Profile.php index a5fb908a78..f78f422359 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -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']; diff --git a/src/Model/User.php b/src/Model/User.php index 4fc17ae82d..602ba9b33f 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -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; diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 245e5f0b22..fa231b1de1 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -10,7 +10,7 @@ use Friendica\Content\Pager; use Friendica\Content\Text\BBCode; use Friendica\Content\Widget; use Friendica\Core\ACL; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Protocol; use Friendica\Core\Renderer; @@ -194,7 +194,7 @@ class Contact extends BaseModule return; // NOTREACHED } - Addon::callHooks('contact_edit_post', $_POST); + Hook::callAll('contact_edit_post', $_POST); $profile_id = intval(defaults($_POST, 'profile-assign', 0)); if ($profile_id) { @@ -659,7 +659,7 @@ class Contact extends BaseModule $arr = ['contact' => $contact, 'output' => $o]; - Addon::callHooks('contact_edit', $arr); + Hook::callAll('contact_edit', $arr); return $arr['output']; } diff --git a/src/Module/Login.php b/src/Module/Login.php index 41ea917cf3..7a0e8e40e2 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -6,9 +6,9 @@ namespace Friendica\Module; use Exception; use Friendica\BaseModule; -use Friendica\Core\Addon; use Friendica\Core\Authentication; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Renderer; @@ -131,7 +131,7 @@ class Login extends BaseModule * Addons should never set 'authenticated' except to indicate success - as hooks may be chained * and later addons should not interfere with an earlier one that succeeded. */ - Addon::callHooks('authenticate', $addon_auth); + Hook::callAll('authenticate', $addon_auth); try { if ($addon_auth['authenticated']) { @@ -340,7 +340,7 @@ class Login extends BaseModule ] ); - Addon::callHooks('login_hook', $o); + Hook::callAll('login_hook', $o); return $o; } diff --git a/src/Module/Logout.php b/src/Module/Logout.php index 7024fc110a..4ccba2d744 100644 --- a/src/Module/Logout.php +++ b/src/Module/Logout.php @@ -2,13 +2,13 @@ /** * @file src/Module/Logout.php */ + namespace Friendica\Module; use Friendica\BaseModule; -use Friendica\Core\Addon; use Friendica\Core\Authentication; +use Friendica\Core\Hook; use Friendica\Core\L10n; -use Friendica\Core\System; /** * Logout module @@ -22,7 +22,7 @@ class Logout extends BaseModule */ public static function init() { - Addon::callHooks("logging_out"); + Hook::callAll("logging_out"); Authentication::deleteSession(); info(L10n::t('Logged out.') . EOL); self::getApp()->internalRedirect(); diff --git a/src/Network/FKOAuth1.php b/src/Network/FKOAuth1.php index 43ef1257c5..1e84ff052b 100644 --- a/src/Network/FKOAuth1.php +++ b/src/Network/FKOAuth1.php @@ -4,7 +4,7 @@ */ namespace Friendica\Network; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\System; @@ -69,6 +69,6 @@ class FKOAuth1 extends OAuthServer DBA::update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $_SESSION['uid']]); - Addon::callHooks('logged_in', $a->user); + Hook::callAll('logged_in', $a->user); } } diff --git a/src/Object/Post.php b/src/Object/Post.php index 8aae024ffb..a1d6c1eab0 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -8,6 +8,7 @@ use Friendica\BaseObject; use Friendica\Content\ContactSelector; use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; @@ -229,7 +230,7 @@ class Post extends BaseObject } $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => '']; - Addon::callHooks('render_location', $locate); + Hook::callAll('render_location', $locate); $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate)); // process action responses - e.g. like/dislike/attend/agree/whatever @@ -433,7 +434,7 @@ class Post extends BaseObject ]; $arr = ['item' => $item, 'output' => $tmp_item]; - Addon::callHooks('display_item', $arr); + Hook::callAll('display_item', $arr); $result = $arr['output']; diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index 6c475b1852..c08a24f423 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -14,8 +14,8 @@ use Friendica\App; use Friendica\Content\OEmbed; 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\Logger; use Friendica\Core\Protocol; use Friendica\Core\System; @@ -295,12 +295,12 @@ class DFRN $root = self::addHeader($doc, $owner, $author, $alternatelink, true); /// @TODO This hook can't work anymore - // Addon::callHooks('atom_feed', $atom); + // \Friendica\Core\Hook::callAll('atom_feed', $atom); if (!DBA::isResult($items) || $onlyheader) { $atom = trim($doc->saveXML()); - Addon::callHooks('atom_feed_end', $atom); + Hook::callAll('atom_feed_end', $atom); return $atom; } @@ -329,7 +329,7 @@ class DFRN $atom = trim($doc->saveXML()); - Addon::callHooks('atom_feed_end', $atom); + Hook::callAll('atom_feed_end', $atom); return $atom; } diff --git a/src/Render/FriendicaSmartyEngine.php b/src/Render/FriendicaSmartyEngine.php index 54295684cc..69a34ae565 100644 --- a/src/Render/FriendicaSmartyEngine.php +++ b/src/Render/FriendicaSmartyEngine.php @@ -4,7 +4,7 @@ */ namespace Friendica\Render; -use Friendica\Core\Addon; +use Friendica\Core\Hook; /** * Smarty implementation of the Friendica template engine interface @@ -39,7 +39,7 @@ class FriendicaSmartyEngine implements ITemplateEngine "template" => basename($s->filename), "vars" => $r ]; - Addon::callHooks("template_vars", $arr); + Hook::callAll("template_vars", $arr); $r = $arr['vars']; foreach ($r as $key => $value) { diff --git a/src/Util/Crypto.php b/src/Util/Crypto.php index 3426babe36..6e054df973 100644 --- a/src/Util/Crypto.php +++ b/src/Util/Crypto.php @@ -4,10 +4,9 @@ */ namespace Friendica\Util; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\Logger; -use Friendica\Util\Strings; use ASN_BASE; use ASNValue; @@ -372,7 +371,7 @@ class Crypto return $result; } else { $x = ['data' => $data, 'pubkey' => $pubkey, 'alg' => $alg, 'result' => $data]; - Addon::callHooks('other_encapsulate', $x); + Hook::callAll('other_encapsulate', $x); return $x['result']; } @@ -455,7 +454,7 @@ class Crypto return self::$fn(Strings::base64UrlDecode($data['data']), $k, $i); } else { $x = ['data' => $data, 'prvkey' => $prvkey, 'alg' => $alg, 'result' => $data]; - Addon::callHooks('other_unencapsulate', $x); + Hook::callAll('other_unencapsulate', $x); return $x['result']; } diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index a13af739e6..e9bcbc200d 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -4,8 +4,8 @@ */ namespace Friendica\Util; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Protocol\Email; @@ -33,7 +33,7 @@ class Emailer */ public static function send($params) { - Addon::callHooks('emailer_send_prepare', $params); + Hook::callAll('emailer_send_prepare', $params); $email_textonly = false; if (!empty($params['uid'])) { @@ -89,7 +89,7 @@ class Emailer 'parameters' => $sendmail_params ]; - Addon::callHooks("emailer_send", $hookdata); + Hook::callAll("emailer_send", $hookdata); $res = mail( $hookdata['to'], diff --git a/src/Util/Map.php b/src/Util/Map.php index d3ac021665..a35235bf5c 100644 --- a/src/Util/Map.php +++ b/src/Util/Map.php @@ -4,7 +4,7 @@ */ namespace Friendica\Util; -use Friendica\Core\Addon; +use Friendica\Core\Hook; /** * Leaflet Map related functions @@ -14,19 +14,19 @@ class Map { $coord = trim($coord); $coord = str_replace([',','/',' '],[' ',' ',' '],$coord); $arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'mode' => $html_mode, 'html' => '']; - Addon::callHooks('generate_map',$arr); + Hook::callAll('generate_map',$arr); return ($arr['html']) ? $arr['html'] : $coord; } public static function byLocation($location, $html_mode = 0) { $arr = ['location' => $location, 'mode' => $html_mode, 'html' => '']; - Addon::callHooks('generate_named_map',$arr); + Hook::callAll('generate_named_map',$arr); return ($arr['html']) ? $arr['html'] : $location; } public static function getCoordinates($location) { $arr = ['location' => $location, 'lat' => false, 'lon' => false]; - Addon::callHooks('Map::getCoordinates', $arr); + Hook::callAll('Map::getCoordinates', $arr); return $arr; } } diff --git a/src/Util/Network.php b/src/Util/Network.php index d4e18a8a63..5cac96b79c 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -4,12 +4,11 @@ */ namespace Friendica\Util; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Core\Config; use Friendica\Network\CurlResult; -use Friendica\Util\Strings; use DOMDocument; use DomXPath; @@ -533,7 +532,7 @@ class Network $avatar['url'] = ''; $avatar['success'] = false; - Addon::callHooks('avatar_lookup', $avatar); + Hook::callAll('avatar_lookup', $avatar); if (! $avatar['success']) { $avatar['url'] = System::baseUrl() . '/images/person-300.jpg'; diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index 70c5279cc8..cdafc7387b 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -8,11 +8,10 @@ namespace Friendica\Util; use DOMDocument; use DOMXPath; use Friendica\Content\OEmbed; -use Friendica\Core\Addon; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\Object\Image; -use Friendica\Util\Strings; /** * @brief Class with methods for extracting certain content from an url @@ -422,7 +421,7 @@ class ParseUrl Logger::log('Siteinfo for ' . $url . ' ' . print_r($siteinfo, true), Logger::DEBUG); - Addon::callHooks('getsiteinfo', $siteinfo); + Hook::callAll('getsiteinfo', $siteinfo); return $siteinfo; } diff --git a/src/Worker/Directory.php b/src/Worker/Directory.php index b4b86e344e..8e8c0aa819 100644 --- a/src/Worker/Directory.php +++ b/src/Worker/Directory.php @@ -6,8 +6,8 @@ namespace Friendica\Worker; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -32,7 +32,7 @@ class Directory $arr = ['url' => $url]; - Addon::callHooks('globaldir_update', $arr); + Hook::callAll('globaldir_update', $arr); Logger::log('Updating directory: ' . $arr['url'], Logger::DEBUG); if (strlen($arr['url'])) { diff --git a/src/Worker/Queue.php b/src/Worker/Queue.php index 7ba18ae1c2..704ac00b4e 100644 --- a/src/Worker/Queue.php +++ b/src/Worker/Queue.php @@ -4,9 +4,9 @@ */ namespace Friendica\Worker; -use Friendica\Core\Addon; use Friendica\Core\Cache; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Worker; @@ -37,7 +37,7 @@ class Queue $r = DBA::toArray(DBA::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`")); - Addon::callHooks('queue_predeliver', $r); + Hook::callAll('queue_predeliver', $r); if (DBA::isResult($r)) { foreach ($r as $q_item) { @@ -148,7 +148,7 @@ class Queue default: $params = ['owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false]; - Addon::callHooks('queue_deliver', $params); + Hook::callAll('queue_deliver', $params); if ($params['result']) { QueueModel::removeItem($q_item['id']);