]> git.mxchange.org Git - friendica.git/blobdiff - doc/Addons.md
Fix own post check for content filter
[friendica.git] / doc / Addons.md
index de0d9e4963a85a84ce8b495bf95e85f17bbf3e31..f7d93aac7ab48ea2b45d41cf9e3931ae1dd5a440 100644 (file)
@@ -126,8 +126,8 @@ $b contains the $a->user array.
 '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
+    '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
@@ -167,8 +167,8 @@ $b is an array:
 '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' => 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
@@ -179,7 +179,7 @@ $b is an array containing:
 '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
+    'contact' => contact (array) record for the person from the database
     'entry' => the (string) HTML of the generated entry
 
 ### 'profile_sidebar_enter'
@@ -190,15 +190,15 @@ $b is an array:
 '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
+    '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
+    'contacts' => array of contacts
+    'output' => the (string) generated HTML of the contact block
 
 ### 'bbcode'
 * called during conversion of bbcode to html
@@ -216,8 +216,8 @@ $b is an array:
 '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
+    '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
@@ -227,8 +227,8 @@ $b is an array:
 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' => 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.
@@ -246,9 +246,9 @@ $b is an array:
 '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
+    '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.
@@ -284,192 +284,337 @@ $b is an array with:
     'template' => filename of template
     'vars' => array of vars passed to template
 
-### ''acl_lookup_end'
+### '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
 
+### 'prepare_body_init'
+Called at the start of prepare_body
+Hook data:
+    'item' => item array (input/output)
+
+### 'prepare_body_content_filter'
+Called before the HTML conversion in prepare_body. If the item matches a content filter rule set by an addon, it should
+just add the reason to the filter_reasons element of the hook data.
+Hook data:
+    'item' => item array (input)
+    'filter_reasons' => reasons array (input/output)
+
+### 'prepare_body'
+Called after the HTML conversion in prepare_body.
+Hook data:
+    'item' => item array (input)
+    'html' => converted item body (input/output)
+    'is_preview' => post preview flag (input)
+    'filter_reasons' => reasons array (input)
+
+### 'prepare_body_final'
+Called at the end of prepare_body.
+Hook data:
+    'item' => item array (input)
+    'html' => converted item body (input/output)
 
 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.
+Here is a complete list of all hook callbacks with file locations (as of 01-Apr-2018). Please see the source for details of any hooks not documented above.
+
+### index.php
+
+    Addon::callHooks('init_1');
+    Addon::callHooks('app_menu', $arr);
+    Addon::callHooks('page_content_top', $a->page['content']);
+    Addon::callHooks($a->module.'_mod_init', $placeholder);
+    Addon::callHooks($a->module.'_mod_init', $placeholder);
+    Addon::callHooks($a->module.'_mod_post', $_POST);
+    Addon::callHooks($a->module.'_mod_afterpost', $placeholder);
+    Addon::callHooks($a->module.'_mod_content', $arr);
+    Addon::callHooks($a->module.'_mod_aftercontent', $arr);
+    Addon::callHooks('page_end', $a->page['content']);
+    
+### include/api.php
+
+    Addon::callHooks('logged_in', $a->user);
+    Addon::callHooks('authenticate', $addon_auth);
+    Addon::callHooks('logged_in', $a->user);
+
+### include/enotify.php
+    
+    Addon::callHooks('enotify', $h);
+    Addon::callHooks('enotify_store', $datarray);
+    Addon::callHooks('enotify_mail', $datarray);
+    Addon::callHooks('check_item_notification', $notification_data);
+    
+### include/conversation.php
+
+    Addon::callHooks('conversation_start', $cb);
+    Addon::callHooks('render_location', $locate);
+    Addon::callHooks('display_item', $arr);
+    Addon::callHooks('display_item', $arr);
+    Addon::callHooks('item_photo_menu', $args);
+    Addon::callHooks('jot_tool', $jotplugins);
+
+### include/security.php
+
+    Addon::callHooks('logged_in', $a->user);
+
+### include/text.php
+
+    Addon::callHooks('contact_block_end', $arr);
+    Addon::callHooks('poke_verbs', $arr);
+    Addon::callHooks('prepare_body_init', $item);
+    Addon::callHooks('prepare_body_content_filter', $hook_data);
+    Addon::callHooks('prepare_body', $hook_data);
+    Addon::callHooks('prepare_body_final', $hook_data);
+
+### include/items.php
+
+    Addon::callHooks('page_info_data', $data);
+
+### mod/directory.php
+
+    Addon::callHooks('directory_item', $arr);
+
+### mod/xrd.php
+
+    Addon::callHooks('personal_xrd', $arr);
+
+### mod/ping.php
+
+    Addon::callHooks('network_ping', $arr);
+
+### mod/parse_url.php
+
+    Addon::callHooks("parse_link", $arr);
 
