diff options
Diffstat (limited to 'doc/hook')
-rw-r--r-- | doc/hook/activity_filter.bb | 1 | ||||
-rw-r--r-- | doc/hook/activity_order.bb | 1 | ||||
-rw-r--r-- | doc/hook/addon_app_installed_filter.bb | 18 | ||||
-rw-r--r-- | doc/hook/app_destroy.bb | 4 | ||||
-rw-r--r-- | doc/hook/app_installed_filter.bb | 17 | ||||
-rw-r--r-- | doc/hook/attach_delete.bb | 11 | ||||
-rw-r--r-- | doc/hook/content_security_policy.bb | 39 | ||||
-rw-r--r-- | doc/hook/dreport_process.bb | 7 | ||||
-rw-r--r-- | doc/hook/dropdown_extras.bb | 17 | ||||
-rw-r--r-- | doc/hook/network_tabs.bb | 1 | ||||
-rw-r--r-- | doc/hook/page_meta.bb | 13 | ||||
-rw-r--r-- | doc/hook/permit_hook.bb | 0 | ||||
-rw-r--r-- | doc/hook/profile_tabs.bb | 1 | ||||
-rw-r--r-- | doc/hook/status_editor.bb | 31 | ||||
-rw-r--r-- | doc/hook/system_app_installed_filter.bb | 18 | ||||
-rw-r--r-- | doc/hook/wiki_preprocess.bb | 11 |
16 files changed, 188 insertions, 2 deletions
diff --git a/doc/hook/activity_filter.bb b/doc/hook/activity_filter.bb new file mode 100644 index 000000000..9d0768577 --- /dev/null +++ b/doc/hook/activity_filter.bb @@ -0,0 +1 @@ +[h2]activity_filter[/h2] diff --git a/doc/hook/activity_order.bb b/doc/hook/activity_order.bb new file mode 100644 index 000000000..4a4670d03 --- /dev/null +++ b/doc/hook/activity_order.bb @@ -0,0 +1 @@ +[h2]activity_order[/h2] diff --git a/doc/hook/addon_app_installed_filter.bb b/doc/hook/addon_app_installed_filter.bb new file mode 100644 index 000000000..e610b3205 --- /dev/null +++ b/doc/hook/addon_app_installed_filter.bb @@ -0,0 +1,18 @@ +[h2]addon_app_installed_filter[/h2] + +Allow plugins to filter the result of addon_app_installed. + +Code excerpt: + +[code] + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('addon_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; +[/code] + +cxref: Zotlabs/Lib/Apps.php + diff --git a/doc/hook/app_destroy.bb b/doc/hook/app_destroy.bb new file mode 100644 index 000000000..386d7af16 --- /dev/null +++ b/doc/hook/app_destroy.bb @@ -0,0 +1,4 @@ +[h2]app_destroy[/h2] + +Allows addons to perform some post delete actions. + diff --git a/doc/hook/app_installed_filter.bb b/doc/hook/app_installed_filter.bb new file mode 100644 index 000000000..f0d91d6f0 --- /dev/null +++ b/doc/hook/app_installed_filter.bb @@ -0,0 +1,17 @@ +[h2]app_installed_filter[/h2] + +Allow plugins to filter the result of app_installed. + +Code excerpt: + +[code] + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; +[/code] + +cxref: Zotlabs/Lib/Apps.php diff --git a/doc/hook/attach_delete.bb b/doc/hook/attach_delete.bb new file mode 100644 index 000000000..3b63f28d3 --- /dev/null +++ b/doc/hook/attach_delete.bb @@ -0,0 +1,11 @@ +[h2]attach_delete[/h2] + +Invoked when an attachment is deleted using attach_delete(). + +[code] +$arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo]; +call_hooks("attach_delete",$arr); +[/code] + + +See include/attach.php diff --git a/doc/hook/content_security_policy.bb b/doc/hook/content_security_policy.bb new file mode 100644 index 000000000..96b8095ae --- /dev/null +++ b/doc/hook/content_security_policy.bb @@ -0,0 +1,39 @@ +[h2]content_security_policy[/h2] + +Called to modify CSP settings prior to the output of the Content-Security-Policy header. + +This hook permits addons to modify the content-security-policy if necessary to allow loading of foreign js libraries or css styles. + +[code] +if(App::$config['system']['content_security_policy']) { + $cspsettings = Array ( + 'script-src' => Array ("'self'","'unsafe-inline'","'unsafe-eval'"), + 'style-src' => Array ("'self'","'unsafe-inline'") + ); + call_hooks('content_security_policy',$cspsettings); + + // Legitimate CSP directives (cxref: https://content-security-policy.com/) + $validcspdirectives=Array( + "default-src", "script-src", "style-src", + "img-src", "connect-src", "font-src", + "object-src", "media-src", 'frame-src', + 'sandbox', 'report-uri', 'child-src', + 'form-action', 'frame-ancestors', 'plugin-types' + ); + $cspheader = "Content-Security-Policy:"; + foreach ($cspsettings as $cspdirective => $csp) { + if (!in_array($cspdirective,$validcspdirectives)) { + logger("INVALID CSP DIRECTIVE: ".$cspdirective,LOGGER_DEBUG); + continue; + } + $cspsettingsarray=array_unique($cspsettings[$cspdirective]); + $cspsetpolicy = implode(' ',$cspsettingsarray); + if ($cspsetpolicy) { + $cspheader .= " ".$cspdirective." ".$cspsetpolicy.";"; + } + } + header($cspheader); +} +[/code] + +see: boot.php diff --git a/doc/hook/dreport_process.bb b/doc/hook/dreport_process.bb new file mode 100644 index 000000000..3ad331f41 --- /dev/null +++ b/doc/hook/dreport_process.bb @@ -0,0 +1,7 @@ +[h2]dreport_process[/h2] + +Called for each delivery report received + +Passed a delivery_report array. + +see: include/zot.php diff --git a/doc/hook/dropdown_extras.bb b/doc/hook/dropdown_extras.bb new file mode 100644 index 000000000..6d7110a76 --- /dev/null +++ b/doc/hook/dropdown_extras.bb @@ -0,0 +1,17 @@ +[h2]dropdown_extras[/h2] + +Modify the dropdown menu available through the cog of items as displayed by conv_item.tpl + +This hook allows plugins to add arbitrary html to the cog dropdown of thread items displayed with the conv_item.tpl template. + +It is fed an array of ['item' => $item, 'dropdown_extras' => '']. Any additions to the cog menu should be prepended/appended to +the ['dropdown_extras'] element. + +[code] +$dropdown_extras_arr = [ 'item' => $item , 'dropdown_extras' => '' ]; +call_hooks('dropdown_extras',$dropdown_extras_arr); +$dropdown_extras = $dropdown_extras_arr['dropdown_extras']; +[/code] + +see: Zotlabs/Lib/ThreadItem.php +see: view/tpl/conv_item.tpl diff --git a/doc/hook/network_tabs.bb b/doc/hook/network_tabs.bb deleted file mode 100644 index 677d7f2b9..000000000 --- a/doc/hook/network_tabs.bb +++ /dev/null @@ -1 +0,0 @@ -[h2]network_tabs[/h2] diff --git a/doc/hook/page_meta.bb b/doc/hook/page_meta.bb new file mode 100644 index 000000000..30a8f9440 --- /dev/null +++ b/doc/hook/page_meta.bb @@ -0,0 +1,13 @@ +[h2]page_meta[/h2] + +Called before generating the page header. + +[code] + $pagemeta = [ 'og:title' => self::$page['title'] ]; + + call_hooks('page_meta',$pagemeta); + foreach ($pagemeta as $metaproperty => $metavalue) { + self::$meta->set($metaproperty,$metavalue); + } + +[/code] diff --git a/doc/hook/permit_hook.bb b/doc/hook/permit_hook.bb new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/doc/hook/permit_hook.bb diff --git a/doc/hook/profile_tabs.bb b/doc/hook/profile_tabs.bb deleted file mode 100644 index 5b3e9e707..000000000 --- a/doc/hook/profile_tabs.bb +++ /dev/null @@ -1 +0,0 @@ -[h2]profile_tabs[/h2] diff --git a/doc/hook/status_editor.bb b/doc/hook/status_editor.bb new file mode 100644 index 000000000..00e97a7c9 --- /dev/null +++ b/doc/hook/status_editor.bb @@ -0,0 +1,31 @@ +[h2]status_editor[/h2] + +Replace the default status_editor (jot). + +Allow plugins to replace the default status editor in a context dependent manner. + +It is fed an array of ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module]. + +All calls to the status_editor at the time of the creation of this hook have been updated +to set $module at invocation. This allows addon developers to have a context dependent editor +based on the Hubzilla module/addon. + +Calls to status_editor() are in the form of: + status_editor($a, $x, $popup, $module). + +Future module/addon developers are encouraged to set $popup and $module when invoking the +status_editor. + + +[code] + $hook_info = ['editor_html' => '', 'x' => $x, 'popup' => $popup, 'module' => $module]; + call_hooks('status_editor',$hook_info); + if ($hook_info['editor_html'] == '') { + return hz_status_editor($a, $x, $popup); + } else { + return $hook_info['editor_html']; + } + +[/code] + +see: include/conversation.php diff --git a/doc/hook/system_app_installed_filter.bb b/doc/hook/system_app_installed_filter.bb new file mode 100644 index 000000000..a269a79a8 --- /dev/null +++ b/doc/hook/system_app_installed_filter.bb @@ -0,0 +1,18 @@ +[h2]system_app_installed_filter[/h2] + +Allow plugins to filter the result of system_app_installed. + +Code excerpt: + +[code] + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('system_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; +[/code] + +cxref: Zotlabs/Lib/Apps.php + diff --git a/doc/hook/wiki_preprocess.bb b/doc/hook/wiki_preprocess.bb new file mode 100644 index 000000000..913b601ba --- /dev/null +++ b/doc/hook/wiki_preprocess.bb @@ -0,0 +1,11 @@ +[h3]wiki_preprocess[/h3] + +Called before markdown/bbcode processors are run for wiki pages + +Passed parameter array: + + 'content' => wiki page content + 'mimetype' => page mimetype + + +see: Zotlabs/Module/Wiki.php |