Browse Source

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

- Updated documentation
tags/2019.03^2
Hypolite Petovan 1 year ago
parent
commit
c90314cd6a
3 changed files with 17 additions and 17 deletions
  1. +3
    -3
      doc/Addons.md
  2. +1
    -1
      doc/de/Addons.md
  3. +13
    -13
      view/theme/frio/theme.php

+ 3
- 3
doc/Addons.md 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.

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 <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
function <addon>_install()
{
Addon::registerHook('footer', __FILE__, '<addon>_footer');
\Friendica\Core\Hook::register('footer', __FILE__, '<addon>_footer');
...
}



+ 1
- 1
doc/de/Addons.md View File

@@ -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.



+ 13
- 13
view/theme/frio/theme.php View File

@@ -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');
}


Loading…
Cancel
Save