]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into item-permissions
authorMichael <heluecht@pirati.ca>
Sat, 20 Jan 2018 19:51:23 +0000 (19:51 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 20 Jan 2018 19:51:23 +0000 (19:51 +0000)
120 files changed:
CHANGELOG
INSTALL.txt
README.md
boot.php
doc/Accesskeys.md
doc/Addons.md [new file with mode: 0644]
doc/Chats.md
doc/Composer.md
doc/FAQ.md
doc/Home.md
doc/Improve-Performance.md
doc/Installing-Connectors.md
doc/Plugins.md [deleted file]
doc/Settings.md
doc/database.md
doc/database/db_addon.md
doc/de/Addons.md [new file with mode: 0644]
doc/de/Chats.md
doc/de/FAQ.md
doc/de/Home.md
doc/de/Improve-Performance.md
doc/de/Installing-Connectors.md
doc/de/Plugins.md [deleted file]
doc/de/Settings.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/pgettext.php
include/plugin.php [deleted file]
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/nogroup.php
mod/parse_url.php
mod/photos.php
mod/ping.php
mod/poke.php
mod/pretheme.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/App.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 [new file with mode: 0644]
src/Core/Theme.php [new file with mode: 0644]
src/Core/Worker.php
src/Database/DBStructure.php
src/Model/Contact.php
src/Model/GContact.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
util/strings.php
view/templates/admin/addons.tpl [new file with mode: 0644]
view/templates/admin/aside.tpl
view/templates/admin/plugins.tpl [deleted file]
view/templates/admin/plugins_details.tpl
view/templates/admin/summary.tpl
view/theme/duepuntozero/style.css
view/theme/frio/php/schema.php
view/theme/frio/templates/admin/aside.tpl
view/theme/frio/theme.php
view/theme/frost-mobile/style.css
view/theme/frost-mobile/templates/admin/aside.tpl
view/theme/frost/style.css
view/theme/frost/templates/admin/aside.tpl
view/theme/frost/theme.php
view/theme/quattro/dark/style.css
view/theme/quattro/green/style.css
view/theme/quattro/lilac/style.css
view/theme/smoothly/style.css
view/theme/vier/plusminus.css
view/theme/vier/style.css
view/theme/vier/theme.php

index e9b5cae857b7992aabc9facae617f4dc20a700b9..9ad913771498b4703e5e61e11bcee4a8a1d15e62 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -299,7 +299,7 @@ Version 3.4.3 (2015-12-22)
        Contact's posts are shown in a dedicated page (annando)
        Module name is shown in page title to ease browser history navigation (issue #2079) (tobiasd)
   What's new for admins:
-       Forumlist functionality moved from plugin to core (rabuzarus, annando)
+       Forumlist functionality moved from addon to core (rabuzarus, annando)
        Changes on poller/workers limits management (annando)
        Diaspora and OStatus can be enabled only if requirements are satisfied (annando)
        Support for additional passwords for ejabberd (annando)
@@ -380,7 +380,7 @@ Version 3.4.2 (2015-09-29)
        Support for inline [code] tag usage (fabrixxm)
        Fix login form in aside (issue #1348) (annando)
        Show both url-style and webfinger-style identity address in profile (issue #1621) (tobiasd)
-       Add button to reload all active plugins in admin plugins page to ensure new hooks are used (fabrixxm)
+       Add button to reload all active addons in admin addons page to ensure new hooks are used (fabrixxm)
        Make the hardcoded path to global directory configurable (annando)
        Change default directory to dir.friendi.ca (annando)
        Improve cache system with granular expire time (annando)
index eaf7604e3e295059814016aaf64170dedc5a88e8..01fe65d118584895bb8c6670d36bb2ab61a10c79 100644 (file)
@@ -130,18 +130,18 @@ You should also be sure that $a->config['php_path'] is set correctly, it should
 look like (changing it to the correct PHP location)
 
 $a->config['php_path'] = '/usr/local/php53/bin/php'
-
-Alternative: You may be able to use the 'poormancron' plugin to perform this
+  
+Alternative: You may be able to use the 'poormancron' addon to perform this
 step if you are using a recent Friendica release. 'poormancron' may result in
 perfomance and memory issues and is only suitable for small sites with one or
-two users and a handful of contacts. To do this, edit the file
-".htconfig.php" and look for a line describing your plugins. On a fresh
+two users and a handful of contacts. To do this, edit the file 
+".htconfig.php" and look for a line describing your addons. On a fresh 
 installation, it will look like
 
 $a->config['system']['addon'] = 'js_upload';
 
-This indicates the "js_upload" addon module is enabled. You may add additional
-addons/plugins using this same line in the configuration file. Change it to
+This indicates the "js_upload" addon module is enabled. You may add additional 
+addons using this same line in the configuration file. Change it to 
 read
 
 $a->config['system']['addon'] = 'js_upload,poormancron';
index 4e627ef2d3c132145ebc5cca8789e8afdb5c4baa..20d6b0ef50152d93bee0c51ce758320c008f4da5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ Our mission is to free friends, family and colleagues from data-harvesting corpo
 
 Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on [Friendica]( https://friendi.ca), [Mastodon](https://joinmastodon.org/), [Diaspora](https://diasporafoundation.org/), [GnuSocial](https://gnu.io/social/), [Pleroma](https://pleroma.social/), or [Hubzilla](https://hubzilla.org/), regardless where each user profile is hosted.
 
-With Friendica, you can also fully interact with anyone on Twitter, post on Facebook and receive any content on Tumblr, Wordpress or RSS. Friendica allows you to integrate most things on the web via a range of plugins such as ITTT, Buffer; you will be able to easily control your own data as you decide.
+With Friendica, you can also fully interact with anyone on Twitter, post on Facebook and receive any content on Tumblr, Wordpress or RSS. Friendica allows you to integrate most things on the web via a range of addons such as ITTT, Buffer; you will be able to easily control your own data as you decide.
 
 Join today and [get your Friendica profile!](https://dir.friendica.social/servers 'Join Friendica today!')
 
index 0692e8475781d1b3844a92dec1da64e673ff9813..776cf49fa884a11e6c11f9486f2684da2d6b6fe3 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';
@@ -798,19 +798,19 @@ function run_update_function($x)
 }
 
 /**
- * @brief Synchronise plugins:
+ * @brief Synchronise addons:
  *
  * $a->config['system']['addon'] contains a comma-separated list of names
- * of plugins/addons which are used on this system.
+ * of addons which are used on this system.
  * Go through the database list of already installed addons, and if we have
  * an entry, but it isn't in the config list, call the uninstall procedure
  * and mark it uninstalled in the database (for now we'll remove it).
- * Then go through the config list and if we have a plugin that isn't installed,
+ * Then go through the config list and if we have a addon that isn't installed,
  * call the install procedure and add it to the database.
  *
  * @param object $a App
  */
-function check_plugins(App $a)
+function check_addons(App $a)
 {
        $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
        if (DBM::is_result($r)) {
@@ -819,36 +819,36 @@ function check_plugins(App $a)
                $installed = [];
        }
 
-       $plugins = Config::get('system', 'addon');
-       $plugins_arr = [];
+       $addons = Config::get('system', 'addon');
+       $addons_arr = [];
 
-       if ($plugins) {
-               $plugins_arr = explode(',', str_replace(' ', '', $plugins));
+       if ($addons) {
+               $addons_arr = explode(',', str_replace(' ', '', $addons));
        }
 
-       $a->plugins = $plugins_arr;
+       $a->addons = $addons_arr;
 
        $installed_arr = [];
 
        if (count($installed)) {
                foreach ($installed as $i) {
-                       if (!in_array($i['name'], $plugins_arr)) {
-                               uninstall_plugin($i['name']);
+                       if (!in_array($i['name'], $addons_arr)) {
+                               Addon::uninstall($i['name']);
                        } else {
                                $installed_arr[] = $i['name'];
                        }
                }
        }
 
-       if (count($plugins_arr)) {
-               foreach ($plugins_arr as $p) {
+       if (count($addons_arr)) {
+               foreach ($addons_arr as $p) {
                        if (!in_array($p, $installed_arr)) {
-                               install_plugin($p);
+                               Addon::install($p);
                        }
                }
        }
 
-       load_hooks();
+       Addon::loadHooks();
 
        return;
 }
index 3369f9afd931d376e180603b76f41cd7cf73fe02..b9e5f5430a0db78d099d4f53dc8c4f3b2b3d8a77 100644 (file)
@@ -69,7 +69,7 @@ General
 * o: Account
 * t: Additional features
 * w: Social Networks
-* l: Plugins
+* l: Addons
 * d: Delegations
 * b: Connected apps
 * e: Export personal data
diff --git a/doc/Addons.md b/doc/Addons.md
new file mode 100644 (file)
index 0000000..5d13107
--- /dev/null
@@ -0,0 +1,473 @@
+Friendica Addon development
+==============
+
+* [Home](help)
+
+Please see the sample addon 'randplace' for a working example of using some of these features.
+Addons work by intercepting event hooks - which must be registered.
+Modules work by intercepting specific page requests (by URL path).
+
+Addon names cannot contain spaces or other punctuation and are used as filenames and function names.
+You may supply a "friendly" name within the comment block.
+Each addon must contain both an install and an uninstall function based on the addon name.
+For instance "addon1name_install()".
+These two functions take no arguments and are usually responsible for registering (and unregistering) event hooks that your addon will require.
+The install and uninstall functions will also be called (i.e. re-installed) if the addon changes after installation.
+Therefore your uninstall should not destroy data and install should consider that data may already exist.
+Future extensions may provide for "setup" amd "remove".
+
+Addons should contain a comment block with the four following parameters:
+
+    /*
+     * Name: My Great Addon
+     * Description: This is what my addon does. It's really cool.
+     * Version: 1.0
+     * Author: John Q. Public <john@myfriendicasite.com>
+     */
+
+Register your addon hooks during installation.
+
+    Addon::registerHook($hookname, $file, $function);
+
+$hookname is a string and corresponds to a known Friendica hook.
+
+$file is a pathname relative to the top-level Friendica directory.
+This *should* be 'addon/addon_name/addon_name.php' in most cases.
+
+$function is a string and is the name of the function which will be executed when the hook is called.
+
+Please also add a README or README.md file to the addon directory.
+It will be displayed in the admin panel and should include some further information in addition to the header information.
+
+Arguments
+---
+Your hook callback functions will be called with at least one and possibly two arguments
+
+    function myhook_function(App $a, &$b) {
+
+    }
+
+
+If you wish to make changes to the calling data, you must declare them as reference variables (with '&') during function declaration.
+
+#### $a
+$a is the Friendica 'App' class.
+It contains a wealth of information about the current state of Friendica:
+
+* which module has been called,
+* configuration information,
+* the page contents at the point the hook was invoked,
+* profile and user information, etc.
+
+It is recommeded you call this '$a' to match its usage elsewhere.
+
+#### $b
+$b can be called anything you like.
+This is information specific to the hook currently being processed, and generally contains information that is being immediately processed or acted on that you can use, display, or alter.
+Remember to declare it with '&' if you wish to alter it.
+
+Modules
+---
+
+Addons may also act as "modules" and intercept all page requests for a given URL path.
+In order for a addon to act as a module it needs to define a function "addon_name_module()" which takes no arguments and needs not do anything.
+
+If this function exists, you will now receive all page requests for "http://my.web.site/addon_name" - with any number of URL components as additional arguments.
+These are parsed into an array $a->argv, with a corresponding $a->argc indicating the number of URL components.
+So http://my.web.site/addon/arg1/arg2 would look for a module named "addon" and pass its module functions the $a App structure (which is available to many components).
+This will include:
+
+    $a->argc = 3
+    $a->argv = array(0 => 'addon', 1 => 'arg1', 2 => 'arg2');
+
+Your module functions will often contain the function addon_name_content(App $a), which defines and returns the page body content.
+They may also contain addon_name_post(App $a) which is called before the _content function and typically handles the results of POST forms.
+You may also have addon_name_init(App $a) which is called very early on and often does module initialisation.
+
+Templates
+---
+
+If your addon needs some template, you can use the Friendica template system.
+Friendica uses [smarty3](http://www.smarty.net/) as a template engine.
+
+Put your tpl files in the *templates/* subfolder of your addon.
+
+In your code, like in the function addon_name_content(), load the template file and execute it passing needed values:
+
+    # load template file. first argument is the template name,
+    # second is the addon path relative to friendica top folder
+    $tpl = get_markup_template('mytemplate.tpl', 'addon/addon_name/');
+
+    # apply template. first argument is the loaded template,
+    # second an array of 'name'=>'values' to pass to template
+    $output = replace_macros($tpl,array(
+        'title' => 'My beautiful addon',
+    ));
+
+See also the wiki page [Quick Template Guide](https://github.com/friendica/friendica/wiki/Quick-Template-Guide).
+
+Current hooks
+-------------
+
+### 'authenticate'
+'authenticate' is called when a user attempts to login.
+$b is an array containing:
+
+    'username' => the supplied username
+    'password' => the supplied password
+    'authenticated' => set this to non-zero to authenticate the user.
+    'user_record' => successful authentication must also return a valid user record from the database
+
+### 'logged_in'
+'logged_in' is called after a user has successfully logged in.
+$b contains the $a->user array.
+
+### 'display_item'
+'display_item' is called when formatting a post for display.
+$b is an array:
+
+       'item' => The item (array) details pulled from the database
+       'output' => the (string) HTML representation of this item prior to adding it to the page
+
+### 'post_local'
+* called when a status post or comment is entered on the local system
+* $b is the item array of the information to be stored in the database
+* Please note: body contents are bbcode - not HTML
+
+### 'post_local_end'
+* called when a local status post or comment has been stored on the local system
+* $b is the item array of the information which has just been stored in the database
+* Please note: body contents are bbcode - not HTML
+
+### 'post_remote'
+* called when receiving a post from another source. This may also be used to post local activity or system generated messages.
+* $b is the item array of information to be stored in the database and the item body is bbcode.
+
+### 'settings_form'
+* called when generating the HTML for the user Settings page
+* $b is the (string) HTML of the settings page before the final '</form>' tag.
+
+### 'settings_post'
+* called when the Settings pages are submitted
+* $b is the $_POST array
+
+### 'addon_settings'
+* called when generating the HTML for the addon settings page
+* $b is the (string) HTML of the addon settings page before the final '</form>' tag.
+
+### 'addon_settings_post'
+* called when the Addon Settings pages are submitted
+* $b is the $_POST array
+
+### 'profile_post'
+* called when posting a profile page
+* $b is the $_POST array
+
+### 'profile_edit'
+'profile_edit' is called prior to output of profile edit page.
+$b is an array containing:
+
+       'profile' => profile (array) record from the database
+       'entry' => the (string) HTML of the generated entry
+
+### 'profile_advanced'
+* called when the HTML is generated for the 'Advanced profile', corresponding to the 'Profile' tab within a person's profile page
+* $b is the (string) HTML representation of the generated profile
+* The profile array details are in $a->profile.
+
+### 'directory_item'
+'directory_item' is called from the Directory page when formatting an item for display.
+$b is an array:
+
+       'contact' => contact (array) record for the person from the database
+    'entry' => the (string) HTML of the generated entry
+
+### 'profile_sidebar_enter'
+* called prior to generating the sidebar "short" profile for a page
+* $b is the person's profile array
+
+### 'profile_sidebar'
+'profile_sidebar is called when generating the sidebar "short" profile for a page.
+$b is an array:
+
+       'profile' => profile (array) record for the person from the database
+       'entry' => the (string) HTML of the generated entry
+
+### 'contact_block_end'
+is called when formatting the block of contacts/friends on a profile sidebar has completed.
+$b is an array:
+
+       'contacts' => array of contacts
+       'output' => the (string) generated HTML of the contact block
+
+### 'bbcode'
+* called during conversion of bbcode to html
+* $b is a string converted text
+
+### 'html2bbcode'
+* called during conversion of html to bbcode (e.g. remote message posting)
+* $b is a string converted text
+
+### 'page_header'
+* called after building the page navigation section
+* $b is a string HTML of nav region
+
+### 'personal_xrd'
+'personal_xrd' is called prior to output of personal XRD file.
+$b is an array:
+
+       'user' => the user record for the person
+       'xml' => the complete XML to be output
+
+### 'home_content'
+* called prior to output home page content, shown to unlogged users
+* $b is (string) HTML of section region
+
+### 'contact_edit'
+is called when editing contact details on an individual from the Contacts page.
+$b is an array:
+
+       'contact' => contact record (array) of target contact
+       'output' => the (string) generated HTML of the contact edit page
+
+### 'contact_edit_post'
+* called when posting the contact edit page.
+* $b is the $_POST array
+
+### 'init_1'
+* called just after DB has been opened and before session start
+* $b is not used or passed
+
+### 'page_end'
+* called after HTML content functions have completed
+* $b is (string) HTML of content div
+
+### 'avatar_lookup'
+'avatar_lookup' is called when looking up the avatar.
+$b is an array:
+
+       'size' => the size of the avatar that will be looked up
+       'email' => email to look up the avatar for
+       'url' => the (string) generated URL of the avatar
+
+### 'emailer_send_prepare'
+'emailer_send_prepare' called from Emailer::send() before building the mime message.
+$b is an array, params to Emailer::send()
+
+    'fromName' => name of the sender
+    'fromEmail' => email fo the sender
+    'replyTo' => replyTo address to direct responses
+    'toEmail' => destination email address
+    'messageSubject' => subject of the message
+    'htmlVersion' => html version of the message
+    'textVersion' => text only version of the message
+    'additionalMailHeader' => additions to the smtp mail header
+
+### 'emailer_send'
+is called before calling PHP's mail().
+$b is an array, params to mail()
+
+    'to'
+    'subject'
+    'body'
+    'headers'
+
+### 'nav_info'
+is called after the navigational menu is build in include/nav.php.
+$b is an array containing $nav from nav.php.
+
+### 'template_vars'
+is called before vars are passed to the template engine to render the page.
+The registered function can add,change or remove variables passed to template.
+$b is an array with:
+
+    'template' => filename of template
+    'vars' => array of vars passed to template
+
+### ''acl_lookup_end'
+is called after the other queries have passed.
+The registered function can add, change or remove the acl_lookup() variables.
+
+    'results' => array of the acl_lookup() vars
+
+
+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:      Addon::callHooks('login_hook',$o);
+
+boot.php:      Addon::callHooks('profile_sidebar_enter', $profile);
+
+boot.php:      Addon::callHooks('profile_sidebar', $arr);
+
+boot.php:      Addon::callHooks("proc_run", $arr);
+
+include/contact_selectors.php: Addon::callHooks('network_to_name', $nets);
+
+include/api.php:                               Addon::callHooks('logged_in', $a->user);
+
+include/api.php:               Addon::callHooks('logged_in', $a->user);
+
+include/queue.php:             Addon::callHooks('queue_predeliver', $a, $r);
+
+include/queue.php:                             Addon::callHooks('queue_deliver', $a, $params);
+
+include/text.php:      Addon::callHooks('contact_block_end', $arr);
+
+include/text.php:      Addon::callHooks('smilie', $s);
+
+include/text.php:      Addon::callHooks('prepare_body_init', $item);
+
+include/text.php:      Addon::callHooks('prepare_body', $prep_arr);
+
+include/text.php:      Addon::callHooks('prepare_body_final', $prep_arr);
+
+include/nav.php:       Addon::callHooks('page_header', $a->page['nav']);
+
+include/auth.php:              Addon::callHooks('authenticate', $addon_auth);
+
+include/bbcode.php:    Addon::callHooks('bbcode',$Text);
+
+include/oauth.php:             Addon::callHooks('logged_in', $a->user);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+
+include/acl_selectors.php:     Addon::callHooks('contact_select_options', $x);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+
+include/acl_selectors.php      Addon::callHooks('acl_lookup_end', $results);
+
+include/notifier.php:          Addon::callHooks('notifier_normal',$target_item);
+
+include/notifier.php:  Addon::callHooks('notifier_end',$target_item);
+
+include/items.php:     Addon::callHooks('atom_feed', $atom);
+
+include/items.php:             Addon::callHooks('atom_feed_end', $atom);
+
+include/items.php:     Addon::callHooks('atom_feed_end', $atom);
+
+include/items.php:     Addon::callHooks('parse_atom', $arr);
+
+include/items.php:     Addon::callHooks('post_remote',$arr);
+
+include/items.php:     Addon::callHooks('atom_author', $o);
+
+include/items.php:     Addon::callHooks('atom_entry', $o);
+
+include/bb2diaspora.php:       Addon::callHooks('bb2diaspora',$Text);
+
+include/cronhooks.php: Addon::callHooks('cron', $d);
+
+include/security.php:          Addon::callHooks('logged_in', $a->user);
+
+include/html2bbcode.php:       Addon::callHooks('html2bbcode', $text);
+
+include/Contact.php:   Addon::callHooks('remove_user',$r[0]);
+
+include/Contact.php:   Addon::callHooks('contact_photo_menu', $args);
+
+include/conversation.php:      Addon::callHooks('conversation_start',$cb);
+
+include/conversation.php:                              Addon::callHooks('render_location',$locate);
+
+include/conversation.php:                              Addon::callHooks('display_item', $arr);
+
+include/conversation.php:                              Addon::callHooks('render_location',$locate);
+
+include/conversation.php:                              Addon::callHooks('display_item', $arr);
+
+include/conversation.php:      Addon::callHooks('item_photo_menu', $args);
+
+include/conversation.php:      Addon::callHooks('jot_tool', $jotplugins);
+
+include/conversation.php:      Addon::callHooks('jot_networks', $jotnets);
+
+index.php:     Addon::callHooks('init_1');
+
+index.php:Addon::callHooks('app_menu', $arr);
+
+index.php:Addon::callHooks('page_end', $a->page['content']);
+
+mod/photos.php:        Addon::callHooks('photo_post_init', $_POST);
+
+mod/photos.php:        Addon::callHooks('photo_post_file',$ret);
+
+mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
+
+mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
+
+mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
+
+mod/photos.php:        Addon::callHooks('photo_post_end',intval($item_id));
+
+mod/photos.php:                Addon::callHooks('photo_upload_form',$ret);
+
+mod/friendica.php:     Addon::callHooks('about_hook', $o);
+
+mod/editpost.php:      Addon::callHooks('jot_tool', $jotplugins);
+
+mod/editpost.php:      Addon::callHooks('jot_networks', $jotnets);
+
+mod/parse_url.php:     Addon::callHooks('parse_link', $arr);
+
+mod/home.php:  Addon::callHooks('home_init',$ret);
+
+mod/home.php:  Addon::callHooks("home_content",$o);
+
+mod/contacts.php:      Addon::callHooks('contact_edit_post', $_POST);
+
+mod/contacts.php:              Addon::callHooks('contact_edit', $arr);
+
+mod/settings.php:              Addon::callHooks('addon_settings_post', $_POST);
+
+mod/settings.php:              Addon::callHooks('connector_settings_post', $_POST);
+
+mod/settings.php:      Addon::callHooks('settings_post', $_POST);
+
+mod/settings.php:              Addon::callHooks('addon_settings', $settings_addons);
+
+mod/settings.php:              Addon::callHooks('connector_settings', $settings_connectors);
+
+mod/settings.php:      Addon::callHooks('settings_form',$o);
+
+mod/register.php:      Addon::callHooks('register_account', $newuid);
+
+mod/like.php:  Addon::callHooks('post_local_end', $arr);
+
+mod/xrd.php:   Addon::callHooks('personal_xrd', $arr);
+
+mod/item.php:  Addon::callHooks('post_local_start', $_REQUEST);
+
+mod/item.php:  Addon::callHooks('post_local',$datarray);
+
+mod/item.php:  Addon::callHooks('post_local_end', $datarray);
+
+mod/profile.php:                       Addon::callHooks('profile_advanced',$o);
+
+mod/profiles.php:      Addon::callHooks('profile_post', $_POST);
+
+mod/profiles.php:              Addon::callHooks('profile_edit', $arr);
+
+mod/tagger.php:        Addon::callHooks('post_local_end', $arr);
+
+mod/cb.php:    Addon::callHooks('cb_init');
+
+mod/cb.php:    Addon::callHooks('cb_post', $_POST);
+
+mod/cb.php:    Addon::callHooks('cb_afterpost');
+
+mod/cb.php:    Addon::callHooks('cb_content', $o);
+
+mod/directory.php:                     Addon::callHooks('directory_item', $arr);
index 4e392f8d8fc8bfbc1af01f398fe2ad585b210ab9..b7557944f32b5e26b1beb0b38ac08f7f2ad97544 100644 (file)
@@ -8,10 +8,10 @@ There are two possibilities to use chat on your friendica site
 * IRC Chat
 * Jappix
 
-IRC-Chat Plugin
+IRC-Chat Addon
 ---
 
-After activating the plugin, you can find the chat at [yoursite.com/irc](../irc).
+After activating the addon, you can find the chat at [yoursite.com/irc](../irc).
 Note: you can use this chat without any login at your site so that everyone could use it.
 
 If you follow the link, you will see the login page of the IRC chat.
@@ -28,8 +28,8 @@ The lower part of the window contains an input field.
 Jappix Mini
 ---
 
-The Jappix Mini Plugin creates a chatbox for jabber- and XMPP-contacts.
-You should already have a jabber/XMPP-account before setting up the plugin.
+The Jappix Mini Addon creates a chatbox for jabber- and XMPP-contacts.
+You should already have a jabber/XMPP-account before setting up the addon.
 You can find more information at [jabber.org](http://www.jabber.org/).
 
 You can use several servers to create an account:
@@ -48,15 +48,15 @@ Or you can download a tar archive here: [jappixmini.tgz](https://github.com/frie
 Just unpack the file and rename the directory to â€žjappixmini“.
 Next, upload this directory and the .tgz-file into your addon directory of your friendica installation.
 
-Now you can activate the plugin globally on the admin pages.
-In the plugin sidebar, you will find an entry of jappix now (where you can also find twitter, GNU Social and others).
-The following page shows the settings of this plugin.
+Now you can activate the addon globally on the admin pages.
+In the addon sidebar, you will find an entry of jappix now (where you can also find twitter, GNU Social and others).
+The following page shows the settings of this addon.
 
 Activate the BOSH proxy.
 
 ###2. Settings
 
-Go to your user account settings next and choose the plugin page.
+Go to your user account settings next and choose the addon page.
 Scroll down until you find the Jappix Mini addon settings.
 
 At first you have to activate the addon.
index 02ce61639cda4fabaad0ba8ec4e55a6844d1d002..41fc2aca3701b58d26ea012d0993196f1f5a10c1 100644 (file)
@@ -55,7 +55,7 @@ If you don't need to use any third-party library, then you don't need to use Com
 
 #### Adding a third-party library to Friendica
 
-Does your shiny new [Plugin](help/Plugins) need to rely on a third-party library not required by Friendica yet?
+Does your shiny new [Addon](help/Addons) need to rely on a third-party library not required by Friendica yet?
 First of all, this library should be available on [Packagist](https://packagist.org) so that Composer knows how to fetch it directly just by mentioning its name in `composer.json`.
 
 This file is the configuration of Friendica for Composer. It lists details about the Friendica project, but also a list of required dependencies and their target version.
index fddc64abc048dc1a726ec2562614bc4005658795..ccf81d8a94d8196281b6016b1ca6d42d7af7878f 100644 (file)
@@ -87,7 +87,7 @@ Blocked contacts cannot do this. They cannot communicate with you directly, only
 However we do not import their posts or private messages to you.
 Like blocking, you will still see this person's comments to posts made by your friends.
 
-A plugin called "blockem" can be installed to collapse/hide all posts from a particular person in your stream if you desire complete blocking of an individual, including his/her conversations with your other friends.
+An addon called "blockem" can be installed to collapse/hide all posts from a particular person in your stream if you desire complete blocking of an individual, including his/her conversations with your other friends.
 
 An **archived contact** means that communication is not possible and will not be attempted.
 (Perhaps the person moved to a new site and removed the old profile.)
index 4f956e3c7a8560bb6324fcf6ddc33f2f4924872b..0a1059d019516dec050875f4fa8849c3a15a2cb3 100644 (file)
@@ -43,7 +43,7 @@ Friendica Documentation and Resources
        * [Help on Vagrant](help/Vagrant)
        * [Bugs and Issues](help/Bugs-and-Issues)
 * Code structure
-       * [Plugin Development](help/Plugins)
+       * [Addon Development](help/Addons)
        * [Theme Development](help/themes)
        * [Smarty 3 Templates](help/smarty3-templates)
 * How To
index 8c0529bd562eead5872d36a6b62176fa68894688..48ac9e798d09bc535cd22ccbb6733ccb8e0b4bec 100644 (file)
@@ -22,16 +22,16 @@ If you have many OStatus contacts then completing of conversations can take some
 
 When using MyISAM (default) or InnoDB on MariaDB 10 this speeds up search.
 
-Plugins
+Addons
 --------
 
-Active the following plugins:
+Active the following addons:
 
     rendertime
 
 ###rendertime
 
-This plugin doesn't speed up your system. 
+This addon doesn't speed up your system. 
 It helps to analyze your bottlenecks.
 
 When enabled you see some values at the bottom of every page.
index 34ade6b3be3fdccea662ee2e2d10635673cb6b2a..1d83f074203150fb570465aeeb812467096d28e6 100644 (file)
@@ -4,28 +4,28 @@ Installing Connectors (Twitter/GNU Social)
 * [Home](help)
 
 
-Friendica uses plugins to provide connectivity to some networks, such as Twitter or App.net. 
+Friendica uses addons to provide connectivity to some networks, such as Twitter or App.net. 
 
-There is also a plugin to post through to an existing account on a GNU Social service.
+There is also a addon to post through to an existing account on a GNU Social service.
 You only need this to post to an already existing GNU Social account, but not to communicate with GNU Social members in general.
 
-All three plugins require an account on the target network.
+All three addons require an account on the target network.
 In addition you (or typically the server administrator) will need to obtain an API key to provide authenticated access to your Friendica server.
 
 Site Configuration
 ---
 
-Plugins must be installed by the site administrator before they can be used.
+Addons must be installed by the site administrator before they can be used.
 This is accomplished through the site administration panel.
 
 Each of the connectors also requires an "API key" from the service you wish to connect with.
-Some plugins allow you to enter this information in the site administration pages, while others may require you to edit your configuration file (.htconfig.php).
+Some addons allow you to enter this information in the site administration pages, while others may require you to edit your configuration file (.htconfig.php).
 The ways to obtain these keys vary between the services, but they all require an existing account on the target service.
 Once installed, these API keys can usually be shared by all site members.
 
-The details of configuring each service follow (much of this information comes directly from the plugin source files):
+The details of configuring each service follow (much of this information comes directly from the addon source files):
 
-Twitter Plugin for Friendica
+Twitter Addon for Friendica
 ---
 
 * Author: Tobias Diekershoff
@@ -33,7 +33,7 @@ Twitter Plugin for Friendica
 * License: 3-clause BSD license
 
 ###Configuration
-To use this plugin you need a OAuth Consumer key pair (key & secret).
+To use this addon you need a OAuth Consumer key pair (key & secret).
 You can get it from [Twitter](https://twitter.com/apps).
 
 Register your Friendica site as "Client" application with "Read & Write" access.
@@ -51,7 +51,7 @@ After this, your users can configure their Twitter account settings from "Settin
 Find the author's documentation here: [http://diekershoff.homeunix.net/redmine/wiki/friendikaplugin/Twitter_Plugin](http://diekershoff.homeunix.net/redmine/wiki/friendikaplugin/Twitter_Plugin)
 
 
-GNU Social Plugin for Friendica
+GNU Social Addon for Friendica
 ---
 
 * Author: Tobias Diekershoff
diff --git a/doc/Plugins.md b/doc/Plugins.md
deleted file mode 100644 (file)
index ab8c58e..0000000
+++ /dev/null
@@ -1,477 +0,0 @@
-Friendica Addon/Plugin development
-==============
-
-* [Home](help)
-
-Please see the sample addon 'randplace' for a working example of using some of these features.
-Addons work by intercepting event hooks - which must be registered.
-Modules work by intercepting specific page requests (by URL path).
-
-Plugin names cannot contain spaces or other punctuation and are used as filenames and function names.
-You may supply a "friendly" name within the comment block.
-Each addon must contain both an install and an uninstall function based on the addon/plugin name.
-For instance "plugin1name_install()".
-These two functions take no arguments and are usually responsible for registering (and unregistering) event hooks that your plugin will require.
-The install and uninstall functions will also be called (i.e. re-installed) if the plugin changes after installation.
-Therefore your uninstall should not destroy data and install should consider that data may already exist.
-Future extensions may provide for "setup" amd "remove".
-
-Plugins should contain a comment block with the four following parameters:
-
-    /*
-     * Name: My Great Plugin
-     * Description: This is what my plugin does. It's really cool.
-     * Version: 1.0
-     * Author: John Q. Public <john@myfriendicasite.com>
-     */
-
-Register your plugin hooks during installation.
-
-    register_hook($hookname, $file, $function);
-
-$hookname is a string and corresponds to a known Friendica hook.
-
-$file is a pathname relative to the top-level Friendica directory.
-This *should* be 'addon/plugin_name/plugin_name.php' in most cases.
-
-$function is a string and is the name of the function which will be executed when the hook is called.
-
-Please also add a README or README.md file to the addon directory.
-It will be displayed in the admin panel and should include some further information in addition to the header information.
-
-Arguments
----
-Your hook callback functions will be called with at least one and possibly two arguments
-
-    function myhook_function(App $a, &$b) {
-
-    }
-
-
-If you wish to make changes to the calling data, you must declare them as reference variables (with '&') during function declaration.
-
-#### $a
-$a is the Friendica 'App' class.
-It contains a wealth of information about the current state of Friendica:
-
-* which module has been called,
-* configuration information,
-* the page contents at the point the hook was invoked,
-* profile and user information, etc.
-
-It is recommeded you call this '$a' to match its usage elsewhere.
-
-#### $b
-$b can be called anything you like.
-This is information specific to the hook currently being processed, and generally contains information that is being immediately processed or acted on that you can use, display, or alter.
-Remember to declare it with '&' if you wish to alter it.
-
-Modules
----
-
-Plugins/addons may also act as "modules" and intercept all page requests for a given URL path.
-In order for a plugin to act as a module it needs to define a function "plugin_name_module()" which takes no arguments and needs not do anything.
-
-If this function exists, you will now receive all page requests for "http://my.web.site/plugin_name" - with any number of URL components as additional arguments.
-These are parsed into an array $a->argv, with a corresponding $a->argc indicating the number of URL components.
-So http://my.web.site/plugin/arg1/arg2 would look for a module named "plugin" and pass its module functions the $a App structure (which is available to many components).
-This will include:
-
-    $a->argc = 3
-    $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
-
-Your module functions will often contain the function plugin_name_content(App $a), which defines and returns the page body content.
-They may also contain plugin_name_post(App $a) which is called before the _content function and typically handles the results of POST forms.
-You may also have plugin_name_init(App $a) which is called very early on and often does module initialisation.
-
-Templates
----
-
-If your plugin needs some template, you can use the Friendica template system.
-Friendica uses [smarty3](http://www.smarty.net/) as a template engine.
-
-Put your tpl files in the *templates/* subfolder of your plugin.
-
-In your code, like in the function plugin_name_content(), load the template file and execute it passing needed values:
-
-    # load template file. first argument is the template name,
-    # second is the plugin path relative to friendica top folder
-    $tpl = get_markup_template('mytemplate.tpl', 'addon/plugin_name/');
-
-    # apply template. first argument is the loaded template,
-    # second an array of 'name'=>'values' to pass to template
-    $output = replace_macros($tpl,array(
-        'title' => 'My beautiful plugin',
-    ));
-
-See also the wiki page [Quick Template Guide](https://github.com/friendica/friendica/wiki/Quick-Template-Guide).
-
-Current hooks
--------------
-
-### 'authenticate'
-'authenticate' is called when a user attempts to login.
-$b is an array containing:
-
-    'username' => the supplied username
-    'password' => the supplied password
-    'authenticated' => set this to non-zero to authenticate the user.
-    'user_record' => successful authentication must also return a valid user record from the database
-
-### 'logged_in'
-'logged_in' is called after a user has successfully logged in.
-$b contains the $a->user array.
-
-### 'display_item'
-'display_item' is called when formatting a post for display.
-$b is an array:
-
-       'item' => The item (array) details pulled from the database
-       'output' => the (string) HTML representation of this item prior to adding it to the page
-
-### 'post_local'
-* called when a status post or comment is entered on the local system
-* $b is the item array of the information to be stored in the database
-* Please note: body contents are bbcode - not HTML
-
-### 'post_local_end'
-* called when a local status post or comment has been stored on the local system
-* $b is the item array of the information which has just been stored in the database
-* Please note: body contents are bbcode - not HTML
-
-### 'post_remote'
-* called when receiving a post from another source. This may also be used to post local activity or system generated messages.
-* $b is the item array of information to be stored in the database and the item body is bbcode.
-
-### 'settings_form'
-* called when generating the HTML for the user Settings page
-* $b is the (string) HTML of the settings page before the final '</form>' tag.
-
-### 'settings_post'
-* called when the Settings pages are submitted
-* $b is the $_POST array
-
-### 'plugin_settings'
-* called when generating the HTML for the addon settings page
-* $b is the (string) HTML of the addon settings page before the final '</form>' tag.
-
-### 'plugin_settings_post'
-* called when the Addon Settings pages are submitted
-* $b is the $_POST array
-
-### 'profile_post'
-* called when posting a profile page
-* $b is the $_POST array
-
-### 'profile_edit'
-'profile_edit' is called prior to output of profile edit page.
-$b is an array containing:
-
-       'profile' => profile (array) record from the database
-       'entry' => the (string) HTML of the generated entry
-
-### 'profile_advanced'
-* called when the HTML is generated for the 'Advanced profile', corresponding to the 'Profile' tab within a person's profile page
-* $b is the (string) HTML representation of the generated profile
-* The profile array details are in $a->profile.
-
-### 'directory_item'
-'directory_item' is called from the Directory page when formatting an item for display.
-$b is an array:
-
-       'contact' => contact (array) record for the person from the database
-    'entry' => the (string) HTML of the generated entry
-
-### 'profile_sidebar_enter'
-* called prior to generating the sidebar "short" profile for a page
-* $b is the person's profile array
-
-### 'profile_sidebar'
-'profile_sidebar is called when generating the sidebar "short" profile for a page.
-$b is an array:
-
-       'profile' => profile (array) record for the person from the database
-       'entry' => the (string) HTML of the generated entry
-
-### 'contact_block_end'
-is called when formatting the block of contacts/friends on a profile sidebar has completed.
-$b is an array:
-
-       'contacts' => array of contacts
-       'output' => the (string) generated HTML of the contact block
-
-### 'bbcode'
-* called during conversion of bbcode to html
-* $b is a string converted text
-
-### 'html2bbcode'
-* called during conversion of html to bbcode (e.g. remote message posting)
-* $b is a string converted text
-
-### 'page_header'
-* called after building the page navigation section
-* $b is a string HTML of nav region
-
-### 'personal_xrd'
-'personal_xrd' is called prior to output of personal XRD file.
-$b is an array:
-
-       'user' => the user record for the person
-       'xml' => the complete XML to be output
-
-### 'home_content'
-* called prior to output home page content, shown to unlogged users
-* $b is (string) HTML of section region
-
-### 'contact_edit'
-is called when editing contact details on an individual from the Contacts page.
-$b is an array:
-
-       'contact' => contact record (array) of target contact
-       'output' => the (string) generated HTML of the contact edit page
-
-### 'contact_edit_post'
-* called when posting the contact edit page.
-* $b is the $_POST array
-
-### 'init_1'
-* called just after DB has been opened and before session start
-* $b is not used or passed
-
-### 'page_end'
-* called after HTML content functions have completed
-* $b is (string) HTML of content div
-
-### 'avatar_lookup'
-'avatar_lookup' is called when looking up the avatar.
-$b is an array:
-
-       'size' => the size of the avatar that will be looked up
-       'email' => email to look up the avatar for
-       'url' => the (string) generated URL of the avatar
-
-### 'emailer_send_prepare'
-'emailer_send_prepare' called from Emailer::send() before building the mime message.
-$b is an array, params to Emailer::send()
-
-    'fromName' => name of the sender
-    'fromEmail' => email fo the sender
-    'replyTo' => replyTo address to direct responses
-    'toEmail' => destination email address
-    'messageSubject' => subject of the message
-    'htmlVersion' => html version of the message
-    'textVersion' => text only version of the message
-    'additionalMailHeader' => additions to the smtp mail header
-
-### 'emailer_send'
-is called before calling PHP's mail().
-$b is an array, params to mail()
-
-    'to'
-    'subject'
-    'body'
-    'headers'
-
-### 'nav_info'
-is called after the navigational menu is build in include/nav.php.
-$b is an array containing $nav from nav.php.
-
-### 'template_vars'
-is called before vars are passed to the template engine to render the page.
-The registered function can add,change or remove variables passed to template.
-$b is an array with:
-
-    'template' => filename of template
-    'vars' => array of vars passed to template
-
-### ''acl_lookup_end'
-is called after the other queries have passed.
-The registered function can add, change or remove the acl_lookup() variables.
-
-    'results' => array of the acl_lookup() vars
-
-
-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:      call_hooks('profile_sidebar_enter', $profile);
-
-boot.php:      call_hooks('profile_sidebar', $arr);
-
-boot.php:      call_hooks("proc_run", $arr);
-
-include/contact_selectors.php: call_hooks('network_to_name', $nets);
-
-include/api.php:                               call_hooks('logged_in', $a->user);
-
-include/api.php:               call_hooks('logged_in', $a->user);
-
-include/queue.php:             call_hooks('queue_predeliver', $a, $r);
-
-include/queue.php:                             call_hooks('queue_deliver', $a, $params);
-
-include/text.php:      call_hooks('contact_block_end', $arr);
-
-include/text.php:      call_hooks('smilie', $s);
-
-include/text.php:      call_hooks('prepare_body_init', $item);
-
-include/text.php:      call_hooks('prepare_body', $prep_arr);
-
-include/text.php:      call_hooks('prepare_body_final', $prep_arr);
-
-include/nav.php:       call_hooks('page_header', $a->page['nav']);
-
-include/auth.php:              call_hooks('authenticate', $addon_auth);
-
-include/bbcode.php:    call_hooks('bbcode',$Text);
-
-include/oauth.php:             call_hooks('logged_in', $a->user);
-
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
-
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
-
-include/acl_selectors.php:     call_hooks('contact_select_options', $x);
-
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
-
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
-
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
-
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
-
-include/acl_selectors.php      call_hooks('acl_lookup_end', $results);
-
-include/notifier.php:          call_hooks('notifier_normal',$target_item);
-
-include/notifier.php:  call_hooks('notifier_end',$target_item);
-
-include/items.php:     call_hooks('atom_feed', $atom);
-
-include/items.php:             call_hooks('atom_feed_end', $atom);
-
-include/items.php:     call_hooks('atom_feed_end', $atom);
-
-include/items.php:     call_hooks('parse_atom', $arr);
-
-include/items.php:     call_hooks('post_remote',$arr);
-
-include/items.php:     call_hooks('atom_author', $o);
-
-include/items.php:     call_hooks('atom_entry', $o);
-
-include/bb2diaspora.php:       call_hooks('bb2diaspora',$Text);
-
-include/cronhooks.php: call_hooks('cron', $d);
-
-include/security.php:          call_hooks('logged_in', $a->user);
-
-include/html2bbcode.php:       call_hooks('html2bbcode', $text);
-
-include/Contact.php:   call_hooks('remove_user',$r[0]);
-
-include/Contact.php:   call_hooks('contact_photo_menu', $args);
-
-include/conversation.php:      call_hooks('conversation_start',$cb);
-
-include/conversation.php:                              call_hooks('render_location',$locate);
-
-include/conversation.php:                              call_hooks('display_item', $arr);
-
-include/conversation.php:                              call_hooks('render_location',$locate);
-
-include/conversation.php:                              call_hooks('display_item', $arr);
-
-include/conversation.php:      call_hooks('item_photo_menu', $args);
-
-include/conversation.php:      call_hooks('jot_tool', $jotplugins);
-
-include/conversation.php:      call_hooks('jot_networks', $jotnets);
-
-include/plugin.php:if(! function_exists('call_hooks')) {
-
-include/plugin.php:function call_hooks($name, &$data = null) {
-
-index.php:     call_hooks('init_1');
-
-index.php:call_hooks('app_menu', $arr);
-
-index.php:call_hooks('page_end', $a->page['content']);
-
-mod/photos.php:        call_hooks('photo_post_init', $_POST);
-
-mod/photos.php:        call_hooks('photo_post_file',$ret);
-
-mod/photos.php:                call_hooks('photo_post_end',$foo);
-
-mod/photos.php:                call_hooks('photo_post_end',$foo);
-
-mod/photos.php:                call_hooks('photo_post_end',$foo);
-
-mod/photos.php:        call_hooks('photo_post_end',intval($item_id));
-
-mod/photos.php:                call_hooks('photo_upload_form',$ret);
-
-mod/friendica.php:     call_hooks('about_hook', $o);
-
-mod/editpost.php:      call_hooks('jot_tool', $jotplugins);
-
-mod/editpost.php:      call_hooks('jot_networks', $jotnets);
-
-mod/parse_url.php:     call_hooks('parse_link', $arr);
-
-mod/home.php:  call_hooks('home_init',$ret);
-
-mod/home.php:  call_hooks("home_content",$o);
-
-mod/contacts.php:      call_hooks('contact_edit_post', $_POST);
-
-mod/contacts.php:              call_hooks('contact_edit', $arr);
-
-mod/settings.php:              call_hooks('plugin_settings_post', $_POST);
-
-mod/settings.php:              call_hooks('connector_settings_post', $_POST);
-
-mod/settings.php:      call_hooks('settings_post', $_POST);
-
-mod/settings.php:              call_hooks('plugin_settings', $settings_addons);
-
-mod/settings.php:              call_hooks('connector_settings', $settings_connectors);
-
-mod/settings.php:      call_hooks('settings_form',$o);
-
-mod/register.php:      call_hooks('register_account', $newuid);
-
-mod/like.php:  call_hooks('post_local_end', $arr);
-
-mod/xrd.php:   call_hooks('personal_xrd', $arr);
-
-mod/item.php:  call_hooks('post_local_start', $_REQUEST);
-
-mod/item.php:  call_hooks('post_local',$datarray);
-
-mod/item.php:  call_hooks('post_local_end', $datarray);
-
-mod/profile.php:                       call_hooks('profile_advanced',$o);
-
-mod/profiles.php:      call_hooks('profile_post', $_POST);
-
-mod/profiles.php:              call_hooks('profile_edit', $arr);
-
-mod/tagger.php:        call_hooks('post_local_end', $arr);
-
-mod/cb.php:    call_hooks('cb_init');
-
-mod/cb.php:    call_hooks('cb_post', $_POST);
-
-mod/cb.php:    call_hooks('cb_afterpost');
-
-mod/cb.php:    call_hooks('cb_content', $o);
-
-mod/directory.php:                     call_hooks('directory_item', $arr);
index a0b33d76d27ee3f41d92b60e48287c83e1b25b8d..a574e0675c3d0627cfeb1cdbd2660582191209ed 100644 (file)
@@ -14,7 +14,7 @@ These worker tasks are prioritised and are done accordingly.
 
 Then you get an overview of the accounts on your node, which can be moderated in the "Users" section of the panel.
 As well as an overview of the currently active addons
-The list is linked, so you can have quick access to the plugin settings.
+The list is linked, so you can have quick access to the Addon settings.
 And finally you are informed about the version of Friendica you have installed.
 If you contact the devs with a bug or problem, please also mention the version of your node.
 
@@ -205,7 +205,7 @@ Here the admin can also block/unblock users from accessing the node or delete th
 In the last section of the page admins can create new accounts on the node.
 The password for the new account will be send by email to the choosen email address.
 
-## Plugins
+## Addons
 
 This page is for selecting and configuration of extensions for Friendica which have to be placed into the `/addon` subdirectory of your Friendica installation.
 You are presented with a long list of available addons.
@@ -213,11 +213,11 @@ The name of each addon is linked to a separate page for that addon which offers
 Also shown is the version of the addon and an indicator if the addon is currently active or not.
 
 When you update your node and the addons they may have to be reloaded.
-To simplify this process there is a button at the top of the page to reload all active plugins.
+To simplify this process there is a button at the top of the page to reload all active Addons.
 
 ## Themes
 
-The Themes section of the admin panel works similar to the Plugins section but let you control the themes on your Friendica node.
+The Themes section of the admin panel works similar to the Addons section but let you control the themes on your Friendica node.
 Each theme has a dedicated subpage showing the current status, some information about the theme and a screen-shot of the Friendica interface using the theme.
 Should the theme offer special settings, admins can set a global default value here.
 
@@ -266,7 +266,7 @@ To do so, they need to know the GUID of the posting.
 This can be found on the `/display` page of the posting, it is the last part of the URL displayed in the browsers navigation bar.
 You can get to the `/display` page by following the *Link to source*.
 
-## Plugin Features
+## Addon Features
 
 Some of the addons you can install for your Friendica node have settings which have to be set by the admin.
 All those addons will be listed in this area of the admin panels side bar with their names.
index e778a0a7219872726e833e6fe09fae08ce4871ba..b58fba9d98340f8845b3deaa2802a6f679b532cf 100644 (file)
@@ -5,7 +5,7 @@ Database Tables
 
 | Table                                                | Description                                      |
 |------------------------------------------------------|--------------------------------------------------|
-| [addon](help/database/db_addon)                      | registered plugins                               |
+| [addon](help/database/db_addon)                      | registered addons                               |
 | [attach](help/database/db_attach)                    | file attachments                                 |
 | [auth_codes](help/database/db_auth_codes)            | OAuth usage                                      |
 | [cache](help/database/db_cache)                      | OEmbed cache                                     |
@@ -24,7 +24,7 @@ Database Tables
 | [group](help/database/db_group)                      | privacy groups, group info                       |
 | [group_member](help/database/db_group_member)        | privacy groups, member info                      |
 | [gserver](help/database/db_gserver)                  |                                                  |
-| [hook](help/database/db_hook)                        | plugin hook registry                             |
+| [hook](help/database/db_hook)                        | addon hook registry                             |
 | [intro](help/database/db_intro)                      |                                                  |
 | [item](help/database/db_item)                        | all posts                                        |
 | [locks](help/database/db_locks)                      |                                                  |
index 099abbf6427083f8b49f8f7dbaba6fd5fc7a7c63..cd8a3d44a62bf83b10170db3e8e8e5147d5630b6 100644 (file)
@@ -4,7 +4,7 @@ Table addon
 | Field         | Description                                   | Type       | Null | Key | Default | Extra           |
 | ------------- | --------------------------------------------- | ---------- | ---- | --- | ------- | --------------- |
 | id            |                                               | int(11)    | NO   | PRI | NULL    | auto_increment  |
-| name          | plugin base (file)name                        | char(255)  | NO   |     |         |                 |
+| name          | addon base (file)name                        | char(255)  | NO   |     |         |                 |
 | version       | currently unused                              | char(255)  | NO   |     |         |                 |
 | installed     | currently always 1                            | tinyint(1) | NO   |     | 0       |                 |
 | hidden        | currently unused                              | tinyint(1) | NO   |     | 0       |                 |
@@ -12,6 +12,6 @@ Table addon
 | plugin_admin  | 1 = has admin config, 0 = has no admin config | tinyint(1) | NO   |     | 0       |                 |
 
 Notes:
-These are addons which have been enabled by the site administrator on the admin/plugin page
+These are addons which have been enabled by the site administrator on the addon page
 
 Return to [database documentation](help/database)
diff --git a/doc/de/Addons.md b/doc/de/Addons.md
new file mode 100644 (file)
index 0000000..f4c14bc
--- /dev/null
@@ -0,0 +1,366 @@
+Friendica Addon/Entwicklung
+==============
+
+* [Zur Startseite der Hilfe](help)
+
+Bitte schau dir das Beispiel-Addon "randplace" für ein funktionierendes Beispiel für manche der hier aufgeführten Funktionen an.
+Das Facebook-Addon bietet ein Beispiel dafür, die "addon"- und "module"-Funktion gemeinsam zu integrieren.
+Addons arbeiten, indem sie Event Hooks abfangen.
+Module arbeiten, indem bestimmte Seitenanfragen (durch den URL-Pfad) abgefangen werden.
+
+Addon-Namen können keine Leerstellen oder andere Interpunktionen enthalten und werden als Datei- und Funktionsnamen genutzt.
+Du kannst einen lesbaren Namen im Kommentarblock eintragen.
+Jedes Addon muss beides beinhalten - eine Installations- und eine Deinstallationsfunktion, die auf dem Addon-Namen basieren; z.B. "addon1name_install()".
+Diese beiden Funktionen haben keine Argumente und sind dafür verantwortlich, Event Hooks zu registrieren und abzumelden (unregistering), die dein Addon benötigt.
+Die Installations- und Deinstallationsfunktionfunktionen werden auch ausgeführt (z.B. neu installiert), wenn sich das Addon nach der Installation Ã¤ndert - somit sollte deine Deinstallationsfunktion keine Daten zerstört und deine Installationsfunktion sollte bestehende Daten berücksichtigen.
+Zukünftige Extensions werden möglicherweise "Setup" und "Entfernen" anbieten.
+
+Addons sollten einen Kommentarblock mit den folgenden vier Parametern enthalten:
+
+    /*
+     * Name: My Great Addon
+     * Description: This is what my addon does. It's really cool.
+     * Version: 1.0
+     * Author: John Q. Public <john@myfriendicasite.com>
+     */
+
+Registriere deine Addon-Hooks während der Installation.
+
+    Addon::registerHook($hookname, $file, $function);
+
+$hookname ist ein String und entspricht einem bekannten Friendica-Hook.
+
+$file steht für den Pfadnamen, der relativ zum Top-Level-Friendicaverzeichnis liegt.
+Das *sollte* "addon/addon_name/addon_name.php' sein.
+
+$function ist ein String und der Name der Funktion, die ausgeführt wird, wenn der Hook aufgerufen wird.
+
+Argumente
+---
+
+Deine Hook-Callback-Funktion wird mit mindestens einem und bis zu zwei Argumenten aufgerufen
+
+    function myhook_function(App $a, &$b) {
+
+    }
+
+Wenn du Ã„nderungen an den aufgerufenen Daten vornehmen willst, musst du diese als Referenzvariable (mit "&") während der Funktionsdeklaration deklarieren.
+
+$a ist die Friendica "App"-Klasse, die eine Menge an Informationen Ã¼ber den aktuellen Friendica-Status beinhaltet, u.a. welche Module genutzt werden, Konfigurationsinformationen, Inhalte der Seite zum Zeitpunkt des Hook-Aufrufs.
+Es ist empfohlen, diese Funktion "$a" zu nennen, um seine Nutzung an den Gebrauch an anderer Stelle anzugleichen.
+
+$b kann frei benannt werden.
+Diese Information ist speziell auf den Hook bezogen, der aktuell bearbeitet wird, und beinhaltet normalerweise Daten, die du sofort nutzen, anzeigen oder bearbeiten kannst.
+Achte darauf, diese mit "&" zu deklarieren, wenn du sie bearbeiten willst.
+
+
+Module
+---
+
+Addons können auch als "Module" agieren und alle Seitenanfragen für eine bestimte URL abfangen.
+Um ein Addon als Modul zu nutzen, ist es nötig, die Funktion "addon_name_module()" zu definieren, die keine Argumente benötigt und nichts weiter machen muss.
+
+Wenn diese Funktion existiert, wirst du nun alle Seitenanfragen für "http://example.com/addon_name" erhalten - mit allen URL-Komponenten als zusätzliche Argumente.
+Diese werden in ein Array $a->argv geparst und stimmen mit $a->argc Ã¼berein, wobei sie die Anzahl der URL-Komponenten abbilden.
+So würde http://example.com/addon/arg1/arg2 nach einem Modul "addon" suchen und seiner Modulfunktion die $a-App-Strukur Ã¼bergeben (dies ist für viele Komponenten verfügbar). Das umfasst:
+
+    $a->argc = 3
+    $a->argv = array(0 => 'addon', 1 => 'arg1', 2 => 'arg2');
+
+Deine Modulfunktionen umfassen oft die Funktion addon_name_content(App $a), welche den Seiteninhalt definiert und zurückgibt.
+Sie können auch addon_name_post(App $a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
+Du kannst ebenso addon_name_init(App $a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
+
+
+Derzeitige Hooks
+---
+
+**'authenticate'** - wird aufgerufen, wenn sich der User einloggt.
+    $b ist ein Array
+        'username' => der Ã¼bertragene Nutzername
+        'password' => das Ã¼bertragene Passwort
+        'authenticated' => setze das auf einen anderen Wert als "0", damit der User sich authentifiziert
+        'user_record' => die erfolgreiche Authentifizierung muss auch einen gültigen Nutzereintrag aus der Datenbank zurückgeben
+
+**'logged_in'** - wird aufgerufen, sobald ein Nutzer sich erfolgreich angemeldet hat.
+    $b beinhaltet den $a->Nutzer-Array
+
+
+**'display_item'** - wird aufgerufen, wenn ein Beitrag für die Anzeige formatiert wird.
+    $b ist ein Array
+        'item' => Die Item-Details (Array), die von der Datenbank ausgegeben werden
+        'output' => Die HTML-Ausgabe (String) des Items, bevor es zur Seite hinzugefügt wird
+
+**'post_local'** - wird aufgerufen, wenn der Statusbeitrag oder ein Kommentar im lokalen System eingetragen wird.
+    $b ist das Item-Array der Information, die in der Datenbank hinterlegt wird.
+        {Bitte beachte: der Seiteninhalt ist bbcode - nicht HTML)
+
+**'post_local_end'** - wird aufgerufen, wenn ein lokaler Statusbeitrag oder Kommentar im lokalen System gespeichert wird.
+    $b ist das Item-Array einer Information, die gerade in der Datenbank gespeichert wurden.
+        {Bitte beachte: der Seiteninhalt ist bbcode - nicht HTML)
+
+**'post_remote'** - wird aufgerufen, wenn ein Beitrag aus einer anderen Quelle empfangen wird. Dies kann auch genutzt werden, um lokale Aktivitäten oder systemgenerierte Nachrichten zu veröffentlichen/posten.
+    $b ist das Item-Array einer Information, die in der Datenbank und im Item gespeichert ist.
+       {Bitte beachte: der Seiteninhalt ist bbcode - nicht HTML)
+
+**'settings_form'** - wird aufgerufen, wenn die HTML-Ausgabe für die Einstellungsseite generiert wird.
+    $b ist die HTML-Ausgabe (String) der Einstellungsseite vor dem finalen "</form>"-Tag.
+
+**'settings_post'** - wird aufgerufen, wenn die Einstellungsseiten geladen werden.
+    $b ist der $_POST-Array
+
+**'addon_settings'** - wird aufgerufen, wenn die HTML-Ausgabe der Addon-Einstellungsseite generiert wird.
+    $b ist die HTML-Ausgabe (String) der Addon-Einstellungsseite vor dem finalen "</form>"-Tag.
+
+**'addon_settings_post'** - wird aufgerufen, wenn die Addon-Einstellungsseite geladen wird.
+    $b ist der $_POST-Array
+
+**'profile_post'** - wird aufgerufen, wenn die Profilseite angezeigt wird.
+    $b ist der $_POST-Array
+
+**'profile_edit'** - wird aufgerufen, bevor die Profil-Bearbeitungsseite angezeigt wird.
+    $b ist ein Array
+        'profile' => Profileintrag (Array) aus der Datenbank
+        'entry' => die HTML-Ausgabe (string) des generierten Eintrags
+
+**'profile_advanced'** - wird aufgerufen, wenn die HTML-Ausgabe für das "Advanced profile" generiert wird; stimmt mit dem "Profil"-Tab auf der Profilseite der Nutzer Ã¼berein.
+    $b ist die HTML-Ausgabe (String) des erstellten Profils
+    (Die Details des Profil-Arrays sind in $a->profile)
+
+**'directory_item'** - wird von der Verzeichnisseite aufgerufen, wenn ein Item für die Anzeige formatiert wird.
+    $b ist ein Array
+        'contact' => Kontakteintrag (Array) einer Person aus der Datenbank
+        'entry' => die HTML-Ausgabe (String) des generierten Eintrags
+
+**'profile_sidebar_enter'** - wird aufgerufen, bevor die Sidebar "Kurzprofil" einer Seite erstellt wird.
+    $b ist der Profil-Array einer Person
+
+**'profile_sidebar'** - wird aufgerufen, wenn die Sidebar "Kurzprofil" einer Seite erstellt wird.
+    $b ist ein Array
+        'profile' => Kontakteintrag (Array) einer Person aus der Datenbank
+        'entry' => die HTML-Ausgabe (String) des generierten Eintrags
+
+**'contact_block_end'** - wird aufgerufen, wenn der Block "Kontakte/Freunde" der Profil-Sidebar komplett formatiert wurde.
+    $b ist ein Array
+          'contacts' => Array von "contacts"
+          'output' => die HTML-Ausgabe (String) des Kontaktblocks
+
+**'bbcode'** - wird während der Umwandlung von bbcode auf HTML aufgerufen.
+    $b ist der konvertierte Text (String)
+
+**'html2bbcode'** - wird während der Umwandlung von HTML zu bbcode aufgerufen (z.B. bei Nachrichtenbeiträgen).
+    $b ist der konvertierte Text (String)
+
+**'page_header'** - wird aufgerufen, nachdem der Bereich der Seitennavigation geladen wurde.
+    $b ist die HTML-Ausgabe (String) der "nav"-Region
+
+**'personal_xrd'** - wird aufgerufen, bevor die Ausgabe der persönlichen XRD-Datei erzeugt wird.
+    $b ist ein Array
+        'user' => die hinterlegten Einträge der Person
+        'xml' => die komplette XML-Datei die ausgegeben wird
+
+**'home_content'** - wird aufgerufen, bevor die Ausgabe des Homepage-Inhalts erstellt wird; wird nicht eingeloggten Nutzern angezeigt.
+    $b ist die HTML-Ausgabe (String) der Auswahlregion
+
+**'contact_edit'** - wird aufgerufen, wenn die Kontaktdetails vom Nutzer auf der "Kontakte"-Seite bearbeitet werden.
+    $b ist ein Array
+        'contact' => Kontakteintrag (Array) des abgezielten Kontakts
+        'output' => die HTML-Ausgabe (String) der "Kontakt bearbeiten"-Seite
+
+**'contact_edit_post'** - wird aufgerufen, wenn die "Kontakt bearbeiten"-Seite ausgegeben wird.
+    $b ist der $_POST-Array
+
+**'init_1'** - wird aufgerufen, kurz nachdem die Datenbank vor Beginn der Sitzung geöffnet wird.
+    $b wird nicht genutzt
+
+**'page_end'** - wird aufgerufen, nachdem die Funktion des HTML-Inhalts komplett abgeschlossen ist.
+    $b ist die HTML-Ausgabe (String) vom Inhalt-"div"
+
+**'avatar_lookup'** - wird aufgerufen, wenn der Avatar geladen wird.
+    $b ist ein Array
+        'size' => Größe des Avatars, der geladen wird
+        'email' => Email-Adresse, um nach dem Avatar zu suchen
+        'url' => generierte URL (String) des Avatars
+
+**'nav_info'**
+ - wird aufgerufen nachdem in include/nav,php der Inhalt des Navigations Menüs erzeugt wurde.
+ - $b ist ein Array, das $nav wiederspiegelt.
+
+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:                      Addon::callHooks('login_hook',$o);
+
+boot.php:                      Addon::callHooks('profile_sidebar_enter', $profile);
+
+boot.php:                      Addon::callHooks('profile_sidebar', $arr);
+
+boot.php:                      Addon::callHooks("proc_run", $arr);
+
+include/contact_selectors.php: Addon::callHooks('network_to_name', $nets);
+
+include/api.php:               Addon::callHooks('logged_in', $a->user);
+
+include/api.php:               Addon::callHooks('logged_in', $a->user);
+
+include/queue.php:             Addon::callHooks('queue_predeliver', $a, $r);
+
+include/queue.php:             Addon::callHooks('queue_deliver', $a, $params);
+
+include/text.php:              Addon::callHooks('contact_block_end', $arr);
+
+include/text.php:              Addon::callHooks('smilie', $s);
+
+include/text.php:              Addon::callHooks('prepare_body_init', $item);
+
+include/text.php:              Addon::callHooks('prepare_body', $prep_arr);
+
+include/text.php:              Addon::callHooks('prepare_body_final', $prep_arr);
+
+include/nav.php:               Addon::callHooks('page_header', $a->page['nav']);
+
+include/auth.php:              Addon::callHooks('authenticate', $addon_auth);
+
+include/bbcode.php:            Addon::callHooks('bbcode',$Text);
+
+include/oauth.php:             Addon::callHooks('logged_in', $a->user);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+
+include/acl_selectors.php:     Addon::callHooks('contact_select_options', $x);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+
+include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+
+include/notifier.php:          Addon::callHooks('notifier_normal',$target_item);
+
+include/notifier.php:          Addon::callHooks('notifier_end',$target_item);
+
+include/items.php:             Addon::callHooks('atom_feed', $atom);
+
+include/items.php:             Addon::callHooks('atom_feed_end', $atom);
+
+include/items.php:             Addon::callHooks('atom_feed_end', $atom);
+
+include/items.php:             Addon::callHooks('parse_atom', $arr);
+
+include/items.php:             Addon::callHooks('post_remote',$arr);
+
+include/items.php:             Addon::callHooks('atom_author', $o);
+
+include/items.php:             Addon::callHooks('atom_entry', $o);
+
+include/bb2diaspora.php:       Addon::callHooks('bb2diaspora',$Text);
+
+include/cronhooks.php:         Addon::callHooks('cron', $d);
+
+include/security.php:          Addon::callHooks('logged_in', $a->user);
+
+include/html2bbcode.php:       Addon::callHooks('html2bbcode', $text);
+
+include/Contact.php:           Addon::callHooks('remove_user',$r[0]);
+
+include/Contact.php:           Addon::callHooks('contact_photo_menu', $args);
+
+include/conversation.php:      Addon::callHooks('conversation_start',$cb);
+
+include/conversation.php:      Addon::callHooks('render_location',$locate);
+
+include/conversation.php:      Addon::callHooks('display_item', $arr);
+
+include/conversation.php:      Addon::callHooks('render_location',$locate);
+
+include/conversation.php:      Addon::callHooks('display_item', $arr);
+
+include/conversation.php:      Addon::callHooks('item_photo_menu', $args);
+
+include/conversation.php:      Addon::callHooks('jot_tool', $jotplugins);
+
+include/conversation.php:      Addon::callHooks('jot_networks', $jotnets);
+
+index.php:                     Addon::callHooks('init_1');
+
+index.php:                     Addon::callHooks('app_menu', $arr);
+
+index.php:                     Addon::callHooks('page_end', $a->page['content']);
+
+mod/photos.php:                        Addon::callHooks('photo_post_init', $_POST);
+
+mod/photos.php:                        Addon::callHooks('photo_post_file',$ret);
+
+mod/photos.php:                        Addon::callHooks('photo_post_end',$foo);
+
+mod/photos.php:                        Addon::callHooks('photo_post_end',$foo);
+
+mod/photos.php:                        Addon::callHooks('photo_post_end',$foo);
+
+mod/photos.php:                        Addon::callHooks('photo_post_end',intval($item_id));
+
+mod/photos.php:                        Addon::callHooks('photo_upload_form',$ret);
+
+mod/friendica.php:             Addon::callHooks('about_hook', $o);
+
+mod/editpost.php:              Addon::callHooks('jot_tool', $jotplugins);
+
+mod/editpost.php:              Addon::callHooks('jot_networks', $jotnets);
+
+mod/parse_url.php:             Addon::callHooks('parse_link', $arr);
+
+mod/home.php:                  Addon::callHooks('home_init',$ret);
+
+mod/home.php:                  Addon::callHooks("home_content",$o);
+
+mod/contacts.php:              Addon::callHooks('contact_edit_post', $_POST);
+
+mod/contacts.php:              Addon::callHooks('contact_edit', $arr);
+
+mod/settings.php:              Addon::callHooks('addon_settings_post', $_POST);
+
+mod/settings.php:              Addon::callHooks('connector_settings_post', $_POST);
+
+mod/settings.php:              Addon::callHooks('settings_post', $_POST);
+
+mod/settings.php:              Addon::callHooks('addon_settings', $settings_addons);
+
+mod/settings.php:              Addon::callHooks('connector_settings', $settings_connectors);
+
+mod/settings.php:              Addon::callHooks('settings_form',$o);
+
+mod/register.php:              Addon::callHooks('register_account', $newuid);
+
+mod/like.php:                  Addon::callHooks('post_local_end', $arr);
+
+mod/xrd.php:                   Addon::callHooks('personal_xrd', $arr);
+
+mod/item.php:                  Addon::callHooks('post_local_start', $_REQUEST);
+
+mod/item.php:                  Addon::callHooks('post_local',$datarray);
+
+mod/item.php:                  Addon::callHooks('post_local_end', $datarray);
+
+mod/profile.php:               Addon::callHooks('profile_advanced',$o);
+
+mod/profiles.php:              Addon::callHooks('profile_post', $_POST);
+
+mod/profiles.php:              Addon::callHooks('profile_edit', $arr);
+
+mod/tagger.php:                        Addon::callHooks('post_local_end', $arr);
+
+mod/cb.php:                    Addon::callHooks('cb_init');
+
+mod/cb.php:                    Addon::callHooks('cb_post', $_POST);
+
+mod/cb.php:                    Addon::callHooks('cb_afterpost');
+
+mod/cb.php:                    Addon::callHooks('cb_content', $o);
+
+mod/directory.php:             Addon::callHooks('directory_item', $arr);
index ae239a675beba6dd997305fa0834631a406433a4..fc46af650e6a9e69812da505a1209902dfaf0194 100644 (file)
@@ -8,9 +8,9 @@ Du hast derzeit zwei Möglichkeiten, einen Chat auf Deiner Friendica-Seite zu be
 * IRC - Internet Relay Chat
 * Jappix
 
-##IRC Plugin
+##IRC Addon
 
-Sobald das Plugin aktiviert ist, kannst Du den Chat unter [deineSeite.de/irc](../irc) finden.
+Sobald das Addon aktiviert ist, kannst Du den Chat unter [deineSeite.de/irc](../irc) finden.
 Beachte aber, dass dieser Chat auch ohne Anmeldung auf Deiner Seite zugänglich ist und somit auch Fremde diesen Chat mitnutzen können.
 
 Wenn Du dem Link folgst, dann kommst Du zum Anmeldefenster des IR-Chats.
@@ -29,7 +29,7 @@ Weiter Informationen zu IRC findest Du zum Beispiel auf <a href="http://wiki.ubu
 
 ##Jappix Mini
 
-Das Jappix Mini Plugin erlaubt das Erstellen einer Chatbox für Jabber/XMPP-Kontakte.
+Das Jappix Mini Addon erlaubt das Erstellen einer Chatbox für Jabber/XMPP-Kontakte.
 Ein Jabber/XMPP Account sollte vor der Installation bereits vorhanden sein.
 Die ausführliche Anleitung dazu und eine Kontrolle, ob Du nicht sogar schon Ã¼ber Deinen E-Mail Anbieter einen Jabber-Account hast, findest Du unter <a href="http://einfachjabber.de" target="_blank">einfachjabber.de</a>.
 
@@ -53,15 +53,15 @@ oder als normaler Download von hier: https://github.com/friendica/friendica-addo
 
 Entpacke diese Datei (ggf. den entpackten Ordner in â€žjappixmini“ umbenennen) und lade sowohl den entpackten Ordner komplett als auch die .tgz Datei in den Addon Ordner Deiner Friendica Installation hoch.
 
-Nach dem Upload gehts in den Friendica Adminbereich und dort zu den Plugins.
-Aktiviere das Jappixmini Addon und gehe anschließend Ã¼ber die Plugins Seitenleiste (dort wo auch die Twitter-, Impressums-, GNU Social-, usw. Einstellungen gemacht werden) zu den Jappix Grundeinstellungen.
+Nach dem Upload gehts in den Friendica Adminbereich und dort zu den Addons.
+Aktiviere das Jappixmini Addon und gehe anschließend Ã¼ber die Addons Seitenleiste (dort wo auch die Twitter-, Impressums-, GNU Social-, usw. Einstellungen gemacht werden) zu den Jappix Grundeinstellungen.
 
 Setze hier den Haken zur Aktivierung des BOSH Proxys.
 Weiter gehts in den Einstellungen Deines Friendica Accounts.
 
 2. Einstellungen
 
-Gehe bitte zu den Plugin-Einstellungen in Deinen Konto-Einstellungen (Account Settings).
+Gehe bitte zu den Addon-Einstellungen in Deinen Konto-Einstellungen (Account Settings).
 Scrolle ein Stück hinunter bis zu den Jappix Mini Addon settings.
 
 Aktiviere hier zuerst das Addon.
index e78e8bc21aea225a0337b3c05db641ab053ebc09..aa9d01b64d25c2cd6f9dcd84c35ef9ff11a8a5d1 100644 (file)
@@ -104,7 +104,7 @@ Ignorierte Kontakte können weiterhin Beiträge und private Nachrichten von Dir
 Deren Beiträge und private Nachrichten werden allerdings nicht importiert. 
 Wie bei blockierten Beiträgen siehst Du auch hier weiterhin die Kommentare dieser Person zu anderen Beiträgen Deiner Freunde. 
 
-[Ein Plugin namens "blockem" kann installiert werden, um alle Beiträge einer bestimmten Person in Deinem Stream zu verstecken bzw. zu verkürzen. 
+[Ein Erweiterung namens "blockem" kann installiert werden, um alle Beiträge einer bestimmten Person in Deinem Stream zu verstecken bzw. zu verkürzen. 
 Dabei werden auch Kommentare dieser Person in Beiträgen Deiner Freunde blockiert.]
 
 Ein archivierter Kontakt bedeutet, dass Kommunikation nicht möglich ist und auch nicht versucht wird (das ist z.B. sinnvoll, wenn eine Person zu einem neuen Server gewechselt ist und das alte Profil gelöscht hat). 
index 67ca15ebcda04f49857b535630482d806879dec6..403cc1477e74185d1465fb85c0faf101750c7c83 100644 (file)
@@ -30,7 +30,7 @@ Friendica - Dokumentation und Ressourcen
 * [Installation](help/Install)
 * [Update](help/Update) (EN)
 * [Konfigurationen & Admin-Panel](help/Settings)
-* [Plugins](help/Plugins)
+* [Addons](help/Addons)
 * [Konnektoren (Connectors) installieren (Twitter/GNU Social)](help/Installing-Connectors)
 * [Installation eines ejabberd Servers (XMPP-Chat) mit synchronisierten Anmeldedaten](help/install-ejabberd) (EN)
 * [Betreibe deine Seite mit einem SSL-Zertifikat](help/SSL)
@@ -45,7 +45,7 @@ Friendica - Dokumentation und Ressourcen
 * [Help on Vagrant](help/Vagrant)
 * [How to translate Friendica](help/translations) (EN)
 * [Bugs and Issues](help/Bugs-and-Issues)
-* [Plugin Development](help/Plugins)
+* [Addon Development](help/Addons)
 * [Theme Development](help/themes)
 * [Smarty 3 Templates](help/smarty3-templates)
 * [Protokoll Dokumentation](help/Protocol) (EN)
index e4bbbffb5b693c34783a360f224e11da6f3d7397..c1f0a54fa0bbd6f190cd6551fb48e1a58f8b1a36 100644 (file)
@@ -28,10 +28,10 @@ Der Nachteil: Du siehst nicht jede Antwort einer OStatus-Unterhaltung. Aus diese
 
 Wenn du MyISAM (Standardeinstellung) oder InnoDB mit MariaDB 10 nutzt, dann beschleunigt dies die Suche.
 
-Plugins
+Addons
 --------
 
-Aktiviere die folgenden Plugins:
+Aktiviere die folgenden Addons:
 
     rendertime
 
@@ -39,7 +39,7 @@ Aktiviere die folgenden Plugins:
 
 **Beschreibung**
 
-Dieses Plugin beschleunigt dein System nicht, aber es hilft dabei, die Flaschenhälse zu ermitteln.
+Dieses Addon beschleunigt dein System nicht, aber es hilft dabei, die Flaschenhälse zu ermitteln.
 
 Wenn es aktiviert ist, dann siehst du Werte wie die folgenden auf jeder deiner Seiten:
 
index 76daa685fb513b53d73b90b503166982e174314a..f9fe5b0f7212efa581ac59c667e6ac6c88199388 100644 (file)
@@ -3,29 +3,29 @@ Konnektoren installieren (Twitter/GNU Social)
 
 * [Zur Startseite der Hilfe](help)
 
-Friendica nutzt Plugins, um die Verbindung zu anderen Netzwerken wie Twitter oder App.net zu gewährleisten.
+Friendica nutzt Erweiterung, um die Verbindung zu anderen Netzwerken wie Twitter oder App.net zu gewährleisten.
 
-Es gibt außerdem ein Plugin, um Ã¼ber einen bestehenden GNU Social-Account diesen Service zu nutzen. 
-Du brauchst dieses Plugin aber nicht, um mit GNU Social-Mitgliedern von Friendica aus zu kommunizieren - es sei denn, du wünschst es, Ã¼ber einen existierenden Account einen Beitrag zu schreiben. 
+Es gibt außerdem ein Erweiterung, um Ã¼ber einen bestehenden GNU Social-Account diesen Service zu nutzen. 
+Du brauchst dieses Erweiterung aber nicht, um mit GNU Social-Mitgliedern von Friendica aus zu kommunizieren - es sei denn, du wünschst es, Ã¼ber einen existierenden Account einen Beitrag zu schreiben. 
 
-Alle drei Plugins benötigen einen Account im gewünschten Netzwerk. 
+Alle drei Erweiterung benötigen einen Account im gewünschten Netzwerk. 
 Zusätzlich musst du (bzw. der Administrator der Seite) einen API-Schlüssel holen, um einen authentifizierten Zugriff zu deinem Friendica-Server herstellen zu lassen.
 
 
 **Seitenkonfiguration**
 
-Plugins müssen vom Administrator installiert werden, bevor sie genutzt werden können. 
+Erweiterung müssen vom Administrator installiert werden, bevor sie genutzt werden können. 
 Dieses kann Ã¼ber das Administrationsmenü erstellt werden.
 
 Jeder der Konnektoren benötigt zudem einen API-Schlüssel vom Service, der verbunden werden soll. 
-Einige Plugins erlaube es, diese Informationen auf den Administrationsseiten einzustellen, wohingegen andere eine direkte Bearbeitung der Konfigurationsdatei ".htconfig.php" erfordern. 
+Einige Erweiterung erlaube es, diese Informationen auf den Administrationsseiten einzustellen, wohingegen andere eine direkte Bearbeitung der Konfigurationsdatei ".htconfig.php" erfordern. 
 Der Weg, um diese Schlüssel zu erhalten, variiert stark, jedoch brauchen fast alle einen bestehenden Account im gewünschten Service. 
 Einmal installiert, können diese Schlüssel von allen Seitennutzern genutzt werden.
 
-Im Folgenden findest du die Einstellungen für die verschiedenen Services (viele dieser Informationen kommen direkt aus den Quelldateien der Plugins):
+Im Folgenden findest du die Einstellungen für die verschiedenen Services (viele dieser Informationen kommen direkt aus den Quelldateien der Erweiterung):
 
 
-**Twitter Plugin für Friendica**
+**Twitter Erweiterung für Friendica**
 
 * Author: Tobias Diekershoff
 * tobias.diekershoff@gmx.net
@@ -33,7 +33,7 @@ Im Folgenden findest du die Einstellungen für die verschiedenen Services (viele
 * License:3-clause BSD license
 
 Konfiguration:
-Um dieses Plugin zu nutzen, benötigst du einen OAuth Consumer-Schlüsselpaar (Schlüssel und Geheimnis), das du auf der Seite [https://twitter.com/apps](https://twitter.com/apps) erhalten kannst
+Um dieses Erweiterung zu nutzen, benötigst du einen OAuth Consumer-Schlüsselpaar (Schlüssel und Geheimnis), das du auf der Seite [https://twitter.com/apps](https://twitter.com/apps) erhalten kannst
 
 Registriere deine Friendica-Seite als "Client"-Anwendung mit "Read&Write"-Zugriff. Wir benötigen "Twitter als Login" nicht. Sobald du deine Anwendung installiert hast, erhältst du das Schlüsselpaar für deine Seite.
 
@@ -47,7 +47,7 @@ $a->config['twitter']['consumersecret'] = 'your consumer_secret here';
 Anschließend kann der Nutzer deiner Seite die Twitter-Einstellungen selbst eintragen: "Einstellungen -> Connector Einstellungen".
 
 
-**GNU Social Plugin für Friendica**
+**GNU Social Erweiterung für Friendica**
 
 * Author: Tobias Diekershoff
 * tobias.diekershoff@gmx.net
diff --git a/doc/de/Plugins.md b/doc/de/Plugins.md
deleted file mode 100644 (file)
index 8b1c711..0000000
+++ /dev/null
@@ -1,370 +0,0 @@
-Friendica Addon/Plugin-Entwicklung
-==============
-
-* [Zur Startseite der Hilfe](help)
-
-Bitte schau dir das Beispiel-Addon "randplace" für ein funktionierendes Beispiel für manche der hier aufgeführten Funktionen an.
-Das Facebook-Addon bietet ein Beispiel dafür, die "addon"- und "module"-Funktion gemeinsam zu integrieren.
-Addons arbeiten, indem sie Event Hooks abfangen.
-Module arbeiten, indem bestimmte Seitenanfragen (durch den URL-Pfad) abgefangen werden.
-
-Plugin-Namen können keine Leerstellen oder andere Interpunktionen enthalten und werden als Datei- und Funktionsnamen genutzt.
-Du kannst einen lesbaren Namen im Kommentarblock eintragen.
-Jedes Addon muss beides beinhalten - eine Installations- und eine Deinstallationsfunktion, die auf dem Addon-/Plugin-Namen basieren; z.B. "plugin1name_install()".
-Diese beiden Funktionen haben keine Argumente und sind dafür verantwortlich, Event Hooks zu registrieren und abzumelden (unregistering), die dein Plugin benötigt.
-Die Installations- und Deinstallationsfunktionfunktionen werden auch ausgeführt (z.B. neu installiert), wenn sich das Plugin nach der Installation Ã¤ndert - somit sollte deine Deinstallationsfunktion keine Daten zerstört und deine Installationsfunktion sollte bestehende Daten berücksichtigen.
-Zukünftige Extensions werden möglicherweise "Setup" und "Entfernen" anbieten.
-
-Plugins sollten einen Kommentarblock mit den folgenden vier Parametern enthalten:
-
-    /*
-     * Name: My Great Plugin
-     * Description: This is what my plugin does. It's really cool.
-     * Version: 1.0
-     * Author: John Q. Public <john@myfriendicasite.com>
-     */
-
-Registriere deine Plugin-Hooks während der Installation.
-
-    register_hook($hookname, $file, $function);
-
-$hookname ist ein String und entspricht einem bekannten Friendica-Hook.
-
-$file steht für den Pfadnamen, der relativ zum Top-Level-Friendicaverzeichnis liegt.
-Das *sollte* "addon/plugin_name/plugin_name.php' sein.
-
-$function ist ein String und der Name der Funktion, die ausgeführt wird, wenn der Hook aufgerufen wird.
-
-Argumente
----
-
-Deine Hook-Callback-Funktion wird mit mindestens einem und bis zu zwei Argumenten aufgerufen
-
-    function myhook_function(App $a, &$b) {
-
-    }
-
-Wenn du Ã„nderungen an den aufgerufenen Daten vornehmen willst, musst du diese als Referenzvariable (mit "&") während der Funktionsdeklaration deklarieren.
-
-$a ist die Friendica "App"-Klasse, die eine Menge an Informationen Ã¼ber den aktuellen Friendica-Status beinhaltet, u.a. welche Module genutzt werden, Konfigurationsinformationen, Inhalte der Seite zum Zeitpunkt des Hook-Aufrufs.
-Es ist empfohlen, diese Funktion "$a" zu nennen, um seine Nutzung an den Gebrauch an anderer Stelle anzugleichen.
-
-$b kann frei benannt werden.
-Diese Information ist speziell auf den Hook bezogen, der aktuell bearbeitet wird, und beinhaltet normalerweise Daten, die du sofort nutzen, anzeigen oder bearbeiten kannst.
-Achte darauf, diese mit "&" zu deklarieren, wenn du sie bearbeiten willst.
-
-
-Module
----
-
-Plugins/Addons können auch als "Module" agieren und alle Seitenanfragen für eine bestimte URL abfangen.
-Um ein Plugin als Modul zu nutzen, ist es nötig, die Funktion "plugin_name_module()" zu definieren, die keine Argumente benötigt und nichts weiter machen muss.
-
-Wenn diese Funktion existiert, wirst du nun alle Seitenanfragen für "http://example.com/plugin_name" erhalten - mit allen URL-Komponenten als zusätzliche Argumente.
-Diese werden in ein Array $a->argv geparst und stimmen mit $a->argc Ã¼berein, wobei sie die Anzahl der URL-Komponenten abbilden.
-So würde http://example.com/plugin/arg1/arg2 nach einem Modul "plugin" suchen und seiner Modulfunktion die $a-App-Strukur Ã¼bergeben (dies ist für viele Komponenten verfügbar). Das umfasst:
-
-    $a->argc = 3
-    $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
-
-Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(App $a), welche den Seiteninhalt definiert und zurückgibt.
-Sie können auch plugin_name_post(App $a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
-Du kannst ebenso plugin_name_init(App $a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
-
-
-Derzeitige Hooks
----
-
-**'authenticate'** - wird aufgerufen, wenn sich der User einloggt.
-    $b ist ein Array
-        'username' => der Ã¼bertragene Nutzername
-        'password' => das Ã¼bertragene Passwort
-        'authenticated' => setze das auf einen anderen Wert als "0", damit der User sich authentifiziert
-        'user_record' => die erfolgreiche Authentifizierung muss auch einen gültigen Nutzereintrag aus der Datenbank zurückgeben
-
-**'logged_in'** - wird aufgerufen, sobald ein Nutzer sich erfolgreich angemeldet hat.
-    $b beinhaltet den $a->Nutzer-Array
-
-
-**'display_item'** - wird aufgerufen, wenn ein Beitrag für die Anzeige formatiert wird.
-    $b ist ein Array
-        'item' => Die Item-Details (Array), die von der Datenbank ausgegeben werden
-        'output' => Die HTML-Ausgabe (String) des Items, bevor es zur Seite hinzugefügt wird
-
-**'post_local'** - wird aufgerufen, wenn der Statusbeitrag oder ein Kommentar im lokalen System eingetragen wird.
-    $b ist das Item-Array der Information, die in der Datenbank hinterlegt wird.
-        {Bitte beachte: der Seiteninhalt ist bbcode - nicht HTML)
-
-**'post_local_end'** - wird aufgerufen, wenn ein lokaler Statusbeitrag oder Kommentar im lokalen System gespeichert wird.
-    $b ist das Item-Array einer Information, die gerade in der Datenbank gespeichert wurden.
-        {Bitte beachte: der Seiteninhalt ist bbcode - nicht HTML)
-
-**'post_remote'** - wird aufgerufen, wenn ein Beitrag aus einer anderen Quelle empfangen wird. Dies kann auch genutzt werden, um lokale Aktivitäten oder systemgenerierte Nachrichten zu veröffentlichen/posten.
-    $b ist das Item-Array einer Information, die in der Datenbank und im Item gespeichert ist.
-       {Bitte beachte: der Seiteninhalt ist bbcode - nicht HTML)
-
-**'settings_form'** - wird aufgerufen, wenn die HTML-Ausgabe für die Einstellungsseite generiert wird.
-    $b ist die HTML-Ausgabe (String) der Einstellungsseite vor dem finalen "</form>"-Tag.
-
-**'settings_post'** - wird aufgerufen, wenn die Einstellungsseiten geladen werden.
-    $b ist der $_POST-Array
-
-**'plugin_settings'** - wird aufgerufen, wenn die HTML-Ausgabe der Addon-Einstellungsseite generiert wird.
-    $b ist die HTML-Ausgabe (String) der Addon-Einstellungsseite vor dem finalen "</form>"-Tag.
-
-**'plugin_settings_post'** - wird aufgerufen, wenn die Addon-Einstellungsseite geladen wird.
-    $b ist der $_POST-Array
-
-**'profile_post'** - wird aufgerufen, wenn die Profilseite angezeigt wird.
-    $b ist der $_POST-Array
-
-**'profile_edit'** - wird aufgerufen, bevor die Profil-Bearbeitungsseite angezeigt wird.
-    $b ist ein Array
-        'profile' => Profileintrag (Array) aus der Datenbank
-        'entry' => die HTML-Ausgabe (string) des generierten Eintrags
-
-**'profile_advanced'** - wird aufgerufen, wenn die HTML-Ausgabe für das "Advanced profile" generiert wird; stimmt mit dem "Profil"-Tab auf der Profilseite der Nutzer Ã¼berein.
-    $b ist die HTML-Ausgabe (String) des erstellten Profils
-    (Die Details des Profil-Arrays sind in $a->profile)
-
-**'directory_item'** - wird von der Verzeichnisseite aufgerufen, wenn ein Item für die Anzeige formatiert wird.
-    $b ist ein Array
-        'contact' => Kontakteintrag (Array) einer Person aus der Datenbank
-        'entry' => die HTML-Ausgabe (String) des generierten Eintrags
-
-**'profile_sidebar_enter'** - wird aufgerufen, bevor die Sidebar "Kurzprofil" einer Seite erstellt wird.
-    $b ist der Profil-Array einer Person
-
-**'profile_sidebar'** - wird aufgerufen, wenn die Sidebar "Kurzprofil" einer Seite erstellt wird.
-    $b ist ein Array
-        'profile' => Kontakteintrag (Array) einer Person aus der Datenbank
-        'entry' => die HTML-Ausgabe (String) des generierten Eintrags
-
-**'contact_block_end'** - wird aufgerufen, wenn der Block "Kontakte/Freunde" der Profil-Sidebar komplett formatiert wurde.
-    $b ist ein Array
-          'contacts' => Array von "contacts"
-          'output' => die HTML-Ausgabe (String) des Kontaktblocks
-
-**'bbcode'** - wird während der Umwandlung von bbcode auf HTML aufgerufen.
-    $b ist der konvertierte Text (String)
-
-**'html2bbcode'** - wird während der Umwandlung von HTML zu bbcode aufgerufen (z.B. bei Nachrichtenbeiträgen).
-    $b ist der konvertierte Text (String)
-
-**'page_header'** - wird aufgerufen, nachdem der Bereich der Seitennavigation geladen wurde.
-    $b ist die HTML-Ausgabe (String) der "nav"-Region
-
-**'personal_xrd'** - wird aufgerufen, bevor die Ausgabe der persönlichen XRD-Datei erzeugt wird.
-    $b ist ein Array
-        'user' => die hinterlegten Einträge der Person
-        'xml' => die komplette XML-Datei die ausgegeben wird
-
-**'home_content'** - wird aufgerufen, bevor die Ausgabe des Homepage-Inhalts erstellt wird; wird nicht eingeloggten Nutzern angezeigt.
-    $b ist die HTML-Ausgabe (String) der Auswahlregion
-
-**'contact_edit'** - wird aufgerufen, wenn die Kontaktdetails vom Nutzer auf der "Kontakte"-Seite bearbeitet werden.
-    $b ist ein Array
-        'contact' => Kontakteintrag (Array) des abgezielten Kontakts
-        'output' => die HTML-Ausgabe (String) der "Kontakt bearbeiten"-Seite
-
-**'contact_edit_post'** - wird aufgerufen, wenn die "Kontakt bearbeiten"-Seite ausgegeben wird.
-    $b ist der $_POST-Array
-
-**'init_1'** - wird aufgerufen, kurz nachdem die Datenbank vor Beginn der Sitzung geöffnet wird.
-    $b wird nicht genutzt
-
-**'page_end'** - wird aufgerufen, nachdem die Funktion des HTML-Inhalts komplett abgeschlossen ist.
-    $b ist die HTML-Ausgabe (String) vom Inhalt-"div"
-
-**'avatar_lookup'** - wird aufgerufen, wenn der Avatar geladen wird.
-    $b ist ein Array
-        'size' => Größe des Avatars, der geladen wird
-        'email' => Email-Adresse, um nach dem Avatar zu suchen
-        'url' => generierte URL (String) des Avatars
-
-**'nav_info'**
- - wird aufgerufen nachdem in include/nav,php der Inhalt des Navigations Menüs erzeugt wurde.
- - $b ist ein Array, das $nav wiederspiegelt.
-
-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:                      call_hooks('profile_sidebar_enter', $profile);
-
-boot.php:                      call_hooks('profile_sidebar', $arr);
-
-boot.php:                      call_hooks("proc_run", $arr);
-
-include/contact_selectors.php: call_hooks('network_to_name', $nets);
-
-include/api.php:               call_hooks('logged_in', $a->user);
-
-include/api.php:               call_hooks('logged_in', $a->user);
-
-include/queue.php:             call_hooks('queue_predeliver', $a, $r);
-
-include/queue.php:             call_hooks('queue_deliver', $a, $params);
-
-include/text.php:              call_hooks('contact_block_end', $arr);
-
-include/text.php:              call_hooks('smilie', $s);
-
-include/text.php:              call_hooks('prepare_body_init', $item);
-
-include/text.php:              call_hooks('prepare_body', $prep_arr);
-
-include/text.php:              call_hooks('prepare_body_final', $prep_arr);
-
-include/nav.php:               call_hooks('page_header', $a->page['nav']);
-
-include/auth.php:              call_hooks('authenticate', $addon_auth);
-
-include/bbcode.php:            call_hooks('bbcode',$Text);
-
-include/oauth.php:             call_hooks('logged_in', $a->user);
-
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
-
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
-
-include/acl_selectors.php:     call_hooks('contact_select_options', $x);
-
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
-
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
-
-include/acl_selectors.php:     call_hooks($a->module . '_pre_' . $selname, $arr);
-
-include/acl_selectors.php:     call_hooks($a->module . '_post_' . $selname, $o);
-
-include/notifier.php:          call_hooks('notifier_normal',$target_item);
-
-include/notifier.php:          call_hooks('notifier_end',$target_item);
-
-include/items.php:             call_hooks('atom_feed', $atom);
-
-include/items.php:             call_hooks('atom_feed_end', $atom);
-
-include/items.php:             call_hooks('atom_feed_end', $atom);
-
-include/items.php:             call_hooks('parse_atom', $arr);
-
-include/items.php:             call_hooks('post_remote',$arr);
-
-include/items.php:             call_hooks('atom_author', $o);
-
-include/items.php:             call_hooks('atom_entry', $o);
-
-include/bb2diaspora.php:       call_hooks('bb2diaspora',$Text);
-
-include/cronhooks.php:         call_hooks('cron', $d);
-
-include/security.php:          call_hooks('logged_in', $a->user);
-
-include/html2bbcode.php:       call_hooks('html2bbcode', $text);
-
-include/Contact.php:           call_hooks('remove_user',$r[0]);
-
-include/Contact.php:           call_hooks('contact_photo_menu', $args);
-
-include/conversation.php:      call_hooks('conversation_start',$cb);
-
-include/conversation.php:      call_hooks('render_location',$locate);
-
-include/conversation.php:      call_hooks('display_item', $arr);
-
-include/conversation.php:      call_hooks('render_location',$locate);
-
-include/conversation.php:      call_hooks('display_item', $arr);
-
-include/conversation.php:      call_hooks('item_photo_menu', $args);
-
-include/conversation.php:      call_hooks('jot_tool', $jotplugins);
-
-include/conversation.php:      call_hooks('jot_networks', $jotnets);
-
-include/plugin.php:            if(! function_exists('call_hooks')) {
-
-include/plugin.php:function    call_hooks($name, &$data = null) {
-
-index.php:                     call_hooks('init_1');
-
-index.php:                     call_hooks('app_menu', $arr);
-
-index.php:                     call_hooks('page_end', $a->page['content']);
-
-mod/photos.php:                        call_hooks('photo_post_init', $_POST);
-
-mod/photos.php:                        call_hooks('photo_post_file',$ret);
-
-mod/photos.php:                        call_hooks('photo_post_end',$foo);
-
-mod/photos.php:                        call_hooks('photo_post_end',$foo);
-
-mod/photos.php:                        call_hooks('photo_post_end',$foo);
-
-mod/photos.php:                        call_hooks('photo_post_end',intval($item_id));
-
-mod/photos.php:                        call_hooks('photo_upload_form',$ret);
-
-mod/friendica.php:             call_hooks('about_hook', $o);
-
-mod/editpost.php:              call_hooks('jot_tool', $jotplugins);
-
-mod/editpost.php:              call_hooks('jot_networks', $jotnets);
-
-mod/parse_url.php:             call_hooks('parse_link', $arr);
-
-mod/home.php:                  call_hooks('home_init',$ret);
-
-mod/home.php:                  call_hooks("home_content",$o);
-
-mod/contacts.php:              call_hooks('contact_edit_post', $_POST);
-
-mod/contacts.php:              call_hooks('contact_edit', $arr);
-
-mod/settings.php:              call_hooks('plugin_settings_post', $_POST);
-
-mod/settings.php:              call_hooks('connector_settings_post', $_POST);
-
-mod/settings.php:              call_hooks('settings_post', $_POST);
-
-mod/settings.php:              call_hooks('plugin_settings', $settings_addons);
-
-mod/settings.php:              call_hooks('connector_settings', $settings_connectors);
-
-mod/settings.php:              call_hooks('settings_form',$o);
-
-mod/register.php:              call_hooks('register_account', $newuid);
-
-mod/like.php:                  call_hooks('post_local_end', $arr);
-
-mod/xrd.php:                   call_hooks('personal_xrd', $arr);
-
-mod/item.php:                  call_hooks('post_local_start', $_REQUEST);
-
-mod/item.php:                  call_hooks('post_local',$datarray);
-
-mod/item.php:                  call_hooks('post_local_end', $datarray);
-
-mod/profile.php:               call_hooks('profile_advanced',$o);
-
-mod/profiles.php:              call_hooks('profile_post', $_POST);
-
-mod/profiles.php:              call_hooks('profile_edit', $arr);
-
-mod/tagger.php:                        call_hooks('post_local_end', $arr);
-
-mod/cb.php:                    call_hooks('cb_init');
-
-mod/cb.php:                    call_hooks('cb_post', $_POST);
-
-mod/cb.php:                    call_hooks('cb_afterpost');
-
-mod/cb.php:                    call_hooks('cb_content', $o);
-
-mod/directory.php:             call_hooks('directory_item', $arr);
index 91cad094cc59e0ce815faa9bcbc220cc9af3030f..1c7a487431ccd5647ddc896abf386a2cc0544f2d 100644 (file)
@@ -195,7 +195,7 @@ An dieser Stelle kannst du existierende Accounts vom Zugriff auf die Instanz blo
 Im letzten Bereich auf der Seite kannst du als Administrator neue Accounts anlegen.
 Das Passwort für so eingerichtete Accounts werden per E-Mail an die Nutzer geschickt.
 
-## Plugins
+## Addons
 
 Dieser Bereich des Admin Panels dient der Auswahl und Konfiguration der Erweiterungen von Friendica.
 Sie müssen in das `/addon` Verzeichnis kopiert werden.
@@ -203,11 +203,11 @@ Auf der Seite wird eine Liste der verfügbaren Erweiterungen angezeigt.
 Neben den Namen der Erweiterungen wird ein Indikator angezeigt, der anzeigt ob das Addon gerade aktiviert ist oder nicht.
 
 Wenn du die Erweiterungen aktualisiert die du auf deiner Friendica-Instanz nutzt könnte es sein, dass sie neu geladen werden müssen, damit die Ã„nderungen aktiviert werden.
-Um diesen Prozess zu vereinfachen gibt es am Anfang der Seite einen Button um alle aktiven Plugins neu zu laden.
+Um diesen Prozess zu vereinfachen gibt es am Anfang der Seite einen Button um alle aktiven Addons neu zu laden.
 
 ## Themen
 
-Der Bereich zur Kontrolle der auf der Friendica-Instanz verfügbaren Themen funktioniert analog zum Plugins Bereich.
+Der Bereich zur Kontrolle der auf der Friendica-Instanz verfügbaren Themen funktioniert analog zum Addons Bereich.
 Jedes Theme hat eine extra Seite auf der der aktuelle Status, ein Bildschirmfoto des Themes, zusätzliche Informationen und eventuelle Einstellungen des Themes zu finden sind.
 Genau wie Erweiterungen können Themes in der Ãœbersichtsliste oder der Theme-Seite aktiviert bzw. deaktiviert werden.
 Um ein Standardtheme für die Instanz zu wählen, benutze bitte die *Seiten* Bereich des Admin Panels.
@@ -256,7 +256,7 @@ Dazu muss man nur die GUID des Beitrags kennen.
 Diese kann u.a. in der Adresse der `/display`-Seite gefunden werden, wenn man dem *Link zum Originalbeitrag* folgt.
 Hier ist die GUID der letzte Teil der URL in der Adresszeile des Browsers.
 
-## Plugin Features
+## Addon Features
 
 Einige der Erweiterungen von Friendica benötigen global gültige Einstellungen, die der Administrator vornehmen muss.
 Diese Erweiterungen sind hier aufgelistet, damit du die Einstellungen schneller findest.
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..15ec2db12c99ecc71a81c29a958b22f3574fe625 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>";
@@ -212,11 +213,11 @@ function api_login(App $a)
        ];
 
        /*
-               * A plugin indicates successful login by setting 'authenticated' to non-zero value and returning a user record
-               * 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);
+       * An addon indicates successful login by setting 'authenticated' to non-zero value and returning a user record
+       * Addons should never set 'authenticated' except to indicate success - as hooks may be chained
+       * and later addons should not interfere with an earlier one that succeeded.
+       */
+       Addon::callHooks('authenticate', $addon_auth);
 
        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..a7d153e30963b98de08e123a17508d7a6a2d9223 100644 (file)
@@ -1,9 +1,8 @@
 <?php
 
+use Friendica\Core\Addon;
 use Friendica\Render\ITemplateEngine;
 
-require_once "include/plugin.php";
-
 define('SMARTY3_TEMPLATE_FOLDER', 'templates');
 
 class FriendicaSmarty extends Smarty
@@ -74,7 +73,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..8063f7fc2d6a71c1bf512588cefa8cf9708cfa8a 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
@@ -600,7 +601,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
        }
 
        /// @TODO old-lost code?
-       // Shouldn't happen but we want to make absolutely sure it doesn't leak from a plugin.
+       // Shouldn't happen but we want to make absolutely sure it doesn't leak from an addon.
        // Deactivated, since the bbcode parser can handle with it - and it destroys posts with some smileys that contain "<"
        //if ((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false))
        //      $arr['body'] = strip_tags($arr['body']);
@@ -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
@@ -953,7 +954,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
        unset($arr['api_source']);
 
        if (x($arr, 'cancel')) {
-               logger('item_store: post cancelled by plugin.');
+               logger('item_store: post cancelled by addon.');
                return 0;
        }
 
@@ -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 403d520cc67a2aab4e4c11849c4a353436de8cf5..fa3260cb1a23eabbba418ecd80d6ea4f1d344104 100644 (file)
@@ -94,7 +94,7 @@ function pop_lang() {
 /**
  * load string translation table for alternate language
  *
- * first plugin strings are loaded, then globals
+ * first addon strings are loaded, then globals
  *
  * @param string $lang language code to load
  */
@@ -102,9 +102,9 @@ function load_translation_table($lang) {
        $a = get_app();
 
        $a->strings = [];
-       // load enabled plugins strings
-       $plugins = dba::select('addon', ['name'], ['installed' => true]);
-       while ($p = dba::fetch($plugins)) {
+       // load enabled addons strings
+       $addons = dba::select('addon', ['name'], ['installed' => true]);
+       while ($p = dba::fetch($addons)) {
                $name = $p['name'];
                if (file_exists("addon/$name/lang/$lang/strings.php")) {
                        include("addon/$name/lang/$lang/strings.php");
diff --git a/include/plugin.php b/include/plugin.php
deleted file mode 100644 (file)
index 0059b7d..0000000
+++ /dev/null
@@ -1,467 +0,0 @@
-<?php
-/**
- * @file include/plugin.php
- *
- * @brief Some functions to handle addons and themes.
- */
-
-use Friendica\App;
-use Friendica\Core\Config;
-use Friendica\Core\System;
-use Friendica\Database\DBM;
-
-/**
- * @brief uninstalls an addon.
- *
- * @param string $plugin name of the addon
- * @return boolean
- */
-function uninstall_plugin($plugin) {
-       logger("Addons: uninstalling " . $plugin);
-       dba::delete('addon', ['name' => $plugin]);
-
-       @include_once('addon/' . $plugin . '/' . $plugin . '.php');
-       if (function_exists($plugin . '_uninstall')) {
-               $func = $plugin . '_uninstall';
-               $func();
-       }
-}
-
-/**
- * @brief installs an addon.
- *
- * @param string $plugin name of the addon
- * @return bool
- */
-function install_plugin($plugin) {
-       // silently fail if plugin was removed
-
-       if (!file_exists('addon/' . $plugin . '/' . $plugin . '.php')) {
-               return false;
-       }
-       logger("Addons: installing " . $plugin);
-       $t = @filemtime('addon/' . $plugin . '/' . $plugin . '.php');
-       @include_once('addon/' . $plugin . '/' . $plugin . '.php');
-       if (function_exists($plugin . '_install')) {
-               $func = $plugin . '_install';
-               $func();
-
-               $plugin_admin = (function_exists($plugin."_plugin_admin") ? 1 : 0);
-
-               dba::insert('addon', ['name' => $plugin, 'installed' => true,
-                                       'timestamp' => $t, 'plugin_admin' => $plugin_admin]);
-
-               // we can add the following with the previous SQL
-               // once most site tables have been updated.
-               // This way the system won't fall over dead during the update.
-
-               if (file_exists('addon/' . $plugin . '/.hidden')) {
-                       dba::update('addon', ['hidden' => true], ['name' => $plugin]);
-               }
-               return true;
-       } else {
-               logger("Addons: FAILED installing " . $plugin);
-               return false;
-       }
-}
-
-// reload all updated plugins
-
-function reload_plugins() {
-       $plugins = Config::get('system', 'addon');
-       if (strlen($plugins)) {
-
-               $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
-               if (DBM::is_result($r)) {
-                       $installed = $r;
-               } else {
-                       $installed = [];
-               }
-
-               $parr = explode(',',$plugins);
-
-               if (count($parr)) {
-                       foreach ($parr as $pl) {
-
-                               $pl = trim($pl);
-
-                               $fname = 'addon/' . $pl . '/' . $pl . '.php';
-
-                               if (file_exists($fname)) {
-                                       $t = @filemtime($fname);
-                                       foreach ($installed as $i) {
-                                               if (($i['name'] == $pl) && ($i['timestamp'] != $t)) {
-                                                       logger('Reloading plugin: ' . $i['name']);
-                                                       @include_once($fname);
-
-                                                       if (function_exists($pl . '_uninstall')) {
-                                                               $func = $pl . '_uninstall';
-                                                               $func();
-                                                       }
-                                                       if (function_exists($pl . '_install')) {
-                                                               $func = $pl . '_install';
-                                                               $func();
-                                                       }
-                                                       dba::update('addon', ['timestamp' => $t], ['id' => $i['id']]);
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-}
-
-/**
- * @brief check if addon is enabled
- *
- * @param string $plugin
- * @return boolean
- */
-function plugin_enabled($plugin) {
-       return dba::exists('addon', ['installed' => true, 'name' => $plugin]);
-}
-
-
-/**
- * @brief registers a hook.
- *
- * @param string $hook the name of the hook
- * @param string $file the name of the file that hooks into
- * @param string $function the name of the function that the hook will call
- * @param int $priority A priority (defaults to 0)
- * @return mixed|bool
- */
-function register_hook($hook, $file, $function, $priority=0) {
-       $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
-       $exists = dba::exists('hook', $condition);
-       if ($exists) {
-               return true;
-       }
-
-       $r = dba::insert('hook', ['hook' => $hook, 'file' => $file, 'function' => $function, 'priority' => $priority]);
-
-       return $r;
-}
-
-/**
- * @brief unregisters a hook.
- *
- * @param string $hook the name of the hook
- * @param string $file the name of the file that hooks into
- * @param string $function the name of the function that the hook called
- * @return array
- */
-function unregister_hook($hook, $file, $function) {
-       $condition = ['hook' => $hook, 'file' => $file, 'function' => $function];
-       $r = dba::delete('hook', $condition);
-       return $r;
-}
-
-
-function load_hooks() {
-       $a = get_app();
-       $a->hooks = [];
-       $r = dba::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);
-
-       while ($rr = dba::fetch($r)) {
-               if (! array_key_exists($rr['hook'],$a->hooks)) {
-                       $a->hooks[$rr['hook']] = [];
-               }
-               $a->hooks[$rr['hook']][] = [$rr['file'],$rr['function']];
-       }
-       dba::close($r);
-}
-
-/**
- * @brief Calls a hook.
- *
- * Use this function when you want to be able to allow a hook to manipulate
- * the provided data.
- *
- * @param string $name of the hook to call
- * @param string|array &$data to transmit to the callback handler
- */
-function call_hooks($name, &$data = null)
-{
-       $a = get_app();
-
-       if (is_array($a->hooks) && array_key_exists($name, $a->hooks)) {
-               foreach ($a->hooks[$name] as $hook) {
-                       call_single_hook($a, $name, $hook, $data);
-               }
-       }
-}
-
-/**
- * @brief Calls a single hook.
- *
- * @param string $name of the hook to call
- * @param array $hook Hook data
- * @param string|array &$data to transmit to the callback handler
- */
-function call_single_hook($a, $name, $hook, &$data = null) {
-       // Don't run a theme's hook if the user isn't using the theme
-       if (strpos($hook[0], 'view/theme/') !== false && strpos($hook[0], 'view/theme/'.current_theme()) === false)
-               return;
-
-       @include_once($hook[0]);
-       if (function_exists($hook[1])) {
-               $func = $hook[1];
-               $func($a, $data);
-       } else {
-               // remove orphan hooks
-               $condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]];
-               dba::delete('hook', $condition);
-       }
-}
-
-//check if an app_menu hook exist for plugin $name.
-//Return true if the plugin is an app
-function plugin_is_app($name) {
-       $a = get_app();
-
-       if (is_array($a->hooks) && (array_key_exists('app_menu',$a->hooks))) {
-               foreach ($a->hooks['app_menu'] as $hook) {
-                       if ($hook[0] == 'addon/'.$name.'/'.$name.'.php')
-                               return true;
-               }
-       }
-
-       return false;
-}
-
-/**
- * @brief Parse plugin comment in search of plugin infos.
- *
- * like
- * \code
- *...* Name: Plugin
- *   * Description: A plugin which plugs in
- * . * Version: 1.2.3
- *   * Author: John <profile url>
- *   * Author: Jane <email>
- *   *
- *  *\endcode
- * @param string $plugin the name of the plugin
- * @return array with the plugin information
- */
-
-function get_plugin_info($plugin) {
-
-       $a = get_app();
-
-       $info=[
-               'name' => $plugin,
-               'description' => "",
-               'author' => [],
-               'version' => "",
-               'status' => ""
-       ];
-
-       if (!is_file("addon/$plugin/$plugin.php")) return $info;
-
-       $stamp1 = microtime(true);
-       $f = file_get_contents("addon/$plugin/$plugin.php");
-       $a->save_timestamp($stamp1, "file");
-
-       $r = preg_match("|/\*.*\*/|msU", $f, $m);
-
-       if ($r) {
-               $ll = explode("\n", $m[0]);
-               foreach ( $ll as $l ) {
-                       $l = trim($l,"\t\n\r */");
-                       if ($l != "") {
-                               list($k,$v) = array_map("trim", explode(":",$l,2));
-                               $k= strtolower($k);
-                               if ($k == "author") {
-                                       $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);
-                                       if ($r) {
-                                               $info['author'][] = ['name'=>$m[1], 'link'=>$m[2]];
-                                       } else {
-                                               $info['author'][] = ['name'=>$v];
-                                       }
-                               } else {
-                                       if (array_key_exists($k,$info)) {
-                                               $info[$k]=$v;
-                                       }
-                               }
-
-                       }
-               }
-
-       }
-       return $info;
-}
-
-
-/**
- * @brief Parse theme comment in search of theme infos.
- *
- * like
- * \code
- * ..* Name: My Theme
- *   * Description: My Cool Theme
- * . * Version: 1.2.3
- *   * Author: John <profile url>
- *   * Maintainer: Jane <profile url>
- *   *
- * \endcode
- * @param string $theme the name of the theme
- * @return array
- */
-
-function get_theme_info($theme) {
-       $info=[
-               'name' => $theme,
-               'description' => "",
-               'author' => [],
-               'maintainer' => [],
-               'version' => "",
-               'credits' => "",
-               'experimental' => false,
-               'unsupported' => false
-       ];
-
-       if (file_exists("view/theme/$theme/experimental"))
-               $info['experimental'] = true;
-       if (file_exists("view/theme/$theme/unsupported"))
-               $info['unsupported'] = true;
-
-       if (!is_file("view/theme/$theme/theme.php")) return $info;
-
-       $a = get_app();
-       $stamp1 = microtime(true);
-       $f = file_get_contents("view/theme/$theme/theme.php");
-       $a->save_timestamp($stamp1, "file");
-
-       $r = preg_match("|/\*.*\*/|msU", $f, $m);
-
-       if ($r) {
-               $ll = explode("\n", $m[0]);
-               foreach ( $ll as $l ) {
-                       $l = trim($l,"\t\n\r */");
-                       if ($l != "") {
-                               list($k,$v) = array_map("trim", explode(":",$l,2));
-                               $k= strtolower($k);
-                               if ($k == "author") {
-
-                                       $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);
-                                       if ($r) {
-                                               $info['author'][] = ['name'=>$m[1], 'link'=>$m[2]];
-                                       } else {
-                                               $info['author'][] = ['name'=>$v];
-                                       }
-                               } elseif ($k == "maintainer") {
-                                       $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);
-                                       if ($r) {
-                                               $info['maintainer'][] = ['name'=>$m[1], 'link'=>$m[2]];
-                                       } else {
-                                               $info['maintainer'][] = ['name'=>$v];
-                                       }
-                               } else {
-                                       if (array_key_exists($k,$info)) {
-                                               $info[$k]=$v;
-                                       }
-                               }
-
-                       }
-               }
-
-       }
-       return $info;
-}
-
-/**
- * @brief Returns the theme's screenshot.
- *
- * The screenshot is expected as view/theme/$theme/screenshot.[png|jpg].
- *
- * @param sring $theme The name of the theme
- * @return string
- */
-function get_theme_screenshot($theme) {
-       $exts = ['.png','.jpg'];
-       foreach ($exts as $ext) {
-               if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
-                       return(System::baseUrl() . '/view/theme/' . $theme . '/screenshot' . $ext);
-               }
-       }
-       return(System::baseUrl() . '/images/blank.png');
-}
-
-// install and uninstall theme
-function uninstall_theme($theme) {
-       logger("Addons: uninstalling theme " . $theme);
-
-       include_once("view/theme/$theme/theme.php");
-       if (function_exists("{$theme}_uninstall")) {
-               $func = "{$theme}_uninstall";
-               $func();
-       }
-}
-
-function install_theme($theme) {
-       // silently fail if theme was removed
-
-       if (! file_exists("view/theme/$theme/theme.php")) {
-               return false;
-       }
-
-       logger("Addons: installing theme $theme");
-
-       include_once("view/theme/$theme/theme.php");
-
-       if (function_exists("{$theme}_install")) {
-               $func = "{$theme}_install";
-               $func();
-               return true;
-       } else {
-               logger("Addons: FAILED installing theme $theme");
-               return false;
-       }
-
-}
-
-/**
- * @brief Get the full path to relevant theme files by filename
- *
- * This function search in the theme directory (and if not present in global theme directory)
- * if there is a directory with the file extension and  for a file with the given
- * filename.
- *
- * @param string $file Filename
- * @param string $root Full root path
- * @return string Path to the file or empty string if the file isn't found
- */
-function theme_include($file, $root = '') {
-       $file = basename($file);
-
-       // Make sure $root ends with a slash / if it's not blank
-       if ($root !== '' && $root[strlen($root)-1] !== '/') {
-               $root = $root . '/';
-       }
-       $theme_info = get_app()->theme_info;
-       if (is_array($theme_info) && array_key_exists('extends',$theme_info)) {
-               $parent = $theme_info['extends'];
-       } else {
-               $parent = 'NOPATH';
-       }
-       $theme = current_theme();
-       $thname = $theme;
-       $ext = substr($file,strrpos($file,'.')+1);
-       $paths = [
-               "{$root}view/theme/$thname/$ext/$file",
-               "{$root}view/theme/$parent/$ext/$file",
-               "{$root}view/$ext/$file",
-       ];
-       foreach ($paths as $p) {
-               // strpos() is faster than strstr when checking if one string is in another (http://php.net/manual/en/function.strstr.php)
-               if (strpos($p,'NOPATH') !== false) {
-                       continue;
-               } elseif (file_exists($p)) {
-                       return $p;
-               }
-       }
-       return '';
-}
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..ad65a701ac0b8547b2b79b02248818a71695df1b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -11,7 +11,9 @@
 use Friendica\App;
 use Friendica\BaseObject;
 use Friendica\Content\Nav;
+use Friendica\Core\Addon;
 use Friendica\Core\System;
+use Friendica\Core\Theme;
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
@@ -75,8 +77,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');
 }
@@ -178,7 +180,7 @@ if (! x($_SESSION, 'last_updated')) {
 /*
  * check_config() is responsible for running update scripts. These automatically
  * update the DB schema whenever we push a new one out. It also checks to see if
- * any plugins have been added or removed and reacts accordingly.
+ * any addons have been added or removed and reacts accordingly.
  */
 
 // in install mode, any url loads install module
@@ -190,7 +192,7 @@ if ($install && $a->module!="view") {
 } else {
        check_url($a);
        check_db(false);
-       check_plugins($a);
+       check_addons($a);
 }
 
 Nav::setSelected('nothing');
@@ -200,7 +202,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'];
 }
@@ -226,7 +228,7 @@ if (strlen($a->module)) {
 
        /**
         * We will always have a module name.
-        * First see if we have a plugin which is masquerading as a module.
+        * First see if we have an addon which is masquerading as a module.
         */
 
        // Compatibility with the Android Diaspora client
@@ -241,9 +243,9 @@ if (strlen($a->module)) {
 
        $privateapps = Config::get('config', 'private_addons');
 
-       if (is_array($a->plugins) && in_array($a->module, $a->plugins) && file_exists("addon/{$a->module}/{$a->module}.php")) {
+       if (is_array($a->addons) && in_array($a->module, $a->addons) && 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 +319,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 +331,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 +345,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 +355,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 +366,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 +374,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 +423,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
@@ -516,15 +518,15 @@ header('X-Frame-Options: sameorigin');
  * The page templates are located in /view/php/ or in the theme directory.
  */
 if (isset($_GET["mode"])) {
-       $template = theme_include($_GET["mode"] . '.php');
+       $template = Theme::getPathForFile($_GET["mode"] . '.php');
 }
 
 // If there is no page template use the default page template
 if (empty($template)) {
-       $template = theme_include("default.php");
+       $template = Theme::getPathForFile("default.php");
 }
 
-/// @TODO Looks unsafe (remote-inclusion), is maybe not but theme_include() uses file_exists() but does not escape anything
+/// @TODO Looks unsafe (remote-inclusion), is maybe not but Theme::getPathForFile() uses file_exists() but does not escape anything
 require_once $template;
 
 killme();
index 9c286c11dd82080d21997797c2dfd9b851e0753c..454491701099db6989b9a5c06fcfb4c22389c42e 100644 (file)
@@ -8,8 +8,10 @@
 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\Theme;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
 use Friendica\Database\DBStructure;
@@ -56,16 +58,16 @@ function admin_post(App $a)
                        case 'users':
                                admin_page_users_post($a);
                                break;
-                       case 'plugins':
+                       case 'addons':
                                if ($a->argc > 2 &&
                                        is_file("addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php")) {
                                        @include_once("addon/" . $a->argv[2] . "/" . $a->argv[2] . ".php");
-                                       if (function_exists($a->argv[2] . '_plugin_admin_post')) {
-                                               $func = $a->argv[2] . '_plugin_admin_post';
+                                       if (function_exists($a->argv[2] . '_addon_admin_post')) {
+                                               $func = $a->argv[2] . '_addon_admin_post';
                                                $func($a);
                                        }
                                }
-                               $return_path = 'admin/plugins/' . $a->argv[2];
+                               $return_path = 'admin/addons/' . $a->argv[2];
                                break;
                        case 'themes':
                                if ($a->argc < 2) {
@@ -170,7 +172,7 @@ function admin_content(App $a)
        $aside_sub = [
                'site'         => ["admin/site/"        , t("Site")                 , "site"],
                'users'        => ["admin/users/"       , t("Users")                , "users"],
-               'plugins'      => ["admin/plugins/"     , t("Plugins")              , "plugins"],
+               'addons'       => ["admin/addons/"      , t("Addons")               , "addons"],
                'themes'       => ["admin/themes/"      , t("Themes")               , "themes"],
                'features'     => ["admin/features/"    , t("Additional features")  , "features"],
                'dbsync'       => ["admin/dbsync/"      , t('DB updates')           , "dbsync"],
@@ -181,15 +183,15 @@ function admin_content(App $a)
                'deleteitem'   => ["admin/deleteitem/"  , t('Delete Item')          , 'deleteitem'],
        ];
 
-       /* get plugins admin page */
+       /* get addons admin page */
 
        $r = q("SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name`");
-       $aside_tools['plugins_admin'] = [];
+       $aside_tools['addons_admin'] = [];
        foreach ($r as $h) {
-               $plugin = $h['name'];
-               $aside_tools['plugins_admin'][] = ["admin/plugins/" . $plugin, $plugin, "plugin"];
-               // temp plugins with admin
-               $a->plugins_admin[] = $plugin;
+               $addon = $h['name'];
+               $aside_tools['addons_admin'][] = ["admin/addons/" . $addon, $addon, "addon"];
+               // temp addons with admin
+               $a->addons_admin[] = $addon;
        }
 
        $aside_tools['logs'] = ["admin/logs/", t("Logs"), "logs"];
@@ -202,7 +204,7 @@ function admin_content(App $a)
                '$admin' => $aside_tools,
                '$subpages' => $aside_sub,
                '$admtxt' => t('Admin'),
-               '$plugadmtxt' => t('Plugin Features'),
+               '$plugadmtxt' => t('Addon Features'),
                '$logtxt' => t('Logs'),
                '$diagnosticstxt' => t('diagnostics'),
                '$h_pending' => t('User registrations waiting for confirmation'),
@@ -220,8 +222,8 @@ function admin_content(App $a)
                        case 'users':
                                $o = admin_page_users($a);
                                break;
-                       case 'plugins':
-                               $o = admin_page_plugins($a);
+                       case 'addons':
+                               $o = admin_page_addons($a);
                                break;
                        case 'themes':
                                $o = admin_page_themes($a);
@@ -779,7 +781,7 @@ function admin_page_summary(App $a)
                '$platform' => FRIENDICA_PLATFORM,
                '$codename' => FRIENDICA_CODENAME,
                '$build' => Config::get('system', 'build'),
-               '$plugins' => [t('Active plugins'), $a->plugins],
+               '$addons' => [t('Active addons'), $a->addons],
                '$showwarning' => $showwarning,
                '$warningtext' => $warningtext
        ]);
@@ -1723,54 +1725,54 @@ function admin_page_users(App $a)
 }
 
 /**
- * @brief Plugins admin page
+ * @brief Addons admin page
  *
- * This function generates the admin panel page for managing plugins on the
- * friendica node. If a plugin name is given a single page showing the details
+ * This function generates the admin panel page for managing addons on the
+ * friendica node. If an addon name is given a single page showing the details
  * for this addon is generated. If no name is given, a list of available
- * plugins is shown.
+ * addons is shown.
  *
- * The template used for displaying the list of plugins and the details of the
- * plugin are the same as used for the templates.
+ * The template used for displaying the list of addons and the details of the
+ * addon are the same as used for the templates.
  *
  * The returned string returned hulds the HTML code of the page.
  *
  * @param App $a
  * @return string
  */
-function admin_page_plugins(App $a)
+function admin_page_addons(App $a)
 {
        /*
-        * Single plugin
+        * Single addon
         */
        if ($a->argc == 3) {
-               $plugin = $a->argv[2];
-               if (!is_file("addon/$plugin/$plugin.php")) {
+               $addon = $a->argv[2];
+               if (!is_file("addon/$addon/$addon.php")) {
                        notice(t("Item not found."));
                        return '';
                }
 
                if (x($_GET, "a") && $_GET['a'] == "t") {
-                       check_form_security_token_redirectOnErr('/admin/plugins', 'admin_themes', 't');
+                       check_form_security_token_redirectOnErr('/admin/addons', 'admin_themes', 't');
 
-                       // Toggle plugin status
-                       $idx = array_search($plugin, $a->plugins);
+                       // Toggle addon status
+                       $idx = array_search($addon, $a->addons);
                        if ($idx !== false) {
-                               unset($a->plugins[$idx]);
-                               uninstall_plugin($plugin);
-                               info(t("Plugin %s disabled.", $plugin));
+                               unset($a->addons[$idx]);
+                               Addon::uninstall($addon);
+                               info(t("Addon %s disabled.", $addon));
                        } else {
-                               $a->plugins[] = $plugin;
-                               install_plugin($plugin);
-                               info(t("Plugin %s enabled.", $plugin));
+                               $a->addons[] = $addon;
+                               Addon::install($addon);
+                               info(t("Addon %s enabled.", $addon));
                        }
-                       Config::set("system", "addon", implode(", ", $a->plugins));
-                       goaway('admin/plugins');
+                       Config::set("system", "addon", implode(", ", $a->addons));
+                       goaway('admin/addons');
                        return ''; // NOTREACHED
                }
 
-               // display plugin details
-               if (in_array($plugin, $a->plugins)) {
+               // display addon details
+               if (in_array($addon, $a->addons)) {
                        $status = "on";
                        $action = t("Disable");
                } else {
@@ -1779,16 +1781,16 @@ function admin_page_plugins(App $a)
                }
 
                $readme = Null;
-               if (is_file("addon/$plugin/README.md")) {
-                       $readme = Markdown::convert(file_get_contents("addon/$plugin/README.md"), false);
-               } elseif (is_file("addon/$plugin/README")) {
-                       $readme = "<pre>" . file_get_contents("addon/$plugin/README") . "</pre>";
+               if (is_file("addon/$addon/README.md")) {
+                       $readme = Markdown::convert(file_get_contents("addon/$addon/README.md"), false);
+               } elseif (is_file("addon/$addon/README")) {
+                       $readme = "<pre>" . file_get_contents("addon/$addon/README") . "</pre>";
                }
 
                $admin_form = "";
-               if (in_array($plugin, $a->plugins_admin)) {
-                       @require_once("addon/$plugin/$plugin.php");
-                       $func = $plugin . '_plugin_admin';
+               if (in_array($addon, $a->addons_admin)) {
+                       @require_once("addon/$addon/$addon.php");
+                       $func = $addon . '_addon_admin';
                        $func($a, $admin_form);
                }
 
@@ -1796,20 +1798,20 @@ function admin_page_plugins(App $a)
 
                return replace_macros($t, [
                        '$title' => t('Administration'),
-                       '$page' => t('Plugins'),
+                       '$page' => t('Addons'),
                        '$toggle' => t('Toggle'),
                        '$settings' => t('Settings'),
                        '$baseurl' => System::baseUrl(true),
 
-                       '$plugin' => $plugin,
+                       '$addon' => $addon,
                        '$status' => $status,
                        '$action' => $action,
-                       '$info' => get_plugin_info($plugin),
+                       '$info' => Addon::getInfo($addon),
                        '$str_author' => t('Author: '),
                        '$str_maintainer' => t('Maintainer: '),
 
                        '$admin_form' => $admin_form,
-                       '$function' => 'plugins',
+                       '$function' => 'addons',
                        '$screenshot' => '',
                        '$readme' => $readme,
 
@@ -1818,52 +1820,52 @@ function admin_page_plugins(App $a)
        }
 
        /*
-        * List plugins
+        * List addons
         */
        if (x($_GET, "a") && $_GET['a'] == "r") {
-               check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/plugins', 'admin_themes', 't');
-               reload_plugins();
-               info("Plugins reloaded");
-               goaway(System::baseUrl() . '/admin/plugins');
+               check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/addons', 'admin_themes', 't');
+               Addon::reload();
+               info("Addons reloaded");
+               goaway(System::baseUrl() . '/admin/addons');
        }
 
-       $plugins = [];
+       $addons = [];
        $files = glob("addon/*/");
        if (is_array($files)) {
                foreach ($files as $file) {
                        if (is_dir($file)) {
                                list($tmp, $id) = array_map("trim", explode("/", $file));
-                               $info = get_plugin_info($id);
-                               $show_plugin = true;
+                               $info = Addon::getInfo($id);
+                               $show_addon = true;
 
                                // If the addon is unsupported, then only show it, when it is enabled
-                               if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->plugins)) {
-                                       $show_plugin = false;
+                               if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->addons)) {
+                                       $show_addon = false;
                                }
 
                                // Override the above szenario, when the admin really wants to see outdated stuff
                                if (Config::get("system", "show_unsupported_addons")) {
-                                       $show_plugin = true;
+                                       $show_addon = true;
                                }
 
-                               if ($show_plugin) {
-                                       $plugins[] = [$id, (in_array($id, $a->plugins) ? "on" : "off"), $info];
+                               if ($show_addon) {
+                                       $addons[] = [$id, (in_array($id, $a->addons) ? "on" : "off"), $info];
                                }
                        }
                }
        }
 
-       $t = get_markup_template('admin/plugins.tpl');
+       $t = get_markup_template('admin/addons.tpl');
        return replace_macros($t, [
                '$title' => t('Administration'),
-               '$page' => t('Plugins'),
+               '$page' => t('Addons'),
                '$submit' => t('Save Settings'),
-               '$reload' => t('Reload active plugins'),
+               '$reload' => t('Reload active addons'),
                '$baseurl' => System::baseUrl(true),
-               '$function' => 'plugins',
-               '$plugins' => $plugins,
-               '$pcount' => count($plugins),
-               '$noplugshint' => t('There are currently no plugins available on your node. You can find the official plugin repository at %1$s and might find other interesting plugins in the open plugin registry at %2$s', 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
+               '$function' => 'addons',
+               '$addons' => $addons,
+               '$pcount' => count($addons),
+               '$noplugshint' => t('There are currently no addons available on your node. You can find the official addon repository at %1$s and might find other interesting addons in the open addon registry at %2$s', 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
                '$form_security_token' => get_form_security_token("admin_themes"),
        ]);
 }
@@ -1938,7 +1940,7 @@ function rebuild_theme_table($themes)
  * themes is generated.
  *
  * The template used for displaying the list of themes and the details of the
- * themes are the same as used for the plugins.
+ * themes are the same as used for the addons.
  *
  * The returned string contains the HTML code of the admin panel page.
  *
@@ -2006,10 +2008,10 @@ function admin_page_themes(App $a)
                        toggle_theme($themes, $theme, $result);
                        $s = rebuild_theme_table($themes);
                        if ($result) {
-                               install_theme($theme);
+                               Theme::install($theme);
                                info(sprintf('Theme %s enabled.', $theme));
                        } else {
-                               uninstall_theme($theme);
+                               Theme::uninstall($theme);
                                info(sprintf('Theme %s disabled.', $theme));
                        }
 
@@ -2057,7 +2059,7 @@ function admin_page_themes(App $a)
                        $a->page = $orig_page;
                }
 
-               $screenshot = [get_theme_screenshot($theme), t('Screenshot')];
+               $screenshot = [Theme::getScreenshot($theme), t('Screenshot')];
                if (!stristr($screenshot[0], $theme)) {
                        $screenshot = null;
                }
@@ -2069,10 +2071,10 @@ function admin_page_themes(App $a)
                        '$toggle' => t('Toggle'),
                        '$settings' => t('Settings'),
                        '$baseurl' => System::baseUrl(true),
-                       '$plugin' => $theme,
+                       '$addon' => $theme,
                        '$status' => $status,
                        '$action' => $action,
-                       '$info' => get_theme_info($theme),
+                       '$info' => Theme::getInfo($theme),
                        '$function' => 'themes',
                        '$admin_form' => $admin_form,
                        '$str_author' => t('Author: '),
@@ -2084,14 +2086,13 @@ function admin_page_themes(App $a)
                ]);
        }
 
-
        // reload active themes
        if (x($_GET, "a") && $_GET['a'] == "r") {
                check_form_security_token_redirectOnErr(System::baseUrl() . '/admin/themes', 'admin_themes', 't');
                foreach ($themes as $th) {
                        if ($th['allowed']) {
-                               uninstall_theme($th['name']);
-                               install_theme($th['name']);
+                               Theme::uninstall($th['name']);
+                               Theme::install($th['name']);
                        }
                }
                info("Themes reloaded");
@@ -2102,12 +2103,12 @@ function admin_page_themes(App $a)
         * List themes
         */
 
-       $plugins = [];
+       $addons = [];
        foreach ($themes as $th) {
-               $plugins[] = [$th['name'], (($th['allowed']) ? "on" : "off"), get_theme_info($th['name'])];
+               $addons[] = [$th['name'], (($th['allowed']) ? "on" : "off"), Theme::getInfo($th['name'])];
        }
 
-       $t = get_markup_template('admin/plugins.tpl');
+       $t = get_markup_template('admin/addons.tpl');
        return replace_macros($t, [
                '$title'               => t('Administration'),
                '$page'                => t('Themes'),
@@ -2115,7 +2116,7 @@ function admin_page_themes(App $a)
                '$reload'              => t('Reload active themes'),
                '$baseurl'             => System::baseUrl(true),
                '$function'            => 'themes',
-               '$plugins'             => $plugins,
+               '$addons'             => $addons,
                '$pcount'              => count($themes),
                '$noplugshint'         => t('No themes found on the system. They should be placed in %1$s', '<code>/view/themes</code>'),
                '$experimental'        => t('[Experimental]'),
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..318d309e362f420fa888cc2822426f7e2d89c9f5 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;
@@ -25,12 +26,12 @@ function friendica_init(App $a) {
                        $admin = false;
                }
 
-               $visible_plugins = [];
-               if (is_array($a->plugins) && count($a->plugins)) {
+               $visible_addons = [];
+               if (is_array($a->addons) && count($a->addons)) {
                        $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
                        if (DBM::is_result($r)) {
                                foreach($r as $rr) {
-                                       $visible_plugins[] = $rr['name'];
+                                       $visible_addons[] = $rr['name'];
                                }
                        }
                }
@@ -50,7 +51,7 @@ function friendica_init(App $a) {
                $data = [
                        'version'         => FRIENDICA_VERSION,
                        'url'             => System::baseUrl(),
-                       'plugins'         => $visible_plugins,
+                       'addons'         => $visible_addons,
                        'locked_features' => $locked_features,
                        'register_policy' =>  $register_policy[$a->config['register_policy']],
                        'admin'           => $admin,
@@ -83,19 +84,19 @@ function friendica_content(App $a) {
        $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com');
        $o .= '</p>' . PHP_EOL;
 
-       $visible_plugins = [];
-       if (is_array($a->plugins) && count($a->plugins)) {
+       $visible_addons = [];
+       if (is_array($a->addons) && count($a->addons)) {
                $r = q("SELECT * FROM `addon` WHERE `hidden` = 0");
                if (DBM::is_result($r)) {
                        foreach($r as $rr) {
-                               $visible_plugins[] = $rr['name'];
+                               $visible_addons[] = $rr['name'];
                        }
                }
        }
 
-       if (count($visible_plugins)) {
-               $o .= '<p>' . t('Installed plugins/addons/apps:') . '</p>' . PHP_EOL;
-               $sorted = $visible_plugins;
+       if (count($visible_addons)) {
+               $o .= '<p>' . t('Installed addons/addons/apps:') . '</p>' . PHP_EOL;
+               $sorted = $visible_addons;
                $s = '';
                sort($sorted);
                foreach ($sorted as $p) {
@@ -108,7 +109,7 @@ function friendica_content(App $a) {
                }
                $o .= '<div style="margin-left: 25px; margin-right: 25px;">' . $s . '</div>' . PHP_EOL;
        } else {
-               $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>' . PHP_EOL;
+               $o .= '<p>' . t('No installed addons/addons/apps') . '</p>' . PHP_EOL;
        }
 
        $blocklist = Config::get('system', 'blocklist');
@@ -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 bb5b0f1d764b7bed1fb32e1f7ea9b1848c97ccd6..ecf4a8395464216497c603d7a361238cc10f1a1b 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,8 @@ function item_post(App $a) {
                killme();
        }
 
-       call_hooks('post_local_start', $_REQUEST);
+       Addon::callHooks('post_local_start', $_REQUEST);
+
        logger('postvars ' . print_r($_REQUEST,true), LOGGER_DATA);
 
        $api_source = defaults($_REQUEST, 'api_source', false);
@@ -637,7 +639,7 @@ function item_post(App $a) {
        $datarray['object']        = $object;
 
        /*
-        * These fields are for the convenience of plugins...
+        * These fields are for the convenience of addons...
         * 'self' if true indicates the owner is posting on their own wall
         * If parent is 0 it is a top-level post.
         */
@@ -679,10 +681,10 @@ 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.');
+               logger('mod_item: post cancelled by addon.');
                if ($return_path) {
                        goaway($return_path);
                }
@@ -792,7 +794,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..bcaf8e7a931cc590853722580b6dbc31a31a4092 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';
                }
        }
@@ -153,22 +152,22 @@ 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 the addon 'statistics_json' is enabled then disable it and actrivate nodeinfo.
+       if (Addon::isEnabled('statistics_json')) {
                Config::set('system', 'nodeinfo', true);
 
-               $plugin = 'statistics_json';
-               $plugins = Config::get('system', 'addon');
-               $plugins_arr = [];
+               $addon = 'statistics_json';
+               $addons = Config::get('system', 'addon');
+               $addons_arr = [];
 
-               if ($plugins) {
-                       $plugins_arr = explode(',',str_replace(' ', '',$plugins));
+               if ($addons) {
+                       $addons_arr = explode(',',str_replace(' ', '',$addons));
 
-                       $idx = array_search($plugin, $plugins_arr);
+                       $idx = array_search($addon, $addons_arr);
                        if ($idx !== false) {
-                               unset($plugins_arr[$idx]);
-                               uninstall_plugin($plugin);
-                               Config::set('system', 'addon', implode(', ',$plugins_arr));
+                               unset($addons_arr[$idx]);
+                               Addon::uninstall($addon);
+                               Config::set('system', 'addon', implode(', ',$addons_arr));
                        }
                }
        }
index d5da626045e4b6837524da2788084b006ca012ca..783399f578820322b94ccb7e19706e04ccf4e5b5 100644 (file)
@@ -14,8 +14,6 @@ function nogroup_init(App $a)
                return;
        }
 
-       require_once 'include/contact_widgets.php';
-
        if (! x($a->page, 'aside')) {
                $a->page['aside'] = '';
        }
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..48eeec85a2df7419b195440268a36bc6bbce74bd 100644 (file)
@@ -7,7 +7,7 @@
  * If the required arguments aren't present, we'll display a simple form to choose a recipient and a verb.
  * parent is a special argument which let's you attach this activity as a comment to an existing conversation, which
  * may have started with somebody else poking (etc.) somebody, but this isn't necessary. This can be used in the more pokes
- * plugin version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc.
+ * addon version to have entire conversations where Alice poked Bob, Bob fingered Alice, Alice hugged Bob, etc.
  *
  * private creates a private conversation with the recipient. Otherwise your profile's default post privacy is used.
  *
@@ -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 be92885b72938a864d61b6fdd35267ce4d05111b..4989eb87b716539b7436c98e7cfb7a48b5d5b099 100644 (file)
@@ -1,12 +1,13 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Theme;
 
 function pretheme_init(App $a) {
 
        if ($_REQUEST['theme']) {
                $theme = $_REQUEST['theme'];
-               $info = get_theme_info($theme);
+               $info = Theme::getInfo($theme);
                if ($info) {
                        // unfortunately there will be no translation for this string
                        $desc = $info['description'];
@@ -17,7 +18,7 @@ function pretheme_init(App $a) {
                        $version = '';
                        $credits = '';
                }
-               echo json_encode(['img' => get_theme_screenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits]);
+               echo json_encode(['img' => Theme::getScreenshot($theme), 'desc' => $desc, 'version' => $version, 'credits' => $credits]);
        }
 
        killme();
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..a5a4d4ad50781d341b25b47eeb6b34a619bfa938 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;
@@ -76,7 +77,7 @@ function settings_init(App $a)
        ];
 
        $tabs[] =       [
-               'label' => t('Plugins'),
+               'label' => t('Addons'),
                'url'   => 'settings/addon',
                'selected'      => (($a->argc > 1) && ($a->argv[1] === 'addon')?'active':''),
                'accesskey' => 'l',
@@ -169,23 +170,25 @@ function settings_post(App $a)
                                                        icon='%s',
                                                        uid=%d
                                                WHERE client_id='%s'",
-                                               dbesc($key),
-                                               dbesc($secret),
-                                               dbesc($name),
-                                               dbesc($redirect),
-                                               dbesc($icon),
-                                               local_user(),
-                                               dbesc($key));
+                                       dbesc($key),
+                                       dbesc($secret),
+                                       dbesc($name),
+                                       dbesc($redirect),
+                                       dbesc($icon),
+                                       local_user(),
+                                       dbesc($key)
+                               );
                        } else {
                                q("INSERT INTO clients
                                                        (client_id, pw, name, redirect_uri, icon, uid)
                                                VALUES ('%s', '%s', '%s', '%s', '%s',%d)",
-                                               dbesc($key),
-                                               dbesc($secret),
-                                               dbesc($name),
-                                               dbesc($redirect),
-                                               dbesc($icon),
-                                               local_user());
+                                       dbesc($key),
+                                       dbesc($secret),
+                                       dbesc($name),
+                                       dbesc($redirect),
+                                       dbesc($icon),
+                                       local_user()
+                               );
                        }
                }
                goaway(System::baseUrl(true)."/settings/oauth/");
@@ -195,12 +198,12 @@ 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('addon_settings_post', $_POST);
                return;
        }
 
-       if (($a->argc > 1) && ($a->argv[1] == 'connectors')) {
-
+       if (($a->argc > 1) && ($a->argv[1] == 'connectors'))
+       {
                check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
 
                if (x($_POST, 'general-submit')) {
@@ -277,7 +280,7 @@ function settings_post(App $a)
                        }
                }
 
-               call_hooks('connector_settings_post', $_POST);
+               Addon::callHooks('connector_settings_post', $_POST);
                return;
        }
 
@@ -351,7 +354,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 +367,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'];
@@ -748,18 +751,18 @@ function settings_content(App $a)
        if (($a->argc > 1) && ($a->argv[1] === 'addon')) {
                $settings_addons = "";
 
-               $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' ");
+               $r = q("SELECT * FROM `hook` WHERE `hook` = 'addon_settings' ");
                if (!DBM::is_result($r)) {
-                       $settings_addons = t('No Plugin settings configured');
+                       $settings_addons = t('No Addon settings configured');
                }
 
-               call_hooks('plugin_settings', $settings_addons);
+               Addon::callHooks('addon_settings', $settings_addons);
 
 
                $tpl = get_markup_template('settings/addons.tpl');
                $o .= replace_macros($tpl, [
                        '$form_security_token' => get_form_security_token("settings_addon"),
-                       '$title'        => t('Plugin Settings'),
+                       '$title'        => t('Addon Settings'),
                        '$settings_addons' => $settings_addons
                ]);
                return $o;
@@ -799,7 +802,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 +874,7 @@ function settings_content(App $a)
                        '$submit' => t('Save Settings'),
                ]);
 
-               call_hooks('display_settings', $o);
+               Addon::callHooks('display_settings', $o);
                return $o;
        }
 
@@ -1284,7 +1287,7 @@ function settings_content(App $a)
 
        ]);
 
-       call_hooks('settings_form', $o);
+       Addon::callHooks('settings_form', $o);
 
        $o .= '</form>' . "\r\n";
 
index 21eb10ab4803cf5f849a5cda57b148a851e20161..f2c6e074f98efe17dec9860e0b456c0a47e12928 100644 (file)
@@ -5,10 +5,9 @@
  */
 
 use Friendica\App;
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 
-require_once("include/plugin.php");
-
 function statistics_json_init(App $a) {
 
        if (!Config::get("system", "nodeinfo")) {
@@ -28,19 +27,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 ae914ba6050fdaa2de553f9ed14a0b12226b7a28..2a134a9c170be5d12218ef59d888d5b320d61852 100644 (file)
@@ -56,8 +56,8 @@ class App
        public $hooks;
        public $timezone;
        public $interactive = true;
-       public $plugins;
-       public $plugins_admin = [];
+       public $addons;
+       public $addons_admin = [];
        public $apps = [];
        public $identities;
        public $is_mobile = false;
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..47b72dce3dfb08279d9295585042cd8ba0b2e2c0 100644 (file)
@@ -5,11 +5,10 @@
  */
 namespace Friendica\Content;
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 
-require_once 'include/plugin.php';
-
 class Feature
 {
        /**
@@ -36,7 +35,7 @@ class Feature
                }
 
                $arr = ['uid' => $uid, 'feature' => $feature, 'enabled' => $x];
-               call_hooks('isEnabled', $arr);
+               Addon::callHooks('isEnabled', $arr);
                return($arr['enabled']);
        }
 
@@ -150,7 +149,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;
                }
 
diff --git a/src/Core/Addon.php b/src/Core/Addon.php
new file mode 100644 (file)
index 0000000..af3d843
--- /dev/null
@@ -0,0 +1,315 @@
+<?php\r
+/**\r
+ * @file src/Core/Addon.php\r
+ */\r
+namespace Friendica\Core;\r
+\r
+use Friendica\App;\r
+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
+ */\r
+class Addon\r
+{\r
+       /**\r
+        * @brief uninstalls an addon.\r
+        *\r
+        * @param string $addon name of the addon\r
+        * @return boolean\r
+        */\r
+       public static function uninstall($addon)\r
+       {\r
+               logger("Addons: uninstalling " . $addon);\r
+               dba::delete('addon', ['name' => $addon]);\r
+\r
+               @include_once('addon/' . $addon . '/' . $addon . '.php');\r
+               if (function_exists($addon . '_uninstall')) {\r
+                       $func = $addon . '_uninstall';\r
+                       $func();\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @brief installs an addon.\r
+        *\r
+        * @param string $addon name of the addon\r
+        * @return bool\r
+        */\r
+       public static function install($addon)\r
+       {\r
+               // silently fail if addon was removed\r
+\r
+               if (!file_exists('addon/' . $addon . '/' . $addon . '.php')) {\r
+                       return false;\r
+               }\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
+                       $addon_admin = (function_exists($addon."_addon_admin") ? 1 : 0);\r
+\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/' . $addon . '/.hidden')) {\r
+                               dba::update('addon', ['hidden' => true], ['name' => $addon]);\r
+                       }\r
+                       return true;\r
+               } else {\r
+                       logger("Addons: FAILED installing " . $addon);\r
+                       return false;\r
+               }\r
+       }\r
+\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 = dba::select('addon', [], ['installed' => 1]);\r
+                       if (DBM::is_result($r)) {\r
+                               $installed = $r;\r
+                       } else {\r
+                               $installed = [];\r
+                       }\r
+\r
+                       $addon_list = explode(',', $addons);\r
+\r
+                       if (count($addon_list)) {\r
+                               foreach ($addon_list as $addon) {\r
+                                       $addon = trim($addon);\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'] == $addon) && ($i['timestamp'] != $t)) {\r
+                                                               logger('Reloading addon: ' . $i['name']);\r
+                                                               @include_once($fname);\r
+\r
+                                                               if (function_exists($addon . '_uninstall')) {\r
+                                                                       $func = $addon . '_uninstall';\r
+                                                                       $func();\r
+                                                               }\r
+                                                               if (function_exists($addon . '_install')) {\r
+                                                                       $func = $addon . '_install';\r
+                                                                       $func();\r
+                                                               }\r
+                                                               dba::update('addon', ['timestamp' => $t], ['id' => $i['id']]);\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @brief check if addon is enabled\r
+        *\r
+        * @param string $addon\r
+        * @return boolean\r
+        */\r
+       public static function isEnabled($addon)\r
+       {\r
+               return dba::exists('addon', ['installed' => true, 'name' => $addon]);\r
+       }\r
+\r
+\r
+       /**\r
+        * @brief registers a hook.\r
+        *\r
+        * @param string $hook the name of the hook\r
+        * @param string $file the name of the file that hooks into\r
+        * @param string $function the name of the function that the hook will call\r
+        * @param int $priority A priority (defaults to 0)\r
+        * @return mixed|bool\r
+        */\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
+                       return true;\r
+               }\r
+\r
+               $r = dba::insert('hook', ['hook' => $hook, 'file' => $file, 'function' => $function, 'priority' => $priority]);\r
+\r
+               return $r;\r
+       }\r
+\r
+       /**\r
+        * @brief unregisters a hook.\r
+        *\r
+        * @param string $hook the name of the hook\r
+        * @param string $file the name of the file that hooks into\r
+        * @param string $function the name of the function that the hook called\r
+        * @return array\r
+        */\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
+        * Load hooks\r
+        */\r
+       public static function loadHooks()\r
+       {\r
+               $a = get_app();\r
+               $a->hooks = [];\r
+               $r = dba::select('hook', ['hook', 'file', 'function'], [], ['order' => ['priority' => 'desc', 'file']]);\r
+\r
+               while ($rr = dba::fetch($r)) {\r
+                       if (! array_key_exists($rr['hook'], $a->hooks)) {\r
+                               $a->hooks[$rr['hook']] = [];\r
+                       }\r
+                       $a->hooks[$rr['hook']][] = [$rr['file'],$rr['function']];\r
+               }\r
+               dba::close($r);\r
+       }\r
+\r
+       /**\r
+        * @brief Calls a hook.\r
+        *\r
+        * Use this function when you want to be able to allow a hook to manipulate\r
+        * the provided data.\r
+        *\r
+        * @param string $name of the hook to call\r
+        * @param string|array &$data to transmit to the callback handler\r
+        */\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
+                               self::callSingleHook($a, $name, $hook, $data);\r
+                       }\r
+               }\r
+       }\r
+\r
+       /**\r
+        * @brief Calls a single hook.\r
+        *\r
+        * @param string $name of the hook to call\r
+        * @param array $hook Hook data\r
+        * @param string|array &$data to transmit to the callback handler\r
+        */\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
+               }\r
+\r
+               @include_once($hook[0]);\r
+               if (function_exists($hook[1])) {\r
+                       $func = $hook[1];\r
+                       $func($a, $data);\r
+               } else {\r
+                       // remove orphan hooks\r
+                       $condition = ['hook' => $name, 'file' => $hook[0], 'function' => $hook[1]];\r
+                       dba::delete('hook', $condition);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * check if an app_menu hook exist for addon $name.\r
+        * Return true if the addon is an app\r
+        */\r
+       public static function isApp($name)\r
+       {\r
+               $a = get_app();\r
+\r
+               if (is_array($a->hooks) && (array_key_exists('app_menu', $a->hooks))) {\r
+                       foreach ($a->hooks['app_menu'] as $hook) {\r
+                               if ($hook[0] == 'addon/'.$name.'/'.$name.'.php') {\r
+                                       return true;\r
+                               }\r
+                       }\r
+               }\r
+\r
+               return false;\r
+       }\r
+\r
+       /**\r
+        * @brief Parse addon comment in search of addon infos.\r
+        *\r
+        * like\r
+        * \code\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 $addon the name of the addon\r
+       * @return array with the addon information\r
+       */\r
+\r
+       public static function getInfo($addon)\r
+       {\r
+               $a = get_app();\r
+\r
+               $info=[\r
+                       'name' => $addon,\r
+                       'description' => "",\r
+                       'author' => [],\r
+                       'version' => "",\r
+                       'status' => ""\r
+               ];\r
+\r
+               if (!is_file("addon/$addon/$addon.php")) {\r
+                       return $info;\r
+               }\r
+\r
+               $stamp1 = microtime(true);\r
+               $f = file_get_contents("addon/$addon/$addon.php");\r
+               $a->save_timestamp($stamp1, "file");\r
+\r
+               $r = preg_match("|/\*.*\*/|msU", $f, $m);\r
+\r
+               if ($r) {\r
+                       $ll = explode("\n", $m[0]);\r
+                       foreach ($ll as $l) {\r
+                               $l = trim($l, "\t\n\r */");\r
+                               if ($l != "") {\r
+                                       list($k,$v) = array_map("trim", explode(":", $l, 2));\r
+                                       $k= strtolower($k);\r
+                                       if ($k == "author") {\r
+                                               $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);\r
+                                               if ($r) {\r
+                                                       $info['author'][] = ['name'=>$m[1], 'link'=>$m[2]];\r
+                                               } else {\r
+                                                       $info['author'][] = ['name'=>$v];\r
+                                               }\r
+                                       } else {\r
+                                               if (array_key_exists($k, $info)) {\r
+                                                       $info[$k]=$v;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+               return $info;\r
+       }\r
+}\r
diff --git a/src/Core/Theme.php b/src/Core/Theme.php
new file mode 100644 (file)
index 0000000..9e7c632
--- /dev/null
@@ -0,0 +1,189 @@
+<?php\r
+/**\r
+ * @file src/Core/Theme.php\r
+ */\r
+namespace Friendica\Core;\r
+\r
+use Friendica\Core\System;\r
+\r
+require_once 'boot.php';\r
+\r
+/**\r
+ * Some functions to handle themes\r
+ */\r
+class Theme\r
+{\r
+    /**\r
+     * @brief Parse theme comment in search of theme infos.\r
+     *\r
+     * like\r
+     * \code\r
+     * ..* Name: My Theme\r
+     *   * Description: My Cool Theme\r
+     * . * Version: 1.2.3\r
+     *   * Author: John <profile url>\r
+     *   * Maintainer: Jane <profile url>\r
+     *   *\r
+     * \endcode\r
+     * @param string $theme the name of the theme\r
+     * @return array\r
+     */\r
+\r
+    public static function getInfo($theme)\r
+    {\r
+        $info=[\r
+            'name' => $theme,\r
+            'description' => "",\r
+            'author' => [],\r
+            'maintainer' => [],\r
+            'version' => "",\r
+            'credits' => "",\r
+            'experimental' => false,\r
+            'unsupported' => false\r
+        ];\r
+\r
+        if (file_exists("view/theme/$theme/experimental"))\r
+            $info['experimental'] = true;\r
+        if (file_exists("view/theme/$theme/unsupported"))\r
+            $info['unsupported'] = true;\r
+\r
+        if (!is_file("view/theme/$theme/theme.php")) return $info;\r
+\r
+        $a = get_app();\r
+        $stamp1 = microtime(true);\r
+        $f = file_get_contents("view/theme/$theme/theme.php");\r
+        $a->save_timestamp($stamp1, "file");\r
+\r
+        $r = preg_match("|/\*.*\*/|msU", $f, $m);\r
+\r
+        if ($r) {\r
+            $ll = explode("\n", $m[0]);\r
+            foreach ( $ll as $l ) {\r
+                $l = trim($l,"\t\n\r */");\r
+                if ($l != "") {\r
+                    list($k, $v) = array_map("trim", explode(":", $l, 2));\r
+                    $k= strtolower($k);\r
+                    if ($k == "author") {\r
+\r
+                        $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);\r
+                        if ($r) {\r
+                            $info['author'][] = ['name'=>$m[1], 'link'=>$m[2]];\r
+                        } else {\r
+                            $info['author'][] = ['name'=>$v];\r
+                        }\r
+                    } elseif ($k == "maintainer") {\r
+                        $r=preg_match("|([^<]+)<([^>]+)>|", $v, $m);\r
+                        if ($r) {\r
+                            $info['maintainer'][] = ['name'=>$m[1], 'link'=>$m[2]];\r
+                        } else {\r
+                            $info['maintainer'][] = ['name'=>$v];\r
+                        }\r
+                    } else {\r
+                        if (array_key_exists($k, $info)) {\r
+                            $info[$k] = $v;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return $info;\r
+    }\r
+\r
+    /**\r
+     * @brief Returns the theme's screenshot.\r
+     *\r
+     * The screenshot is expected as view/theme/$theme/screenshot.[png|jpg].\r
+     *\r
+     * @param sring $theme The name of the theme\r
+     * @return string\r
+     */\r
+    public static function getScreenshot($theme)\r
+    {\r
+        $exts = ['.png','.jpg'];\r
+        foreach ($exts as $ext) {\r
+            if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {\r
+                return(System::baseUrl() . '/view/theme/' . $theme . '/screenshot' . $ext);\r
+            }\r
+        }\r
+        return(System::baseUrl() . '/images/blank.png');\r
+    }\r
+\r
+    // install and uninstall theme\r
+    public static function uninstall($theme)\r
+    {\r
+        logger("Addons: uninstalling theme " . $theme);\r
+\r
+        include_once("view/theme/$theme/theme.php");\r
+        if (function_exists("{$theme}_uninstall")) {\r
+            $func = "{$theme}_uninstall";\r
+            $func();\r
+        }\r
+    }\r
+\r
+    public static function install($theme)\r
+    {\r
+        // silently fail if theme was removed\r
+\r
+        if (! file_exists("view/theme/$theme/theme.php")) {\r
+            return false;\r
+        }\r
+\r
+        logger("Addons: installing theme $theme");\r
+\r
+        include_once("view/theme/$theme/theme.php");\r
+\r
+        if (function_exists("{$theme}_install")) {\r
+            $func = "{$theme}_install";\r
+            $func();\r
+            return true;\r
+        } else {\r
+            logger("Addons: FAILED installing theme $theme");\r
+            return false;\r
+        }\r
+\r
+    }\r
+\r
+    /**\r
+     * @brief Get the full path to relevant theme files by filename\r
+     *\r
+     * This function search in the theme directory (and if not present in global theme directory)\r
+     * if there is a directory with the file extension and  for a file with the given\r
+     * filename.\r
+     *\r
+     * @param string $file Filename\r
+     * @param string $root Full root path\r
+     * @return string Path to the file or empty string if the file isn't found\r
+     */\r
+    public static function getPathForFile($file, $root = '')\r
+    {\r
+        $file = basename($file);\r
+\r
+        // Make sure $root ends with a slash / if it's not blank\r
+        if ($root !== '' && $root[strlen($root)-1] !== '/') {\r
+            $root = $root . '/';\r
+        }\r
+        $theme_info = get_app()->theme_info;\r
+        if (is_array($theme_info) && array_key_exists('extends',$theme_info)) {\r
+            $parent = $theme_info['extends'];\r
+        } else {\r
+            $parent = 'NOPATH';\r
+        }\r
+        $theme = current_theme();\r
+        $thname = $theme;\r
+        $ext = substr($file,strrpos($file,'.')+1);\r
+        $paths = [\r
+            "{$root}view/theme/$thname/$ext/$file",\r
+            "{$root}view/theme/$parent/$ext/$file",\r
+            "{$root}view/$ext/$file",\r
+        ];\r
+        foreach ($paths as $p) {\r
+            // strpos() is faster than strstr when checking if one string is in another (http://php.net/manual/en/function.strstr.php)\r
+            if (strpos($p,'NOPATH') !== false) {\r
+                continue;\r
+            } elseif (file_exists($p)) {\r
+                return $p;\r
+            }\r
+        }\r
+        return '';\r
+    }\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 973098d460ae717d258458ae94235ec693818285..3f4614b6c7fd7e073c436f530d07a7ceef2b86b3 100644 (file)
@@ -661,7 +661,7 @@ class DBStructure {
                $database = [];
 
                $database["addon"] = [
-                               "comment" => "registered plugins",
+                               "comment" => "registered addons",
                                "fields" => [
                                                "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
                                                "name" => ["type" => "varchar(190)", "not null" => "1", "default" => "", "comment" => ""],
@@ -1081,7 +1081,7 @@ class DBStructure {
                                                ]
                                ];
                $database["hook"] = [
-                               "comment" => "plugin hook registry",
+                               "comment" => "addon hook registry",
                                "fields" => [
                                                "id" => ["type" => "int", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => ""],
                                                "hook" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
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 8e78dc68fd00a5b964206187aa32f97a94a1ebe8..d125ff8fe24267ff2b16d7430432c9bddbc46740 100644 (file)
@@ -969,7 +969,7 @@ class GContact
        /**
         * @brief Fetches users of given GNU Social server
         *
-        * If the "Statistics" plugin is enabled (See http://gstools.org/ for details) we query user data with this.
+        * If the "Statistics" addon is enabled (See http://gstools.org/ for details) we query user data with this.
         *
         * @param string $server Server address
         * @return void
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..862a9d408428535f5cf85a5e841ff87636314865 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;
@@ -26,7 +27,6 @@ require_once 'include/enotify.php';
 require_once 'include/network.php';
 require_once 'library/openid.php';
 require_once 'include/pgettext.php';
-require_once 'include/plugin.php';
 require_once 'include/text.php';
 /**
  * @brief This class handles User related functions
@@ -390,7 +390,7 @@ class User
                        $photo = avatar_img($email);
                }
 
-               // unless there is no avatar-plugin loaded
+               // unless there is no avatar-addon loaded
                if (strlen($photo)) {
                        $photo_failure = false;
 
@@ -433,7 +433,7 @@ class User
                        }
                }
 
-               call_hooks('register_account', $uid);
+               Addon::callHooks('register_account', $uid);
 
                $return['user'] = $user;
                return $return;
@@ -532,7 +532,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..d2388832695e2a8e5d5b2ee266b8c93409c21331 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;
@@ -88,11 +89,11 @@ class Login extends BaseModule
                        ];
 
                        /*
-                        * A plugin indicates successful login by setting 'authenticated' to non-zero value and returning a user record
-                        * 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.
+                        * An addon indicates successful login by setting 'authenticated' to non-zero value and returning a user record
+                        * Addons should never set 'authenticated' except to indicate success - as hooks may be chained
+                        * and later addons should not interfere with an earlier one that succeeded.
                         */
-                       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..49483fe272a1e76d53744a475edba745e7b47bf5 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;
@@ -15,7 +16,6 @@ use OAuthSignatureMethod_PLAINTEXT;
 use OAuthSignatureMethod_HMAC_SHA1;
 
 require_once "library/OAuth1.php";
-require_once "include/plugin.php";
 
 /**
  * @brief OAuth protocol
@@ -72,6 +72,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..59258a0aec7ccc4fbafd988825504922e72460ac 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'];
 
@@ -758,10 +759,10 @@ class Post extends BaseObject
                        $qc = $qcomment = null;
 
                        /*
-                        * Hmmm, code depending on the presence of a particular plugin?
+                        * Hmmm, code depending on the presence of a particular addon?
                         * This should be better if done by a hook
                         */
-                       if (in_array('qcomment', $a->plugins)) {
+                       if (in_array('qcomment', $a->addons)) {
                                $qc = ((local_user()) ? PConfig::get(local_user(), 'qcomment', 'words') : null);
                                $qcomment = (($qc) ? explode("\n", $qc) : null);
                        }
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..3cfc39e192e89576e5527b520c746a8f4f70de85 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\Core\Addon;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
 use Friendica\Core\Worker;
@@ -81,26 +82,24 @@ function update_1189() {
 
 function update_1191() {
 
-       require_once 'include/plugin.php';
-
        Config::set('system', 'maintenance', 1);
 
-       if (plugin_enabled('forumlist')) {
-               $plugin = 'forumlist';
-               $plugins = Config::get('system','addon');
-               $plugins_arr = [];
+       if (Addon::isEnabled('forumlist')) {
+               $addon = 'forumlist';
+               $addons = Config::get('system', 'addon');
+               $addons_arr = [];
 
-               if ($plugins) {
-                       $plugins_arr = explode(",",str_replace(" ", "",$plugins));
+               if ($addons) {
+                       $addons_arr = explode(",",str_replace(" ", "", $addons));
 
-                       $idx = array_search($plugin, $plugins_arr);
+                       $idx = array_search($addon, $addons_arr);
                        if ($idx !== false){
-                               unset($plugins_arr[$idx]);
+                               unset($addons_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));
+                               Config::set('system','addon', implode(", ", $addons_arr));
                        }
                }
        }
index 2b6e39cdc13f2ec6f4d54080e404e797456c5af8..eb6471ec216fbbbcd885abb862954dcb843d466c 100644 (file)
@@ -386,12 +386,12 @@ $a->strings["Contacts who are not members of a group"] = "";
 $a->strings["Theme settings updated."] = "";
 $a->strings["Site"] = "";
 $a->strings["Users"] = "";
-$a->strings["Plugins"] = "";
+$a->strings["Addons"] = "";
 $a->strings["Themes"] = "";
 $a->strings["DB updates"] = "";
 $a->strings["Logs"] = "";
 $a->strings["Admin"] = "";
-$a->strings["Plugin Features"] = "";
+$a->strings["Addon Features"] = "";
 $a->strings["User registrations waiting for confirmation"] = "";
 $a->strings["Normal Account"] = "";
 $a->strings["Soapbox Account"] = "";
@@ -405,7 +405,7 @@ $a->strings["Summary"] = "";
 $a->strings["Registered users"] = "";
 $a->strings["Pending registrations"] = "";
 $a->strings["Version"] = "";
-$a->strings["Active plugins"] = "";
+$a->strings["Active addons"] = "";
 $a->strings["Can not parse base url. Must have at least <scheme>://<domain>"] = "";
 $a->strings["Site settings updated."] = "";
 $a->strings["No special theme for mobile devices"] = "";
@@ -579,8 +579,8 @@ $a->strings["Name of the new user."] = "";
 $a->strings["Nickname"] = "";
 $a->strings["Nickname of the new user."] = "";
 $a->strings["Email address of the new user."] = "";
-$a->strings["Plugin %s disabled."] = "";
-$a->strings["Plugin %s enabled."] = "";
+$a->strings["Addon %s disabled."] = "";
+$a->strings["Addon %s enabled."] = "";
 $a->strings["Disable"] = "";
 $a->strings["Enable"] = "";
 $a->strings["Toggle"] = "";
@@ -812,8 +812,8 @@ $a->strings["Connected Apps"] = "";
 $a->strings["Client key starts with"] = "";
 $a->strings["No name"] = "";
 $a->strings["Remove authorization"] = "";
-$a->strings["No Plugin settings configured"] = "";
-$a->strings["Plugin Settings"] = "";
+$a->strings["No Addon settings configured"] = "";
+$a->strings["Addon Settings"] = "";
 $a->strings["Off"] = "";
 $a->strings["On"] = "";
 $a->strings["Additional Features"] = "";
@@ -1128,8 +1128,8 @@ $a->strings["running at web location"] = "";
 $a->strings["Please visit <a href=\"http://friendica.com\">Friendica.com</a> to learn more about the Friendica project."] = "";
 $a->strings["Bug reports and issues: please visit"] = "";
 $a->strings["Suggestions, praise, donations, etc. - please email \"Info\" at Friendica - dot com"] = "";
-$a->strings["Installed plugins/addons/apps:"] = "";
-$a->strings["No installed plugins/addons/apps"] = "";
+$a->strings["Installed addons/addons/apps:"] = "";
+$a->strings["No installed addons/addons/apps"] = "";
 $a->strings["Authorize application connection"] = "";
 $a->strings["Return to your app and insert this Securty Code:"] = "";
 $a->strings["Please login to continue."] = "";
diff --git a/view/templates/admin/addons.tpl b/view/templates/admin/addons.tpl
new file mode 100644 (file)
index 0000000..297e132
--- /dev/null
@@ -0,0 +1,22 @@
+
+<div id='adminpage'>
+       <h1>{{$title}} - {{$page}}</h1>
+               {{if $pcount eq 0}}
+                   <div class="error-message">
+                   {{$noplugshint}}
+                   </div>
+               {{else}}
+               <a class="btn" href="{{$baseurl}}/admin/{{$function}}?a=r&amp;t={{$form_security_token}}">{{$reload}}</a>
+               <ul id='pluginslist'>
+               {{foreach $addons as $p}}
+                       <li class='plugin {{$p.1}}'>
+                               <a class='toggleplugin' href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}?a=t&amp;t={{$form_security_token}}' title="{{if $p.1==on}}Disable{{else}}Enable{{/if}}" ><span class='icon {{$p.1}}'></span></a>
+                               <a href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}'><span class='name'>{{$p.2.name}}</span></a> - <span class="version">{{$p.2.version}}</span>
+                               {{if $p.2.experimental}} {{$experimental}} {{/if}}{{if $p.2.unsupported}} {{$unsupported}} {{/if}}
+
+                                       <div class='desc'>{{$p.2.description}}</div>
+                       </li>
+               {{/foreach}}
+               </ul>
+               {{/if}}
+</div>
index 5c9cce0d0c58c408f8e7f62af9306ec3779926ee..0049394bae5a8283e4cc052ebe7b7e9cc529dd04 100644 (file)
@@ -26,9 +26,9 @@
 {{/if}}
 
 
-{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
+{{if $admin.addons_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
 <ul class='admin linklist'>
-       {{foreach $admin.plugins_admin as $l}}
+       {{foreach $admin.addons_admin as $l}}
        <li class='admin link button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
        {{/foreach}}
 </ul>
diff --git a/view/templates/admin/plugins.tpl b/view/templates/admin/plugins.tpl
deleted file mode 100644 (file)
index 75565dd..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-<div id='adminpage'>
-       <h1>{{$title}} - {{$page}}</h1>
-               {{if $pcount eq 0}}
-                   <div class="error-message">
-                   {{$noplugshint}}
-                   </div>
-               {{else}}
-               <a class="btn" href="{{$baseurl}}/admin/{{$function}}?a=r&amp;t={{$form_security_token}}">{{$reload}}</a>
-               <ul id='pluginslist'>
-               {{foreach $plugins as $p}}
-                       <li class='plugin {{$p.1}}'>
-                               <a class='toggleplugin' href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}?a=t&amp;t={{$form_security_token}}' title="{{if $p.1==on}}Disable{{else}}Enable{{/if}}" ><span class='icon {{$p.1}}'></span></a>
-                               <a href='{{$baseurl}}/admin/{{$function}}/{{$p.0}}'><span class='name'>{{$p.2.name}}</span></a> - <span class="version">{{$p.2.version}}</span>
-                               {{if $p.2.experimental}} {{$experimental}} {{/if}}{{if $p.2.unsupported}} {{$unsupported}} {{/if}}
-
-                                       <div class='desc'>{{$p.2.description}}</div>
-                       </li>
-               {{/foreach}}
-               </ul>
-               {{/if}}
-</div>
index 9def8fc6050575fe33526f80b4132d7a29202282..cbeb4171e871193b1c57bab02b5d5d73a8c7424b 100644 (file)
@@ -2,7 +2,7 @@
 <div id='adminpage'>
        <h1>{{$title}} - {{$page}}</h1>
        
-       <p><span class='toggleplugin icon {{$status}}'></span> {{$info.name}} - {{$info.version}} : <a href="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/?a=t&amp;t={{$form_security_token}}">{{$action}}</a></p>
+       <p><span class='toggleplugin icon {{$status}}'></span> {{$info.name}} - {{$info.version}} : <a href="{{$baseurl}}/admin/{{$function}}/{{$addon}}/?a=t&amp;t={{$form_security_token}}">{{$action}}</a></p>
        <p>{{$info.description}}</p>
        
        <p class="author">{{$str_author}}
@@ -23,7 +23,7 @@
 
        {{if $admin_form}}
        <h3>{{$settings}}</h3>
-       <form method="post" action="{{$baseurl}}/admin/{{$function}}/{{$plugin}}/">
+       <form method="post" action="{{$baseurl}}/admin/{{$function}}/{{$addon}}/">
                {{$admin_form}}
        </form>
        {{/if}}
index e650144134960f583579228821372ada5fe20461..6b1ebe40ea2513861584c6fda2dad4d369b46bf5 100644 (file)
 
 
        <dl>
-               <dt>{{$plugins.0}}</dt>
+               <dt>{{$addons.0}}</dt>
                
-               {{foreach $plugins.1 as $p}}
-                       <dd><a href="/admin/plugins/{{$p}}/">{{$p}}</a></dd>
+               {{foreach $addons.1 as $p}}
+                       <dd><a href="/admin/addons/{{$p}}/">{{$p}}</a></dd>
                {{/foreach}}
                
        </dl>
index 8e2c5d44780129bbe25c8345b9932403f5f310ba..75ada9b0b2caeba72ecdab79c4b59b458804203c 100644 (file)
@@ -1123,7 +1123,7 @@ input#dfrn-url {
        /* add ellipsis on text overflow               */
        /* this work on safari, opera, ie, chrome.     */
        /* firefox users have to wait support or we    */
-       /* can use a jquery plugin http://bit.ly/zJskg */
+       /* can use a jquery addon http://bit.ly/zJskg */
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
        width: 100%;
@@ -2550,7 +2550,7 @@ aside input[type='text'] {
 }
 
 
-#plugin-settings-link, #account-settings-link {
+#addon-settings-link, #account-settings-link {
        margin-bottom: 10px;
 }
 
@@ -3082,10 +3082,10 @@ aside input[type='text'] {
        text-align: right;
 }
 
-#adminpage #pluginslist {
+#adminpage #addonslist {
        margin: 0px; padding: 0px;
 }
-#adminpage .plugin {
+#adminpage .addon {
        list-style: none;
        display: block;
        border: 1px solid #888888;
@@ -3093,8 +3093,8 @@ aside input[type='text'] {
        margin-bottom: 5px;
        clear: left;
 }
-#adminpage .plugin .desc { margin-left: 2.5em;}
-#adminpage .toggleplugin {
+#adminpage .addon .desc { margin-left: 2.5em;}
+#adminpage .toggleaddon {
        float:left;
        margin-right: 1em;
 }
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 a90ec69163a92fba3f332a20adca3bdb17bfea87..186b87695ac36a0919f09e4876c5da288ccce7da 100644 (file)
        {{/if}}
 </div>
 
-{{if $admin.plugins_admin}}
+{{if $admin.addons_admin}}
 <div class="widget">
        <h3>{{$plugadmtxt}}</h3>
        <ul role="menu">
-               {{foreach $admin.plugins_admin as $name => $item}}
+               {{foreach $admin.addons_admin as $name => $item}}
                <li role="menuitem" class="{{$item.2}}">
                        <a href="{{$item.0}}" {{if $item.accesskey}}accesskey="{{$item.accesskey}}"{{/if}}>
                                {{$item.1}}
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 7c5d2c7609d09f26a2a1beb943fecf24debd44a1..632e44b1da946e2d8c76339969320702d575dc3a 100644 (file)
@@ -1385,7 +1385,7 @@ input#dfrn-url {
        /* add ellipsis on text overflow               */\r
        /* this work on safari, opera, ie, chrome.     */\r
        /* firefox users have to wait support or we    */\r
-       /* can use a jquery plugin http://bit.ly/zJskg */\r
+       /* can use a jquery addon http://bit.ly/zJskg */\r
        text-overflow: ellipsis;\r
        -o-text-overflow: ellipsis;\r
        width: 100%;\r
@@ -3162,7 +3162,7 @@ aside input[type='text'] {
 }\r
 \r
 \r
-#plugin-settings-link, #account-settings-link {\r
+#addon-settings-link, #account-settings-link {\r
        margin-bottom: 10px;\r
 }\r
 \r
@@ -3776,10 +3776,10 @@ aside input[type='text'] {
        text-align: right;\r
 }\r
 \r
-#adminpage #pluginslist {\r
+#adminpage #addonslist {\r
        margin: 0px; padding: 0px;\r
 }\r
-#adminpage .plugin {\r
+#adminpage .addon {\r
        list-style: none;\r
        display: block;\r
        border: 1px solid #888888;\r
@@ -3787,8 +3787,8 @@ aside input[type='text'] {
        margin-bottom: 5px;\r
        clear: left;\r
 }\r
-#adminpage .plugin .desc { margin-left: 2.5em;}\r
-#adminpage .toggleplugin {\r
+#adminpage .addon .desc { margin-left: 2.5em;}\r
+#adminpage .toggleaddon {\r
        float:left;\r
        margin-right: 1em;\r
 }\r
index 74b6cd5f69d36fed139eff7af39edd46a33c7119..74e92dab2a2e66281b92442656ce5a9edb693bda 100644 (file)
@@ -4,7 +4,7 @@
 <ul class='admin linklist'>
        <li class='admin button {{$admin.site.2}}'><a href='{{$admin.site.0}}'>{{$admin.site.1}}</a></li>
        <li class='admin button {{$admin.users.2}}'><a href='{{$admin.users.0}}'>{{$admin.users.1}}</a><span id='pending-update' title='{{$h_pending}}'></span></li>
-       <li class='admin button {{$admin.plugins.2}}'><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
+       <li class='admin button {{$admin.addons.2}}'><a href='{{$admin.addons.0}}'>{{$admin.addons.1}}</a></li>
        <li class='admin button {{$admin.themes.2}}'><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
        <li class='admin button {{$admin.dbsync.2}}'><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
 </ul>
@@ -17,9 +17,9 @@
 {{/if}}
 
 
-{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
+{{if $admin.addons_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
 <ul class='admin linklist'>
-       {{foreach $admin.plugins_admin as $l}}
+       {{foreach $admin.addons_admin as $l}}
        <li class='admin button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
        {{/foreach}}
 </ul>
index 9b65da9c8c81251e0d10aad3f933f21699448088..3ed83e28b94a5b127762cec7d1258aaf50e2d8b9 100644 (file)
@@ -1365,7 +1365,7 @@ input#dfrn-url {
        /* add ellipsis on text overflow               */
        /* this work on safari, opera, ie, chrome.     */
        /* firefox users have to wait support or we    */
-       /* can use a jquery plugin http://bit.ly/zJskg */
+       /* can use a jquery addon http://bit.ly/zJskg */
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
        width: 100%;
@@ -2964,7 +2964,7 @@ aside input[type='text'] {
 }
 
 
-#plugin-settings-link, #account-settings-link {
+#addon-settings-link, #account-settings-link {
        margin-bottom: 10px;
 }
 
@@ -3584,10 +3584,10 @@ aside input[type='text'] {
        text-align: right;
 }
 
-#adminpage #pluginslist {
+#adminpage #addonslist {
        margin: 0px; padding: 0px;
 }
-#adminpage .plugin {
+#adminpage .addon {
        list-style: none;
        display: block;
        border: 1px solid #888888;
@@ -3595,8 +3595,8 @@ aside input[type='text'] {
        margin-bottom: 5px;
        clear: left;
 }
-#adminpage .plugin .desc { margin-left: 2.5em;}
-#adminpage .toggleplugin {
+#adminpage .addon .desc { margin-left: 2.5em;}
+#adminpage .toggleaddon {
        float:left;
        margin-right: 1em;
 }
index 74b6cd5f69d36fed139eff7af39edd46a33c7119..74e92dab2a2e66281b92442656ce5a9edb693bda 100644 (file)
@@ -4,7 +4,7 @@
 <ul class='admin linklist'>
        <li class='admin button {{$admin.site.2}}'><a href='{{$admin.site.0}}'>{{$admin.site.1}}</a></li>
        <li class='admin button {{$admin.users.2}}'><a href='{{$admin.users.0}}'>{{$admin.users.1}}</a><span id='pending-update' title='{{$h_pending}}'></span></li>
-       <li class='admin button {{$admin.plugins.2}}'><a href='{{$admin.plugins.0}}'>{{$admin.plugins.1}}</a></li>
+       <li class='admin button {{$admin.addons.2}}'><a href='{{$admin.addons.0}}'>{{$admin.addons.1}}</a></li>
        <li class='admin button {{$admin.themes.2}}'><a href='{{$admin.themes.0}}'>{{$admin.themes.1}}</a></li>
        <li class='admin button {{$admin.dbsync.2}}'><a href='{{$admin.dbsync.0}}'>{{$admin.dbsync.1}}</a></li>
 </ul>
@@ -17,9 +17,9 @@
 {{/if}}
 
 
-{{if $admin.plugins_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
+{{if $admin.addons_admin}}<h4>{{$plugadmtxt}}</h4>{{/if}}
 <ul class='admin linklist'>
-       {{foreach $admin.plugins_admin as $l}}
+       {{foreach $admin.addons_admin as $l}}
        <li class='admin button {{$l.2}}'><a href='{{$l.0}}'>{{$l.1}}</a></li>
        {{/foreach}}
 </ul>
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 3e8fe754b88199a395f28ab31ff7ae1eee058187..36a0a6aee7f0830602bcb203c13db141d02fe9f6 100644 (file)
@@ -64,7 +64,7 @@
 .icon.unlock {
   background-image: url("../../../images/icons/22/unlock.png");
 }
-.icon.plugin {
+.icon.addon {
   background-image: url("../../../images/icons/22/plugin.png");
 }
 .icon.type-unkn {
 .icon.s10.unlock {
   background-image: url("../../../images/icons/10/unlock.png");
 }
-.icon.s10.plugin {
+.icon.s10.addon {
   background-image: url("../../../images/icons/10/plugin.png");
 }
 .icon.s10.type-unkn {
 .icon.s16.unlock {
   background-image: url("../../../images/icons/16/unlock.png");
 }
-.icon.s16.plugin {
+.icon.s16.addon {
   background-image: url("../../../images/icons/16/plugin.png");
 }
 .icon.s16.type-unkn {
 .icon.s22.unlock {
   background-image: url("../../../images/icons/22/unlock.png");
 }
-.icon.s22.plugin {
+.icon.s22.addon {
   background-image: url("../../../images/icons/22/plugin.png");
 }
 .icon.s22.type-unkn {
 .icon.s48.unlock {
   background-image: url("../../../images/icons/48/unlock.png");
 }
-.icon.s48.plugin {
+.icon.s48.addon {
   background-image: url("../../../images/icons/48/plugin.png");
 }
 .icon.s48.type-unkn {
@@ -2515,11 +2515,11 @@ footer {
   clear: left;
   text-align: right;
 }
-#adminpage #pluginslist {
+#adminpage #addonslist {
   margin: 0;
   padding: 0;
 }
-#adminpage .plugin {
+#adminpage .addon {
   list-style: none;
   display: block;
   border: 1px solid #888888;
@@ -2527,10 +2527,10 @@ footer {
   margin-bottom: 5px;
   clear: left;
 }
-#adminpage .plugin desc {
+#adminpage .addon desc {
   margin-left: 2.5em;
 }
-#adminpage .toggleplugin {
+#adminpage .toggleaddon {
   float: left;
   margin-right: 1em;
 }
index af5cfcedf0bc175ae156c35044d487ba6de0c6d6..9776faeb0068a7f3420a524233ef22de3516d5c4 100644 (file)
@@ -64,7 +64,7 @@
 .icon.unlock {
   background-image: url("../../../images/icons/22/unlock.png");
 }
-.icon.plugin {
+.icon.addon {
   background-image: url("../../../images/icons/22/plugin.png");
 }
 .icon.type-unkn {
 .icon.s10.unlock {
   background-image: url("../../../images/icons/10/unlock.png");
 }
-.icon.s10.plugin {
+.icon.s10.addon {
   background-image: url("../../../images/icons/10/plugin.png");
 }
 .icon.s10.type-unkn {
 .icon.s16.unlock {
   background-image: url("../../../images/icons/16/unlock.png");
 }
-.icon.s16.plugin {
+.icon.s16.addon {
   background-image: url("../../../images/icons/16/plugin.png");
 }
 .icon.s16.type-unkn {
 .icon.s22.unlock {
   background-image: url("../../../images/icons/22/unlock.png");
 }
-.icon.s22.plugin {
+.icon.s22.addon {
   background-image: url("../../../images/icons/22/plugin.png");
 }
 .icon.s22.type-unkn {
 .icon.s48.unlock {
   background-image: url("../../../images/icons/48/unlock.png");
 }
-.icon.s48.plugin {
+.icon.s48.addon {
   background-image: url("../../../images/icons/48/plugin.png");
 }
 .icon.s48.type-unkn {
@@ -2518,11 +2518,11 @@ footer {
   clear: left;
   text-align: right;
 }
-#adminpage #pluginslist {
+#adminpage #addonslist {
   margin: 0;
   padding: 0;
 }
-#adminpage .plugin {
+#adminpage .addon {
   list-style: none;
   display: block;
   border: 1px solid #888888;
@@ -2530,10 +2530,10 @@ footer {
   margin-bottom: 5px;
   clear: left;
 }
-#adminpage .plugin desc {
+#adminpage .addon desc {
   margin-left: 2.5em;
 }
-#adminpage .toggleplugin {
+#adminpage .toggleaddon {
   float: left;
   margin-right: 1em;
 }
index 0c17b00331d1651159d8a6d298bdea3827186e1a..4760d4b43488e3f0786e5f046e7ed99d30611607 100644 (file)
@@ -64,7 +64,7 @@
 .icon.unlock {
   background-image: url("../../../images/icons/22/unlock.png");
 }
-.icon.plugin {
+.icon.addon {
   background-image: url("../../../images/icons/22/plugin.png");
 }
 .icon.type-unkn {
 .icon.s10.unlock {
   background-image: url("../../../images/icons/10/unlock.png");
 }
-.icon.s10.plugin {
+.icon.s10.addon {
   background-image: url("../../../images/icons/10/plugin.png");
 }
 .icon.s10.type-unkn {
 .icon.s16.unlock {
   background-image: url("../../../images/icons/16/unlock.png");
 }
-.icon.s16.plugin {
+.icon.s16.addon {
   background-image: url("../../../images/icons/16/plugin.png");
 }
 .icon.s16.type-unkn {
 .icon.s22.unlock {
   background-image: url("../../../images/icons/22/unlock.png");
 }
-.icon.s22.plugin {
+.icon.s22.addon {
   background-image: url("../../../images/icons/22/plugin.png");
 }
 .icon.s22.type-unkn {
 .icon.s48.unlock {
   background-image: url("../../../images/icons/48/unlock.png");
 }
-.icon.s48.plugin {
+.icon.s48.addon {
   background-image: url("../../../images/icons/48/plugin.png");
 }
 .icon.s48.type-unkn {
@@ -2518,11 +2518,11 @@ footer {
   clear: left;
   text-align: right;
 }
-#adminpage #pluginslist {
+#adminpage #addonslist {
   margin: 0;
   padding: 0;
 }
-#adminpage .plugin {
+#adminpage .addon {
   list-style: none;
   display: block;
   border: 1px solid #888888;
@@ -2530,10 +2530,10 @@ footer {
   margin-bottom: 5px;
   clear: left;
 }
-#adminpage .plugin desc {
+#adminpage .addon desc {
   margin-left: 2.5em;
 }
-#adminpage .toggleplugin {
+#adminpage .toggleaddon {
   float: left;
   margin-right: 1em;
 }
index 07fc3ed89526d244283232de269b6f04ccd60629..8d84e1b03a32f67d599fc61490d0c6bff85c1f34 100644 (file)
@@ -3824,12 +3824,12 @@ margin-left: 0px;
 }
 
 #adminpage
-#pluginslist {
+#addonslist {
        margin: 0px;
        padding: 0px;
 }
 
-#adminpage .plugin {
+#adminpage .addon {
        list-style: none;
        display: block;
        clear: left;
@@ -3844,7 +3844,7 @@ margin-left: 0px;
        margin:10px 10px 10px 0;
 }
 
-#adminpage .toggleplugin {
+#adminpage .toggleaddon {
        float: left;
        margin-right: 1em;
 }
index facfb975e2c92860852b928d3393292d741ee595..d8e58e178134fb264759114b847d28e037f50e23 100644 (file)
@@ -647,7 +647,7 @@ td.checkbox, td.tools{
 }
 
 
-/* Settings - Plugin */
+/* Settings - Addon */
 
 .settings-block.fakelink h3{
   font-size:16px;
index e45a3751e7cf32979f24a514aec5523d0ca179f4..48a89c0b40a95dc3b448afe7608f6864a62419ad 100644 (file)
@@ -71,11 +71,11 @@ img {
        clear:left;
 }
 
-#adminpage #pluginslist {
+#adminpage #addonslist {
        margin: 0px; padding: 0px;
 }
 
-#adminpage .plugin {
+#adminpage .addon {
        list-style: none;
        display: block;
        /* border: 1px solid #888888; */
@@ -84,7 +84,7 @@ img {
        clear: left;
 }
 
-#adminpage .toggleplugin {
+#adminpage .toggleaddon {
        float:left;
        margin-right: 1em;
 }
index 22060c6a4919efd759e4d304740c0feb42cd0319..57df31aeedf358ec93723e9f65efebf0e27969b0 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;
@@ -18,7 +19,6 @@ use Friendica\Database\DBM;
 use Friendica\Model\GContact;
 use Friendica\Model\Profile;
 
-require_once "include/plugin.php";
 require_once "mod/proxy.php";
 
 function vier_init(App $a) {
@@ -313,64 +313,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"];
                }