-boot.php:      Addon::callHooks('login_hook',$o);
+### mod/manage.php
 
-boot.php:      Addon::callHooks('profile_sidebar_enter', $profile);
+    Addon::callHooks('home_init', $ret);
 
-boot.php:      Addon::callHooks('profile_sidebar', $arr);
+### mod/acl.php
 
-boot.php:      Addon::callHooks("proc_run", $arr);
+    Addon::callHooks('acl_lookup_end', $results);
 
-include/contact_selectors.php: Addon::callHooks('network_to_name', $nets);
+### mod/network.php
 
-include/api.php:                               Addon::callHooks('logged_in', $a->user);
+    Addon::callHooks('network_content_init', $arr);
+    Addon::callHooks('network_tabs', $arr);
 
-include/api.php:               Addon::callHooks('logged_in', $a->user);
+### mod/friendica.php
 
-include/queue.php:             Addon::callHooks('queue_predeliver', $a, $r);
+    Addon::callHooks('about_hook', $o);
+    
+### mod/subthread.php
 
-include/queue.php:                             Addon::callHooks('queue_deliver', $a, $params);
+    Addon::callHooks('post_local_end', $arr);
 
-include/text.php:      Addon::callHooks('contact_block_end', $arr);
+### mod/profiles.php
 
-include/text.php:      Addon::callHooks('smilie', $s);
+    Addon::callHooks('profile_post', $_POST);
+    Addon::callHooks('profile_edit', $arr);
 
-include/text.php:      Addon::callHooks('prepare_body_init', $item);
+### mod/settings.php
 
-include/text.php:      Addon::callHooks('prepare_body', $prep_arr);
+    Addon::callHooks('addon_settings_post', $_POST);
+    Addon::callHooks('connector_settings_post', $_POST);
+    Addon::callHooks('display_settings_post', $_POST);
+    Addon::callHooks('settings_post', $_POST);
+    Addon::callHooks('addon_settings', $settings_addons);
+    Addon::callHooks('connector_settings', $settings_connectors);
+    Addon::callHooks('display_settings', $o);
+    Addon::callHooks('settings_form', $o);
 
-include/text.php:      Addon::callHooks('prepare_body_final', $prep_arr);
+### mod/photos.php
 
-include/nav.php:       Addon::callHooks('page_header', $a->page['nav']);
+    Addon::callHooks('photo_post_init', $_POST);
+    Addon::callHooks('photo_post_file', $ret);
+    Addon::callHooks('photo_post_end', $foo);
+    Addon::callHooks('photo_post_end', $foo);
+    Addon::callHooks('photo_post_end', $foo);
+    Addon::callHooks('photo_post_end', $foo);
+    Addon::callHooks('photo_post_end', intval($item_id));
+    Addon::callHooks('photo_upload_form', $ret);
 
-include/auth.php:              Addon::callHooks('authenticate', $addon_auth);
+### mod/profile.php
 
-include/bbcode.php:    Addon::callHooks('bbcode',$Text);
+    Addon::callHooks('profile_advanced', $o);
 
-include/oauth.php:             Addon::callHooks('logged_in', $a->user);
+### mod/home.php
 
-include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+    Addon::callHooks('home_init', $ret);
+    Addon::callHooks("home_content", $content);
 
-include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+### mod/poke.php
 
-include/acl_selectors.php:     Addon::callHooks('contact_select_options', $x);
+    Addon::callHooks('post_local_end', $arr);
 
-include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+### mod/contacts.php
 
-include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+    Addon::callHooks('contact_edit_post', $_POST);
+    Addon::callHooks('contact_edit', $arr);
 
-include/acl_selectors.php:     Addon::callHooks($a->module . '_pre_' . $selname, $arr);
+### mod/tagger.php
 
-include/acl_selectors.php:     Addon::callHooks($a->module . '_post_' . $selname, $o);
+    Addon::callHooks('post_local_end', $arr);
 
-include/acl_selectors.php      Addon::callHooks('acl_lookup_end', $results);
+### mod/lockview.php
 
-include/notifier.php:          Addon::callHooks('notifier_normal',$target_item);
+    Addon::callHooks('lockview_content', $item);
 
-include/notifier.php:  Addon::callHooks('notifier_end',$target_item);
+### mod/uexport.php
 
-include/items.php:     Addon::callHooks('atom_feed', $atom);
+    Addon::callHooks('uexport_options', $options);
 
