Skip to content

Commit

Permalink
refs #4134 added generic API hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Oct 1, 2013
1 parent f00d2f8 commit cc422d3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions core/API/Proxy.php
Expand Up @@ -184,18 +184,21 @@ public function call($className, $methodName, $parametersRequest)
// allow plugins to manipulate the value
$pluginName = $this->getModuleNameFromClassName($className);

Piwik_PostEvent(sprintf('API.%s.%s', $pluginName, $methodName), array($finalParameters));
Piwik_PostEvent(sprintf('API.Request.dispatch', $pluginName, $methodName), array(&$finalParameters));
Piwik_PostEvent(sprintf('API.%s.%s', $pluginName, $methodName), array(&$finalParameters));

// call the method
$returnedValue = call_user_func_array(array($object, $methodName), $finalParameters);

Piwik_PostEvent(sprintf('API.%s.%s.end', $pluginName, $methodName), array(
$endHookParams = array(
&$returnedValue,
array('className' => $className,
'module' => $pluginName,
'action' => $methodName,
'parameters' => $finalParameters)
));
'module' => $pluginName,
'action' => $methodName,
'parameters' => $finalParameters)
);
Piwik_PostEvent(sprintf('API.%s.%s.end', $pluginName, $methodName), $endHookParams);
Piwik_PostEvent(sprintf('API.Request.dispatch.end', $pluginName, $methodName), $endHookParams);

// Restore the request
$_GET = $saveGET;
Expand Down

0 comments on commit cc422d3

Please sign in to comment.