]> git.mxchange.org Git - friendica.git/commitdiff
Update Addon functions and calls
authorAdam Magness <adam.magness@gmail.com>
Wed, 17 Jan 2018 18:42:40 +0000 (13:42 -0500)
committerAdam Magness <adam.magness@gmail.com>
Sat, 20 Jan 2018 12:48:22 +0000 (07:48 -0500)
Update function names and calls for Addon class.

73 files changed:
boot.php
doc/Plugins.md
doc/de/Plugins.md
include/acl_selectors.php
include/api.php
include/bb2diaspora.php
include/bbcode.php
include/conversation.php
include/enotify.php
include/event.php
include/friendica_smarty.php
include/html2bbcode.php
include/items.php
include/like.php
include/network.php
include/security.php
include/text.php
index.php
mod/admin.php
mod/contacts.php
mod/directory.php
mod/editpost.php
mod/friendica.php
mod/home.php
mod/item.php
mod/lockview.php
mod/manage.php
mod/network.php
mod/nodeinfo.php
mod/parse_url.php
mod/photos.php
mod/ping.php
mod/poke.php
mod/profile.php
mod/profiles.php
mod/register.php
mod/settings.php
mod/statistics_json.php
mod/subthread.php
mod/tagger.php
mod/uexport.php
mod/xrd.php
scripts/worker.php
src/Content/ContactSelector.php
src/Content/Feature.php
src/Content/Nav.php
src/Content/OEmbed.php
src/Content/Smilies.php
src/Content/Widget.php
src/Core/Addon.php
src/Core/Worker.php
src/Model/Contact.php
src/Model/Profile.php
src/Model/User.php
src/Module/Login.php
src/Module/Logout.php
src/Network/FKOAuth1.php
src/Object/Post.php
src/Protocol/DFRN.php
src/Util/Emailer.php
src/Util/Map.php
src/Util/ParseUrl.php
src/Worker/Cron.php
src/Worker/CronHooks.php
src/Worker/Directory.php
src/Worker/Expire.php
src/Worker/Notifier.php
src/Worker/Queue.php
update.php
view/theme/frio/php/schema.php
view/theme/frio/theme.php
view/theme/frost/theme.php
view/theme/vier/theme.php

index 0692e8475781d1b3844a92dec1da64e673ff9813..2c4a6fa0a8a92cb1f32dc0e1476322cf18d92615 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -21,6 +21,7 @@
 require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
@@ -32,7 +33,6 @@ use Friendica\Database\DBStructure;
 use Friendica\Module\Login;
 
 require_once 'include/network.php';
-require_once 'include/plugin.php';
 require_once 'include/text.php';
 require_once 'include/datetime.php';
 require_once 'include/pgettext.php';
