Skip to content

Commit

Permalink
refs #4134 trigger general API event for all actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Oct 1, 2013
1 parent 7abaeb9 commit 676327f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions core/API/Proxy.php
Expand Up @@ -181,18 +181,21 @@ public function call($className, $methodName, $parametersRequest)
// start the timer
$timer = new Timer();

// allow plugins to manipulate the value
$pluginName = $this->getModuleNameFromClassName($className);

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

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

// allow plugins to manipulate the value
$pluginName = $this->getModuleNameFromClassName($className);
Piwik_PostEvent('API.Request.end', array(
&$returnedValue,
array('className' => $className,
'module' => $pluginName,
'action' => $methodName,
'parameters' => &$parametersRequest)
));
Piwik_PostEvent(sprintf('API.%s.%s.end', $pluginName, $methodName), array(
&$returnedValue,
array('className' => $className,
'module' => $pluginName,
'action' => $methodName,
'parameters' => $finalParameters)
));

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

0 comments on commit 676327f

Please sign in to comment.