aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-23 16:56:41 -0700
committerredmatrix <git@macgirvin.com>2016-04-23 16:56:41 -0700
commit79c63e3cf44438a7f993b2ea1813b9234ea4d3f3 (patch)
treed1fe1a2d5befc11e874e6f1c56a093639052550c /include
parentdf2990b27ee1e55cfe68f8f532b6be76d176ba62 (diff)
downloadvolse-hubzilla-79c63e3cf44438a7f993b2ea1813b9234ea4d3f3.tar.gz
volse-hubzilla-79c63e3cf44438a7f993b2ea1813b9234ea4d3f3.tar.bz2
volse-hubzilla-79c63e3cf44438a7f993b2ea1813b9234ea4d3f3.zip
this should work to call a hook for a string class method
Diffstat (limited to 'include')
-rwxr-xr-xinclude/plugin.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/plugin.php b/include/plugin.php
index 92040f297..8dd67bb0c 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -282,10 +282,20 @@ function call_hooks($name, &$data = null) {
$a = 0;
if((is_array(App::$hooks)) && (array_key_exists($name, App::$hooks))) {
foreach(App::$hooks[$name] as $hook) {
+ $origfn = $hook[1];
if($hook[0])
@include_once($hook[0]);
- if(preg_match('|^a:[0-9]+:{.*}$|s', $hook[1]))
+ if(preg_match('|^a:[0-9]+:{.*}$|s', $hook[1])) {
$hook[1] = unserialize($hook[1]);
+ }
+ elseif(strpos($hook[1],'::')) {
+ // We shouldn't need to do this, but it appears that PHP
+ // isn't able to directly execute a string variable with a class
+ // method in the manner we are attempting it, so we'll
+ // turn it into an array.
+ $hook[1] = explode('::',$hook[1]);
+ }
+
if(is_callable($hook[1])) {
$func = $hook[1];
if($hook[3])
@@ -296,7 +306,7 @@ function call_hooks($name, &$data = null) {
q("DELETE FROM hook WHERE hook = '%s' AND file = '%s' AND function = '%s'",
dbesc($name),
dbesc($hook[0]),
- dbesc($hook[1])
+ dbesc($origfn)
);
}
}