aboutsummaryrefslogtreecommitdiffstats
path: root/include/plugin.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2018-09-20 12:08:45 +0200
committerMario <mario@mariovavti.com>2018-09-20 12:08:45 +0200
commit1b2732705782a6369bdff0c00b650dfc5c1353a9 (patch)
treefb9f161d9dcedc19a57676d6611d28d4f477c16d /include/plugin.php
parent3d713cee62d98bbb1cc95a0aeb8ed5cde7889150 (diff)
parent3ee632514c44317ede9280a6975a698c61775aa1 (diff)
downloadvolse-hubzilla-1b2732705782a6369bdff0c00b650dfc5c1353a9.tar.gz
volse-hubzilla-1b2732705782a6369bdff0c00b650dfc5c1353a9.tar.bz2
volse-hubzilla-1b2732705782a6369bdff0c00b650dfc5c1353a9.zip
Merge branch 'preempt-hooks' into 'dev'
Preempt hooks See merge request hubzilla/core!1279
Diffstat (limited to 'include/plugin.php')
-rwxr-xr-xinclude/plugin.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/plugin.php b/include/plugin.php
index 9757be356..fdc62b3a7 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -458,6 +458,25 @@ function call_hooks($name, &$data = null) {
if (isset(App::$hooks[$name])) {
foreach(App::$hooks[$name] as $hook) {
+
+ if ($name != 'permit_hook') { // avoid looping
+ $checkhook = [
+ 'name'=>$name,
+ 'hook'=>$hook,
+ 'data'=>$data,
+ // Note: Since PHP uses COPY-ON-WRITE
+ // for variables, there is no cost to
+ // passing the $data structure (unless
+ // the permit_hook processors change the
+ // information it contains.
+ 'permit'=>true
+ ];
+ call_hooks('permit_hook',$checkhook);
+ if (!$checkhook['permit']) {
+ continue;
+ }
+ $data = $checkhook['data'];
+ }
$origfn = $hook[1];
if($hook[0])
@include_once($hook[0]);