Merge pull request #4722 from MrPetovan/task/add-content_filter-hook

Add content_filter hook
This commit is contained in:
Michael Vogel 2018-04-06 06:42:52 +02:00 committed by GitHub
commit 05cff59f70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 6162 additions and 6062 deletions

View file

@ -284,192 +284,221 @@ $b is an array with:
'template' => filename of template 'template' => filename of template
'vars' => array of vars passed to template 'vars' => array of vars passed to template
### ''acl_lookup_end' ### 'acl_lookup_end'
is called after the other queries have passed. is called after the other queries have passed.
The registered function can add, change or remove the acl_lookup() variables. The registered function can add, change or remove the acl_lookup() variables.
'results' => array of the acl_lookup() vars '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 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.
boot.php: Addon::callHooks('login_hook',$o); index.php: Addon::callHooks('init_1');
index.php: Addon::callHooks('app_menu', $arr);
boot.php: Addon::callHooks('profile_sidebar_enter', $profile); index.php: Addon::callHooks('page_content_top', $a->page['content']);
index.php: Addon::callHooks($a->module.'_mod_init', $placeholder);
boot.php: Addon::callHooks('profile_sidebar', $arr); index.php: Addon::callHooks($a->module.'_mod_init', $placeholder);
index.php: Addon::callHooks($a->module.'_mod_post', $_POST);
boot.php: Addon::callHooks("proc_run", $arr); index.php: Addon::callHooks($a->module.'_mod_afterpost', $placeholder);
index.php: Addon::callHooks($a->module.'_mod_content', $arr);
include/contact_selectors.php: Addon::callHooks('network_to_name', $nets); index.php: Addon::callHooks($a->module.'_mod_aftercontent', $arr);
index.php: Addon::callHooks('page_end', $a->page['content']);
include/api.php: Addon::callHooks('logged_in', $a->user); include/api.php: Addon::callHooks('logged_in', $a->user);
include/api.php: Addon::callHooks('authenticate', $addon_auth);
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/enotify.php: Addon::callHooks('enotify', $h);
include/enotify.php: Addon::callHooks('enotify_store', $datarray);
include/enotify.php: Addon::callHooks('enotify_mail', $datarray);
include/enotify.php: Addon::callHooks('check_item_notification', $notification_data);
include/queue.php: Addon::callHooks('queue_deliver', $a, $params); include/conversation.php: Addon::callHooks('conversation_start', $cb);
include/conversation.php: Addon::callHooks('render_location', $locate);
include/text.php: Addon::callHooks('contact_block_end', $arr); include/conversation.php: Addon::callHooks('display_item', $arr);
include/conversation.php: Addon::callHooks('display_item', $arr);
include/text.php: Addon::callHooks('smilie', $s); include/conversation.php: Addon::callHooks('item_photo_menu', $args);
include/conversation.php: Addon::callHooks('jot_tool', $jotplugins);
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/security.php: Addon::callHooks('logged_in', $a->user);
src/Content/Text/HTML.php: Addon::callHooks('html2bbcode', $text); include/text.php: Addon::callHooks('contact_block_end', $arr);
include/text.php: Addon::callHooks('poke_verbs', $arr);
include/text.php: Addon::callHooks('prepare_body_init', $item);
include/text.php: Addon::callHooks('prepare_body_content_filter', $hook_data);
include/text.php: Addon::callHooks('prepare_body', $hook_data);
include/text.php: Addon::callHooks('prepare_body_final', $hook_data);
include/Contact.php: Addon::callHooks('remove_user',$r[0]); include/items.php: Addon::callHooks('page_info_data', $data);
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); mod/directory.php: Addon::callHooks('directory_item', $arr);
src/Model/Item.php Addon::callHooks('tagged', $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);
mod/manage.php: Addon::callHooks('home_init', $ret);
mod/acl.php: Addon::callHooks('acl_lookup_end', $results);
mod/network.php: Addon::callHooks('network_content_init', $arr);
mod/network.php: Addon::callHooks('network_tabs', $arr);
mod/friendica.php: Addon::callHooks('about_hook', $o);
mod/subthread.php: Addon::callHooks('post_local_end', $arr);
mod/profiles.php: Addon::callHooks('profile_post', $_POST);
mod/profiles.php: Addon::callHooks('profile_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('display_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('display_settings', $o);
mod/settings.php: Addon::callHooks('settings_form', $o);
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', $foo);
mod/photos.php: Addon::callHooks('photo_post_end', intval($item_id));
mod/photos.php: Addon::callHooks('photo_upload_form', $ret);
mod/profile.php: Addon::callHooks('profile_advanced', $o);
mod/home.php: Addon::callHooks('home_init', $ret);
mod/home.php: Addon::callHooks("home_content", $content);
mod/poke.php: Addon::callHooks('post_local_end', $arr);
mod/contacts.php: Addon::callHooks('contact_edit_post', $_POST);
mod/contacts.php: Addon::callHooks('contact_edit', $arr);
mod/tagger.php: Addon::callHooks('post_local_end', $arr);
mod/lockview.php: Addon::callHooks('lockview_content', $item);
mod/uexport.php: Addon::callHooks('uexport_options', $options);
mod/register.php: Addon::callHooks('register_post', $arr);
mod/register.php: Addon::callHooks('register_form', $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/editpost.php: Addon::callHooks('jot_tool', $jotplugins);
src/Network/FKOAuth1.php: Addon::callHooks('logged_in', $a->user);
src/Render/FriendicaSmartyEngine.php: Addon::callHooks("template_vars", $arr);
src/Model/Item.php: Addon::callHooks('post_local', $item);
src/Model/Item.php: Addon::callHooks('post_remote', $item);
src/Model/Item.php: Addon::callHooks('post_local_end', $posted_item);
src/Model/Item.php: Addon::callHooks('post_remote_end', $posted_item);
src/Model/Item.php: Addon::callHooks('tagged', $arr);
src/Model/Item.php: Addon::callHooks('post_local_end', $new_item);
src/Model/Contact.php: Addon::callHooks('contact_photo_menu', $args);
src/Model/Contact.php: Addon::callHooks('follow', $arr);
src/Model/Profile.php: Addon::callHooks('profile_sidebar_enter', $profile);
src/Model/Profile.php: Addon::callHooks('profile_sidebar', $arr);
src/Model/Profile.php: Addon::callHooks('profile_tabs', $arr);
src/Model/Profile.php: Addon::callHooks('zrl_init', $arr);
src/Model/Event.php: Addon::callHooks('event_updated', $event['id']);
src/Model/Event.php: Addon::callHooks("event_created", $event['id']);
src/Model/User.php: Addon::callHooks('register_account', $uid);
src/Model/User.php: Addon::callHooks('remove_user', $user);
src/Content/Text/BBCode.php: Addon::callHooks('bbcode', $text);
src/Content/Text/BBCode.php: Addon::callHooks('bb2diaspora', $text);
src/Content/Text/HTML.php: Addon::callHooks('html2bbcode', $message);
src/Content/Smilies.php: Addon::callHooks('smilie', $params);
src/Content/Feature.php: Addon::callHooks('isEnabled', $arr);
src/Content/Feature.php: Addon::callHooks('get', $arr);
src/Content/ContactSelector.php: Addon::callHooks('network_to_name', $nets);
src/Content/ContactSelector.php: Addon::callHooks('gender_selector', $select);
src/Content/ContactSelector.php: Addon::callHooks('sexpref_selector', $select);
src/Content/ContactSelector.php: Addon::callHooks('marital_selector', $select);
src/Content/OEmbed.php: Addon::callHooks('oembed_fetch_url', $embedurl, $j);
src/Content/Nav.php: Addon::callHooks('page_header', $a->page['nav']);
src/Content/Nav.php: Addon::callHooks('nav_info', $nav);
src/Worker/Directory.php: Addon::callHooks('globaldir_update', $arr);
src/Worker/Notifier.php: Addon::callHooks('notifier_end', $target_item);
src/Worker/Queue.php: Addon::callHooks('queue_predeliver', $r);
src/Worker/Queue.php: Addon::callHooks('queue_deliver', $params);
src/Module/Login.php: Addon::callHooks('authenticate', $addon_auth);
src/Module/Login.php: Addon::callHooks('login_hook', $o);
src/Module/Logout.php: Addon::callHooks("logging_out");
src/Object/Post.php: Addon::callHooks('render_location', $locate);
src/Object/Post.php: Addon::callHooks('display_item', $arr);
src/Core/ACL.php: Addon::callHooks('contact_select_options', $x);
src/Core/ACL.php: Addon::callHooks($a->module.'_pre_'.$selname, $arr);
src/Core/ACL.php: Addon::callHooks($a->module.'_post_'.$selname, $o);
src/Core/ACL.php: Addon::callHooks($a->module.'_pre_'.$selname, $arr);
src/Core/ACL.php: Addon::callHooks($a->module.'_post_'.$selname, $o);
src/Core/ACL.php: Addon::callHooks('jot_networks', $jotnets);
src/Core/Worker.php: Addon::callHooks("proc_run", $arr);
src/Util/Emailer.php: Addon::callHooks('emailer_send_prepare', $params);
src/Util/Emailer.php: Addon::callHooks("emailer_send", $hookdata);
src/Util/Map.php: Addon::callHooks('generate_map', $arr);
src/Util/Map.php: Addon::callHooks('generate_named_map', $arr);
src/Util/Map.php: Addon::callHooks('Map::getCoordinates', $arr);
src/Util/Network.php: Addon::callHooks('avatar_lookup', $avatar);
src/Util/ParseUrl.php: Addon::callHooks("getsiteinfo", $siteinfo);
src/Protocol/DFRN.php: Addon::callHooks('atom_feed_end', $atom);
src/Protocol/DFRN.php: Addon::callHooks('atom_feed_end', $atom);

View file

@ -189,178 +189,186 @@ Derzeitige Hooks
Komplette Liste der Hook-Callbacks 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. Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Apr-2018 generiert): Bitte schau in die Quellcodes für Details zu Hooks, die oben nicht dokumentiert sind.
boot.php: Addon::callHooks('login_hook',$o); index.php: Addon::callHooks('init_1');
index.php: Addon::callHooks('app_menu', $arr);
boot.php: Addon::callHooks('profile_sidebar_enter', $profile); index.php: Addon::callHooks('page_content_top', $a->page['content']);
index.php: Addon::callHooks($a->module.'_mod_init', $placeholder);
boot.php: Addon::callHooks('profile_sidebar', $arr); index.php: Addon::callHooks($a->module.'_mod_init', $placeholder);
index.php: Addon::callHooks($a->module.'_mod_post', $_POST);
boot.php: Addon::callHooks("proc_run", $arr); index.php: Addon::callHooks($a->module.'_mod_afterpost', $placeholder);
index.php: Addon::callHooks($a->module.'_mod_content', $arr);
include/contact_selectors.php: Addon::callHooks('network_to_name', $nets); index.php: Addon::callHooks($a->module.'_mod_aftercontent', $arr);
index.php: Addon::callHooks('page_end', $a->page['content']);
include/api.php: Addon::callHooks('logged_in', $a->user); include/api.php: Addon::callHooks('logged_in', $a->user);
include/api.php: Addon::callHooks('authenticate', $addon_auth);
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/enotify.php: Addon::callHooks('enotify', $h);
include/enotify.php: Addon::callHooks('enotify_store', $datarray);
include/enotify.php: Addon::callHooks('enotify_mail', $datarray);
include/enotify.php: Addon::callHooks('check_item_notification', $notification_data);
include/queue.php: Addon::callHooks('queue_deliver', $a, $params); include/conversation.php: Addon::callHooks('conversation_start', $cb);
include/conversation.php: Addon::callHooks('render_location', $locate);
include/text.php: Addon::callHooks('contact_block_end', $arr); include/conversation.php: Addon::callHooks('display_item', $arr);
include/conversation.php: Addon::callHooks('display_item', $arr);
include/text.php: Addon::callHooks('smilie', $s); include/conversation.php: Addon::callHooks('item_photo_menu', $args);
include/conversation.php: Addon::callHooks('jot_tool', $jotplugins);
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/security.php: Addon::callHooks('logged_in', $a->user);
src/Content/Text/HTML.php: Addon::callHooks('html2bbcode', $text); include/text.php: Addon::callHooks('contact_block_end', $arr);
include/text.php: Addon::callHooks('poke_verbs', $arr);
include/text.php: Addon::callHooks('prepare_body_init', $item);
include/text.php: Addon::callHooks('prepare_body_content_filter', $hook_data);
include/text.php: Addon::callHooks('prepare_body', $hook_data);
include/text.php: Addon::callHooks('prepare_body_final', $hook_data);
include/Contact.php: Addon::callHooks('remove_user',$r[0]); include/items.php: Addon::callHooks('page_info_data', $data);
include/Contact.php: Addon::callHooks('contact_photo_menu', $args); mod/directory.php: Addon::callHooks('directory_item', $arr);
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/xrd.php: Addon::callHooks('personal_xrd', $arr);
mod/item.php: Addon::callHooks('post_local_start', $_REQUEST); mod/ping.php: Addon::callHooks('network_ping', $arr);
mod/item.php: Addon::callHooks('post_local',$datarray); mod/parse_url.php: Addon::callHooks("parse_link", $arr);
mod/item.php: Addon::callHooks('post_local_end', $datarray); mod/manage.php: Addon::callHooks('home_init', $ret);
mod/profile.php: Addon::callHooks('profile_advanced',$o); mod/acl.php: Addon::callHooks('acl_lookup_end', $results);
mod/network.php: Addon::callHooks('network_content_init', $arr);
mod/network.php: Addon::callHooks('network_tabs', $arr);
mod/friendica.php: Addon::callHooks('about_hook', $o);
mod/subthread.php: Addon::callHooks('post_local_end', $arr);
mod/profiles.php: Addon::callHooks('profile_post', $_POST); mod/profiles.php: Addon::callHooks('profile_post', $_POST);
mod/profiles.php: Addon::callHooks('profile_edit', $arr); mod/profiles.php: Addon::callHooks('profile_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('display_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('display_settings', $o);
mod/settings.php: Addon::callHooks('settings_form', $o);
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', $foo);
mod/photos.php: Addon::callHooks('photo_post_end', intval($item_id));
mod/photos.php: Addon::callHooks('photo_upload_form', $ret);
mod/profile.php: Addon::callHooks('profile_advanced', $o);
mod/home.php: Addon::callHooks('home_init', $ret);
mod/home.php: Addon::callHooks("home_content", $content);
mod/poke.php: Addon::callHooks('post_local_end', $arr);
mod/contacts.php: Addon::callHooks('contact_edit_post', $_POST);
mod/contacts.php: Addon::callHooks('contact_edit', $arr);
mod/tagger.php: Addon::callHooks('post_local_end', $arr); mod/tagger.php: Addon::callHooks('post_local_end', $arr);
mod/cb.php: Addon::callHooks('cb_init'); mod/lockview.php: Addon::callHooks('lockview_content', $item);
mod/cb.php: Addon::callHooks('cb_post', $_POST); mod/uexport.php: Addon::callHooks('uexport_options', $options);
mod/cb.php: Addon::callHooks('cb_afterpost'); mod/register.php: Addon::callHooks('register_post', $arr);
mod/register.php: Addon::callHooks('register_form', $arr);
mod/cb.php: Addon::callHooks('cb_content', $o); 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/directory.php: Addon::callHooks('directory_item', $arr); mod/editpost.php: Addon::callHooks('jot_tool', $jotplugins);
src/Network/FKOAuth1.php: Addon::callHooks('logged_in', $a->user);
src/Render/FriendicaSmartyEngine.php: Addon::callHooks("template_vars", $arr);
src/Model/Item.php: Addon::callHooks('post_local', $item);
src/Model/Item.php: Addon::callHooks('post_remote', $item);
src/Model/Item.php: Addon::callHooks('post_local_end', $posted_item);
src/Model/Item.php: Addon::callHooks('post_remote_end', $posted_item);
src/Model/Item.php: Addon::callHooks('tagged', $arr);
src/Model/Item.php: Addon::callHooks('post_local_end', $new_item);
src/Model/Contact.php: Addon::callHooks('contact_photo_menu', $args);
src/Model/Contact.php: Addon::callHooks('follow', $arr);
src/Model/Profile.php: Addon::callHooks('profile_sidebar_enter', $profile);
src/Model/Profile.php: Addon::callHooks('profile_sidebar', $arr);
src/Model/Profile.php: Addon::callHooks('profile_tabs', $arr);
src/Model/Profile.php: Addon::callHooks('zrl_init', $arr);
src/Model/Event.php: Addon::callHooks('event_updated', $event['id']);
src/Model/Event.php: Addon::callHooks("event_created", $event['id']);
src/Model/User.php: Addon::callHooks('register_account', $uid);
src/Model/User.php: Addon::callHooks('remove_user', $user);
src/Content/Text/BBCode.php: Addon::callHooks('bbcode', $text);
src/Content/Text/BBCode.php: Addon::callHooks('bb2diaspora', $text);
src/Content/Text/HTML.php: Addon::callHooks('html2bbcode', $message);
src/Content/Smilies.php: Addon::callHooks('smilie', $params);
src/Content/Feature.php: Addon::callHooks('isEnabled', $arr);
src/Content/Feature.php: Addon::callHooks('get', $arr);
src/Content/ContactSelector.php: Addon::callHooks('network_to_name', $nets);
src/Content/ContactSelector.php: Addon::callHooks('gender_selector', $select);
src/Content/ContactSelector.php: Addon::callHooks('sexpref_selector', $select);
src/Content/ContactSelector.php: Addon::callHooks('marital_selector', $select);
src/Content/OEmbed.php: Addon::callHooks('oembed_fetch_url', $embedurl, $j);
src/Content/Nav.php: Addon::callHooks('page_header', $a->page['nav']);
src/Content/Nav.php: Addon::callHooks('nav_info', $nav);
src/Worker/Directory.php: Addon::callHooks('globaldir_update', $arr);
src/Worker/Notifier.php: Addon::callHooks('notifier_end', $target_item);
src/Worker/Queue.php: Addon::callHooks('queue_predeliver', $r);
src/Worker/Queue.php: Addon::callHooks('queue_deliver', $params);
src/Module/Login.php: Addon::callHooks('authenticate', $addon_auth);
src/Module/Login.php: Addon::callHooks('login_hook', $o);
src/Module/Logout.php: Addon::callHooks("logging_out");
src/Object/Post.php: Addon::callHooks('render_location', $locate);
src/Object/Post.php: Addon::callHooks('display_item', $arr);
src/Core/ACL.php: Addon::callHooks('contact_select_options', $x);
src/Core/ACL.php: Addon::callHooks($a->module.'_pre_'.$selname, $arr);
src/Core/ACL.php: Addon::callHooks($a->module.'_post_'.$selname, $o);
src/Core/ACL.php: Addon::callHooks($a->module.'_pre_'.$selname, $arr);
src/Core/ACL.php: Addon::callHooks($a->module.'_post_'.$selname, $o);
src/Core/ACL.php: Addon::callHooks('jot_networks', $jotnets);
src/Core/Worker.php: Addon::callHooks("proc_run", $arr);
src/Util/Emailer.php: Addon::callHooks('emailer_send_prepare', $params);
src/Util/Emailer.php: Addon::callHooks("emailer_send", $hookdata);
src/Util/Map.php: Addon::callHooks('generate_map', $arr);
src/Util/Map.php: Addon::callHooks('generate_named_map', $arr);
src/Util/Map.php: Addon::callHooks('Map::getCoordinates', $arr);
src/Util/Network.php: Addon::callHooks('avatar_lookup', $avatar);
src/Util/ParseUrl.php: Addon::callHooks("getsiteinfo", $siteinfo);
src/Protocol/DFRN.php: Addon::callHooks('atom_feed_end', $atom);
src/Protocol/DFRN.php: Addon::callHooks('atom_feed_end', $atom);

View file

@ -756,7 +756,13 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
list($categories, $folders) = get_cats_and_terms($item); list($categories, $folders) = get_cats_and_terms($item);
$profile_name_e = $profile_name; $profile_name_e = $profile_name;
$item['title_e'] = $item['title'];
if (!empty($item['content-warning']) && PConfig::get(local_user(), 'system', 'disable_cw', false)) {
$title_e = ucfirst($item['content-warning']);
} else {
$title_e = $item['title'];
}
$body_e = $body; $body_e = $body;
$tags_e = $tags; $tags_e = $tags;
$hashtags_e = $hashtags; $hashtags_e = $hashtags;
@ -781,7 +787,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'lock' => $lock, 'lock' => $lock,
'thumb' => System::removedBaseUrl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)), 'thumb' => System::removedBaseUrl(proxy_url($item['author-thumb'], false, PROXY_SIZE_THUMB)),
'title' => $item['title_e'], 'title' => $title_e,
'body' => $body_e, 'body' => $body_e,
'tags' => $tags_e, 'tags' => $tags_e,
'hashtags' => $hashtags_e, 'hashtags' => $hashtags_e,

