Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-04-18 11:55:47 +0300
committerdiosmosis <benaka@piwik.pro>2015-04-18 12:08:36 +0300
commit1760412a370823f96eeed21d730acf8f4038c843 (patch)
tree76b4c6ca0a2f9678b34d247e09e609b9ff7fc108 /core/EventDispatcher.php
parent5d57e10591a9e7e394f649cc67ea93ed14c47292 (diff)
parent898afb809d54553dea34e4d101e66b37f50f0334 (diff)
Merge branch 'master' into config_step_2
Conflicts: config/global.php core/CliMulti/RequestCommand.php core/Config.php core/Config/IniFileChain.php tests/PHPUnit/System/BlobReportLimitingTest.php tests/PHPUnit/TestingEnvironment.php tests/PHPUnit/Unit/Config/IniFileChainTest.php tests/PHPUnit/Unit/ConfigTest.php
Diffstat (limited to 'core/EventDispatcher.php')
-rw-r--r--core/EventDispatcher.php27
1 files changed, 18 insertions, 9 deletions
diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php
index 87e8ca59c2..47ae487cde 100644
--- a/core/EventDispatcher.php
+++ b/core/EventDispatcher.php
@@ -52,6 +52,8 @@ class EventDispatcher extends Singleton
*/
private $pluginManager;
+ private $pluginHooks = array();
+
/**
* Constructor.
*/
@@ -78,29 +80,36 @@ class EventDispatcher extends Singleton
$this->pendingEvents[] = array($eventName, $params);
}
+ $manager = $this->getPluginManager();
+
if (empty($plugins)) {
- $plugins = $this->getPluginManager()->getPluginsLoadedAndActivated();
+ $plugins = $manager->getPluginsLoadedAndActivated();
}
$callbacks = array();
// collect all callbacks to execute
- foreach ($plugins as $plugin) {
- if (is_string($plugin)) {
- $plugin = $this->getPluginManager()->getLoadedPlugin($plugin);
+ foreach ($plugins as $pluginName) {
+ if (!is_string($pluginName)) {
+ $pluginName = $pluginName->getPluginName();
}
- if (empty($plugin)) {
- return; // may happen in unit tests
+ if (!isset($this->pluginHooks[$pluginName])) {
+ $plugin = $manager->getLoadedPlugin($pluginName);
+ $this->pluginHooks[$pluginName] = $plugin->getListHooksRegistered();
}
-
- $hooks = $plugin->getListHooksRegistered();
+ $hooks = $this->pluginHooks[$pluginName];
if (isset($hooks[$eventName])) {
list($pluginFunction, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($hooks[$eventName]);
- $callbacks[$callbackGroup][] = is_string($pluginFunction) ? array($plugin, $pluginFunction) : $pluginFunction;
+ if (is_string($pluginFunction)) {
+ $plugin = $manager->getLoadedPlugin($pluginName);
+ $callbacks[$callbackGroup][] = array($plugin, $pluginFunction) ;
+ } else {
+ $callbacks[$callbackGroup][] = $pluginFunction;
+ }
}
}