aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-06-18 20:57:43 -0700
committerfriendica <info@friendica.com>2012-06-18 20:57:43 -0700
commite9aba87d76d44cf99db7666aa1bbb96489c3a04d (patch)
treea3855e9051ad1762690ddcaf8cc9832187ed4f3f
parentdbceef04e88f9f7c3f40c1ce3b1366c300abb394 (diff)
downloadvolse-hubzilla-e9aba87d76d44cf99db7666aa1bbb96489c3a04d.tar.gz
volse-hubzilla-e9aba87d76d44cf99db7666aa1bbb96489c3a04d.tar.bz2
volse-hubzilla-e9aba87d76d44cf99db7666aa1bbb96489c3a04d.zip
add plugin hooks to every module_function (allows plugins to be triggered off specific pages/urls)
-rw-r--r--index.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/index.php b/index.php
index 6967d0f31..61f3562b5 100644
--- a/index.php
+++ b/index.php
@@ -246,7 +246,10 @@ if(! $install)
if($a->module_loaded) {
$a->page['page_title'] = $a->module;
+ $placeholder = '';
+
if(function_exists($a->module . '_init')) {
+ call_hooks($a->module . '_mod_init', $placeholder);
$func = $a->module . '_init';
$func($a);
}
@@ -266,18 +269,25 @@ if($a->module_loaded) {
if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error)
&& (function_exists($a->module . '_post'))
&& (! x($_POST,'auth-params'))) {
+ call_hooks($a->module . '_mod_post', $_POST);
$func = $a->module . '_post';
$func($a);
}
if((! $a->error) && (function_exists($a->module . '_afterpost'))) {
+ call_hooks($a->module . '_mod_afterpost',$placeholder);
$func = $a->module . '_afterpost';
$func($a);
}
if((! $a->error) && (function_exists($a->module . '_content'))) {
+ $arr = array('content' => $a->page['content']);
+ call_hooks($a->module . '_mod_content', $arr);
+ $a->page['content'] = $arr['content'];
$func = $a->module . '_content';
- $a->page['content'] .= $func($a);
+ $arr = array('content' => $func($a));
+ call_hooks($a->module . '_mod_aftercontent', $arr);
+ $a->page['content'] .= $arr['content'];
}
}