-include/items.php:             Addon::callHooks('atom_feed_end', $atom);
+### mod/register.php
 
-include/items.php:     Addon::callHooks('atom_feed_end', $atom);
+    Addon::callHooks('register_post', $arr);
+    Addon::callHooks('register_form', $arr);
 
-include/items.php:     Addon::callHooks('parse_atom', $arr);
+### mod/item.php
 
-include/items.php:     Addon::callHooks('post_remote',$arr);
+    Addon::callHooks('post_local_start', $_REQUEST);
+    Addon::callHooks('post_local', $datarray);
+    Addon::callHooks('post_local_end', $datarray);
 
-include/items.php:     Addon::callHooks('atom_author', $o);
+### mod/editpost.php    
 
-include/items.php:     Addon::callHooks('atom_entry', $o);
+    Addon::callHooks('jot_tool', $jotplugins);
 
-include/bb2diaspora.php:       Addon::callHooks('bb2diaspora',$Text);
+### src/Network/FKOAuth1.php
 
-include/cronhooks.php: Addon::callHooks('cron', $d);
+    Addon::callHooks('logged_in', $a->user);
 
-include/security.php:          Addon::callHooks('logged_in', $a->user);
+### src/Render/FriendicaSmartyEngine.php
 
-src/Content/Text/HTML.php:     Addon::callHooks('html2bbcode', $text);
+    Addon::callHooks("template_vars", $arr);
 
-include/Contact.php:   Addon::callHooks('remove_user',$r[0]);
+### src/Model/Item.php
 
-include/Contact.php:   Addon::callHooks('contact_photo_menu', $args);
+    Addon::callHooks('post_local', $item);
+    Addon::callHooks('post_remote', $item);
+    Addon::callHooks('post_local_end', $posted_item);
+    Addon::callHooks('post_remote_end', $posted_item);
+    Addon::callHooks('tagged', $arr);
+    Addon::callHooks('post_local_end', $new_item);
 
-include/conversation.php:      Addon::callHooks('conversation_start',$cb);
+### src/Model/Contact.php
 
-include/conversation.php:                              Addon::callHooks('render_location',$locate);
+    Addon::callHooks('contact_photo_menu', $args);
+    Addon::callHooks('follow', $arr);
 
-include/conversation.php:                              Addon::callHooks('display_item', $arr);
+### src/Model/Profile.php
 
-include/conversation.php:                              Addon::callHooks('render_location',$locate);
+    Addon::callHooks('profile_sidebar_enter', $profile);
+    Addon::callHooks('profile_sidebar', $arr);
+    Addon::callHooks('profile_tabs', $arr);
+    Addon::callHooks('zrl_init', $arr);
 
-include/conversation.php:                              Addon::callHooks('display_item', $arr);
+### src/Model/Event.php
 
-include/conversation.php:      Addon::callHooks('item_photo_menu', $args);
+    Addon::callHooks('event_updated', $event['id']);
+    Addon::callHooks("event_created", $event['id']);
 
-include/conversation.php:      Addon::callHooks('jot_tool', $jotplugins);
+### src/Model/User.php
 
-include/conversation.php:      Addon::callHooks('jot_networks', $jotnets);
+    Addon::callHooks('register_account', $uid);
+    Addon::callHooks('remove_user', $user);
 
-index.php:     Addon::callHooks('init_1');
+### src/Content/Text/BBCode.php
 
-index.php:Addon::callHooks('app_menu', $arr);
+    Addon::callHooks('bbcode', $text);
+    Addon::callHooks('bb2diaspora', $text);
 
-index.php:Addon::callHooks('page_end', $a->page['content']);
+### src/Content/Text/HTML.php
 
-mod/photos.php:        Addon::callHooks('photo_post_init', $_POST);
+    Addon::callHooks('html2bbcode', $message);
 
-mod/photos.php:        Addon::callHooks('photo_post_file',$ret);
+### src/Content/Smilies.php
 
-mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
+    Addon::callHooks('smilie', $params);
 
-mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
+### src/Content/Feature.php
 
-mod/photos.php:                Addon::callHooks('photo_post_end',$foo);
+    Addon::callHooks('isEnabled', $arr);
+    Addon::callHooks('get', $arr);
 
-mod/photos.php:        Addon::callHooks('photo_post_end',intval($item_id));
+### src/Content/ContactSelector.php
 
-mod/photos.php:                Addon::callHooks('photo_upload_form',$ret);
+    Addon::callHooks('network_to_name', $nets);
+    Addon::callHooks('gender_selector', $select);
+    Addon::callHooks('sexpref_selector', $select);
+    Addon::callHooks('marital_selector', $select);
 
