From c90314cd6ad8b865205c0bca656df5e9efb65638 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 26 Dec 2018 10:06:05 -0500 Subject: [PATCH] Replace deprecated Addon::*registerHook by Hook::*register - Updated documentation --- doc/Addons.md | 6 +++--- doc/de/Addons.md | 2 +- view/theme/frio/theme.php | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/Addons.md b/doc/Addons.md index 3aee9b7384..29cf22bfe9 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -32,7 +32,7 @@ It will be displayed in the admin panel and should include some further informat Register your addon hooks during installation. - Addon::registerHook($hookname, $file, $function); + \Friendica\Core\Hook::register($hookname, $file, $function); $hookname is a string and corresponds to a known Friendica PHP hook. @@ -74,7 +74,7 @@ If your addon requires adding a stylesheet on all pages of Friendica, add the fo ```php function _install() { - Addon::registerHook('head', __FILE__, '_head'); + \Friendica\Core\Hook::register('head', __FILE__, '_head'); ... } @@ -97,7 +97,7 @@ If your addon requires adding a script on all pages of Friendica, add the follow ```php function _install() { - Addon::registerHook('footer', __FILE__, '_footer'); + \Friendica\Core\Hook::register('footer', __FILE__, '_footer'); ... } diff --git a/doc/de/Addons.md b/doc/de/Addons.md index d63f0aa37b..d85d4d07b1 100644 --- a/doc/de/Addons.md +++ b/doc/de/Addons.md @@ -26,7 +26,7 @@ Addons sollten einen Kommentarblock mit den folgenden vier Parametern enthalten: Registriere deine Addon-Hooks während der Installation. - Addon::registerHook($hookname, $file, $function); + \Friendica\Core\Hook::register($hookname, $file, $function); $hookname ist ein String und entspricht einem bekannten Friendica-Hook. diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index 9bae9053af..d177e81d32 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -10,8 +10,8 @@ use Friendica\App; use Friendica\Content\Text\Plaintext; use Friendica\Content\Widget; -use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\PConfig; @@ -46,24 +46,24 @@ EOT; function frio_install() { - Addon::registerHook('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links'); - Addon::registerHook('item_photo_menu', 'view/theme/frio/theme.php', 'frio_item_photo_menu'); - Addon::registerHook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); - Addon::registerHook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); - Addon::registerHook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); - Addon::registerHook('display_item', 'view/theme/frio/theme.php', 'frio_display_item'); + Hook::register('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links'); + Hook::register('item_photo_menu', 'view/theme/frio/theme.php', 'frio_item_photo_menu'); + Hook::register('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); + Hook::register('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); + Hook::register('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); + Hook::register('display_item', 'view/theme/frio/theme.php', 'frio_display_item'); Logger::log('installed theme frio'); } function frio_uninstall() { - Addon::unregisterHook('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links'); - Addon::unregisterHook('item_photo_menu', 'view/theme/frio/theme.php', 'frio_item_photo_menu'); - Addon::unregisterHook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); - Addon::unregisterHook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); - Addon::unregisterHook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); - Addon::unregisterHook('display_item', 'view/theme/frio/theme.php', 'frio_display_item'); + Hook::unregister('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links'); + Hook::unregister('item_photo_menu', 'view/theme/frio/theme.php', 'frio_item_photo_menu'); + Hook::unregister('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); + Hook::unregister('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); + Hook::unregister('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); + Hook::unregister('display_item', 'view/theme/frio/theme.php', 'frio_display_item'); Logger::log('uninstalled theme frio'); } -- 2.39.5