View file

@ -1183,11 +1183,6 @@ function put_item_in_cache(&$item, $update = false)
{ {
$body = $item["body"]; $body = $item["body"];
// Add the content warning
if (!empty($item['content-warning'])) {
$item["body"] = $item['content-warning'] . '[spoiler]' . $item["body"] . '[/spoiler]';
}
$rendered_hash = defaults($item, 'rendered-hash', ''); $rendered_hash = defaults($item, 'rendered-hash', '');
if ($rendered_hash == '' if ($rendered_hash == ''
@ -1216,13 +1211,15 @@ function put_item_in_cache(&$item, $update = false)
* *
* @param array $item * @param array $item
* @param boolean $attach * @param boolean $attach
* @param boolean $is_preview
* @return string item body html * @return string item body html
* @hook prepare_body_init item array before any work * @hook prepare_body_init item array before any work
* @hook prepare_body ('item'=>item array, 'html'=>body string) after first bbcode to html * @hook prepare_body_content_filter ('item'=>item array, 'filter_reasons'=>string array) before first bbcode to html
* @hook prepare_body ('item'=>item array, 'html'=>body string, 'is_preview'=>boolean, 'filter_reasons'=>string array) after first bbcode to html
* @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author) * @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author)
*/ */
function prepare_body(&$item, $attach = false, $preview = false) { function prepare_body(array &$item, $attach = false, $is_preview = false)
{
$a = get_app(); $a = get_app();
Addon::callHooks('prepare_body_init', $item); Addon::callHooks('prepare_body_init', $item);
@ -1271,6 +1268,22 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$item['hashtags'] = $hashtags; $item['hashtags'] = $hashtags;
$item['mentions'] = $mentions; $item['mentions'] = $mentions;
// Compile eventual content filter reasons
$filter_reasons = [];
if (!$is_preview && !($item['self'] && local_user() == $item['uid'])) {
if (!empty($item['content-warning']) && (!local_user() || !PConfig::get(local_user(), 'system', 'disable_cw', false))) {
$filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']);
}
$hook_data = [
'item' => $item,
'filter_reasons' => $filter_reasons
];
Addon::callHooks('prepare_body_content_filter', $hook_data);
$filter_reasons = $hook_data['filter_reasons'];
unset($hook_data);
}
// Update the cached values if there is no "zrl=..." on the links. // Update the cached values if there is no "zrl=..." on the links.
$update = (!local_user() && !remote_user() && ($item["uid"] == 0)); $update = (!local_user() && !remote_user() && ($item["uid"] == 0));
@ -1282,9 +1295,17 @@ function prepare_body(&$item, $attach = false, $preview = false) {
put_item_in_cache($item, $update); put_item_in_cache($item, $update);
$s = $item["rendered-html"]; $s = $item["rendered-html"];
$prep_arr = ['item' => $item, 'html' => $s, 'preview' => $preview]; $hook_data = [
Addon::callHooks('prepare_body', $prep_arr); 'item' => $item,
$s = $prep_arr['html']; 'html' => $s,
'preview' => $is_preview,
'filter_reasons' => $filter_reasons
];
Addon::callHooks('prepare_body', $hook_data);
$s = $hook_data['html'];
unset($hook_data);
$s = apply_content_filter($s, $filter_reasons);
if (! $attach) { if (! $attach) {
// Replace the blockquotes with quotes that are used in mails. // Replace the blockquotes with quotes that are used in mails.
@ -1393,10 +1414,39 @@ function prepare_body(&$item, $attach = false, $preview = false) {
$s = preg_replace('|(<img[^>]+src="[^"]+/photo/[0-9a-f]+)-[0-9]|', "$1-" . $ps, $s); $s = preg_replace('|(<img[^>]+src="[^"]+/photo/[0-9a-f]+)-[0-9]|', "$1-" . $ps, $s);
} }
$prep_arr = ['item' => $item, 'html' => $s]; $hook_data = ['item' => $item, 'html' => $s];
Addon::callHooks('prepare_body_final', $prep_arr); Addon::callHooks('prepare_body_final', $hook_data);
return $prep_arr['html']; return $hook_data['html'];
}
/**
* Given a HTML text and a set of filtering reasons, adds a content hiding header with the provided reasons
*
* Reasons are expected to have been translated already.
*
* @param string $html
* @param array $reasons
* @return string
*/
function apply_content_filter($html, array $reasons)
{
if (count($reasons)) {
$rnd = random_string(8);
$content_filter_html = '<ul class="content-filter-reasons">';
foreach ($reasons as $reason) {
$content_filter_html .= '<li>' . htmlspecialchars($reason) . '</li>' . PHP_EOL;
}
$content_filter_html .= '</ul>
<p><span id="content-filter-wrap-' . $rnd . '" class="fakelink content-filter-button" onclick=openClose(\'content-filter-' . $rnd . '\'); >' .
L10n::t('Click to open/close') .
'</span></p>
<div id="content-filter-' . $rnd . '" class="content-filter-content" style="display: none;">';
$html = $content_filter_html . $html . '</div>';
}
return $html;
} }
/** /**

View file

@ -19,7 +19,6 @@ use Friendica\Model\GContact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Protocol\Email; use Friendica\Protocol\Email;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
@ -213,6 +212,7 @@ function settings_post(App $a)
check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors'); check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
if (x($_POST, 'general-submit')) { if (x($_POST, 'general-submit')) {
PConfig::set(local_user(), 'system', 'disable_cw', intval($_POST['disable_cw']));
PConfig::set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening'])); PConfig::set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening']));
PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow'])); PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
PConfig::set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']); PConfig::set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']);
@ -787,6 +787,7 @@ function settings_content(App $a)
} }
if (($a->argc > 1) && ($a->argv[1] === 'connectors')) { if (($a->argc > 1) && ($a->argv[1] === 'connectors')) {
$disable_cw = intval(PConfig::get(local_user(), 'system', 'disable_cw'));
$no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening')); $no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening'));
$ostatus_autofriend = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend')); $ostatus_autofriend = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend'));
$default_group = PConfig::get(local_user(), 'ostatus', 'default_group'); $default_group = PConfig::get(local_user(), 'ostatus', 'default_group');
@ -844,6 +845,7 @@ function settings_content(App $a)
'$ostat_enabled' => $ostat_enabled, '$ostat_enabled' => $ostat_enabled,
'$general_settings' => L10n::t('General Social Media Settings'), '$general_settings' => L10n::t('General Social Media Settings'),
'$disable_cw' => ['disable_cw', L10n::t('Disable Content Warning'), $disable_cw, L10n::t('Users on networks like Mastodon or Pleroma are able to set a content warning field which collapse their post by default. This disables the automatic collapsing and sets the content warning as the post title. Doesn\'t affect any other content filtering you eventually set up.')],
'$no_intelligent_shortening' => ['no_intelligent_shortening', L10n::t('Disable intelligent shortening'), $no_intelligent_shortening, L10n::t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')], '$no_intelligent_shortening' => ['no_intelligent_shortening', L10n::t('Disable intelligent shortening'), $no_intelligent_shortening, L10n::t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')],
'$ostatus_autofriend' => ['snautofollow', L10n::t("Automatically follow any GNU Social \x28OStatus\x29 followers/mentioners"), $ostatus_autofriend, L10n::t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')], '$ostatus_autofriend' => ['snautofollow', L10n::t("Automatically follow any GNU Social \x28OStatus\x29 followers/mentioners"), $ostatus_autofriend, L10n::t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')],
'$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")), '$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")),

View file

@ -316,7 +316,13 @@ class Post extends BaseObject
$body_e = $body; $body_e = $body;
$text_e = strip_tags($body); $text_e = strip_tags($body);
$name_e = $profile_name; $name_e = $profile_name;
if (!empty($item['content-warning']) && PConfig::get(local_user(), 'system', 'disable_cw', false)) {
$title_e = ucfirst($item['content-warning']);
} else {
$title_e = $item['title']; $title_e = $item['title'];
}
$location_e = $location; $location_e = $location;
$owner_name_e = $this->getOwnerName(); $owner_name_e = $this->getOwnerName();

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@
<h3 class="connector">{{$general_settings}}</h3> <h3 class="connector">{{$general_settings}}</h3>
</span> </span>
{{include file="field_checkbox.tpl" field=$disable_cw}}
{{include file="field_checkbox.tpl" field=$no_intelligent_shortening}} {{include file="field_checkbox.tpl" field=$no_intelligent_shortening}}
{{include file="field_checkbox.tpl" field=$ostatus_autofriend}} {{include file="field_checkbox.tpl" field=$ostatus_autofriend}}
{{$default_group}} {{$default_group}}

View file

@ -20,6 +20,7 @@
<div id="content-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="content-settings"> <div id="content-settings-content" class="panel-collapse collapse" role="tabpanel" aria-labelledby="content-settings">
<div class="section-content-wrapper"> <div class="section-content-wrapper">
{{include file="field_checkbox.tpl" field=$disable_cw}}
{{include file="field_checkbox.tpl" field=$no_intelligent_shortening}} {{include file="field_checkbox.tpl" field=$no_intelligent_shortening}}
{{include file="field_checkbox.tpl" field=$ostatus_autofriend}} {{include file="field_checkbox.tpl" field=$ostatus_autofriend}}
{{$default_group}} {{$default_group}}