-mod/friendica.php:     Addon::callHooks('about_hook', $o);
+### src/Content/OEmbed.php    
 
-mod/editpost.php:      Addon::callHooks('jot_tool', $jotplugins);
+    Addon::callHooks('oembed_fetch_url', $embedurl, $j);
 
-mod/editpost.php:      Addon::callHooks('jot_networks', $jotnets);
+### src/Content/Nav.php    
 
-mod/parse_url.php:     Addon::callHooks('parse_link', $arr);
+    Addon::callHooks('page_header', $a->page['nav']);
+    Addon::callHooks('nav_info', $nav);
 
-mod/home.php:  Addon::callHooks('home_init',$ret);
+### src/Worker/Directory.php
 
-mod/home.php:  Addon::callHooks("home_content",$o);
+    Addon::callHooks('globaldir_update', $arr);
 
-mod/contacts.php:      Addon::callHooks('contact_edit_post', $_POST);
+### src/Worker/Notifier.php
 
-mod/contacts.php:              Addon::callHooks('contact_edit', $arr);
+    Addon::callHooks('notifier_end', $target_item);
 
-mod/settings.php:              Addon::callHooks('addon_settings_post', $_POST);
+### src/Worker/Queue.php    
 
-mod/settings.php:              Addon::callHooks('connector_settings_post', $_POST);
+    Addon::callHooks('queue_predeliver', $r);
+    Addon::callHooks('queue_deliver', $params);
 
-mod/settings.php:      Addon::callHooks('settings_post', $_POST);
+### src/Module/Login.php
 
-mod/settings.php:              Addon::callHooks('addon_settings', $settings_addons);
+    Addon::callHooks('authenticate', $addon_auth);
+    Addon::callHooks('login_hook', $o);
 
-mod/settings.php:              Addon::callHooks('connector_settings', $settings_connectors);
+### src/Module/Logout.php    
 
-mod/settings.php:      Addon::callHooks('settings_form',$o);
+    Addon::callHooks("logging_out");
 
-mod/register.php:      Addon::callHooks('register_account', $newuid);
+### src/Object/Post.php
 
-mod/like.php:  Addon::callHooks('post_local_end', $arr);
+    Addon::callHooks('render_location', $locate);
+    Addon::callHooks('display_item', $arr);
 
-mod/xrd.php:   Addon::callHooks('personal_xrd', $arr);
+### src/Core/ACL.php
 
-mod/item.php:  Addon::callHooks('post_local_start', $_REQUEST);
+    Addon::callHooks('contact_select_options', $x);
+    Addon::callHooks($a->module.'_pre_'.$selname, $arr);
+    Addon::callHooks($a->module.'_post_'.$selname, $o);
+    Addon::callHooks($a->module.'_pre_'.$selname, $arr);
+    Addon::callHooks($a->module.'_post_'.$selname, $o);
+    Addon::callHooks('jot_networks', $jotnets);
 
-mod/item.php:  Addon::callHooks('post_local',$datarray);
+### src/Core/Worker.php
 
-mod/item.php:  Addon::callHooks('post_local_end', $datarray);
+    Addon::callHooks("proc_run", $arr);
 
-mod/profile.php:                       Addon::callHooks('profile_advanced',$o);
+### src/Util/Emailer.php
 
-mod/profiles.php:      Addon::callHooks('profile_post', $_POST);
+    Addon::callHooks('emailer_send_prepare', $params);
+    Addon::callHooks("emailer_send", $hookdata);
 
-mod/profiles.php:              Addon::callHooks('profile_edit', $arr);
+### src/Util/Map.php
 
-mod/tagger.php:        Addon::callHooks('post_local_end', $arr);
+    Addon::callHooks('generate_map', $arr);
+    Addon::callHooks('generate_named_map', $arr);
+    Addon::callHooks('Map::getCoordinates', $arr);
 
-mod/cb.php:    Addon::callHooks('cb_init');
+### src/Util/Network.php
 
-mod/cb.php:    Addon::callHooks('cb_post', $_POST);
+    Addon::callHooks('avatar_lookup', $avatar);
 
-mod/cb.php:    Addon::callHooks('cb_afterpost');
+### src/Util/ParseUrl.php
 
-mod/cb.php:    Addon::callHooks('cb_content', $o);
+    Addon::callHooks("getsiteinfo", $siteinfo);
 
-mod/directory.php:                     Addon::callHooks('directory_item', $arr);
+### src/Protocol/DFRN.php
 
-src/Model/Item.php Addon::callHooks('tagged', $arr);
+    Addon::callHooks('atom_feed_end', $atom);
+    Addon::callHooks('atom_feed_end', $atom);