Replace deprecated Addon::*registerHook by Hook::*register

- Updated documentation
This commit is contained in:
Hypolite Petovan 2018-12-26 10:06:05 -05:00
parent 55e54bb950
commit c90314cd6a
3 changed files with 17 additions and 17 deletions

View file

@ -32,7 +32,7 @@ It will be displayed in the admin panel and should include some further informat
Register your addon hooks during installation. 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. $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 ```php
function <addon>_install() function <addon>_install()
{ {
Addon::registerHook('head', __FILE__, '<addon>_head'); \Friendica\Core\Hook::register('head', __FILE__, '<addon>_head');
... ...
} }
@ -97,7 +97,7 @@ If your addon requires adding a script on all pages of Friendica, add the follow
```php ```php
function <addon>_install() function <addon>_install()
{ {
Addon::registerHook('footer', __FILE__, '<addon>_footer'); \Friendica\Core\Hook::register('footer', __FILE__, '<addon>_footer');
... ...
} }

View file

@ -26,7 +26,7 @@ Addons sollten einen Kommentarblock mit den folgenden vier Parametern enthalten:
Registriere deine Addon-Hooks während der Installation. 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. $hookname ist ein String und entspricht einem bekannten Friendica-Hook.

View file

@ -10,8 +10,8 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Text\Plaintext; use Friendica\Content\Text\Plaintext;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Addon;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
@ -46,24 +46,24 @@ EOT;
function frio_install() function frio_install()
{ {
Addon::registerHook('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links'); Hook::register('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'); Hook::register('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'); Hook::register('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu');
Addon::registerHook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); Hook::register('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav');
Addon::registerHook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); Hook::register('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('display_item', 'view/theme/frio/theme.php', 'frio_display_item');
Logger::log('installed theme frio'); Logger::log('installed theme frio');
} }
function frio_uninstall() function frio_uninstall()
{ {
Addon::unregisterHook('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links'); Hook::unregister('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'); Hook::unregister('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'); Hook::unregister('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu');
Addon::unregisterHook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); Hook::unregister('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav');
Addon::unregisterHook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); Hook::unregister('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('display_item', 'view/theme/frio/theme.php', 'frio_display_item');
Logger::log('uninstalled theme frio'); Logger::log('uninstalled theme frio');
} }