@@ -833,7 +833,7 @@ function check_plugins(App $a)
        if (count($installed)) {
                foreach ($installed as $i) {
                        if (!in_array($i['name'], $plugins_arr)) {
-                               uninstall_plugin($i['name']);
+                               Addon::uninstall($i['name']);
                        } else {
                                $installed_arr[] = $i['name'];
                        }
@@ -843,12 +843,12 @@ function check_plugins(App $a)
        if (count($plugins_arr)) {
                foreach ($plugins_arr as $p) {
                        if (!in_array($p, $installed_arr)) {
-                               install_plugin($p);
+                               Addon::install($p);
                        }
                }
        }
 
-       load_hooks();
+       Addon::loadHooks();
 
        return;
 }
index ab8c58eb856801efd20c2cca07e783dbae91f199..995e9184c78b7f57fa6804025f46ac5786b260cb 100644 (file)
@@ -27,7 +27,7 @@ Plugins should contain a comment block with the four following parameters:
 
 Register your plugin hooks during installation.
 
-    register_hook($hookname, $file, $function);
+    Addon::registerHook($hookname, $file, $function);
 
 $hookname is a string and corresponds to a known Friendica hook.
 
@@ -296,182 +296,182 @@ Complete list of hook callbacks
 
 Here is a complete list of all hook callbacks with file locations (as of 14-Feb-2012). Please see the source for details of any hooks not documented above.
 
-boot.php:      call_hooks('login_hook',$o);
+boot.php:      Addon::callHooks('login_hook',$o);
 
-boot.php:      call_hooks('profile_sidebar_enter', $profile);
+boot.php:      Addon::callHooks('profile_sidebar_enter', $profile);
 
-boot.php:      call_hooks('profile_sidebar', $arr);
+boot.php:      Addon::callHooks('profile_sidebar', $arr);
 
-boot.php:      call_hooks("proc_run", $arr);
+boot.php:      Addon::callHooks("proc_run", $arr);
 
-include/contact_selectors.php: call_hooks('network_to_name', $nets);
+include/contact_selectors.php: Addon::callHooks('network_to_name', $nets);
 
-include/api.php:                               call_hooks('logged_in', $a->user);
+include/api.php:                               Addon::callHooks('logged_in', $a->user);
 
-include/api.php:               call_hooks('logged_in', $a->user);
+include/api.php:               Addon::callHooks('logged_in', $a->user);
 
-include/queue.php:             call_hooks('queue_predeliver', $a, $r);
+include/queue.php:             Addon::callHooks('queue_predeliver', $a, $r);
 
-include/queue.php:                             call_hooks('queue_deliver', $a, $params);
+include/queue.php:                             Addon::callHooks('queue_deliver', $a, $params);
 
-include/text.php:      call_hooks('contact_block_end', $arr);
+include/text.php:      Addon::callHooks('contact_block_end', $arr);
 
-include/text.php:      call_hooks('smilie', $s);
+include/text.php:      Addon::callHooks('smilie', $s);
 
-include/text.php:      call_hooks('prepare_body_init', $item);
+include/text.php:      Addon::callHooks('prepare_body_init', $item);
 
-include/text.php:      call_hooks('prepare_body', $prep_arr);
+include/text.php:      Addon::callHooks('prepare_body', $prep_arr);
 
-include/text.php:      call_hooks('prepare_body_final', $prep_arr);
+include/text.php:      Addon::callHooks('prepare_body_final', $prep_arr);
 
-include/nav.php:       call_hooks('page_header', $a->page['nav']);
+include/nav.php:       Addon::callHooks('page_header', $a->page['nav']);
 
-include/auth.php:              call_hooks('authenticate', $addon_auth);
+include/auth.php:              Addon::callHooks('authenticate', $addon_auth);
 
-include/bbcode.php:    call_hooks('bbcode',$Text);
+include/bbcode.php:    Addon::callHooks('bbcode',$Text);
 
-include/oauth.php:             call_hooks('logged_in', $a->user);
+include/oauth.php:             Addon::callHooks('logged_in', $a->user);
 
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
 
-include/acl_selectors.php:     call_hooks('contact_select_options', $x);
+include/acl_selectors.php:     Addon::callHooks('contact_select_options', $x);
 
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
 
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
 
-include/acl_selectors.php      call_hooks('acl_lookup_end', $results);
+include/acl_selectors.php      Addon::callHooks('acl_lookup_end', $results);
 
-include/notifier.php:          call_hooks('notifier_normal',$target_item);
+include/notifier.php:          Addon::callHooks('notifier_normal',$target_item);
 
-include/notifier.php:  call_hooks('notifier_end',$target_item);
+include/notifier.php:  Addon::callHooks('notifier_end',$target_item);
 
-include/items.php:     call_hooks('atom_feed', $atom);
+include/items.php:     Addon::callHooks('atom_feed', $atom);
 
-include/items.php:             call_hooks('atom_feed_end', $atom);
+include/items.php:             Addon::callHooks('atom_feed_end', $atom);
 
-include/items.php:     call_hooks('atom_feed_end', $atom);
+include/items.php:     Addon::callHooks('atom_feed_end', $atom);
 
-include/items.php:     call_hooks('parse_atom', $arr);
+include/items.php:     Addon::callHooks('parse_atom', $arr);
 
-include/items.php:     call_hooks('post_remote',$arr);
+include/items.php:     Addon::callHooks('post_remote',$arr);
 
-include/items.php:     call_hooks('atom_author', $o);
+include/items.php:     Addon::callHooks('atom_author', $o);
 
-include/items.php:     call_hooks('atom_entry', $o);
+include/items.php:     Addon::callHooks('atom_entry', $o);
 
-include/bb2diaspora.php:       call_hooks('bb2diaspora',$Text);
+include/bb2diaspora.php:       Addon::callHooks('bb2diaspora',$Text);
 
-include/cronhooks.php: call_hooks('cron', $d);
+include/cronhooks.php: Addon::callHooks('cron', $d);
 
-include/security.php:          call_hooks('logged_in', $a->user);
+include/security.php:          Addon::callHooks('logged_in', $a->user);
 
-include/html2bbcode.php:       call_hooks('html2bbcode', $text);
+include/html2bbcode.php:       Addon::callHooks('html2bbcode', $text);
 
-include/Contact.php:   call_hooks('remove_user',$r[0]);
+include/Contact.php:   Addon::callHooks('remove_user',$r[0]);
 
-include/Contact.php:   call_hooks('contact_photo_menu', $args);
+include/Contact.php:   Addon::callHooks('contact_photo_menu', $args);
 
-include/conversation.php:      call_hooks('conversation_start',$cb);
+include/conversation.php:      Addon::callHooks('conversation_start',$cb);
 
-include/conversation.php:                              call_hooks('render_location',$locate);
+include/conversation.php:                              Addon::callHooks('render_location',$locate);
 
-include/conversation.php:                              call_hooks('display_item', $arr);
+include/conversation.php:                              Addon::callHooks('display_item', $arr);
 
-include/conversation.php:                              call_hooks('render_location',$locate);
+include/conversation.php:                              Addon::callHooks('render_location',$locate);
 
-include/conversation.php:                              call_hooks('display_item', $arr);
+include/conversation.php:                              Addon::callHooks('display_item', $arr);
 
-include/conversation.php:      call_hooks('item_photo_menu', $args);
+include/conversation.php:      Addon::callHooks('item_photo_menu', $args);
 
-include/conversation.php:      call_hooks('jot_tool', $jotplugins);
+include/conversation.php:      Addon::callHooks('jot_tool', $jotplugins);
 
-include/conversation.php:      call_hooks('jot_networks', $jotnets);
+include/conversation.php:      Addon::callHooks('jot_networks', $jotnets);
 
 include/plugin.php:if(! function_exists('call_hooks')) {
 
-include/plugin.php:function call_hooks($name, &$data = null) {
+include/plugin.php:function Addon::callHooks($name, &$data = null) {
 
-index.php:     call_hooks('init_1');
+index.php:     Addon::callHooks('init_1');
 
-index.php:call_hooks('app_menu', $arr);
+index.php:Addon::callHooks('app_menu', $arr);
 
-index.php:call_hooks('page_end', $a->page['content']);
+index.php:Addon::callHooks('page_end', $a->page['content']);
 
-mod/photos.php:        call_hooks('photo_post_init', $_POST);
+mod/photos.php:        Addon::callHooks('photo_post_init', $_POST);
 
-mod/photos.php:        call_hooks('photo_post_file',$ret);
+mod/photos.php:        Addon::callHooks('photo_post_file',$ret);
 
-mod/photos.php:                call_hooks('photo_post_end',$foo);
+mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
 
-mod/photos.php:                call_hooks('photo_post_end',$foo);
+mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
 
-mod/photos.php:                call_hooks('photo_post_end',$foo);
+mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
 
-mod/photos.php:        call_hooks('photo_post_end',intval($item_id));
+mod/photos.php:        Addon::callHooks('photo_post_end',intval($item_id));
 
-mod/photos.php:                call_hooks('photo_upload_form',$ret);
+mod/photos.php:                Addon::callHooks('photo_upload_form',$ret);
 
-mod/friendica.php:     call_hooks('about_hook', $o);
+mod/friendica.php:     Addon::callHooks('about_hook', $o);
 
-mod/editpost.php:      call_hooks('jot_tool', $jotplugins);
+mod/editpost.php:      Addon::callHooks('jot_tool', $jotplugins);
 
-mod/editpost.php:      call_hooks('jot_networks', $jotnets);
+mod/editpost.php:      Addon::callHooks('jot_networks', $jotnets);
 
-mod/parse_url.php:     call_hooks('parse_link', $arr);
+mod/parse_url.php:     Addon::callHooks('parse_link', $arr);
 
-mod/home.php:  call_hooks('home_init',$ret);
+mod/home.php:  Addon::callHooks('home_init',$ret);
 
-mod/home.php:  call_hooks("home_content",$o);
+mod/home.php:  Addon::callHooks("home_content",$o);
 
-mod/contacts.php:      call_hooks('contact_edit_post', $_POST);
+mod/contacts.php:      Addon::callHooks('contact_edit_post', $_POST);
 
-mod/contacts.php:              call_hooks('contact_edit', $arr);
+mod/contacts.php:              Addon::callHooks('contact_edit', $arr);
 
-mod/settings.php:              call_hooks('plugin_settings_post', $_POST);
+mod/settings.php:              Addon::callHooks('plugin_settings_post', $_POST);
 
-mod/settings.php:              call_hooks('connector_settings_post', $_POST);
+mod/settings.php:              Addon::callHooks('connector_settings_post', $_POST);
 
-mod/settings.php:      call_hooks('settings_post', $_POST);
+mod/settings.php:      Addon::callHooks('settings_post', $_POST);
 
-mod/settings.php:              call_hooks('plugin_settings', $settings_addons);
+mod/settings.php:              Addon::callHooks('plugin_settings', $settings_addons);
 
-mod/settings.php:              call_hooks('connector_settings', $settings_connectors);
+mod/settings.php:              Addon::callHooks('connector_settings', $settings_connectors);
 
-mod/settings.php:      call_hooks('settings_form',$o);
+mod/settings.php:      Addon::callHooks('settings_form',$o);
 
-mod/register.php:      call_hooks('register_account', $newuid);
+mod/register.php:      Addon::callHooks('register_account', $newuid);
 
-mod/like.php:  call_hooks('post_local_end', $arr);
+mod/like.php:  Addon::callHooks('post_local_end', $arr);
 
-mod/xrd.php:   call_hooks('personal_xrd', $arr);
+mod/xrd.php:   Addon::callHooks('personal_xrd', $arr);
 
-mod/item.php:  call_hooks('post_local_start', $_REQUEST);
+mod/item.php:  Addon::callHooks('post_local_start', $_REQUEST);
 
-mod/item.php:  call_hooks('post_local',$datarray);
+mod/item.php:  Addon::callHooks('post_local',$datarray);
 
-mod/item.php:  call_hooks('post_local_end', $datarray);
+mod/item.php:  Addon::callHooks('post_local_end', $datarray);
 
-mod/profile.php:                       call_hooks('profile_advanced',$o);
+mod/profile.php:                       Addon::callHooks('profile_advanced',$o);
 
-mod/profiles.php:      call_hooks('profile_post', $_POST);
+mod/profiles.php:      Addon::callHooks('profile_post', $_POST);
 
-mod/profiles.php:              call_hooks('profile_edit', $arr);
+mod/profiles.php:              Addon::callHooks('profile_edit', $arr);
 
-mod/tagger.php:        call_hooks('post_local_end', $arr);
+mod/tagger.php:        Addon::callHooks('post_local_end', $arr);
 
-mod/cb.php:    call_hooks('cb_init');
+mod/cb.php:    Addon::callHooks('cb_init');
 
-mod/cb.php:    call_hooks('cb_post', $_POST);
+mod/cb.php:    Addon::callHooks('cb_post', $_POST);
 
-mod/cb.php:    call_hooks('cb_afterpost');
+mod/cb.php:    Addon::callHooks('cb_afterpost');
 
-mod/cb.php:    call_hooks('cb_content', $o);
+mod/cb.php:    Addon::callHooks('cb_content', $o);
 
-mod/directory.php:                     call_hooks('directory_item', $arr);
+mod/directory.php:                     Addon::callHooks('directory_item', $arr);
index 8b1c71177d308770621ce26652609311b3925b0c..6ad3ac8f78b2eba34a0418d029e683eadbdba209 100644 (file)
@@ -26,7 +26,7 @@ Plugins sollten einen Kommentarblock mit den folgenden vier Parametern enthalten
 
 Registriere deine Plugin-Hooks während der Installation.
 
-    register_hook($hookname, $file, $function);
+    Addon::registerHook($hookname, $file, $function);
 
 $hookname ist ein String und entspricht einem bekannten Friendica-Hook.
 
@@ -191,180 +191,180 @@ Komplette Liste der Hook-Callbacks
 
 Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 14-Feb-2012 generiert): Bitte schau in die Quellcodes für Details zu Hooks, die oben nicht dokumentiert sind.
 
-boot.php:                      call_hooks('login_hook',$o);
+boot.php:                      Addon::callHooks('login_hook',$o);
 
-boot.php:                      call_hooks('profile_sidebar_enter', $profile);
+boot.php:                      Addon::callHooks('profile_sidebar_enter', $profile);
 
-boot.php:                      call_hooks('profile_sidebar', $arr);
+boot.php:                      Addon::callHooks('profile_sidebar', $arr);
 
-boot.php:                      call_hooks("proc_run", $arr);
+boot.php:                      Addon::callHooks("proc_run", $arr);
 
-include/contact_selectors.php: call_hooks('network_to_name', $nets);
+include/contact_selectors.php: Addon::callHooks('network_to_name', $nets);
 
-include/api.php:               call_hooks('logged_in', $a->user);
+include/api.php:               Addon::callHooks('logged_in', $a->user);
 
-include/api.php:               call_hooks('logged_in', $a->user);
+include/api.php:               Addon::callHooks('logged_in', $a->user);
 
-include/queue.php:             call_hooks('queue_predeliver', $a, $r);
+include/queue.php:             Addon::callHooks('queue_predeliver', $a, $r);
 
-include/queue.php:             call_hooks('queue_deliver', $a, $params);
+include/queue.php:             Addon::callHooks('queue_deliver', $a, $params);
 
-include/text.php:              call_hooks('contact_block_end', $arr);
+include/text.php:              Addon::callHooks('contact_block_end', $arr);
 
-include/text.php:              call_hooks('smilie', $s);
+include/text.php:              Addon::callHooks('smilie', $s);
 
-include/text.php:              call_hooks('prepare_body_init', $item);
+include/text.php:              Addon::callHooks('prepare_body_init', $item);
 
-include/text.php:              call_hooks('prepare_body', $prep_arr);
+include/text.php:              Addon::callHooks('prepare_body', $prep_arr);
 
-include/text.php:              call_hooks('prepare_body_final', $prep_arr);
+include/text.php:              Addon::callHooks('prepare_body_final', $prep_arr);
 
-include/nav.php:               call_hooks('page_header', $a->page['nav']);
+include/nav.php:               Addon::callHooks('page_header', $a->page['nav']);
 
-include/auth.php:              call_hooks('authenticate', $addon_auth);
+include/auth.php:              Addon::callHooks('authenticate', $addon_auth);
 
-include/bbcode.php:            call_hooks('bbcode',$Text);
+include/bbcode.php:            Addon::callHooks('bbcode',$Text);
 
-include/oauth.php:             call_hooks('logged_in', $a->user);
+include/oauth.php:             Addon::callHooks('logged_in', $a->user);
 
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
 
-include/acl_selectors.php:     call_hooks('contact_select_options', $x);
+include/acl_selectors.php:     Addon::callHooks('contact_select_options', $x);
 
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
 
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
 
-include/notifier.php:          call_hooks('notifier_normal',$target_item);
+include/notifier.php:          Addon::callHooks('notifier_normal',$target_item);
 
-include/notifier.php:          call_hooks('notifier_end',$target_item);
+include/notifier.php:          Addon::callHooks('notifier_end',$target_item);
 
-include/items.php:             call_hooks('atom_feed', $atom);
+include/items.php:             Addon::callHooks('atom_feed', $atom);
 
-include/items.php:             call_hooks('atom_feed_end', $atom);
+include/items.php:             Addon::callHooks('atom_feed_end', $atom);
 
-include/items.php:             call_hooks('atom_feed_end', $atom);
+include/items.php:             Addon::callHooks('atom_feed_end', $atom);
 
-include/items.php:             call_hooks('parse_atom', $arr);
+include/items.php:             Addon::callHooks('parse_atom', $arr);
 
-include/items.php:             call_hooks('post_remote',$arr);
+include/items.php:             Addon::callHooks('post_remote',$arr);
 
-include/items.php:             call_hooks('atom_author', $o);
+include/items.php:             Addon::callHooks('atom_author', $o);
 
-include/items.php:             call_hooks('atom_entry', $o);
+include/items.php:             Addon::callHooks('atom_entry', $o);
 
-include/bb2diaspora.php:       call_hooks('bb2diaspora',$Text);
+include/bb2diaspora.php:       Addon::callHooks('bb2diaspora',$Text);
 
-include/cronhooks.php:         call_hooks('cron', $d);
+include/cronhooks.php:         Addon::callHooks('cron', $d);
 
-include/security.php:          call_hooks('logged_in', $a->user);
+include/security.php:          Addon::callHooks('logged_in', $a->user);
 
-include/html2bbcode.php:       call_hooks('html2bbcode', $text);
+include/html2bbcode.php:       Addon::callHooks('html2bbcode', $text);
 
-include/Contact.php:           call_hooks('remove_user',$r[0]);
+include/Contact.php:           Addon::callHooks('remove_user',$r[0]);
 
-include/Contact.php:           call_hooks('contact_photo_menu', $args);
+include/Contact.php:           Addon::callHooks('contact_photo_menu', $args);
 
-include/conversation.php:      call_hooks('conversation_start',$cb);
+include/conversation.php:      Addon::callHooks('conversation_start',$cb);
 
-include/conversation.php:      call_hooks('render_location',$locate);
+include/conversation.php:      Addon::callHooks('render_location',$locate);
 
-include/conversation.php:      call_hooks('display_item', $arr);
+include/conversation.php:      Addon::callHooks('display_item', $arr);
 
-include/conversation.php:      call_hooks('render_location',$locate);
+include/conversation.php:      Addon::callHooks('render_location',$locate);
 
-include/conversation.php:      call_hooks('display_item', $arr);
+include/conversation.php:      Addon::callHooks('display_item', $arr);
 
-include/conversation.php:      call_hooks('item_photo_menu', $args);
+include/conversation.php:      Addon::callHooks('item_photo_menu', $args);
 
-include/conversation.php:      call_hooks('jot_tool', $jotplugins);
+include/conversation.php:      Addon::callHooks('jot_tool', $jotplugins);
 
-include/conversation.php:      call_hooks('jot_networks', $jotnets);
+include/conversation.php:      Addon::callHooks('jot_networks', $jotnets);
 
 include/plugin.php:            if(! function_exists('call_hooks')) {
 
-include/plugin.php:function    call_hooks($name, &$data = null) {
+include/plugin.php:function    Addon::callHooks($name, &$data = null) {
 
-index.php:                     call_hooks('init_1');
+index.php:                     Addon::callHooks('init_1');
 
-index.php:                     call_hooks('app_menu', $arr);
+index.php:                     Addon::callHooks('app_menu', $arr);
 
-index.php:                     call_hooks('page_end', $a->page['content']);
+index.php:                     Addon::callHooks('page_end', $a->page['content']);
 
-mod/photos.php:                        call_hooks('photo_post_init', $_POST);
+mod/photos.php:                        Addon::callHooks('photo_post_init', $_POST);
 
-mod/photos.php:                        call_hooks('photo_post_file',$ret);
+mod/photos.php:                        Addon::callHooks('photo_post_file',$ret);
 
-mod/photos.php:                        call_hooks('photo_post_end',$foo);
+mod/photos.php:                        Addon::callHooks('photo_post_end',$foo);
 
-mod/photos.php:                        call_hooks('photo_post_end',$foo);
+mod/photos.php:                        Addon::callHooks('photo_post_end',$foo);
 
-mod/photos.php:                        call_hooks('photo_post_end',$foo);
+mod/photos.php:                        Addon::callHooks('photo_post_end',$foo);
 
-mod/photos.php:                        call_hooks('photo_post_end',intval($item_id));
+mod/photos.php:                        Addon::callHooks('photo_post_end',intval($item_id));
 
-mod/photos.php:                        call_hooks('photo_upload_form',$ret);
+mod/photos.php:                        Addon::callHooks('photo_upload_form',$ret);
 
-mod/friendica.php:             call_hooks('about_hook', $o);
+mod/friendica.php:             Addon::callHooks('about_hook', $o);
 
-mod/editpost.php:              call_hooks('jot_tool', $jotplugins);
+mod/editpost.php:              Addon::callHooks('jot_tool', $jotplugins);
 
-mod/editpost.php:              call_hooks('jot_networks', $jotnets);
+mod/editpost.php:              Addon::callHooks('jot_networks', $jotnets);
 
-mod/parse_url.php:             call_hooks('parse_link', $arr);
+mod/parse_url.php:             Addon::callHooks('parse_link', $arr);
 
-mod/home.php:                  call_hooks('home_init',$ret);
+mod/home.php:                  Addon::callHooks('home_init',$ret);
 
-mod/home.php:                  call_hooks("home_content",$o);
+mod/home.php:                  Addon::callHooks("home_content",$o);
 
-mod/contacts.php:              call_hooks('contact_edit_post', $_POST);
+mod/contacts.php:              Addon::callHooks('contact_edit_post', $_POST);
 
-mod/contacts.php:              call_hooks('contact_edit', $arr);
+mod/contacts.php:              Addon::callHooks('contact_edit', $arr);
 
-mod/settings.php:              call_hooks('plugin_settings_post', $_POST);
+mod/settings.php:              Addon::callHooks('plugin_settings_post', $_POST);
 
-mod/settings.php:              call_hooks('connector_settings_post', $_POST);
+mod/settings.php:              Addon::callHooks('connector_settings_post', $_POST);
 
-mod/settings.php:              call_hooks('settings_post', $_POST);
+mod/settings.php:              Addon::callHooks('settings_post', $_POST);
 
-mod/settings.php:              call_hooks('plugin_settings', $settings_addons);
+mod/settings.php:              Addon::callHooks('plugin_settings', $settings_addons);
 
-mod/settings.php:              call_hooks('connector_settings', $settings_connectors);
+mod/settings.php:              Addon::callHooks('connector_settings', $settings_connectors);
 
-mod/settings.php:              call_hooks('settings_form',$o);
+mod/settings.php:              Addon::callHooks('settings_form',$o);
 
-mod/register.php:              call_hooks('register_account', $newuid);
+mod/register.php:              Addon::callHooks('register_account', $newuid);
 
-mod/like.php:                  call_hooks('post_local_end', $arr);
+mod/like.php:                  Addon::callHooks('post_local_end', $arr);
 
-mod/xrd.php:                   call_hooks('personal_xrd', $arr);
+mod/xrd.php:                   Addon::callHooks('personal_xrd', $arr);
 
-mod/item.php:                  call_hooks('post_local_start', $_REQUEST);
+mod/item.php:                  Addon::callHooks('post_local_start', $_REQUEST);
 
-mod/item.php:                  call_hooks('post_local',$datarray);
+mod/item.php:                  Addon::callHooks('post_local',$datarray);
 
-mod/item.php:                  call_hooks('post_local_end', $datarray);
+mod/item.php:                  Addon::callHooks('post_local_end', $datarray);
 
-mod/profile.php:               call_hooks('profile_advanced',$o);
+mod/profile.php:               Addon::callHooks('profile_advanced',$o);
 
-mod/profiles.php:              call_hooks('profile_post', $_POST);
+mod/profiles.php:              Addon::callHooks('profile_post', $_POST);
 
-mod/profiles.php:              call_hooks('profile_edit', $arr);
+mod/profiles.php:              Addon::callHooks('profile_edit', $arr);
 
-mod/tagger.php:                        call_hooks('post_local_end', $arr);
+mod/tagger.php:                        Addon::callHooks('post_local_end', $arr);
 
-mod/cb.php:                    call_hooks('cb_init');
+mod/cb.php:                    Addon::callHooks('cb_init');
 
-mod/cb.php:                    call_hooks('cb_post', $_POST);
+mod/cb.php:                    Addon::callHooks('cb_post', $_POST);
 
-mod/cb.php:                    call_hooks('cb_afterpost');
+mod/cb.php:                    Addon::callHooks('cb_afterpost');
 
-mod/cb.php:                    call_hooks('cb_content', $o);
+mod/cb.php:                    Addon::callHooks('cb_content', $o);
 
-mod/directory.php:             call_hooks('directory_item', $arr);
+mod/directory.php:             Addon::callHooks('directory_item', $arr);
index 5be3fd1f3f6efeda2564ec4a7c3ff501f4b07c67..caa3e98c231bf82403502fe65d9446553978e5b3 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Content\Widget;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
@@ -32,7 +33,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
 
        // e.g. 'network_pre_group_deny', 'profile_pre_group_allow'
 
-       call_hooks($a->module . '_pre_' . $selname, $arr);
+       Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
        if (DBM::is_result($r)) {
                foreach ($r as $rr) {
@@ -50,7 +51,7 @@ function group_select($selname,$selclass,$preselected = false,$size = 4) {
        }
        $o .= "</select>\r\n";
 
-       call_hooks($a->module . '_post_' . $selname, $o);
+       Addon::callHooks($a->module . '_post_' . $selname, $o);
 
 
        return $o;
@@ -111,7 +112,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false)
 
        $x = ['options' => $options, 'size' => $size, 'single' => $single, 'mutual' => $mutual, 'exclude' => $exclude, 'networks' => $networks];
 
-       call_hooks('contact_select_options', $x);
+       Addon::callHooks('contact_select_options', $x);
 
        $o = '';
 
@@ -154,7 +155,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false)
 
        // e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
 
-       call_hooks($a->module . '_pre_' . $selname, $arr);
+       Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
        if (DBM::is_result($r)) {
                foreach ($r as $rr) {
@@ -173,7 +174,7 @@ function contact_selector($selname, $selclass, $options, $preselected = false)
 
        $o .= "</select>\r\n";
 
-       call_hooks($a->module . '_post_' . $selname, $o);
+       Addon::callHooks($a->module . '_post_' . $selname, $o);
 
        return $o;
 }
@@ -232,7 +233,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
 
        // e.g. 'network_pre_contact_deny', 'profile_pre_contact_allow'
 
-       call_hooks($a->module . '_pre_' . $selname, $arr);
+       Addon::callHooks($a->module . '_pre_' . $selname, $arr);
 
        $receiverlist = [];
 
@@ -263,7 +264,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
                $o .= implode(", ", $receiverlist);
        }
 
-       call_hooks($a->module . '_post_' . $selname, $o);
+       Addon::callHooks($a->module . '_post_' . $selname, $o);
 
        return $o;
 }
@@ -353,7 +354,7 @@ function populate_acl($user = null, $show_jotnets = false) {
                                $jotnets .= '<div class="profile-jot-net"><input type="checkbox" name="pubmail_enable"' . $selected . ' value="1" /> ' . t("Post to Email") . '</div>';
                        }
 
-                       call_hooks('jot_networks', $jotnets);
+                       Addon::callHooks('jot_networks', $jotnets);
                } else {
                        $jotnets .= sprintf(t('Connectors disabled, since "%s" is enabled.'),
                                            t('Hide your profile details from unknown viewers?'));
@@ -671,7 +672,7 @@ function acl_lookup(App $a, $out_type = 'json')
                'search'   => $search,
        ];
 
-       call_hooks('acl_lookup_end', $results);
+       Addon::callHooks('acl_lookup_end', $results);
 
        if ($out_type === 'html') {
                $o = [
index b4fdb646f90362c2f572e25db463c9fd4e29359e..7011f613d62a49a1cba4e17ec56340eabb57746a 100644 (file)
@@ -8,6 +8,7 @@
 use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\NotificationsManager;
@@ -166,7 +167,7 @@ function api_login(App $a)
                list($consumer, $token) = $oauth1->verify_request(OAuthRequest::from_request());
                if (!is_null($token)) {
                        $oauth1->loginUser($token->uid);
-                       call_hooks('logged_in', $a->user);
+                       Addon::callHooks('logged_in', $a->user);
                        return;
                }
                echo __FILE__.__LINE__.__FUNCTION__ . "<pre>";
@@ -216,7 +217,7 @@ function api_login(App $a)
                * Plugins should never set 'authenticated' except to indicate success - as hooks may be chained
                * and later plugins should not interfere with an earlier one that succeeded.
                */
-       call_hooks('authenticate', $addon_auth);
+       Addon::callHooks('authenticate', $addon_auth);
 
        if ($addon_auth['authenticated'] && count($addon_auth['user_record'])) {
                $record = $addon_auth['user_record'];
@@ -239,7 +240,7 @@ function api_login(App $a)
 
        $_SESSION["allow_api"] = true;
 
-       call_hooks('logged_in', $a->user);
+       Addon::callHooks('logged_in', $a->user);
 }
 
 /**
index fc25a584a91b44ffd3513722ebe9683cacf4b5e3..4856d18ab181fbf02b59a1a91a4bd9f5d70b2539 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\Content\Text\Markdown;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Model\Contact;
 use Friendica\Network\Probe;
@@ -218,7 +219,7 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
                }
        , $Text);
 
-       call_hooks('bb2diaspora',$Text);
+       Addon::callHooks('bb2diaspora',$Text);
 
        return $Text;
 }
index ffc2387c3b5a2277aa747df9e634b936fdee834c..281eeeb021acdf18cc1819480317d5a6dc59b395 100644 (file)
@@ -3,6 +3,7 @@
 use Friendica\App;
 use Friendica\Content\Smilies;
 use Friendica\Content\OEmbed;
+use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\System;
 use Friendica\Core\Config;
@@ -1401,7 +1402,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
        //$Text = str_replace('<br /><li>', '<li>', $Text);
        //$Text = str_replace('<br /><ul', '<ul ', $Text);
 
-       call_hooks('bbcode', $Text);
+       Addon::callHooks('bbcode', $Text);
 
        return trim($Text);
 }
index a6edf0d577305ecc7471dac77baa493be2996be6..7b358d3dd6f52a254f4cb635634e121cec3d96b8 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -595,7 +596,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
        }
 
        $cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview];
-       call_hooks('conversation_start',$cb);
+       Addon::callHooks('conversation_start',$cb);
 
        $items = $cb['items'];
 
@@ -731,7 +732,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
                                }
 
                                $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
-                               call_hooks('render_location',$locate);
+                               Addon::callHooks('render_location',$locate);
 
                                $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
 
@@ -820,7 +821,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
                                ];
 
                                $arr = ['item' => $item, 'output' => $tmp_item];
-                               call_hooks('display_item', $arr);
+                               Addon::callHooks('display_item', $arr);
 
                                $threads[$threadsid]['id'] = $item['item_id'];
                                $threads[$threadsid]['network'] = $item['item_network'];
@@ -864,7 +865,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
                                        continue;
                                }
 
-                               call_hooks('display_item', $arr);
+                               Addon::callHooks('display_item', $arr);
 
                                $item['pagedrop'] = $page_dropping;
 
@@ -1075,7 +1076,7 @@ function item_photo_menu($item) {
 
        $args = ['item' => $item, 'menu' => $menu];
 
-       call_hooks('item_photo_menu', $args);
+       Addon::callHooks('item_photo_menu', $args);
 
        $menu = $args['menu'];
 
@@ -1297,7 +1298,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
        ]);
 
        $jotplugins = '';
-       call_hooks('jot_tool', $jotplugins);
+       Addon::callHooks('jot_tool', $jotplugins);
 
        // Private/public post links for the non-JS ACL form
        $private_post = 1;
index 286a372e9cb6ea5c1d2fa342e582c35e88f7e05b..ab4bbc6db249c1fb84ebd85fd16f8a8ae1212e85 100644 (file)
@@ -3,6 +3,7 @@
  * @file include/enotify.php
  */
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -398,7 +399,7 @@ function notification($params)
                'itemlink'  => $itemlink
        ];
 
-       call_hooks('enotify', $h);
+       Addon::callHooks('enotify', $h);
 
        $subject   = $h['subject'];
 
@@ -440,7 +441,7 @@ function notification($params)
                $datarray['otype'] = $params['otype'];
                $datarray['abort'] = false;
 
-               call_hooks('enotify_store', $datarray);
+               Addon::callHooks('enotify_store', $datarray);
 
                if ($datarray['abort']) {
                        pop_lang();
@@ -576,7 +577,7 @@ function notification($params)
                $datarray['subject'] = $subject;
                $datarray['headers'] = $additional_mail_header;
 
-               call_hooks('enotify_mail', $datarray);
+               Addon::callHooks('enotify_mail', $datarray);
 
                // check whether sending post content in email notifications is allowed
                // always true for SYSTEM_EMAIL
@@ -667,7 +668,7 @@ function check_user_notification($itemid) {
  */
 function check_item_notification($itemid, $uid, $defaulttype = "") {
        $notification_data = ["uid" => $uid, "profiles" => []];
-       call_hooks('check_item_notification', $notification_data);
+       Addon::callHooks('check_item_notification', $notification_data);
 
        $profiles = $notification_data["profiles"];
 
index d4c97c750c12d9fa62994d79f43dbe2804799819..64ccf3f53c82f2321775d85cc3cc1f8b3bdc0a28 100644 (file)
@@ -6,6 +6,7 @@
 
 use Friendica\App;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -328,7 +329,7 @@ function event_store($arr) {
                        $item_id = 0;
                }
 
-               call_hooks("event_updated", $arr['id']);
+               Addon::callHooks("event_updated", $arr['id']);
 
                return $item_id;
        } else {
@@ -406,7 +407,7 @@ function event_store($arr) {
                        );
                }
 
-               call_hooks("event_created", $event['id']);
+               Addon::callHooks("event_created", $event['id']);
 
                return $item_id;
        }
index 1992a3716ee5e159fc995af1972af210f04c06f2..f0d819d6232f7435647ef63af1b6ea8ad5908c25 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\Core\Addon;
 use Friendica\Render\ITemplateEngine;
 
 require_once "include/plugin.php";
@@ -74,7 +75,7 @@ class FriendicaSmartyEngine implements ITemplateEngine
                        "template" => basename($s->filename),
                        "vars" => $r
                ];
-               call_hooks("template_vars", $arr);
+               Addon::callHooks("template_vars", $arr);
                $r = $arr['vars'];
 
                foreach ($r as $key => $value) {
index 75f05f453dc2538cf6041e3b562f3a1c75c6ebc4..2404e42f6bc3045334a8046842322ef74fe859ed 100644 (file)
@@ -8,6 +8,7 @@
  *                                     https://github.com/annando/Syncom
  */
 
+use Friendica\Core\Addon;
 use Friendica\Util\XML;
 
 function node2bbcode(&$doc, $oldnode, $attributes, $startbb, $endbb)
@@ -261,7 +262,7 @@ function html2bbcode($message, $basepath = '')
        $message = preg_replace('=\r *\r=i', "\n", $message);
        $message = str_replace("\r", "\n", $message);
 
-       call_hooks('html2bbcode', $message);
+       Addon::callHooks('html2bbcode', $message);
 
        $message = strip_tags($message);
 
index e99799ad6608f58bd151b83eb47b35bc0207d5ff..be370b3d19f1a9211e7f4da28f1d9746967ff654 100644 (file)
@@ -4,6 +4,7 @@
  */
 use Friendica\App;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
@@ -157,7 +158,7 @@ function title_is_body($title, $body) {
 }
 
 function add_page_info_data($data) {
-       call_hooks('page_info_data', $data);
+       Addon::callHooks('page_info_data', $data);
 
        // It maybe is a rich content, but if it does have everything that a link has,
        // then treat it that way
@@ -943,9 +944,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
        put_item_in_cache($arr);
 
        if ($notify) {
-               call_hooks('post_local', $arr);
+               Addon::callHooks('post_local', $arr);
        } else {
-               call_hooks('post_remote', $arr);
+               Addon::callHooks('post_remote', $arr);
        }
 
        // This array field is used to trigger some automatic reactions
@@ -1086,9 +1087,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
                $r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
                if ((DBM::is_result($r)) && (count($r) == 1)) {
                        if ($notify) {
-                               call_hooks('post_local_end', $r[0]);
+                               Addon::callHooks('post_local_end', $r[0]);
                        } else {
-                               call_hooks('post_remote_end', $r[0]);
+                               Addon::callHooks('post_remote_end', $r[0]);
                        }
                } else {
                        logger('item_store: new item not found in DB, id ' . $current_post);
@@ -1364,7 +1365,7 @@ function tag_deliver($uid, $item_id)
 
        $arr = ['item' => $item, 'user' => $u[0], 'contact' => $r[0]];
 
-       call_hooks('tagged', $arr);
+       Addon::callHooks('tagged', $arr);
 
        if ((! $community_page) && (! $prvgroup)) {
                return;
index f89b7a82e69ea991aa9f488a27fb8547816386ee..1dbdcc936d727fc10fd05969674cfe8feeb06ed6 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -254,7 +255,7 @@ EOT;
 
        $new_item['id'] = $new_item_id;
 
-       call_hooks('post_local_end', $new_item);
+       Addon::callHooks('post_local_end', $new_item);
 
        Worker::add(PRIORITY_HIGH, "Notifier", "like", $new_item_id);
 
index de7069a6d964b250bd00a2677c0ca301e4693408..a9110837d0b95fc33d24de9b60abff4e5d4f91c4 100644 (file)
@@ -3,6 +3,7 @@
  * @file include/network.php
  */
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Network\Probe;
@@ -653,7 +654,7 @@ function avatar_img($email)
        $avatar['url'] = '';
        $avatar['success'] = false;
 
-       call_hooks('avatar_lookup', $avatar);
+       Addon::callHooks('avatar_lookup', $avatar);
 
        if (! $avatar['success']) {
                $avatar['url'] = System::baseUrl() . '/images/person-175.jpg';
index 5c393cbb62e9c29ab3e667f430764fe7d15d016e..d1387ca2260b39e732818b3954982359dbcfdbc3 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -157,7 +158,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
        }
 
        if ($login_initial) {
-               call_hooks('logged_in', $a->user);
+               Addon::callHooks('logged_in', $a->user);
 
                if (($a->module !== 'home') && isset($_SESSION['return_url'])) {
                        goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
index 5ce0b850efdab64f3632782aab356d3c913d6a90..6856d28aa3e5794f2df39d698c19993d2796a42c 100644 (file)
@@ -6,6 +6,7 @@ use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
 use Friendica\Content\Smilies;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -969,7 +970,7 @@ function contact_block() {
 
        $arr = ['contacts' => $r, 'output' => $o];
 
-       call_hooks('contact_block_end', $arr);
+       Addon::callHooks('contact_block_end', $arr);
        return $o;
 
 }
@@ -1123,7 +1124,7 @@ function get_poke_verbs() {
                'finger' => ['fingered', t('finger'), t('fingered')],
                'rebuff' => ['rebuffed', t('rebuff'), t('rebuffed')],
        ];
-       call_hooks('poke_verbs', $arr);
+       Addon::callHooks('poke_verbs', $arr);
        return $arr;
 }
 
@@ -1255,7 +1256,7 @@ function put_item_in_cache(&$item, $update = false)
 function prepare_body(&$item, $attach = false, $preview = false) {
 
        $a = get_app();
-       call_hooks('prepare_body_init', $item);
+       Addon::callHooks('prepare_body_init', $item);
 
        $searchpath = System::baseUrl() . "/search?tag=";
 
@@ -1314,7 +1315,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
        $s = $item["rendered-html"];
 
        $prep_arr = ['item' => $item, 'html' => $s, 'preview' => $preview];
-       call_hooks('prepare_body', $prep_arr);
+       Addon::callHooks('prepare_body', $prep_arr);
        $s = $prep_arr['html'];
 
        if (! $attach) {
@@ -1432,7 +1433,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
        }
 
        $prep_arr = ['item' => $item, 'html' => $s];
-       call_hooks('prepare_body_final', $prep_arr);
+       Addon::callHooks('prepare_body_final', $prep_arr);
 
        return $prep_arr['html'];
 }
index dcb25cc3a37d513998914d1aab4c887b0cc8d22f..c4ccc9ef24db8bda5837516c3f1a89987cfd2275 100644 (file)
--- a/index.php
+++ b/index.php
@@ -11,6 +11,7 @@
 use Friendica\App;
 use Friendica\BaseObject;
 use Friendica\Content\Nav;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
@@ -75,8 +76,8 @@ if (!$install) {
        }
 
        require_once 'include/session.php';
-       load_hooks();
-       call_hooks('init_1');
+       Addon::loadHooks();
+       Addon::callHooks('init_1');
 
        $maintenance = Config::get('system', 'maintenance');
 }
@@ -200,7 +201,7 @@ $privateapps = Config::get('config', 'private_addons');
 if ((local_user()) || (! $privateapps === "1")) {
        $arr = ['app_menu' => $a->apps];
 
-       call_hooks('app_menu', $arr);
+       Addon::callHooks('app_menu', $arr);
 
        $a->apps = $arr['app_menu'];
 }
@@ -243,7 +244,7 @@ if (strlen($a->module)) {
 
        if (is_array($a->plugins) && in_array($a->module, $a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
                //Check if module is an app and if public access to apps is allowed or not
-               if ((!local_user()) && plugin_is_app($a->module) && $privateapps === "1") {
+               if ((!local_user()) && Addon::isApp($a->module) && $privateapps === "1") {
                        info(t("You must be logged in to use addons. "));
                } else {
                        include_once "addon/{$a->module}/{$a->module}.php";
@@ -317,7 +318,7 @@ if (! x($a->page, 'content')) {
 }
 
 if (!$install && !$maintenance) {
-       call_hooks('page_content_top', $a->page['content']);
+       Addon::callHooks('page_content_top', $a->page['content']);
 }
 
 /**
@@ -329,10 +330,10 @@ if ($a->module_loaded) {
        $placeholder = '';
 
        if ($a->module_class) {
-               call_hooks($a->module . '_mod_init', $placeholder);
+               Addon::callHooks($a->module . '_mod_init', $placeholder);
                call_user_func([$a->module_class, 'init']);
        } else if (function_exists($a->module . '_init')) {
-               call_hooks($a->module . '_mod_init', $placeholder);
+               Addon::callHooks($a->module . '_mod_init', $placeholder);
                $func = $a->module . '_init';
                $func($a);
        }
@@ -343,7 +344,7 @@ if ($a->module_loaded) {
        }
 
        if (! $a->error && $_SERVER['REQUEST_METHOD'] === 'POST') {
-               call_hooks($a->module . '_mod_post', $_POST);
+               Addon::callHooks($a->module . '_mod_post', $_POST);
                if ($a->module_class) {
                        call_user_func([$a->module_class, 'post']);
                } else if (function_exists($a->module . '_post')) {
@@ -353,7 +354,7 @@ if ($a->module_loaded) {
        }
 
        if (! $a->error) {
-               call_hooks($a->module . '_mod_afterpost', $placeholder);
+               Addon::callHooks($a->module . '_mod_afterpost', $placeholder);
                if ($a->module_class) {
                        call_user_func([$a->module_class, 'afterpost']);
                } else if (function_exists($a->module . '_afterpost')) {
@@ -364,7 +365,7 @@ if ($a->module_loaded) {
 
        if (! $a->error) {
                $arr = ['content' => $a->page['content']];
-               call_hooks($a->module . '_mod_content', $arr);
+               Addon::callHooks($a->module . '_mod_content', $arr);
                $a->page['content'] = $arr['content'];
                if ($a->module_class) {
                        $arr = ['content' => call_user_func([$a->module_class, 'content'])];
@@ -372,7 +373,7 @@ if ($a->module_loaded) {
                        $func = $a->module . '_content';
                        $arr = ['content' => $func($a)];
                }
-               call_hooks($a->module . '_mod_aftercontent', $arr);
+               Addon::callHooks($a->module . '_mod_aftercontent', $arr);
                $a->page['content'] .= $arr['content'];
        }
 
@@ -421,7 +422,7 @@ if (stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
 /*
  * Report anything which needs to be communicated in the notification area (before the main body)
  */
-call_hooks('page_end', $a->page['content']);
+Addon::callHooks('page_end', $a->page['content']);
 
 /*
  * Add the navigation (menu) template
index 9c286c11dd82080d21997797c2dfd9b851e0753c..fd8a61cb2b0f480364702c23cbdd7095d085c5ce 100644 (file)
@@ -8,6 +8,7 @@
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Content\Text\Markdown;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
@@ -1757,11 +1758,11 @@ function admin_page_plugins(App $a)
                        $idx = array_search($plugin, $a->plugins);
                        if ($idx !== false) {
                                unset($a->plugins[$idx]);
-                               uninstall_plugin($plugin);
+                               Addon::uninstall($plugin);
                                info(t("Plugin %s disabled.", $plugin));
                        } else {
                                $a->plugins[] = $plugin;
-                               install_plugin($plugin);
+                               Addon::install($plugin);
                                info(t("Plugin %s enabled.", $plugin));
                        }
                        Config::set("system", "addon", implode(", ", $a->plugins));
@@ -1804,7 +1805,7 @@ function admin_page_plugins(App $a)
                        '$plugin' => $plugin,
                        '$status' => $status,
                        '$action' => $action,
-                       '$info' => get_plugin_info($plugin),
+                       '$info' => Addon::getInfo($plugin),
                        '$str_author' => t('Author: '),
                        '$str_maintainer' => t('Maintainer: '),
 
@@ -1822,7 +1823,7 @@ function admin_page_plugins(App $a)
         */
        if (x($_GET, "a") && $_GET['a'] == "r") {
                check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/plugins', 'admin_themes', 't');
-               reload_plugins();
+               Addon::reload();
                info("Plugins reloaded");
                goaway(System::baseUrl() . '/admin/plugins');
        }
@@ -1833,7 +1834,7 @@ function admin_page_plugins(App $a)
                foreach ($files as $file) {
                        if (is_dir($file)) {
                                list($tmp, $id) = array_map("trim", explode("/", $file));
-                               $info = get_plugin_info($id);
+                               $info = Addon::getInfo($id);
                                $show_plugin = true;
 
                                // If the addon is unsupported, then only show it, when it is enabled
index 682d427c6d175fdfbdc22fcd4d9e54e7912c2dbb..dfda3a33634dc916689d812569701679873b0822 100644 (file)
@@ -6,6 +6,7 @@ use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Nav;
 use Friendica\Content\Widget;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -173,7 +174,7 @@ function contacts_post(App $a)
                return; // NOTREACHED
        }
 
-       call_hooks('contact_edit_post', $_POST);
+       Addon::callHooks('contact_edit_post', $_POST);
 
        $profile_id = intval($_POST['profile-assign']);
        if ($profile_id) {
@@ -662,7 +663,7 @@ function contacts_content(App $a)
 
                $arr = ['contact' => $contact, 'output' => $o];
 
-               call_hooks('contact_edit', $arr);
+               Addon::callHooks('contact_edit', $arr);
 
                return $arr['output'];
        }
index 6398127cf5ae3c8e422598161b6d854ba6e87103..5afaa08c6437aa32269201b3c7548f083e5e1b2e 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Nav;
 use Friendica\Content\Widget;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
@@ -174,7 +175,7 @@ function directory_content(App $a) {
 
                        $arr = ['contact' => $rr, 'entry' => $entry];
 
-                       call_hooks('directory_item', $arr);
+                       Addon::callHooks('directory_item', $arr);
 
                        unset($profile);
                        unset($location);
index 117cb3fb19301180746acc0c91e92fabcc3964ae..9e3401e958a7d7e6e19d11d28e7ba071525549a6 100644 (file)
@@ -4,6 +4,7 @@
  */
 use Friendica\App;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -94,8 +95,8 @@ function editpost_content(App $a) {
 
 
 
-       call_hooks('jot_tool', $jotplugins);
-       //call_hooks('jot_networks', $jotnets);
+       Addon::callHooks('jot_tool', $jotplugins);
+       //Addon::callHooks('jot_networks', $jotnets);
 
 
        //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
index 7f48ae3d4a4eed258c57800dd664f7bfe863ac62..7a9f6c6f61b70391fcdf7e6d77178ec3e9e2841c 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
@@ -121,7 +122,7 @@ function friendica_content(App $a) {
                $o .= '</tbody></table></div>' . PHP_EOL;
        }
 
-       call_hooks('about_hook', $o);
+       Addon::callHooks('about_hook', $o);
 
        return $o;
 }
index 614fd0e3e8eed8451ad4c16b323df6ac91d3f9b9..dc571aaabd393aef51ee923e28c27b8d21e23d01 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Module\Login;
@@ -9,7 +10,7 @@ if(! function_exists('home_init')) {
 function home_init(App $a) {
 
        $ret = [];
-       call_hooks('home_init',$ret);
+       Addon::callHooks('home_init',$ret);
 
        if (local_user() && ($a->user['nickname'])) {
                goaway(System::baseUrl()."/network");
@@ -46,7 +47,7 @@ function home_content(App $a) {
        $login = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
 
        $content = '';
-       call_hooks("home_content",$content);
+       Addon::callHooks("home_content",$content);
 
 
        $tpl = get_markup_template('home.tpl');
index 4b284568aaaf0f3a8900e5f9fb79c99650634925..ef4bf8dbce03f9f1692922cb6b8e773b9a050a58 100644 (file)
@@ -15,6 +15,7 @@
  * information.
  */
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
@@ -50,7 +51,7 @@ function item_post(App $a) {
                killme();
        }
 
-       call_hooks('post_local_start', $_REQUEST);
+       Addon::callHooks('post_local_start', $_REQUEST);
        // logger('postinput ' . file_get_contents('php://input'));
        logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA);
 
@@ -772,7 +773,7 @@ function item_post(App $a) {
                killme();
        }
 
-       call_hooks('post_local',$datarray);
+       Addon::callHooks('post_local',$datarray);
 
        if (x($datarray, 'cancel')) {
                logger('mod_item: post cancelled by plugin.');
@@ -885,7 +886,7 @@ function item_post(App $a) {
                }
        }
 
-       call_hooks('post_local_end', $datarray);
+       Addon::callHooks('post_local_end', $datarray);
 
        if (strlen($emailcc) && $profile_uid == local_user()) {
                $erecips = explode(',', $emailcc);
index ced03d1b569edb707141b176bbb1ea5004cebbe0..ead2269c7a98d0341a02cb26986fb38101ebbafe 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Database\DBM;
 
 function lockview_content(App $a) {
@@ -28,7 +29,7 @@ function lockview_content(App $a) {
        }
        $item = $r[0];
 
-       call_hooks('lockview_content', $item);
+       Addon::callHooks('lockview_content', $item);
 
        if($item['uid'] != local_user()) {
                echo t('Remote privacy information not available.') . '<br />';
index f2781f10815876dd412a320109c1ee9183eba9fc..dde08d3facf088abb3173029385b36c6932a1357 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 
@@ -91,7 +92,7 @@ function manage_post(App $a) {
        }
 
        $ret = [];
-       call_hooks('home_init',$ret);
+       Addon::callHooks('home_init',$ret);
 
        goaway( System::baseUrl() . "/profile/" . $a->user['nickname'] );
        // NOTREACHED
index c08d8e68d66ec6ad0307065961784cd96a8a551f..6bb1cf387c70ffdb7c66ee59ddd737565ad2dc1d 100644 (file)
@@ -7,6 +7,7 @@ use Friendica\Content\Feature;
 use Friendica\Content\ForumManager;
 use Friendica\Content\Nav;
 use Friendica\Content\Widget;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
@@ -388,7 +389,7 @@ function network_content(App $a, $update = 0) {
 
        /// @TODO Is this really necessary? $a is already available to hooks
        $arr = ['query' => $a->query_string];
-       call_hooks('network_content_init', $arr);
+       Addon::callHooks('network_content_init', $arr);
 
        $nouveau = false;
 
@@ -1006,7 +1007,7 @@ function network_tabs(App $a)
        }
 
        $arr = ['tabs' => $tabs];
-       call_hooks('network_tabs', $arr);
+       Addon::callHooks('network_tabs', $arr);
 
        $tpl = get_markup_template('common_tabs.tpl');
 
index d92335ad13463d79b1a0d1bdf1b0eb7feb34af6c..e5388154fe61d084cd5ee5b90e348bd58fb6542a 100644 (file)
@@ -6,11 +6,10 @@
 */
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 
-require_once 'include/plugin.php';
-
 function nodeinfo_wellknown(App $a) {
        $nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
                                        'href' => System::baseUrl().'/nodeinfo/1.0']]];
@@ -72,48 +71,48 @@ function nodeinfo_init(App $a) {
                $nodeinfo['usage']['localPosts'] = (int)Config::get('nodeinfo', 'local_posts');
                $nodeinfo['usage']['localComments'] = (int)Config::get('nodeinfo', 'local_comments');
 
-               if (plugin_enabled('appnet')) {
+               if (Addon::isEnabled('appnet')) {
                        $nodeinfo['services']['inbound'][] = 'appnet';
                }
-               if (plugin_enabled('appnet') || plugin_enabled('buffer')) {
+               if (Addon::isEnabled('appnet') || Addon::isEnabled('buffer')) {
                        $nodeinfo['services']['outbound'][] = 'appnet';
                }
-               if (plugin_enabled('blogger')) {
+               if (Addon::isEnabled('blogger')) {
                        $nodeinfo['services']['outbound'][] = 'blogger';
                }
-               if (plugin_enabled('dwpost')) {
+               if (Addon::isEnabled('dwpost')) {
                        $nodeinfo['services']['outbound'][] = 'dreamwidth';
                }
-               if (plugin_enabled('fbpost') || plugin_enabled('buffer')) {
+               if (Addon::isEnabled('fbpost') || Addon::isEnabled('buffer')) {
                        $nodeinfo['services']['outbound'][] = 'facebook';
                }
-               if (plugin_enabled('statusnet')) {
+               if (Addon::isEnabled('statusnet')) {
                        $nodeinfo['services']['inbound'][] = 'gnusocial';
                        $nodeinfo['services']['outbound'][] = 'gnusocial';
                }
 
-               if (plugin_enabled('gpluspost') || plugin_enabled('buffer')) {
+               if (Addon::isEnabled('gpluspost') || Addon::isEnabled('buffer')) {
                        $nodeinfo['services']['outbound'][] = 'google';
                }
-               if (plugin_enabled('ijpost')) {
+               if (Addon::isEnabled('ijpost')) {
                        $nodeinfo['services']['outbound'][] = 'insanejournal';
                }
-               if (plugin_enabled('libertree')) {
+               if (Addon::isEnabled('libertree')) {
                        $nodeinfo['services']['outbound'][] = 'libertree';
                }
-               if (plugin_enabled('buffer')) {
+               if (Addon::isEnabled('buffer')) {
                        $nodeinfo['services']['outbound'][] = 'linkedin';
                }
-               if (plugin_enabled('ljpost')) {
+               if (Addon::isEnabled('ljpost')) {
                        $nodeinfo['services']['outbound'][] = 'livejournal';
                }
-               if (plugin_enabled('buffer')) {
+               if (Addon::isEnabled('buffer')) {
                        $nodeinfo['services']['outbound'][] = 'pinterest';
                }
-               if (plugin_enabled('posterous')) {
+               if (Addon::isEnabled('posterous')) {
                        $nodeinfo['services']['outbound'][] = 'posterous';
                }
-               if (plugin_enabled('pumpio')) {
+               if (Addon::isEnabled('pumpio')) {
                        $nodeinfo['services']['inbound'][] = 'pumpio';
                        $nodeinfo['services']['outbound'][] = 'pumpio';
                }
@@ -121,13 +120,13 @@ function nodeinfo_init(App $a) {
                if ($smtp) {
                        $nodeinfo['services']['outbound'][] = 'smtp';
                }
-               if (plugin_enabled('tumblr')) {
+               if (Addon::isEnabled('tumblr')) {
                        $nodeinfo['services']['outbound'][] = 'tumblr';
                }
-               if (plugin_enabled('twitter') || plugin_enabled('buffer')) {
+               if (Addon::isEnabled('twitter') || Addon::isEnabled('buffer')) {
                        $nodeinfo['services']['outbound'][] = 'twitter';
                }
-               if (plugin_enabled('wppost')) {
+               if (Addon::isEnabled('wppost')) {
                        $nodeinfo['services']['outbound'][] = 'wordpress';
                }
                $nodeinfo['metadata']['protocols'] = $nodeinfo['protocols'];
@@ -137,7 +136,7 @@ function nodeinfo_init(App $a) {
 
                $nodeinfo['metadata']['services'] = $nodeinfo['services'];
 
-               if (plugin_enabled('twitter')) {
+               if (Addon::isEnabled('twitter')) {
                        $nodeinfo['metadata']['services']['inbound'][] = 'twitter';
                }
        }
@@ -154,7 +153,7 @@ function nodeinfo_cron() {
        $a = get_app();
 
        // If the plugin 'statistics_json' is enabled then disable it and actrivate nodeinfo.
-       if (plugin_enabled('statistics_json')) {
+       if (Addon::isEnabled('statistics_json')) {
                Config::set('system', 'nodeinfo', true);
 
                $plugin = 'statistics_json';
@@ -167,7 +166,7 @@ function nodeinfo_cron() {
                        $idx = array_search($plugin, $plugins_arr);
                        if ($idx !== false) {
                                unset($plugins_arr[$idx]);
-                               uninstall_plugin($plugin);
+                               Addon::uninstall($plugin);
                                Config::set('system', 'addon', implode(', ',$plugins_arr));
                        }
                }
index dbe45aba15736245f606d9ea110c2b8b7d5af5db..6fb404f1b052f9714d9afb9ff2f62c87872570b0 100644 (file)
@@ -11,6 +11,7 @@
 */
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Util\ParseUrl;
 
 require_once("include/items.php");
@@ -91,7 +92,7 @@ function parse_url_content(App $a) {
 
        $arr = ["url" => $url, "text" => ""];
 
-       call_hooks("parse_link", $arr);
+       Addon::callHooks("parse_link", $arr);
 
        if (strlen($arr["text"])) {
                echo $arr["text"];
index 6183ed60b6984b8bf4125d4e53c5e58f20622cfd..3cb75e539cd83b3a29ede1ee5d7dd28cd61139f5 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Content\Nav;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
@@ -720,7 +721,7 @@ function photos_post(App $a)
 
 
        // default post action - upload a photo
-       call_hooks('photo_post_init', $_POST);
+       Addon::callHooks('photo_post_init', $_POST);
 
        // Determine the album to use
        $album    = x($_REQUEST, 'album') ? notags(trim($_REQUEST['album'])) : '';
@@ -770,7 +771,7 @@ function photos_post(App $a)
 
        $ret = ['src' => '', 'filename' => '', 'filesize' => 0, 'type' => ''];
 
-       call_hooks('photo_post_file', $ret);
+       Addon::callHooks('photo_post_file', $ret);
 
        if (x($ret, 'src') && x($ret, 'filesize')) {
                $src      = $ret['src'];
@@ -808,7 +809,7 @@ function photos_post(App $a)
                }
                @unlink($src);
                $foo = 0;
-               call_hooks('photo_post_end', $foo);
+               Addon::callHooks('photo_post_end', $foo);
                return;
        }
 
@@ -824,7 +825,7 @@ function photos_post(App $a)
                notice(t('Image exceeds size limit of %s', formatBytes($maximagesize)) . EOL);
                @unlink($src);
                $foo = 0;
-               call_hooks('photo_post_end', $foo);
+               Addon::callHooks('photo_post_end', $foo);
                return;
        }
 
@@ -832,7 +833,7 @@ function photos_post(App $a)
                notice(t('Image file is empty.') . EOL);
                @unlink($src);
                $foo = 0;
-               call_hooks('photo_post_end', $foo);
+               Addon::callHooks('photo_post_end', $foo);
                return;
        }
 
@@ -847,7 +848,7 @@ function photos_post(App $a)
                notice(t('Unable to process image.') . EOL);
                @unlink($src);
                $foo = 0;
-               call_hooks('photo_post_end',$foo);
+               Addon::callHooks('photo_post_end',$foo);
                killme();
        }
 
@@ -937,7 +938,7 @@ function photos_post(App $a)
                Worker::add(PRIORITY_HIGH, "Notifier", 'wall-new', $item_id);
        }
 
-       call_hooks('photo_post_end', intval($item_id));
+       Addon::callHooks('photo_post_end', intval($item_id));
 
        // addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
        // if they do not wish to be redirected
@@ -1103,7 +1104,7 @@ function photos_content(App $a)
                                'addon_text' => $uploader,
                                'default_upload' => true];
 
-               call_hooks('photo_upload_form',$ret);
+               Addon::callHooks('photo_upload_form',$ret);
 
                $default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), []);
                $default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), [
index 9dd6780d01bcd7b0cd375a97cb278785dfcef064..6e11e18cd6ea5584a7b4726fe227004474298eb8 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Content\ForumManager;
+use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\System;
 use Friendica\Core\PConfig;
@@ -138,7 +139,7 @@ function ping_init(App $a)
 
                if (DBM::is_result($items_unseen)) {
                        $arr = ['items' => $items_unseen];
-                       call_hooks('network_ping', $arr);
+                       Addon::callHooks('network_ping', $arr);
 
                        foreach ($items_unseen as $item) {
                                if ($item['wall']) {
index a8410b17d21816dbbdbd0bde08ec8dd3555401e5..74348f84a7dad6f760380a234e2c111eb304f10b 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -142,7 +143,7 @@ function poke_init(App $a) {
        }
 
 
-       call_hooks('post_local_end', $arr);
+       Addon::callHooks('post_local_end', $arr);
 
        Worker::add(PRIORITY_HIGH, "Notifier", "like", $post_id);
 
index 4b1d4d2a0a8cc10fe23adeb69d758b322c7fa466..081b5e3a8596f66f15ff4a995f0de1e7c22efc1a 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Widget;
 use Friendica\Content\Nav;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -180,7 +181,7 @@ function profile_content(App $a, $update = 0)
 
                if ($tab === 'profile') {
                        $o .= Profile::getAdvanced($a);
-                       call_hooks('profile_advanced', $o);
+                       Addon::callHooks('profile_advanced', $o);
                        return $o;
                }
 
index 32ed24346fdd69d42721b69035c72fd379d3a3e6..4cb95330931561107598f0cd29da4ed2f04c2368 100644 (file)
@@ -6,6 +6,7 @@ use Friendica\App;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
 use Friendica\Content\Nav;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -178,7 +179,7 @@ function profiles_post(App $a) {
 
        $namechanged = false;
 
-       call_hooks('profile_post', $_POST);
+       Addon::callHooks('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",
@@ -743,7 +744,7 @@ function profiles_content(App $a) {
                ]);
 
                $arr = ['profile' => $r[0], 'entry' => $o];
-               call_hooks('profile_edit', $arr);
+               Addon::callHooks('profile_edit', $arr);
 
                return $o;
        } else {
index 56d4e59360346a7b9a7aefdfc7932f0e4f9b113b..2bd09aca92db55da4ecb54d5ad18b5498a2c00ce 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -20,7 +21,7 @@ function register_post(App $a)
        $blocked  = 1;
 
        $arr = ['post' => $_POST];
-       call_hooks('register_post', $arr);
+       Addon::callHooks('register_post', $arr);
 
        $max_dailies = intval(Config::get('system', 'max_daily_registrations'));
        if ($max_dailies) {
@@ -241,7 +242,7 @@ function register_content(App $a)
 
        $arr = ['template' => $tpl];
 
-       call_hooks('register_form', $arr);
+       Addon::callHooks('register_form', $arr);
 
        $tpl = $arr['template'];
 
index 572857a48b9fb30acf718abd28df50066ee3b529..dd863cc19b2b668a25b6051ceeb9e09268d6fe9a 100644 (file)
@@ -5,6 +5,7 @@
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Content\Nav;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Core\Config;
@@ -195,7 +196,7 @@ function settings_post(App $a)
        if (($a->argc > 1) && ($a->argv[1] == 'addon')) {
                check_form_security_token_redirectOnErr('/settings/addon', 'settings_addon');
 
-               call_hooks('plugin_settings_post', $_POST);
+               Addon::callHooks('plugin_settings_post', $_POST);
                return;
        }
 
@@ -277,7 +278,7 @@ function settings_post(App $a)
                        }
                }
 
-               call_hooks('connector_settings_post', $_POST);
+               Addon::callHooks('connector_settings_post', $_POST);
                return;
        }
 
@@ -351,7 +352,7 @@ function settings_post(App $a)
                                intval(local_user())
                );
 
-               call_hooks('display_settings_post', $_POST);
+               Addon::callHooks('display_settings_post', $_POST);
                goaway('settings/display');
                return; // NOTREACHED
        }
@@ -364,7 +365,7 @@ function settings_post(App $a)
                goaway('settings');
        }
 
-       call_hooks('settings_post', $_POST);
+       Addon::callHooks('settings_post', $_POST);
 
        if (x($_POST, 'password') || x($_POST, 'confirm')) {
                $newpass = $_POST['password'];
@@ -753,7 +754,7 @@ function settings_content(App $a)
                        $settings_addons = t('No Plugin settings configured');
                }
 
-               call_hooks('plugin_settings', $settings_addons);
+               Addon::callHooks('plugin_settings', $settings_addons);
 
 
                $tpl = get_markup_template('settings/addons.tpl');
@@ -799,7 +800,7 @@ function settings_content(App $a)
                }
 
                $settings_connectors = '';
-               call_hooks('connector_settings', $settings_connectors);
+               Addon::callHooks('connector_settings', $settings_connectors);
 
                if (is_site_admin()) {
                        $diasp_enabled = t('Built-in support for %s connectivity is %s', t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? t('enabled') : t('disabled')));
@@ -871,7 +872,7 @@ function settings_content(App $a)
                        '$submit' => t('Save Settings'),
                ]);
 
-               call_hooks('display_settings', $o);
+               Addon::callHooks('display_settings', $o);
                return $o;
        }
 
@@ -1284,7 +1285,7 @@ function settings_content(App $a)
 
        ]);
 
-       call_hooks('settings_form', $o);
+       Addon::callHooks('settings_form', $o);
 
        $o .= '</form>' . "\r\n";
 
index 21eb10ab4803cf5f849a5cda57b148a851e20161..94a7fc9e1c41244bb096351ab2b0e5a1270c1e35 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 
 require_once("include/plugin.php");
@@ -28,19 +29,19 @@ function statistics_json_init(App $a) {
        ];
 
        $statistics["services"] = [];
-       $statistics["services"]["appnet"] = plugin_enabled("appnet");
-       $statistics["services"]["blogger"] = plugin_enabled("blogger");
-       $statistics["services"]["buffer"] = plugin_enabled("buffer");
-       $statistics["services"]["dreamwidth"] = plugin_enabled("dwpost");
-       $statistics["services"]["facebook"] = plugin_enabled("fbpost");
-       $statistics["services"]["gnusocial"] = plugin_enabled("statusnet");
-       $statistics["services"]["googleplus"] = plugin_enabled("gpluspost");
-       $statistics["services"]["libertree"] = plugin_enabled("libertree");
-       $statistics["services"]["livejournal"] = plugin_enabled("ljpost");
-       $statistics["services"]["pumpio"] = plugin_enabled("pumpio");
-       $statistics["services"]["twitter"] = plugin_enabled("twitter");
-       $statistics["services"]["tumblr"] = plugin_enabled("tumblr");
-       $statistics["services"]["wordpress"] = plugin_enabled("wppost");
+       $statistics["services"]["appnet"] = Addon::isEnabled("appnet");
+       $statistics["services"]["blogger"] = Addon::isEnabled("blogger");
+       $statistics["services"]["buffer"] = Addon::isEnabled("buffer");
+       $statistics["services"]["dreamwidth"] = Addon::isEnabled("dwpost");
+       $statistics["services"]["facebook"] = Addon::isEnabled("fbpost");
+       $statistics["services"]["gnusocial"] = Addon::isEnabled("statusnet");
+       $statistics["services"]["googleplus"] = Addon::isEnabled("gpluspost");
+       $statistics["services"]["libertree"] = Addon::isEnabled("libertree");
+       $statistics["services"]["livejournal"] = Addon::isEnabled("ljpost");
+       $statistics["services"]["pumpio"] = Addon::isEnabled("pumpio");
+       $statistics["services"]["twitter"] = Addon::isEnabled("twitter");
+       $statistics["services"]["tumblr"] = Addon::isEnabled("tumblr");
+       $statistics["services"]["wordpress"] = Addon::isEnabled("wppost");
 
        $statistics["appnet"] = $statistics["services"]["appnet"];
        $statistics["blogger"] = $statistics["services"]["blogger"];
index 037e2982e779aa00f59e4b682e5819eecacb59a6..af7f0b49219b42ca267068977a9847843cee927c 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 
@@ -156,7 +157,7 @@ EOT;
 
        $arr['id'] = $post_id;
 
-       call_hooks('post_local_end', $arr);
+       Addon::callHooks('post_local_end', $arr);
 
        killme();
 
index 60eafa865fcd25641c8e4b19e0151848ae95492e..74cbd658fd4750abb8d629469cb41882da3cd8f7 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -213,7 +214,7 @@ EOT;
 
        $arr['id'] = $post_id;
 
-       call_hooks('post_local_end', $arr);
+       Addon::callHooks('post_local_end', $arr);
 
        Worker::add(PRIORITY_HIGH, "Notifier", "tag", $post_id);
 
index 5881817b300e962a300e6a9514da281332bbe61a..29ea19c20e6ce07087646693a7cd7936ee1bde61 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 
@@ -40,7 +41,7 @@ function uexport_content(App $a) {
                ['uexport/account', t('Export account'), 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', t('Export all'), 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 (photos are not exported)')],
        ];
-       call_hooks('uexport_options', $options);
+       Addon::callHooks('uexport_options', $options);
 
        $tpl = get_markup_template("uexport.tpl");
        return replace_macros($tpl, [
index e5b537cd9749c41d8dd83b8f4cf4b2549db06b21..bbfd7ce64a31687f5fc0a66e787c6c3c3e645e54 100644 (file)
@@ -3,6 +3,7 @@
  * @file mod/xrd.php
  */
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Salmon;
@@ -109,7 +110,7 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r)
        );
 
        $arr = ['user' => $r, 'xml' => $o];
-       call_hooks('personal_xrd', $arr);
+       Addon::callHooks('personal_xrd', $arr);
 
        echo $arr['xml'];
        killme();
index ccf24b7b43dd005421f9410e24b592280e92a9f7..a821fc1abecdbdd3f4dcf5a4d79733ed06414526 100755 (executable)
@@ -6,6 +6,7 @@
  */
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 
@@ -42,7 +43,7 @@ if (Config::get('system', 'maintenance', true)) {
 
 $a->set_baseurl(Config::get('system', 'url'));
 
-load_hooks();
+Addon::loadHooks();
 
 $spawn = (($_SERVER["argc"] == 2) && ($_SERVER["argv"][1] == "spawn"));
 
index 4eb2e74aa298aed87909d6d454f3db4485dc1f27..fcaafb898c5275a51bd35ce200517cfb82f0809b 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Content;
 
+use Friendica\Core\Addon;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Diaspora;
 use dba;
@@ -93,7 +94,7 @@ class ContactSelector
                        NETWORK_APPNET => t('App.net')
                ];
 
-               call_hooks('network_to_name', $nets);
+               Addon::callHooks('network_to_name', $nets);
 
                $search  = array_keys($nets);
                $replace = array_values($nets);
@@ -122,7 +123,7 @@ class ContactSelector
                $o = '';
                $select = ['', t('Male'), t('Female'), t('Currently Male'), t('Currently Female'), t('Mostly Male'), t('Mostly Female'), t('Transgender'), t('Intersex'), t('Transsexual'), t('Hermaphrodite'), t('Neuter'), t('Non-specific'), t('Other'), t('Undecided')];
        
-               call_hooks('gender_selector', $select);
+               Addon::callHooks('gender_selector', $select);
        
                $o .= "<select name=\"gender$suffix\" id=\"gender-select$suffix\" size=\"1\" >";
                foreach ($select as $selection) {
@@ -145,7 +146,7 @@ class ContactSelector
                $select = ['', t('Males'), t('Females'), t('Gay'), t('Lesbian'), t('No Preference'), t('Bisexual'), t('Autosexual'), t('Abstinent'), t('Virgin'), t('Deviant'), t('Fetish'), t('Oodles'), t('Nonsexual')];
        
        
-               call_hooks('sexpref_selector', $select);
+               Addon::callHooks('sexpref_selector', $select);
        
                $o .= "<select name=\"sexual$suffix\" id=\"sexual-select$suffix\" size=\"1\" >";
                foreach ($select as $selection) {
@@ -166,7 +167,7 @@ class ContactSelector
                $o = '';
                $select = ['', t('Single'), t('Lonely'), t('Available'), t('Unavailable'), t('Has crush'), t('Infatuated'), t('Dating'), t('Unfaithful'), t('Sex Addict'), t('Friends'), t('Friends/Benefits'), t('Casual'), t('Engaged'), t('Married'), t('Imaginarily married'), t('Partners'), t('Cohabiting'), t('Common law'), t('Happy'), t('Not looking'), t('Swinger'), t('Betrayed'), t('Separated'), t('Unstable'), t('Divorced'), t('Imaginarily divorced'), t('Widowed'), t('Uncertain'), t('It\'s complicated'), t('Don\'t care'), t('Ask me')];
        
-               call_hooks('marital_selector', $select);
+               Addon::callHooks('marital_selector', $select);
        
                $o .= '<select name="marital" id="marital-select" size="1" >';
                foreach ($select as $selection) {
index 6d90c3fbc41085981fa9338b4c3bf6e4027d6222..d35fcf7030f0dc8c66569354d90f895e4bf41018 100644 (file)
@@ -5,6 +5,7 @@
  */
 namespace Friendica\Content;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 
@@ -36,7 +37,7 @@ class Feature
                }
 
                $arr = ['uid' => $uid, 'feature' => $feature, 'enabled' => $x];
-               call_hooks('isEnabled', $arr);
+               Addon::callHooks('isEnabled', $arr);
                return($arr['enabled']);
        }
 
@@ -150,7 +151,7 @@ class Feature
                        }
                }
 
-               call_hooks('get', $arr);
+               Addon::callHooks('get', $arr);
                return $arr;
        }
 }
index 4bbc7900d460a31437591225dbcb655365f27dd1..a9a6eb3d18df0ac91918b7bcec2f3d44a9b2154a 100644 (file)
@@ -6,6 +6,7 @@ namespace Friendica\Content;
 
 use Friendica\App;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -57,7 +58,7 @@ class Nav
                        '$search_hint' => t('@name, !forum, #tags, content')
                ]);
        
-               call_hooks('page_header', $a->page['nav']);
+               Addon::callHooks('page_header', $a->page['nav']);
        }
        
        /**
@@ -224,7 +225,7 @@ class Nav
                        $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
                }
        
-               call_hooks('nav_info', $nav);
+               Addon::callHooks('nav_info', $nav);
        
                return [
                        'sitelocation' => $sitelocation,
index a8780d4d51e225349cede4a654a495c8f2f00c54..bcfb2346745ae25f07a4ddcd40b7c1c9b64accf7 100644 (file)
@@ -6,6 +6,7 @@
 
 namespace Friendica\Content;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\System;
 use Friendica\Core\Config;
@@ -154,7 +155,7 @@ class OEmbed
                        }
                }
 
-               call_hooks('oembed_fetch_url', $embedurl, $j);
+               Addon::callHooks('oembed_fetch_url', $embedurl, $j);
 
                return $j;
        }
index 201530cb823102ae9aa025652c1e165e045ff9b0..89a833d71098762dd1f8f583bd1b447a76ccb7e4 100644 (file)
@@ -15,6 +15,7 @@
 namespace Friendica\Content;
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -139,7 +140,7 @@ class Smilies
                ];
 
                $params = ['texts' => $texts, 'icons' => $icons];
-               call_hooks('smilie', $params);
+               Addon::callHooks('smilie', $params);
 
                return $params;
        }
index 3c8131f45cad614c528f979b2467cbcd0e0ed672..156e9e3593b29ee849d9812265ceeac6f87aa13e 100644 (file)
@@ -6,6 +6,7 @@ namespace Friendica\Content;
 
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -74,23 +75,23 @@ class Widget
        {
                $networks = array();
 
-               if (!plugin_enabled("appnet")) {
+               if (!Addon::isEnabled("appnet")) {
                        $networks[] = NETWORK_APPNET;
                }
 
-               if (!plugin_enabled("fbpost") && !plugin_enabled("facebook")) {
+               if (!Addon::isEnabled("fbpost") && !Addon::isEnabled("facebook")) {
                        $networks[] = NETWORK_FACEBOOK;
                }
 
-               if (!plugin_enabled("statusnet")) {
+               if (!Addon::isEnabled("statusnet")) {
                        $networks[] = NETWORK_STATUSNET;
                }
 
-               if (!plugin_enabled("pumpio")) {
+               if (!Addon::isEnabled("pumpio")) {
                        $networks[] = NETWORK_PUMPIO;
                }
 
-               if (!plugin_enabled("twitter")) {
+               if (!Addon::isEnabled("twitter")) {
                        $networks[] = NETWORK_TWITTER;
                }
 
@@ -102,7 +103,7 @@ class Widget
                        $networks[] = NETWORK_DIASPORA;
                }
 
-               if (!plugin_enabled("pnut")) {
+               if (!Addon::isEnabled("pnut")) {
                        $networks[] = NETWORK_PNUT;
                }
 
index f9a21d429c63aa15a813c0760bd6bf6514c1401c..7d5115b27d254c52fe06c5a556639f139887c08d 100644 (file)
@@ -8,6 +8,9 @@ use Friendica\App;
 use Friendica\Core\Config;\r
 use Friendica\Core\System;\r
 use Friendica\Database\DBM;\r
+use dba;\r
+\r
+require_once 'include/dba.php';\r
 \r
 /**\r
  * Some functions to handle addons\r
@@ -17,16 +20,17 @@ class Addon
     /**\r
      * @brief uninstalls an addon.\r
      *\r
-     * @param string $plugin name of the addon\r
+     * @param string $addon name of the addon\r
      * @return boolean\r
      */\r
-    function uninstall_plugin($plugin) {\r
-        logger("Addons: uninstalling " . $plugin);\r
-        dba::delete('addon', ['name' => $plugin]);\r
+    public static function uninstall($addon)\r
+    {\r
+        logger("Addons: uninstalling " . $addon);\r
+        dba::delete('addon', ['name' => $addon]);\r
 \r
-        @include_once('addon/' . $plugin . '/' . $plugin . '.php');\r
-        if (function_exists($plugin . '_uninstall')) {\r
-            $func = $plugin . '_uninstall';\r
+        @include_once('addon/' . $addon . '/' . $addon . '.php');\r
+        if (function_exists($addon . '_uninstall')) {\r
+            $func = $addon . '_uninstall';\r
             $func();\r
         }\r
     }\r
@@ -34,76 +38,79 @@ class Addon
     /**\r
      * @brief installs an addon.\r
      *\r
-     * @param string $plugin name of the addon\r
+     * @param string $addon name of the addon\r
      * @return bool\r
      */\r
-    function install_plugin($plugin) {\r
-        // silently fail if plugin was removed\r
+    public static function install($addon)\r
+    {\r
+        // silently fail if addon was removed\r
 \r
-        if (!file_exists('addon/' . $plugin . '/' . $plugin . '.php')) {\r
+        if (!file_exists('addon/' . $addon . '/' . $addon . '.php')) {\r
             return false;\r
         }\r
-        logger("Addons: installing " . $plugin);\r
-        $t = @filemtime('addon/' . $plugin . '/' . $plugin . '.php');\r
-        @include_once('addon/' . $plugin . '/' . $plugin . '.php');\r
-        if (function_exists($plugin . '_install')) {\r
-            $func = $plugin . '_install';\r
+        logger("Addons: installing " . $addon);\r
+        $t = @filemtime('addon/' . $addon . '/' . $addon . '.php');\r
+        @include_once('addon/' . $addon . '/' . $addon . '.php');\r
+        if (function_exists($addon . '_install')) {\r
+            $func = $addon . '_install';\r
             $func();\r
 \r
-            $plugin_admin = (function_exists($plugin."_plugin_admin") ? 1 : 0);\r
+            $addon_admin = (function_exists($addon."_plugin_admin") ? 1 : 0);\r
 \r
-            dba::insert('addon', ['name' => $plugin, 'installed' => true,\r
-                        'timestamp' => $t, 'plugin_admin' => $plugin_admin]);\r
+            dba::insert('addon', ['name' => $addon, 'installed' => true,\r
+                        'timestamp' => $t, 'plugin_admin' => $addon_admin]);\r
 \r
             // we can add the following with the previous SQL\r
             // once most site tables have been updated.\r
             // This way the system won't fall over dead during the update.\r
 \r
-            if (file_exists('addon/' . $plugin . '/.hidden')) {\r
-                dba::update('addon', ['hidden' => true], ['name' => $plugin]);\r
+            if (file_exists('addon/' . $addon . '/.hidden')) {\r
+                dba::update('addon', ['hidden' => true], ['name' => $addon]);\r
             }\r
             return true;\r
         } else {\r
-            logger("Addons: FAILED installing " . $plugin);\r
+            logger("Addons: FAILED installing " . $addon);\r
             return false;\r
         }\r
     }\r
 \r
-    // reload all updated plugins\r
-\r
-    function reload_plugins() {\r
-        $plugins = Config::get('system', 'addon');\r
-        if (strlen($plugins)) {\r
+    /**\r
+     * reload all updated addons\r
+     */\r
+    public static function reload()\r
+    {\r
+        $addons = Config::get('system', 'addon');\r
+        if (strlen($addons)) {\r
 \r
-            $r = q("SELECT * FROM `addon` WHERE `installed` = 1");\r
+            $r = dba::select('addon', [], ['installed' => 1]);\r
             if (DBM::is_result($r)) {\r
                 $installed = $r;\r
             } else {\r
                 $installed = [];\r
             }\r
 \r
-            $parr = explode(',',$plugins);\r
+            $addon_list = explode(',', $addons);\r
 \r
-            if (count($parr)) {\r
-                foreach ($parr as $pl) {\r
+            if (count($addon_list)) {\r
+                foreach ($addon_list as $addon) {\r
 \r
-                    $pl = trim($pl);\r
+                    $addon = trim($addon);\r
 \r
-                    $fname = 'addon/' . $pl . '/' . $pl . '.php';\r
+                    $fname = 'addon/' . $addon . '/' . $addon . '.php';\r
 \r
                     if (file_exists($fname)) {\r
                         $t = @filemtime($fname);\r
                         foreach ($installed as $i) {\r
-                            if (($i['name'] == $pl) && ($i['timestamp'] != $t)) {\r
-                                logger('Reloading plugin: ' . $i['name']);\r
+                            if (($i['name'] == $addon) && ($i['timestamp'] != $t)) {\r
+                                logger('Reloading addon: ' . $i['name']);\r
                                 @include_once($fname);\r
 \r
-                                if (function_exists($pl . '_uninstall')) {\r
-                                    $func = $pl . '_uninstall';\r
+                                if (function_exists($addon . '_uninstall')) {\r
+                                    $func = $addon . '_uninstall';\r
                                     $func();\r
                                 }\r
-                                if (function_exists($pl . '_install')) {\r
-                                    $func = $pl . '_install';\r
+                                if (function_exists($addon . '_install')) {\r
+                                    $func = $addon . '_install';\r
                                     $func();\r
                                 }\r
                                 dba::update('addon', ['timestamp' => $t], ['id' => $i['id']]);\r
@@ -113,17 +120,17 @@ class Addon
                 }\r
             }\r
         }\r
-\r
     }\r
 \r
     /**\r
      * @brief check if addon is enabled\r
      *\r
-     * @param string $plugin\r
+     * @param string $addon\r
      * @return boolean\r
      */\r
-    function plugin_enabled($plugin) {\r
-        return dba::exists('addon', ['installed' => true, 'name' => $plugin]);\r
+    public static function isEnabled($addon)\r
+    {\r
+        return dba::exists('addon', ['installed' => true, 'name' => $addon]);\r
     }\r
 \r
 \r
@@ -136,7 +143,8 @@ class Addon
      * @param int $priority A priority (defaults to 0)\r
      * @return mixed|bool\r
      */\r
-    function register_hook($hook, $file, $function, $priority=0) {\r
+    public static function registerHook($hook, $file, $function, $priority = 0)\r
+    {\r
         $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];\r
         $exists = dba::exists('hook', $condition);\r
         if ($exists) {\r
@@ -156,14 +164,15 @@ class Addon
      * @param string $function the name of the function that the hook called\r
      * @return array\r
      */\r
-    function unregister_hook($hook, $file, $function) {\r
+    public static function unregisterHook($hook, $file, $function)\r
+    {\r
         $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];\r
         $r = dba::delete('hook', $condition);\r
         return $r;\r
     }\r
 \r
 \r
-    function load_hooks() {\r
+    public static function loadHooks() {\r
         $a = get_app();\r
         $a->hooks = [];\r
         $r = dba::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);\r
@@ -186,13 +195,13 @@ class Addon
      * @param string $name of the hook to call\r
      * @param string|array &$data to transmit to the callback handler\r
      */\r
-    function call_hooks($name, &$data = null)\r
+    public static function callHooks($name, &$data = null)\r
     {\r
         $a = get_app();\r
 \r
         if (is_array($a->hooks) && array_key_exists($name, $a->hooks)) {\r
             foreach ($a->hooks[$name] as $hook) {\r
-                call_single_hook($a, $name, $hook, $data);\r
+                self::callSingleHook($a, $name, $hook, $data);\r
             }\r
         }\r
     }\r
@@ -204,7 +213,8 @@ class Addon
      * @param array $hook Hook data\r
      * @param string|array &$data to transmit to the callback handler\r
      */\r
-    function call_single_hook($a, $name, $hook, &$data = null) {\r
+    public static function callSingleHook($a, $name, $hook, &$data = null)\r
+    {\r
         // Don't run a theme's hook if the user isn't using the theme\r
         if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/'.current_theme()) === false)\r
             return;\r
@@ -220,9 +230,12 @@ class Addon
         }\r
     }\r
 \r
-    //check if an app_menu hook exist for plugin $name.\r
-    //Return true if the plugin is an app\r
-    function plugin_is_app($name) {\r
+    /**\r
+     * check if an app_menu hook exist for addon $name.\r
+     * Return true if the addon is an app\r
+     */\r
+    function isApp($name)\r
+    {\r
         $a = get_app();\r
 \r
         if (is_array($a->hooks) && (array_key_exists('app_menu',$a->hooks))) {\r
@@ -236,37 +249,39 @@ class Addon
     }\r
 \r
     /**\r
-     * @brief Parse plugin comment in search of plugin infos.\r
+     * @brief Parse addon comment in search of addon infos.\r
      *\r
      * like\r
      * \code\r
-     *...* Name: Plugin\r
-    *   * Description: A plugin which plugs in\r
+     *...* Name: addon\r
+    *   * Description: An addon which plugs in\r
     * . * Version: 1.2.3\r
     *   * Author: John <profile url>\r
     *   * Author: Jane <email>\r
     *   *\r
     *  *\endcode\r
-    * @param string $plugin the name of the plugin\r
-    * @return array with the plugin information\r
+    * @param string $addon the name of the addon\r
+    * @return array with the addon information\r
     */\r
 \r
-    function get_plugin_info($plugin) {\r
+    public static function getInfo($addon) {\r
 \r
         $a = get_app();\r
 \r
         $info=[\r
-            'name' => $plugin,\r
+            'name' => $addon,\r
             'description' => "",\r
             'author' => [],\r
             'version' => "",\r
             'status' => ""\r
         ];\r
 \r
-        if (!is_file("addon/$plugin/$plugin.php")) return $info;\r
+        if (!is_file("addon/$addon/$addon.php")) {\r
+            return $info;\r
+        }\r
 \r
         $stamp1 = microtime(true);\r
-        $f = file_get_contents("addon/$plugin/$plugin.php");\r
+        $f = file_get_contents("addon/$addon/$addon.php");\r
         $a->save_timestamp($stamp1, "file");\r
 \r
         $r = preg_match("|/\*.*\*/|msU", $f, $m);\r
@@ -293,7 +308,6 @@ class Addon
 \r
                 }\r
             }\r
-\r
         }\r
         return $info;\r
     }\r
index 478f01a9674ed6c8263fa8a75d6a2aa6331c3fb0..893b1bccc8877a305bb5accebb884dfa64a02100 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Core;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -1030,7 +1031,7 @@ class Worker
 
                $arr = ['args' => $args, 'run_cmd' => true];
 
-               call_hooks("proc_run", $arr);
+               Addon::callHooks("proc_run", $arr);
                if (!$arr['run_cmd'] || !count($args)) {
                        return true;
                }
index 2f3328a24ee296e9b7c8544ab3838e80152f2da4..2778e8a5d636669dbae0e3f4ab5876cccb85e44c 100644 (file)
@@ -5,6 +5,7 @@
 namespace Friendica\Model;
 
 use Friendica\BaseObject;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -559,7 +560,7 @@ class Contact extends BaseObject
 
                $args = ['contact' => $contact, 'menu' => &$menu];
 
-               call_hooks('contact_photo_menu', $args);
+               Addon::callHooks('contact_photo_menu', $args);
 
                $menucondensed = [];
 
@@ -1146,7 +1147,7 @@ class Contact extends BaseObject
 
                $arr = ['url' => $url, 'contact' => []];
 
-               call_hooks('follow', $arr);
+               Addon::callHooks('follow', $arr);
 
                if (x($arr['contact'], 'name')) {
                        $ret = $arr['contact'];
index b47a53c9e9579f2a5dd5d50b325294ccfd0e7a4b..cd925780b1b1cff3638fc582ec2148b7889c9617 100644 (file)
@@ -8,6 +8,7 @@ namespace Friendica\Model;
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Content\ForumManager;
+use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
@@ -286,7 +287,7 @@ class Profile
                        $profile['network_name'] = '';
                }
 
-               call_hooks('profile_sidebar_enter', $profile);
+               Addon::callHooks('profile_sidebar_enter', $profile);
 
 
                // don't show connect link to yourself
@@ -520,7 +521,7 @@ class Profile
 
                $arr = ['profile' => &$profile, 'entry' => &$o];
 
-               call_hooks('profile_sidebar', $arr);
+               Addon::callHooks('profile_sidebar', $arr);
 
                return $o;
        }
@@ -939,7 +940,7 @@ class Profile
                }
 
                $arr = ['is_owner' => $is_owner, 'nickname' => $nickname, 'tab' => $tab, 'tabs' => $tabs];
-               call_hooks('profile_tabs', $arr);
+               Addon::callHooks('profile_tabs', $arr);
 
                $tpl = get_markup_template('common_tabs.tpl');
 
@@ -976,7 +977,7 @@ class Profile
 
                        Worker::add(PRIORITY_LOW, 'GProbe', $my_url);
                        $arr = ['zrl' => $my_url, 'url' => $a->cmd];
-                       call_hooks('zrl_init', $arr);
+                       Addon::callHooks('zrl_init', $arr);
                }
        }
 
index 2ba0f05bd81a279ed5d27a95fdd738eb941a9571..57f1d0ab241d49862973ef44f973680bf3ab460d 100644 (file)
@@ -7,6 +7,7 @@
 
 namespace Friendica\Model;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -433,7 +434,7 @@ class User
                        }
                }
 
-               call_hooks('register_account', $uid);
+               Addon::callHooks('register_account', $uid);
 
                $return['user'] = $user;
                return $return;
@@ -532,7 +533,7 @@ class User
 
                $user = dba::selectFirst('user', [], ['uid' => $uid]);
 
-               call_hooks('remove_user', $user);
+               Addon::callHooks('remove_user', $user);
 
                // save username (actually the nickname as it is guaranteed
                // unique), so it cannot be re-registered in the future.
index 941510576b3a04ddcd28e6b2dbe66d5fc1b2eb1b..1da7a7417a0a0ae2a4452ca5a963be257ce944c4 100644 (file)
@@ -3,6 +3,7 @@
 namespace Friendica\Module;
 
 use Friendica\BaseModule;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Model\User;
@@ -92,7 +93,7 @@ class Login extends BaseModule
                         * Plugins should never set 'authenticated' except to indicate success - as hooks may be chained
                         * and later plugins should not interfere with an earlier one that succeeded.
                         */
-                       call_hooks('authenticate', $addon_auth);
+                       Addon::callHooks('authenticate', $addon_auth);
 
                        if ($addon_auth['authenticated'] && count($addon_auth['user_record'])) {
                                $record = $addon_auth['user_record'];
@@ -299,7 +300,7 @@ class Login extends BaseModule
                        ]
                );
 
-               call_hooks('login_hook', $o);
+               Addon::callHooks('login_hook', $o);
 
                return $o;
        }
index 0c8a617b224a39fcefce99a9e0a65f4934a7fc4c..366f000a8a708f13abccf6f9c542f688067e5bd3 100644 (file)
@@ -3,10 +3,10 @@
 namespace Friendica\Module;\r
 \r
 use Friendica\BaseModule;\r
+use Friendica\Core\Addon;\r
 \r
 require_once 'boot.php';\r
 require_once 'include/pgettext.php';\r
-require_once 'include/plugin.php';\r
 require_once 'include/security.php';\r
 \r
 /**\r
@@ -21,7 +21,7 @@ class Logout extends BaseModule
         */\r
        public static function init()\r
        {\r
-               call_hooks("logging_out");\r
+               Addon::callHooks("logging_out");\r
                nuke_session();\r
                info(t('Logged out.') . EOL);\r
                goaway(self::getApp()->get_baseurl());\r
index 64ae3374a987c5ab25ef68c24609299612bfcfe0..93e17a704543f36c80379a5f9e83549e548416b4 100644 (file)
@@ -5,6 +5,7 @@
 namespace Friendica\Network;
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
@@ -72,6 +73,6 @@ class FKOAuth1 extends OAuthServer
 
                dba::update('user', ['login_date' => datetime_convert()], ['uid' => $_SESSION['uid']]);
 
-               call_hooks('logged_in', $a->user);
+               Addon::callHooks('logged_in', $a->user);
        }
 }
index a3d6818fcfc71e800d80b24430aa40b5ea4210bd..7136df5535785a162b4346cb826141ca1e980500 100644 (file)
@@ -7,6 +7,7 @@ namespace Friendica\Object;
 use Friendica\BaseObject;
 use Friendica\Content\ContactSelector;
 use Friendica\Content\Feature;
+use Friendica\Core\Addon;
 use Friendica\Core\PConfig;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
@@ -214,7 +215,7 @@ class Post extends BaseObject
                }
 
                $locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
-               call_hooks('render_location', $locate);
+               Addon::callHooks('render_location', $locate);
                $location = ((strlen($locate['html'])) ? $locate['html'] : render_location_dummy($locate));
 
                // process action responses - e.g. like/dislike/attend/agree/whatever
@@ -405,7 +406,7 @@ class Post extends BaseObject
                ];
 
                $arr = ['item' => $item, 'output' => $tmp_item];
-               call_hooks('display_item', $arr);
+               Addon::callHooks('display_item', $arr);
 
                $result = $arr['output'];
 
index 0d92d598cf373e3198736c36337e54c22e7657cc..08f2c4d07cb29f442f011636308e7c7d6941e5b4 100644 (file)
@@ -10,6 +10,7 @@ namespace Friendica\Protocol;
 
 use Friendica\App;
 use Friendica\Content\OEmbed;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
@@ -269,12 +270,12 @@ class DFRN
                $root = self::addHeader($doc, $owner, $author, $alternatelink, true);
 
                /// @TODO This hook can't work anymore
-               //      call_hooks('atom_feed', $atom);
+               //      Addon::callHooks('atom_feed', $atom);
 
                if (!DBM::is_result($items) || $onlyheader) {
                        $atom = trim($doc->saveXML());
 
-                       call_hooks('atom_feed_end', $atom);
+                       Addon::callHooks('atom_feed_end', $atom);
 
                        return $atom;
                }
@@ -303,7 +304,7 @@ class DFRN
 
                $atom = trim($doc->saveXML());
 
-               call_hooks('atom_feed_end', $atom);
+               Addon::callHooks('atom_feed_end', $atom);
 
                return $atom;
        }
index ba65296f507a2f3faaacf00ee6484cc94233c458..7d35e54417eb5452c3b52a39fb9dacde87e317b6 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Util;
 
+use Friendica\Core\Addon;
 use Friendica\Core\PConfig;
 use Friendica\Protocol\Email;
 
@@ -30,7 +31,7 @@ class Emailer
         */
        public static function send($params)
        {
-               call_hooks('emailer_send_prepare', $params);
+               Addon::callHooks('emailer_send_prepare', $params);
 
                $email_textonly = false;
                if (x($params, "uid")) {
@@ -79,7 +80,7 @@ class Emailer
                        'headers' => $messageHeader
                ];
                //echo "<pre>"; var_dump($hookdata); killme();
-               call_hooks("emailer_send", $hookdata);
+               Addon::callHooks("emailer_send", $hookdata);
                $res = mail(
                        $hookdata['to'],                                                        // send to address
                        $hookdata['subject'],                                           // subject
index 9aabb9db9847bb16406adb1fd72cdf72c3c3e378..e736ca719b4d442a4b82a0f62cd73ea47fdd4143 100644 (file)
@@ -4,6 +4,8 @@
  */
 namespace Friendica\Util;
 
+use Friendica\Core\Addon;
+
 /**
  * Leaflet Map related functions
  */
@@ -12,13 +14,13 @@ class Map {
                $coord = trim($coord);
                $coord = str_replace([',','/','  '],[' ',' ',' '],$coord);
                $arr = ['lat' => trim(substr($coord,0,strpos($coord,' '))), 'lon' => trim(substr($coord,strpos($coord,' ')+1)), 'html' => ''];
-               call_hooks('generate_map',$arr);
+               Addon::callHooks('generate_map',$arr);
                return ($arr['html']) ? $arr['html'] : $coord;
        }
 
        public static function byLocation($location) {
                $arr = ['location' => $location, 'html' => ''];
-               call_hooks('generate_named_map',$arr);
+               Addon::callHooks('generate_named_map',$arr);
                return ($arr['html']) ? $arr['html'] : $location;
        }
 }
index bca51270266e55067cf59bb9e1d92e53c873a1f9..b03fcd9827b8e6b2517beafeddab6b479513f9eb 100644 (file)
@@ -6,6 +6,7 @@
 namespace Friendica\Util;
 
 use Friendica\Content\OEmbed;
+use Friendica\Core\Addon;
 use Friendica\Object\Image;
 use Friendica\Util\XML;
 
@@ -425,7 +426,7 @@ class ParseUrl
 
                logger("parseurl_getsiteinfo: Siteinfo for ".$url." ".print_r($siteinfo, true), LOGGER_DEBUG);
 
-               call_hooks("getsiteinfo", $siteinfo);
+               Addon::callHooks("getsiteinfo", $siteinfo);
 
                return($siteinfo);
        }
index e9019216f5b5a798e42197154ca259bb559063dc..2c855d569f74390218a5f2b8c7f59c277494c7fe 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Worker;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -138,7 +139,7 @@ Class Cron {
 
                $sql_extra = (($manual_id) ? " AND `id` = $manual_id " : "");
 
-               reload_plugins();
+               Addon::reload();
 
                $d = datetime_convert();
 
index fed65b2291e757d484dd8a963456a981c1a14eb6..ed1675031392bac04e826458c684afeb5059083f 100644 (file)
@@ -5,6 +5,7 @@
 
 namespace Friendica\Worker;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 
@@ -18,7 +19,7 @@ Class CronHooks {
                        foreach ($a->hooks["cron"] as $single_hook) {
                                if ($single_hook[1] == $hook) {
                                        logger("Calling cron hook '" . $hook . "'", LOGGER_DEBUG);
-                                       call_single_hook($a, $hook, $single_hook);
+                                       Addon::callSingleHook($a, $hook, $single_hook);
                                }
                        }
                        return;
index b29978cea731e666751485aa3239a6ba0a15cd21..e38f9eeeee46a89cabace54a8bc0fc1757193274 100644 (file)
@@ -6,6 +6,7 @@
 
 namespace Friendica\Worker;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -27,7 +28,7 @@ class Directory {
 
                $arr = ['url' => $url];
 
-               call_hooks('globaldir_update', $arr);
+               Addon::callHooks('globaldir_update', $arr);
 
                logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
                if (strlen($arr['url'])) {
index 039ae44db20c9afc335a4c74f8cc2cda5181c741..6b853bde7722742427bf5967fe608ea7352819bf 100644 (file)
@@ -6,6 +6,7 @@
 
 namespace Friendica\Worker;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -20,7 +21,7 @@ class Expire {
                require_once 'include/datetime.php';
                require_once 'include/items.php';
 
-               load_hooks();
+               Addon::loadHooks();
 
                if ($param == 'delete') {
                        logger('Delete expired items', LOGGER_DEBUG);
@@ -50,7 +51,7 @@ class Expire {
                        foreach ($a->hooks["expire"] as $hook) {
                                if ($hook[1] == $hook_name) {
                                        logger("Calling expire hook '" . $hook[1] . "'", LOGGER_DEBUG);
-                                       call_single_hook($a, $hook_name, $hook, $data);
+                                       Addon::callSingleHook($a, $hook_name, $hook, $data);
                                }
                        }
                        return;
index d69627d111c4bdff45dabd1a09d893262f920810..f28b8c68a15d6b6feb4102d310a464044750af2d 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Worker;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -553,10 +554,10 @@ class Notifier {
                logger('notifier: calling hooks', LOGGER_DEBUG);
 
                if ($normal_mode) {
-                       call_hooks('notifier_normal',$target_item);
+                       Addon::callHooks('notifier_normal',$target_item);
                }
 
-               call_hooks('notifier_end',$target_item);
+               Addon::callHooks('notifier_end',$target_item);
 
                return;
        }
index 96c9fed310aa524845de2d467cf63e425019e1de..daa8fcb5ccd54febb0b671ef1e3e91582a74864f 100644 (file)
@@ -4,6 +4,7 @@
  */
 namespace Friendica\Worker;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
@@ -55,7 +56,7 @@ class Queue
                         */
                        $r = q("SELECT `id` FROM `queue` WHERE ((`created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE) OR (`last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR)) ORDER BY `cid`, `created`");
 
-                       call_hooks('queue_predeliver', $r);
+                       Addon::callHooks('queue_predeliver', $r);
 
                        if (DBM::is_result($r)) {
                                foreach ($r as $q_item) {
@@ -159,7 +160,7 @@ class Queue
 
                        default:
                                $params = ['owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false];
-                               call_hooks('queue_deliver', $params);
+                               Addon::callHooks('queue_deliver', $params);
 
                                if ($params['result']) {
                                        QueueModel::removeItem($q_item['id']);
index bf6eee9d7822e246943af2f5c2f4a5237672a5bf..0dc3398ec4384996536e3f81f24b193b0dd2633f 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
@@ -85,7 +86,7 @@ function update_1191() {
 
        Config::set('system', 'maintenance', 1);
 
-       if (plugin_enabled('forumlist')) {
+       if (Addon::isEnabled('forumlist')) {
                $plugin = 'forumlist';
                $plugins = Config::get('system','addon');
                $plugins_arr = [];
@@ -97,7 +98,7 @@ function update_1191() {
                        if ($idx !== false){
                                unset($plugins_arr[$idx]);
                                //delete forumlist manually from addon and hook table
-                               // since uninstall_plugin() don't work here
+                               // since Addon::uninstall() don't work here
                                q("DELETE FROM `addon` WHERE `name` = 'forumlist' ");
                                q("DELETE FROM `hook` WHERE `file` = 'addon/forumlist/forumlist.php' ");
                                Config::set('system','addon', implode(", ",$plugins_arr));
index e34ff45b2bc5eb280e1a40eb156457537505c193..e890a4a6914269ed93933a9ead3d39dc2b5057ee 100644 (file)
@@ -5,7 +5,7 @@
  * @brief: Get info header of the shema
  *
  * This function parses the header of the shemename.php file for inormations like
- * Author, Description and Overwrites. Most of the code comes from the get_plugin_info()
+ * Author, Description and Overwrites. Most of the code comes from the Addon::getInfo()
  * function. We use this to get the variables which get overwritten through the shema.
  * All color variables which get overwritten through the theme have to be
  * listed (comma seperated) in the shema header under Overwrites:
index 16d1b03f2e5c37391b5be290c3688d2c519c2232..b3b8e9009f0fbd362b826f170788f5635a646b34 100644 (file)
@@ -8,6 +8,7 @@
  */
 use Friendica\App;
 use Friendica\Content\Widget;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -52,24 +53,24 @@ EOT;
 
 function frio_install()
 {
-       register_hook('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links');
-       register_hook('item_photo_menu', 'view/theme/frio/theme.php', 'frio_item_photo_menu');
-       register_hook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu');
-       register_hook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav');
-       register_hook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup');
-       register_hook('display_item', 'view/theme/frio/theme.php', 'frio_display_item');
+       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');
 
        logger("installed theme frio");
 }
 
 function frio_uninstall()
 {
-       unregister_hook('prepare_body_final', 'view/theme/frio/theme.php', 'frio_item_photo_links');
-       unregister_hook('item_photo_menu', 'view/theme/frio/theme.php', 'frio_item_photo_menu');
-       unregister_hook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu');
-       unregister_hook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav');
-       unregister_hook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup');
-       unregister_hook('display_item', 'view/theme/frio/theme.php', 'frio_display_item');
+       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');
 
        logger("uninstalled theme frio");
 }
index 22733e8d111462aa718ba431bbb00ed132fd444d..1692560341035b6d7e32fc216051185503ff6b56 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
 use Friendica\Object\Image;
 
@@ -35,13 +36,13 @@ function frost_content_loaded(App $a) {
 }
 
 function frost_install() {
-       register_hook('prepare_body_final', 'view/theme/frost/theme.php', 'frost_item_photo_links');
+       Addon::registerHook('prepare_body_final', 'view/theme/frost/theme.php', 'frost_item_photo_links');
 
        logger("installed theme frost");
 }
 
 function frost_uninstall() {
-       unregister_hook('bbcode', 'view/theme/frost/theme.php', 'frost_bbcode');
+       Addon::unregisterHook('bbcode', 'view/theme/frost/theme.php', 'frost_bbcode');
 
        logger("uninstalled theme frost");
 }
index 22060c6a4919efd759e4d304740c0feb42cd0319..4a57199f16bba17e806a13844eebd84a179b1385 100644 (file)
@@ -11,6 +11,7 @@
 
 use Friendica\App;
 use Friendica\Content\ForumManager;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\System;
@@ -313,64 +314,64 @@ function vier_community_info() {
                /// @TODO This whole thing is hard-coded, better rewrite to Intercepting Filter Pattern (future-todo)
                $r = [];
 
-               if (plugin_enabled("appnet")) {
+               if (Addon::isEnabled("appnet")) {
                        $r[] = ["photo" => "images/appnet.png", "name" => "App.net"];
                }
 
-               if (plugin_enabled("buffer")) {
+               if (Addon::isEnabled("buffer")) {
                        $r[] = ["photo" => "images/buffer.png", "name" => "Buffer"];
                }
 
-               if (plugin_enabled("blogger")) {
+               if (Addon::isEnabled("blogger")) {
                        $r[] = ["photo" => "images/blogger.png", "name" => "Blogger"];
                }
 
-               if (plugin_enabled("dwpost")) {
+               if (Addon::isEnabled("dwpost")) {
                        $r[] = ["photo" => "images/dreamwidth.png", "name" => "Dreamwidth"];
                }
 
-               if (plugin_enabled("fbpost")) {
+               if (Addon::isEnabled("fbpost")) {
                        $r[] = ["photo" => "images/facebook.png", "name" => "Facebook"];
                }
 
-               if (plugin_enabled("ifttt")) {
+               if (Addon::isEnabled("ifttt")) {
                        $r[] = ["photo" => "addon/ifttt/ifttt.png", "name" => "IFTTT"];
                }
 
-               if (plugin_enabled("statusnet")) {
+               if (Addon::isEnabled("statusnet")) {
                        $r[] = ["photo" => "images/gnusocial.png", "name" => "GNU Social"];
                }
 
-               if (plugin_enabled("gpluspost")) {
+               if (Addon::isEnabled("gpluspost")) {
                        $r[] = ["photo" => "images/googleplus.png", "name" => "Google+"];
                }
 
                /// @TODO old-lost code (and below)?
-               //if (plugin_enabled("ijpost")) {
+               //if (Addon::isEnabled("ijpost")) {
                //      $r[] = array("photo" => "images/", "name" => "");
                //}
 
-               if (plugin_enabled("libertree")) {
+               if (Addon::isEnabled("libertree")) {
                        $r[] = ["photo" => "images/libertree.png", "name" => "Libertree"];
                }
 
-               //if (plugin_enabled("ljpost")) {
+               //if (Addon::isEnabled("ljpost")) {
                //      $r[] = array("photo" => "images/", "name" => "");
                //}
 
-               if (plugin_enabled("pumpio")) {
+               if (Addon::isEnabled("pumpio")) {
                        $r[] = ["photo" => "images/pumpio.png", "name" => "pump.io"];
                }
 
-               if (plugin_enabled("tumblr")) {
+               if (Addon::isEnabled("tumblr")) {
                        $r[] = ["photo" => "images/tumblr.png", "name" => "Tumblr"];
                }
 
-               if (plugin_enabled("twitter")) {
+               if (Addon::isEnabled("twitter")) {
                        $r[] = ["photo" => "images/twitter.png", "name" => "Twitter"];
                }
 
-               if (plugin_enabled("wppost")) {
+               if (Addon::isEnabled("wppost")) {
                        $r[] = ["photo" => "images/wordpress.png", "name" => "Wordpress"];
                }