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:
authorBenaka Moorthi <benaka.moorthi@gmail.com>2013-07-06 03:44:45 +0400
committerBenaka Moorthi <benaka.moorthi@gmail.com>2013-07-06 03:44:45 +0400
commitddd7aac6f2d1e3b1660f38045cab4214a26f2325 (patch)
tree8e49b4362a6a88505d1b790d64a546a719056188
parent3a3517e48823a4d7dc521e5a754c51ddbcf5d210 (diff)
Implemented custom event dispatching system for Piwik (replaced event dispatcher lib in libs/Event).
Notes: - New dispatcher can execute callbacks before or after other callbacks. - It is also possible to dispatch events only to a specific set of plugins instead of all plugins. - Moved Piwik::unprefixClass to Piwik_Common::unprefixClass - Added visibility to some event handlers that were missing it. - Allowed two unit tests to fail w/ better diagnostic messages.
-rw-r--r--core/API/DocumentationGenerator.php2
-rw-r--r--core/API/Proxy.php13
-rw-r--r--core/API/Request.php2
-rw-r--r--core/ArchiveProcessor/Day.php2
-rw-r--r--core/ArchiveProcessor/Period.php2
-rw-r--r--core/AssetManager.php8
-rw-r--r--core/Common.php19
-rw-r--r--core/Controller.php6
-rw-r--r--core/Db/Schema.php4
-rw-r--r--core/EventDispatcher.php206
-rw-r--r--core/FrontController.php6
-rw-r--r--core/Piwik.php30
-rw-r--r--core/Plugin.php14
-rw-r--r--core/PluginsArchiver.php4
-rw-r--r--core/PluginsManager.php105
-rw-r--r--core/TaskScheduler.php2
-rw-r--r--core/Tracker.php6
-rw-r--r--core/Tracker/Action.php2
-rw-r--r--core/Tracker/Cache.php2
-rw-r--r--core/Tracker/GoalManager.php4
-rw-r--r--core/Tracker/Referer.php2
-rw-r--r--core/Tracker/Request.php4
-rw-r--r--core/Tracker/Visit.php17
-rw-r--r--core/Tracker/VisitExcluded.php2
-rw-r--r--core/Translate.php2
-rw-r--r--core/Twig.php4
-rw-r--r--core/Visualization/Chart.php2
-rw-r--r--libs/Event/Dispatcher.php485
-rw-r--r--libs/Event/Notification.php193
-rw-r--r--piwik.php2
-rw-r--r--plugins/API/API.php10
-rw-r--r--plugins/API/ProcessedReport.php8
-rw-r--r--plugins/Actions/Actions.php27
-rwxr-xr-xplugins/Annotations/Annotations.php10
-rw-r--r--plugins/AnonymizeIP/AnonymizeIP.php5
-rw-r--r--plugins/CoreAdminHome/CoreAdminHome.php21
-rw-r--r--plugins/CoreHome/CoreHome.php15
-rw-r--r--plugins/CustomVariables/CustomVariables.php36
-rw-r--r--plugins/DBStats/DBStats.php12
-rw-r--r--plugins/Dashboard/Dashboard.php20
-rw-r--r--plugins/DevicesDetection/DevicesDetection.php28
-rw-r--r--plugins/DoNotTrack/DoNotTrack.php6
-rw-r--r--plugins/ExamplePlugin/ExamplePlugin.php8
-rw-r--r--plugins/ExampleRssWidget/ExampleRssWidget.php9
-rw-r--r--plugins/Feedback/Feedback.php15
-rw-r--r--plugins/Goals/Goals.php67
-rw-r--r--plugins/ImageGraph/ImageGraph.php8
-rw-r--r--plugins/Installation/Controller.php2
-rw-r--r--plugins/Installation/Installation.php14
-rw-r--r--plugins/LanguagesManager/LanguagesManager.php36
-rw-r--r--plugins/Live/Live.php14
-rw-r--r--plugins/Login/Controller.php2
-rw-r--r--plugins/Login/Login.php25
-rw-r--r--plugins/MobileMessaging/MobileMessaging.php97
-rw-r--r--plugins/MultiSites/MultiSites.php21
-rw-r--r--plugins/Overlay/API.php3
-rw-r--r--plugins/Overlay/Overlay.php4
-rw-r--r--plugins/PDFReports/API.php55
-rw-r--r--plugins/PDFReports/PDFReports.php131
-rw-r--r--plugins/PrivacyManager/PrivacyManager.php14
-rw-r--r--plugins/Provider/Provider.php42
-rw-r--r--plugins/Referers/Referers.php29
-rw-r--r--plugins/SegmentEditor/API.php2
-rw-r--r--plugins/SegmentEditor/SegmentEditor.php17
-rw-r--r--plugins/SitesManager/API.php6
-rw-r--r--plugins/SitesManager/SitesManager.php21
-rw-r--r--plugins/Transitions/Transitions.php10
-rw-r--r--plugins/UserCountry/UserCountry.php64
-rw-r--r--plugins/UserCountryMap/UserCountryMap.php15
-rw-r--r--plugins/UserSettings/UserSettings.php25
-rw-r--r--plugins/UsersManager/API.php6
-rw-r--r--plugins/UsersManager/Controller.php2
-rw-r--r--plugins/UsersManager/UsersManager.php26
-rw-r--r--plugins/VisitFrequency/VisitFrequency.php7
-rw-r--r--plugins/VisitTime/VisitTime.php27
-rw-r--r--plugins/VisitorInterest/VisitorInterest.php28
-rw-r--r--plugins/VisitsSummary/VisitsSummary.php6
-rw-r--r--plugins/Widgetize/Widgetize.php14
-rw-r--r--tests/PHPUnit/Core/JsProxyTest.php7
-rw-r--r--tests/PHPUnit/Core/PiwikTest.php4
-rw-r--r--tests/PHPUnit/Core/TaskSchedulerTest.php16
-rw-r--r--tests/PHPUnit/MockEventDispatcher.php23
-rw-r--r--tests/PHPUnit/Plugins/MobileMessagingTest.php20
-rw-r--r--tests/PHPUnit/Plugins/PDFReportsTest.php2
-rwxr-xr-xtests/PHPUnit/Plugins/PrivacyManagerTest.php4
-rw-r--r--tests/PHPUnit/bootstrap.php1
86 files changed, 562 insertions, 1737 deletions
diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php
index 34ee2c1034..bc3dcf8b01 100644
--- a/core/API/DocumentationGenerator.php
+++ b/core/API/DocumentationGenerator.php
@@ -25,7 +25,7 @@ class Piwik_API_DocumentationGenerator
{
$plugins = Piwik_PluginsManager::getInstance()->getLoadedPluginsName();
foreach ($plugins as $plugin) {
- $plugin = Piwik::unprefixClass($plugin);
+ $plugin = Piwik_Common::unprefixClass($plugin);
try {
Piwik_API_Proxy::getInstance()->registerClass('Piwik_' . $plugin . '_API');
} catch (Exception $e) {
diff --git a/core/API/Proxy.php b/core/API/Proxy.php
index e7ed698f6e..8bb16832ac 100644
--- a/core/API/Proxy.php
+++ b/core/API/Proxy.php
@@ -190,12 +190,13 @@ class Piwik_API_Proxy
// allow plugins to manipulate the value
if (substr($className, 0, 6) == 'Piwik_' && substr($className, -4) == '_API') {
$pluginName = substr($className, 6, -4);
- Piwik_PostEvent('API.Proxy.processReturnValue', $returnedValue, array(
- 'className' => $className,
- 'module' => $pluginName,
- 'action' => $methodName,
- 'parameters' => &$parametersRequest
- ));
+ Piwik_PostEvent('API.Proxy.processReturnValue', array(
+ &$returnedValue,
+ array('className' => $className,
+ 'module' => $pluginName,
+ 'action' => $methodName,
+ 'parameters' => &$parametersRequest)
+ ));
}
// Restore the request
diff --git a/core/API/Request.php b/core/API/Request.php
index 1d074cc03e..53654cec58 100644
--- a/core/API/Request.php
+++ b/core/API/Request.php
@@ -164,7 +164,7 @@ class Piwik_API_Request
// if a token_auth is specified in the API request, we load the right permissions
$token_auth = Piwik_Common::getRequestVar('token_auth', '', 'string', $request);
if ($token_auth) {
- Piwik_PostEvent('API.Request.authenticate', $token_auth);
+ Piwik_PostEvent('API.Request.authenticate', array($token_auth));
Zend_Registry::get('access')->reloadAccess();
Piwik::raiseMemoryLimitIfNecessary();
}
diff --git a/core/ArchiveProcessor/Day.php b/core/ArchiveProcessor/Day.php
index aeb49cc450..7507da0591 100644
--- a/core/ArchiveProcessor/Day.php
+++ b/core/ArchiveProcessor/Day.php
@@ -97,6 +97,6 @@ class Piwik_ArchiveProcessor_Day extends Piwik_ArchiveProcessor
protected function compute()
{
- Piwik_PostEvent('ArchiveProcessing_Day.compute', $this);
+ Piwik_PostEvent('ArchiveProcessing_Day.compute', array(&$this));
}
}
diff --git a/core/ArchiveProcessor/Period.php b/core/ArchiveProcessor/Period.php
index ff052ac6ae..e16cf8956d 100644
--- a/core/ArchiveProcessor/Period.php
+++ b/core/ArchiveProcessor/Period.php
@@ -173,7 +173,7 @@ class Piwik_ArchiveProcessor_Period extends Piwik_ArchiveProcessor
protected function compute()
{
- Piwik_PostEvent('ArchiveProcessing_Period.compute', $this);
+ Piwik_PostEvent('ArchiveProcessing_Period.compute', array(&$this));
}
protected function aggregateCoreVisitsMetrics()
diff --git a/core/AssetManager.php b/core/AssetManager.php
index a1a1f9b14c..ca8ba38c37 100644
--- a/core/AssetManager.php
+++ b/core/AssetManager.php
@@ -123,7 +123,7 @@ class Piwik_AssetManager
$mergedContent = cssmin::minify($mergedContent);
$mergedContent = str_replace("\n", "\r\n", $mergedContent);
- Piwik_PostEvent('AssetManager.filterMergedCss', $mergedContent);
+ Piwik_PostEvent('AssetManager.filterMergedCss', array(&$mergedContent));
self::writeAssetToFile($mergedContent, self::MERGED_CSS_FILE);
}
@@ -174,7 +174,7 @@ class Piwik_AssetManager
private static function getCssFiles()
{
$cssFiles = array();
- Piwik_PostEvent(self::CSS_IMPORT_EVENT, $cssFiles);
+ Piwik_PostEvent(self::CSS_IMPORT_EVENT, array(&$cssFiles));
$cssFiles = self::sortCssFiles($cssFiles);
return $cssFiles;
}
@@ -237,7 +237,7 @@ class Piwik_AssetManager
}
$mergedContent = str_replace("\n", "\r\n", $mergedContent);
- Piwik_PostEvent('AssetManager.filterMergedJs', $mergedContent);
+ Piwik_PostEvent('AssetManager.filterMergedJs', array(&$mergedContent));
self::writeAssetToFile($mergedContent, self::MERGED_JS_FILE);
}
@@ -266,7 +266,7 @@ class Piwik_AssetManager
private static function getJsFiles()
{
$jsFiles = array();
- Piwik_PostEvent(self::JS_IMPORT_EVENT, $jsFiles);
+ Piwik_PostEvent(self::JS_IMPORT_EVENT, array(&$jsFiles));
$jsFiles = self::sortJsFiles($jsFiles);
return $jsFiles;
}
diff --git a/core/Common.php b/core/Common.php
index 8e442a37a9..e9a4625573 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -20,6 +20,8 @@
*/
class Piwik_Common
{
+ const CLASSES_PREFIX = 'Piwik_';
+
/**
* Const used to map the referer type to an integer in the log_visit table
*/
@@ -1025,7 +1027,7 @@ class Piwik_Common
public static function getCountry($lang, $enableLanguageToCountryGuess, $ip)
{
$country = null;
- Piwik_PostEvent('Common.getCountry', $country, $ip);
+ Piwik_PostEvent('Common.getCountry', array(&$country, $ip));
if (!empty($country)) {
return strtolower($country);
}
@@ -1549,6 +1551,21 @@ class Piwik_Common
? Piwik_UserCountry_LocationProvider_Default::ID
: $cache['currentLocationProviderId'];
}
+
+ /**
+ * Unprefix class name (if needed)
+ *
+ * @param string $class
+ * @return string
+ */
+ public static function unprefixClass($class)
+ {
+ $lenPrefix = strlen(self::CLASSES_PREFIX);
+ if (!strncmp($class, self::CLASSES_PREFIX, $lenPrefix)) {
+ return substr($class, $lenPrefix);
+ }
+ return $class;
+ }
}
/**
diff --git a/core/Controller.php b/core/Controller.php
index 0ae3c33320..b961f8759e 100644
--- a/core/Controller.php
+++ b/core/Controller.php
@@ -134,7 +134,7 @@ abstract class Piwik_Controller
*/
protected function renderView(Piwik_ViewDataTable $view, $fetch = false)
{
- Piwik_PostEvent('Controller.renderView',
+ Piwik_PostEvent('Controller.renderView', array(
$this,
array('view' => $view,
'controllerName' => $view->getCurrentControllerName(),
@@ -142,7 +142,7 @@ abstract class Piwik_Controller
'apiMethodToRequestDataTable' => $view->getApiMethodToRequestDataTable(),
'controllerActionCalledWhenRequestSubTable' => $view->getControllerActionCalledWhenRequestSubTable(),
)
- );
+ ));
$view->main();
@@ -698,7 +698,7 @@ abstract class Piwik_Controller
$defaultWebsiteId = $defaultReport;
}
- Piwik_PostEvent('Controller.getDefaultWebsiteId', $defaultWebsiteId);
+ Piwik_PostEvent('Controller.getDefaultWebsiteId', array(&$defaultWebsiteId));
if ($defaultWebsiteId) {
return $defaultWebsiteId;
diff --git a/core/Db/Schema.php b/core/Db/Schema.php
index 8cf56ccb85..e9057e4852 100644
--- a/core/Db/Schema.php
+++ b/core/Db/Schema.php
@@ -128,7 +128,7 @@ class Piwik_Db_Schema
private function loadSchema()
{
$schema = null;
- Piwik_PostEvent('Schema.loadSchema', $schema);
+ Piwik_PostEvent('Schema.loadSchema', array(&$schema));
if ($schema === null) {
$config = Piwik_Config::getInstance();
$dbInfos = $config->database;
@@ -260,4 +260,4 @@ class Piwik_Db_Schema
{
return $this->getSchema()->hasTables();
}
-} \ No newline at end of file
+}
diff --git a/core/EventDispatcher.php b/core/EventDispatcher.php
new file mode 100644
index 0000000000..f39148c7a4
--- /dev/null
+++ b/core/EventDispatcher.php
@@ -0,0 +1,206 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ * @category Piwik
+ * @package Piwik
+ */
+
+/**
+ * This class allows code to post events from anywhere in Piwik and for
+ * plugins to associate callbacks to be executed when events are posted.
+ */
+class Piwik_EventDispatcher
+{
+ // implementation details for postEvent
+ const EVENT_CALLBACK_GROUP_FIRST = 0;
+ const EVENT_CALLBACK_GROUP_SECOND = 1;
+ const EVENT_CALLBACK_GROUP_THIRD = 2;
+
+ /**
+ * Singleton instance.
+ */
+ private static $instance = null;
+
+ /**
+ * Returns the singleton EventDispatcher instance. Creates it if necessary.
+ */
+ public static function getInstance()
+ {
+ if (self::$instance === null) {
+ self::$instance = new Piwik_EventDispatcher();
+ }
+ return self::$instance;
+ }
+
+ /**
+ * Array of observers (callbacks attached to events) that are not methods
+ * of plugin classes.
+ *
+ * @var array
+ */
+ private $extraObservers = array();
+
+ /**
+ * Array storing information for all pending events. Each item in the array
+ * will be an array w/ two elements:
+ *
+ * array(
+ * 'Event.Name', // the event name
+ * array('event', 'parameters') // the parameters to pass to event observers
+ * )
+ *
+ * @var array
+ */
+ private $pendingEvents = array();
+
+ /**
+ * Triggers an event, executing all callbacks associated with it.
+ *
+ * @param string $eventName The name of the event, ie, API.getReportMetadata.
+ * @param array $params The parameters to pass to each callback when executing.
+ * @param bool $pending Whether this event should be posted again for plugins
+ * loaded after the event is fired.
+ * @param array|null $plugins The plugins to post events to. If null, the event
+ * is posted to all plugins. The elements of this array
+ * can be either the Piwik_Plugin objects themselves
+ * or their string names.
+ */
+ public function postEvent($eventName, $params, $pending = false, $plugins = null)
+ {
+ if ($pending) {
+ $this->pendingEvents[] = array($eventName, $params);
+ }
+
+ if (empty($plugins)) {
+ $plugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
+ }
+
+ $callbacks = array();
+
+ // collect all callbacks to execute
+ foreach ($plugins as $plugin) {
+ if (is_string($plugin)) {
+ $plugin = Piwik_PluginsManager::getInstance()->getLoadedPlugin($plugin);
+ }
+
+ $hooks = $plugin->getListHooksRegistered();
+
+ if (isset($hooks[$eventName])) {
+ list($pluginFunction, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($hooks[$eventName]);
+
+ $callbacks[$callbackGroup][] = array($plugin, $pluginFunction);
+ }
+ }
+
+ if (isset($this->extraObservers[$eventName])) {
+ foreach ($this->extraObservers[$eventName] as $callbackInfo) {
+ list($callback, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($callbackInfo);
+
+ $callbacks[$callbackGroup][] = $callback;
+ }
+ }
+
+ // execute callbacks in order
+ foreach ($callbacks as $callbackGroup) {
+ foreach ($callbackGroup as $callback) {
+ call_user_func_array($callback, $params);
+ }
+ }
+ }
+
+ /**
+ * Associates a callback that is not a plugin class method with an event
+ * name.
+ *
+ * @param string $eventName
+ * @param array $callback This can be a normal PHP callback or an array
+ * that looks like this:
+ * array(
+ * 'function' => $callback,
+ * 'before' => true
+ * )
+ * or this:
+ * array(
+ * 'function' => $callback,
+ * 'after' => true
+ * )
+ * If 'before' is set, the callback will be executed
+ * before normal & 'after' ones. If 'after' then it
+ * will be executed after normal ones.
+ */
+ public function addObserver($eventName, $callback)
+ {
+ $this->extraObservers[$eventName][] = $callback;
+ }
+
+ /**
+ * Removes all registered observers for an event name. Only used for testing.
+ *
+ * @param string $eventName
+ */
+ public function clearObservers($eventName)
+ {
+ $this->extraObservers[$eventName] = array();
+ }
+
+ /**
+ * Re-posts all pending events to the given plugin.
+ *
+ * @param Piwik_Plugin $plugin
+ */
+ public function postPendingEventsTo($plugin)
+ {
+ foreach ($this->pendingEvents as $eventInfo) {
+ list($eventName, $eventParams) = $eventInfo;
+ $this->postEvent($eventName, $eventParams, $pending = false, array($plugin));
+ }
+ }
+
+ private function getCallbackFunctionAndGroupNumber($hookInfo)
+ {
+ if (is_array($hookInfo)
+ && !empty($hookInfo['function'])
+ ) {
+ $pluginFunction = $hookInfo['function'];
+ if (!empty($hookInfo['before'])) {
+ $callbackGroup = self::EVENT_CALLBACK_GROUP_FIRST;
+ } else if (!empty($hookInfo['after'])) {
+ $callbackGroup = self::EVENT_CALLBACK_GROUP_SECOND;
+ } else {
+ $callbackGroup = self::EVENT_CALLBACK_GROUP_THIRD;
+ }
+ } else {
+ $pluginFunction = $hookInfo;
+ $callbackGroup = self::EVENT_CALLBACK_GROUP_SECOND;
+ }
+
+ return array($pluginFunction, $callbackGroup);
+ }
+}
+
+/**
+ * Post an event to the dispatcher which will notice the observers.
+ *
+ * @param string $eventName The event name.
+ * @param array $params The parameter array to forward to observer callbacks.
+ * @return void
+ */
+function Piwik_PostEvent($eventName, $params = array(), $pending = false, $plugins = null)
+{
+ Piwik_EventDispatcher::getInstance()->postEvent($eventName, $params, $pending, $plugins);
+}
+
+/**
+ * Register an action to execute for a given event
+ *
+ * @param string $eventName Name of event
+ * @param function $function Callback hook
+ */
+function Piwik_AddAction($eventName, $function)
+{
+ Piwik_EventDispatcher::getInstance()->addObserver($eventName, $function);
+}
diff --git a/core/FrontController.php b/core/FrontController.php
index f9b6e947c9..1f0845fbc3 100644
--- a/core/FrontController.php
+++ b/core/FrontController.php
@@ -124,7 +124,7 @@ class Piwik_FrontController
try {
return call_user_func_array(array($params[0], $params[1]), $params[2]);
} catch (Piwik_Access_NoAccessException $e) {
- Piwik_PostEvent('FrontController.NoAccessException', $e);
+ Piwik_PostEvent('FrontController.NoAccessException', array($e), $pending = true);
} catch (Exception $e) {
$debugTrace = $e->getTraceAsString();
$message = Piwik_Common::sanitizeInputValue($e->getMessage());
@@ -191,7 +191,7 @@ class Piwik_FrontController
try {
Piwik::createConfigObject();
} catch (Exception $e) {
- Piwik_PostEvent('FrontController.NoConfigurationFile', $e, $info = array(), $pending = true);
+ Piwik_PostEvent('FrontController.NoConfigurationFile', array($e), $pending = true);
$exceptionToThrow = $e;
}
return $exceptionToThrow;
@@ -261,7 +261,7 @@ class Piwik_FrontController
if (self::shouldRethrowException()) {
throw $e;
}
- Piwik_PostEvent('FrontController.badConfigurationFile', $e, $info = array(), $pending = true);
+ Piwik_PostEvent('FrontController.badConfigurationFile', array($e), $pending = true);
throw $e;
}
diff --git a/core/Piwik.php b/core/Piwik.php
index d9f2ba9913..8f2d737fe0 100644
--- a/core/Piwik.php
+++ b/core/Piwik.php
@@ -22,7 +22,6 @@ require_once PIWIK_INCLUDE_PATH . '/core/Translate.php';
*/
class Piwik
{
- const CLASSES_PREFIX = 'Piwik_';
const COMPRESSED_FILE_LOCATION = '/tmp/assets/';
/**
@@ -84,25 +83,10 @@ class Piwik
*/
static public function prefixClass($class)
{
- if (!strncmp($class, Piwik::CLASSES_PREFIX, strlen(Piwik::CLASSES_PREFIX))) {
+ if (!strncmp($class, Piwik_Common::CLASSES_PREFIX, strlen(Piwik_Common::CLASSES_PREFIX))) {
return $class;
}
- return Piwik::CLASSES_PREFIX . $class;
- }
-
- /**
- * Unprefix class name (if needed)
- *
- * @param string $class
- * @return string
- */
- static public function unprefixClass($class)
- {
- $lenPrefix = strlen(Piwik::CLASSES_PREFIX);
- if (!strncmp($class, Piwik::CLASSES_PREFIX, $lenPrefix)) {
- return substr($class, $lenPrefix);
- }
- return $class;
+ return Piwik_Common::CLASSES_PREFIX . $class;
}
/**
@@ -1550,8 +1534,8 @@ class Piwik
$segments = Piwik_Config::getInstance()->Segments;
$cachedResult = isset($segments['Segments']) ? $segments['Segments'] : array();
- Piwik_PostEvent('Piwik.getKnownSegmentsToArchiveAllSites', $cachedResult);
-
+ Piwik_PostEvent('Piwik.getKnownSegmentsToArchiveAllSites', array(&$cachedResult));
+
$cachedResult = array_unique($cachedResult);
}
@@ -1561,7 +1545,7 @@ class Piwik
static public function getKnownSegmentsToArchiveForSite($idSite)
{
$segments = array();
- Piwik_PostEvent('Piwik.getKnownSegmentsToArchiveForSite', $segments, $idSite);
+ Piwik_PostEvent('Piwik.getKnownSegmentsToArchiveForSite', array(&$segments, $idSite));
return $segments;
}
@@ -1922,12 +1906,12 @@ class Piwik
$dbInfos = $config->database;
}
- Piwik_PostEvent('Reporting.getDatabaseConfig', $dbInfos);
+ Piwik_PostEvent('Reporting.getDatabaseConfig', array(&$dbInfos));
$dbInfos['profiler'] = $config->Debug['enable_sql_profiler'];
$db = null;
- Piwik_PostEvent('Reporting.createDatabase', $db);
+ Piwik_PostEvent('Reporting.createDatabase', array(&$db));
if (is_null($db)) {
$adapter = $dbInfos['adapter'];
$db = @Piwik_Db_Adapter::factory($adapter, $dbInfos);
diff --git a/core/Plugin.php b/core/Plugin.php
index cfc6a0cdb4..65ae6bc54b 100644
--- a/core/Plugin.php
+++ b/core/Plugin.php
@@ -36,7 +36,17 @@ abstract class Piwik_Plugin
/**
* Returns the list of hooks registered with the methods names
*
- * @return array
+ * @return array eg, array(
+ * 'API.getReportMetadata' => 'myPluginFunction',
+ * 'Another.event' => array(
+ * 'function' => 'myOtherPluginFunction',
+ * 'after' => true // execute after callbacks w/o ordering
+ * )
+ * 'Yet.Another.event' => array(
+ * 'function' => 'myOtherPluginFunction',
+ * 'before' => true // execute before callbacks w/o ordering
+ * )
+ * )
*/
public function getListHooksRegistered()
{
@@ -106,7 +116,7 @@ abstract class Piwik_Plugin
*/
final public function getPluginName()
{
- return Piwik::unprefixClass(get_class($this));
+ return Piwik_Common::unprefixClass(get_class($this));
}
/**
diff --git a/core/PluginsArchiver.php b/core/PluginsArchiver.php
index d3f0fb31aa..e322108033 100644
--- a/core/PluginsArchiver.php
+++ b/core/PluginsArchiver.php
@@ -30,7 +30,7 @@ abstract class Piwik_PluginsArchiver
// TODO: Review this concept / each plugin should somehow maintain the list of report names they generate
public function shouldArchive()
{
- $pluginName = Piwik::unprefixClass(get_class($this));
+ $pluginName = Piwik_Common::unprefixClass(get_class($this));
$pluginName = str_replace("_Archiver", "", $pluginName);
return $this->getProcessor()->shouldProcessReportsForPlugin($pluginName);
}
@@ -50,4 +50,4 @@ abstract class Piwik_PluginsArchiver
{
return $this->getProcessor()->getLogAggregator();
}
-} \ No newline at end of file
+}
diff --git a/core/PluginsManager.php b/core/PluginsManager.php
index 5e4c7e3a5f..f003859a39 100644
--- a/core/PluginsManager.php
+++ b/core/PluginsManager.php
@@ -16,6 +16,7 @@
* @see core/Menu/Top.php
* @see core/PluginsFunctions/WidgetsList.php
* @see core/PluginsFunctions/Sql.php
+ * @see core/EventDispatcher.php
*/
require_once PIWIK_INCLUDE_PATH . '/core/Menu/Abstract.php';
require_once PIWIK_INCLUDE_PATH . '/core/Menu/Main.php';
@@ -23,6 +24,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Menu/Admin.php';
require_once PIWIK_INCLUDE_PATH . '/core/Menu/Top.php';
require_once PIWIK_INCLUDE_PATH . '/core/PluginsFunctions/WidgetsList.php';
require_once PIWIK_INCLUDE_PATH . '/core/PluginsFunctions/Sql.php';
+require_once PIWIK_INCLUDE_PATH . '/core/EventDispatcher.php';
/**
* Plugin manager
@@ -32,11 +34,6 @@ require_once PIWIK_INCLUDE_PATH . '/core/PluginsFunctions/Sql.php';
*/
class Piwik_PluginsManager
{
- /**
- * @var Event_Dispatcher
- */
- public $dispatcher;
-
protected $pluginsToLoad = array();
protected $doLoadPlugins = true;
@@ -71,11 +68,6 @@ class Piwik_PluginsManager
return self::$instance;
}
- private function __construct()
- {
- $this->dispatcher = Event_Dispatcher::getInstance();
- }
-
/**
* Update Plugins config
*
@@ -377,12 +369,6 @@ class Piwik_PluginsManager
if ($newPlugin === null) {
continue;
}
-
- if ($this->doLoadPlugins
- && $this->isPluginActivated($pluginName)
- ) {
- $this->addPluginObservers($newPlugin);
- }
}
}
}
@@ -429,6 +415,8 @@ class Piwik_PluginsManager
}
$this->addLoadedPlugin($pluginName, $newPlugin);
+
+ Piwik_EventDispatcher::getInstance()->postPendingEventsTo($newPlugin);
return $newPlugin;
}
@@ -450,14 +438,7 @@ class Piwik_PluginsManager
$plugin = $oPlugin;
}
- $hooks = $plugin->getListHooksRegistered();
- foreach ($hooks as $hookName => $methodToCall) {
- $success = $this->dispatcher->removeObserver(array($plugin, $methodToCall), $hookName);
- if ($success !== true) {
- throw new Exception("Error unloading plugin = " . $plugin->getPluginName() . ", method = $methodToCall, hook = $hookName ");
- }
- }
unset($this->loadedPlugins[$plugin->getPluginName()]);
}
@@ -497,21 +478,6 @@ class Piwik_PluginsManager
}
}
-
- /**
- * For the given plugin, add all the observers of this plugin.
- *
- * @param Piwik_Plugin $plugin
- */
- private function addPluginObservers(Piwik_Plugin $plugin)
- {
- $hooks = $plugin->getListHooksRegistered();
-
- foreach ($hooks as $hookName => $methodToCall) {
- $this->dispatcher->addObserver(array($plugin, $methodToCall), $hookName);
- }
- }
-
/**
* Add a plugin in the loaded plugins array
*
@@ -658,66 +624,3 @@ class Piwik_PluginsManager_PluginException extends Exception
}
}
-/**
- * Post an event to the dispatcher which will notice the observers
- *
- * @param string $eventName The event name
- * @param mixed $object Object, array or string that the listeners can read and/or modify.
- * Listeners can call $object =& $notification->getNotificationObject(); to fetch and then modify this variable.
- * @param array $info Additional array of data that can be used by the listeners, but not edited
- * @param bool $pending Should the notification be posted to plugins that register after the notification was sent?
- * @return void
- */
-function Piwik_PostEvent($eventName, &$object = null, $info = array(), $pending = false)
-{
- $notification = new Piwik_Event_Notification($object, $eventName, $info);
- Piwik_PluginsManager::getInstance()->dispatcher->postNotification($notification, $pending, $bubble = false);
-}
-
-/**
- * Register an action to execute for a given event
- *
- * @param string $hookName Name of event
- * @param function $function Callback hook
- */
-function Piwik_AddAction($hookName, $function)
-{
- Piwik_PluginsManager::getInstance()->dispatcher->addObserver($function, $hookName);
-}
-
-/**
- * Event notification
- *
- * @package Piwik
- *
- * @see Event_Notification, libs/Event/Notification.php
- * @link http://pear.php.net/package/Event_Dispatcher/docs/latest/Event_Dispatcher/Event_Notification.html
- */
-class Piwik_Event_Notification extends Event_Notification
-{
- static $showProfiler = false;
-
- /**
- * Use notification counter to profile runtime execution
- * time and memory usage.
- */
- function increaseNotificationCount( /* array($className|object, $method) */)
- {
- parent::increaseNotificationCount();
- if (self::$showProfiler && func_num_args() == 1) {
- $callback = func_get_arg(0);
- if (is_array($callback)) {
- $className = is_object($callback[0]) ? get_class($callback[0]) : $callback[0];
- $method = $callback[1];
-
- echo "after $className -> $method <br />";
- echo "-";
- Piwik::printTimer();
- echo "<br />";
- echo "-";
- Piwik::printMemoryLeak();
- echo "<br />";
- }
- }
- }
-}
diff --git a/core/TaskScheduler.php b/core/TaskScheduler.php
index 1a29780f72..a606a359a5 100644
--- a/core/TaskScheduler.php
+++ b/core/TaskScheduler.php
@@ -41,7 +41,7 @@ class Piwik_TaskScheduler
// collect tasks
$tasks = array();
- Piwik_PostEvent(self::GET_TASKS_EVENT, $tasks);
+ Piwik_PostEvent(self::GET_TASKS_EVENT, array(&$tasks));
// remove from timetable tasks that are not active anymore
$activeTaskNames = array();
diff --git a/core/Tracker.php b/core/Tracker.php
index 6396667d0c..ab4c65520d 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -490,7 +490,7 @@ class Piwik_Tracker
$configDb['port'] = '3306';
}
- Piwik_PostEvent('Tracker.getDatabaseConfig', $configDb);
+ Piwik_PostEvent('Tracker.getDatabaseConfig', array(&$configDb));
$db = Piwik_Tracker::factory($configDb);
$db->connect();
@@ -506,7 +506,7 @@ class Piwik_Tracker
try {
$db = null;
- Piwik_PostEvent('Tracker.createDatabase', $db);
+ Piwik_PostEvent('Tracker.createDatabase', array(&$db));
if (is_null($db)) {
$db = self::connectPiwikTrackerDb();
}
@@ -542,7 +542,7 @@ class Piwik_Tracker
protected function getNewVisitObject()
{
$visit = null;
- Piwik_PostEvent('Tracker.getNewVisitObject', $visit);
+ Piwik_PostEvent('Tracker.getNewVisitObject', array(&$visit));
if (is_null($visit)) {
$visit = new Piwik_Tracker_Visit();
diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php
index 3ea0cfb5bb..f4b3bb3288 100644
--- a/core/Tracker/Action.php
+++ b/core/Tracker/Action.php
@@ -709,7 +709,7 @@ class Piwik_Tracker_Action implements Piwik_Tracker_Action_Interface
/*
* send the Action object ($this) and the list of ids ($info) as arguments to the event
*/
- Piwik_PostEvent('Tracker.Action.record', $this, $info);
+ Piwik_PostEvent('Tracker.Action.record', array($this, $info));
}
public function getCustomVariables()
diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php
index e7077d17bd..d277d94f84 100644
--- a/core/Tracker/Cache.php
+++ b/core/Tracker/Cache.php
@@ -54,7 +54,7 @@ class Piwik_Tracker_Cache
Piwik::setUserIsSuperUser();
$content = array();
- Piwik_PostEvent('Common.fetchWebsiteAttributes', $content, $idSite);
+ Piwik_PostEvent('Common.fetchWebsiteAttributes', array(&$content, $idSite));
// restore original user privilege
Piwik::setUserIsSuperUser($isSuperUser);
diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php
index fa870d1f3c..1f674ce438 100644
--- a/core/Tracker/GoalManager.php
+++ b/core/Tracker/GoalManager.php
@@ -401,7 +401,7 @@ class Piwik_Tracker_GoalManager
$this->recordEcommerceItems($goal, $items);
}
- Piwik_PostEvent('Tracker.recordEcommerceGoal', $goal);
+ Piwik_PostEvent('Tracker.recordEcommerceGoal', array($goal));
}
/**
@@ -762,7 +762,7 @@ class Piwik_Tracker_GoalManager
$this->recordGoal($newGoal);
- Piwik_PostEvent('Tracker.recordStandardGoals', $newGoal);
+ Piwik_PostEvent('Tracker.recordStandardGoals', array($newGoal));
}
}
diff --git a/core/Tracker/Referer.php b/core/Tracker/Referer.php
index 168c04e158..c941e0e480 100644
--- a/core/Tracker/Referer.php
+++ b/core/Tracker/Referer.php
@@ -124,7 +124,7 @@ class Piwik_Tracker_Referer
protected function detectRefererSearchEngine()
{
$searchEngineInformation = Piwik_Common::extractSearchEngineInformationFromUrl($this->refererUrl);
- Piwik_PostEvent('Tracker.detectRefererSearchEngine', $searchEngineInformation, $this->refererUrl);
+ Piwik_PostEvent('Tracker.detectRefererSearchEngine', array(&$searchEngineInformation, $this->refererUrl));
if ($searchEngineInformation === false) {
return false;
}
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php
index ec656d7582..486808e3ae 100644
--- a/core/Tracker/Request.php
+++ b/core/Tracker/Request.php
@@ -260,7 +260,7 @@ class Piwik_Tracker_Request
public function getIdSite()
{
$idSite = Piwik_Common::getRequestVar('idsite', 0, 'int', $this->params);
- Piwik_PostEvent('Tracker.setRequest.idSite', $idSite, $this->params);
+ Piwik_PostEvent('Tracker.setRequest.idSite', array(&$idSite, $this->params));
if ($idSite <= 0) {
throw new Exception('Invalid idSite');
}
@@ -483,4 +483,4 @@ class Piwik_Tracker_Request
{
return count($this->params);
}
-} \ No newline at end of file
+}
diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php
index 3533e7a929..3058656d51 100644
--- a/core/Tracker/Visit.php
+++ b/core/Tracker/Visit.php
@@ -89,7 +89,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
}
// Anonymize IP (after testing for IP exclusion)
- Piwik_PostEvent('Tracker.Visit.setVisitorIp', $this->visitorInfo['location_ip']);
+ Piwik_PostEvent('Tracker.Visit.setVisitorIp', array(&$this->visitorInfo['location_ip']));
$this->visitorCustomVariables = $this->request->getCustomVariables($scope = 'visit');
if (!empty($this->visitorCustomVariables)) {
@@ -300,7 +300,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$valuesToUpdate = array_merge($valuesToUpdate, $this->visitorCustomVariables);
// trigger event before update
- Piwik_PostEvent('Tracker.knownVisitorUpdate', $valuesToUpdate);
+ Piwik_PostEvent('Tracker.knownVisitorUpdate', array(&$valuesToUpdate));
$this->visitorInfo['time_spent_ref_action'] = $this->getTimeSpentRefererAction();
@@ -341,7 +341,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
. " wasn't found in the DB, we fallback to a new visitor");
}
- Piwik_PostEvent('Tracker.knownVisitorInformation', $this->visitorInfo);
+ Piwik_PostEvent('Tracker.knownVisitorInformation', array(&$this->visitorInfo));
}
/**
@@ -461,7 +461,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$extraInfo = array(
'UserAgent' => $this->request->getUserAgent(),
);
- Piwik_PostEvent('Tracker.newVisitorInformation', $this->visitorInfo, $extraInfo);
+ Piwik_PostEvent('Tracker.newVisitorInformation', array(&$this->visitorInfo, $extraInfo));
$debugVisitInfo = $this->visitorInfo;
$debugVisitInfo['idvisitor'] = bin2hex($debugVisitInfo['idvisitor']);
@@ -494,7 +494,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
{
$location = array();
$userInfo = array('lang' => $browserLang, 'ip' => Piwik_IP::N2P($this->getVisitorIp()));
- Piwik_PostEvent('Tracker.getVisitorLocation', $location, $userInfo);
+ Piwik_PostEvent('Tracker.getVisitorLocation', array(&$location, $userInfo));
$location = $this->request->enrichLocation($location);
@@ -561,7 +561,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
*/
protected function saveVisitorInformation()
{
- Piwik_PostEvent('Tracker.saveVisitorInformation', $this->visitorInfo);
+ Piwik_PostEvent('Tracker.saveVisitorInformation', array(&$this->visitorInfo));
$this->visitorInfo['location_browser_lang'] = substr($this->visitorInfo['location_browser_lang'], 0, 20);
$this->visitorInfo['referer_name'] = substr($this->visitorInfo['referer_name'], 0, 70);
@@ -581,7 +581,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
$this->visitorInfo['visit_first_action_time'] = $this->request->getCurrentTimestamp();
$this->visitorInfo['visit_last_action_time'] = $this->request->getCurrentTimestamp();
- Piwik_PostEvent('Tracker.saveVisitorInformation.end', $this->visitorInfo);
+ Piwik_PostEvent('Tracker.saveVisitorInformation.end', array(&$this->visitorInfo));
}
/**
@@ -622,7 +622,6 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
return $this->visitorInfo['location_ip'];
}
-
/**
* This methods tries to see if the visitor has visited the website before.
*
@@ -965,7 +964,7 @@ class Piwik_Tracker_Visit implements Piwik_Tracker_Visit_Interface
protected function newAction()
{
$action = null;
- Piwik_PostEvent('Tracker.newAction', $action);
+ Piwik_PostEvent('Tracker.newAction', array(&$action));
if (is_null($action)) {
$action = new Piwik_Tracker_Action($this->request);
diff --git a/core/Tracker/VisitExcluded.php b/core/Tracker/VisitExcluded.php
index 233bb289ed..2ac0f1826f 100644
--- a/core/Tracker/VisitExcluded.php
+++ b/core/Tracker/VisitExcluded.php
@@ -63,7 +63,7 @@ class Piwik_Tracker_VisitExcluded
}
/* custom filters can override the built-in filters above */
- Piwik_PostEvent('Tracker.Visit.isExcluded', $excluded);
+ Piwik_PostEvent('Tracker.Visit.isExcluded', array(&$excluded));
/*
* Following exclude operations happen after the hook.
diff --git a/core/Translate.php b/core/Translate.php
index e19ea422fc..807638357c 100644
--- a/core/Translate.php
+++ b/core/Translate.php
@@ -97,7 +97,7 @@ class Piwik_Translate
if (is_null(self::$languageToLoad)) {
$lang = Piwik_Common::getRequestVar('language', '', 'string');
- Piwik_PostEvent('Translate.getLanguageToLoad', $lang);
+ Piwik_PostEvent('Translate.getLanguageToLoad', array(&$lang));
self::$languageToLoad = $lang;
}
diff --git a/core/Twig.php b/core/Twig.php
index 73440180c2..47497b00be 100644
--- a/core/Twig.php
+++ b/core/Twig.php
@@ -90,7 +90,7 @@ class Piwik_Twig
{
$postEventFunction = new Twig_SimpleFunction('postEvent', function ($eventName) {
$str = '';
- Piwik_PostEvent($eventName, $str);
+ Piwik_PostEvent($eventName, array(&$str));
return $str;
}, array('is_safe' => array('html')));
$this->twig->addFunction($postEventFunction);
@@ -222,7 +222,7 @@ class Piwik_Twig
{
$plugins = Piwik_PluginsManager::getInstance()->getLoadedPluginsName();
foreach($plugins as $name) {
- $name = Piwik::unprefixClass($name);
+ $name = Piwik_Common::unprefixClass($name);
$path = sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, $name);
if (is_dir($path)) {
$loader->addPath(PIWIK_INCLUDE_PATH . '/plugins/' . $name . '/templates', $name);
diff --git a/core/Visualization/Chart.php b/core/Visualization/Chart.php
index 1cde982ef0..74d4bf1b52 100644
--- a/core/Visualization/Chart.php
+++ b/core/Visualization/Chart.php
@@ -165,7 +165,7 @@ abstract class Piwik_Visualization_Chart implements Piwik_View_Interface
'seriesPicker' => &$this->seriesPicker
);
- Piwik_PostEvent('Visualization_Chart.render', $data);
+ Piwik_PostEvent('Visualization_Chart.render', array(&$data));
return Piwik_Common::json_encode($data);
}
diff --git a/libs/Event/Dispatcher.php b/libs/Event/Dispatcher.php
deleted file mode 100644
index 8818f15976..0000000000
--- a/libs/Event/Dispatcher.php
+++ /dev/null
@@ -1,485 +0,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Copyright (c) 2005, Bertrand Mansion |
-// | All rights reserved. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | o Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | o Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution.|
-// | o The names of the authors may not be used to endorse or promote |
-// | products derived from this software without specific prior written |
-// | permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
-// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
-// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
-// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
-// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
-// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
-// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
-// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
-// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// | |
-// +-----------------------------------------------------------------------+
-// | Author: Bertrand Mansion <bmansion@mamasam.com> |
-// | Stephan Schmidt <schst@php.net> |
-// +-----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
- * Pseudo 'static property' for Notification object
- * @global array $GLOBALS["_Event_Dispatcher"]
- */
-$GLOBALS['_Event_Dispatcher'] = array(
- 'NotificationClass' => 'Event_Notification'
- );
-
-/**
- * Registers a global observer
- */
-define('EVENT_DISPATCHER_GLOBAL', '');
-
-/**
- * Dispatch notifications using PHP callbacks
- *
- * The Event_Dispatcher acts acts as a notification dispatch table.
- * It is used to notify other objects of interesting things, if
- * they meet certain criteria. This information is encapsulated
- * in {@link Event_Notification} objects. Client objects register
- * themselves with the Event_Dispatcher as observers of specific
- * notifications posted by other objects. When an event occurs,
- * an object posts an appropriate notification to the Event_Dispatcher.
- * The Event_Dispatcher dispatches a message to each
- * registered observer, passing the notification as the sole argument.
- *
- * The Event_Dispatcher is actually a combination of three design
- * patterns: the Singleton, {@link http://c2.com/cgi/wiki?MediatorPattern Mediator},
- * and Observer patterns. The idea behind Event_Dispatcher is borrowed from
- * {@link http://developer.apple.com/documentation/Cocoa/Conceptual/Notifications/index.html Apple's Cocoa framework}.
- *
- * @category Event
- * @package Event_Dispatcher
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Stephan Schmidt <schst@php.net>
- * @copyright 1997-2005 The PHP Group
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Event_Dispatcher
- */
-class Event_Dispatcher
-{
- /**
- * Registered observer callbacks
- * @var array
- * @access private
- */
- var $_ro = array();
-
- /**
- * Pending notifications
- * @var array
- * @access private
- */
- var $_pending = array();
-
- /**
- * Nested observers
- * @var array
- * @access private
- */
- var $_nestedDispatchers = array();
-
- /**
- * Name of the dispatcher
- * @var string
- * @access private
- */
- var $_name = null;
-
- /**
- * Class used for notifications
- * @var string
- * @access private
- */
- var $_notificationClass = null;
-
- /**
- * PHP4 constructor
- *
- * Please use {@link getInstance()} instead.
- *
- * @access private
- * @param string Name of the notification dispatcher.
- */
-// function Event_Dispatcher($name)
-// {
-// Event_Dispatcher::__construct($name);
-// }
-
- /**
- * PHP5 constructor
- *
- * Please use {@link getInstance()} instead.
- *
- * @access private
- * @param string Name of the notification dispatcher.
- */
- function __construct($name)
- {
- $this->_name = $name;
- $this->_notificationClass = $GLOBALS['_Event_Dispatcher']['NotificationClass'];
- }
-
- /**
- * Returns a notification dispatcher singleton
- *
- * There is usually no need to have more than one notification
- * center for an application so this is the recommended way
- * to get a Event_Dispatcher object.
- *
- * @param string Name of the notification dispatcher.
- * The default notification dispatcher is named __default.
- *
- * @return object Event_Dispatcher
- */
- static function getInstance($name = '__default')
- {
- static $dispatchers = array();
-
- if (!isset($dispatchers[$name])) {
- $dispatchers[$name] = new Event_Dispatcher($name);
- }
-
- return $dispatchers[$name];
- }
-
- /**
- * Registers an observer callback
- *
- * This method registers a {@link http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback callback}
- * which is called when the notification corresponding to the
- * criteria given at registration time is posted.
- * The criteria are the notification name and eventually the
- * class of the object posted with the notification.
- *
- * If there are any pending notifications corresponding to the criteria
- * given here, the callback will be called straight away.
- *
- * If the notification name is empty, the observer will receive all the
- * posted notifications. Same goes for the class name.
- *
- * @access public
- * @param mixed A PHP callback
- * @param string Expected notification name, serves as a filter
- * @param string Expected contained object class, serves as a filter
- * @return void
- */
- function addObserver($callback, $nName = EVENT_DISPATCHER_GLOBAL, $class = null)
- {
- if (is_array($callback)) {
- if (is_object($callback[0])) {
- // Note : PHP4 does not allow correct object comparison so
- // only the class name is used for registration checks.
- $reg = get_class($callback[0]).'::'.$callback[1];
- } else {
- $reg = $callback[0].'::'.$callback[1];
- }
- } else {
- $reg = $callback;
- }
-
- $this->_ro[$nName][$reg] = array(
- 'callback' => $callback,
- 'class' => $class
- );
-
- // Post eventual pending notifications for this observer
- if (isset($this->_pending[$nName])) {
- foreach (array_keys($this->_pending[$nName]) as $k) {
- $notification =& $this->_pending[$nName][$k];
- if (!$notification->isNotificationCancelled()) {
- $object = $notification->getNotificationObject();
- $objClass = is_object($object) ? get_class($object) : null;
- if (empty($class) || strcasecmp($class, $objClass) == 0) {
- call_user_func_array($callback, array(&$notification));
- //-- Piwik Hack --//
- $notification->increaseNotificationCount($callback);
- //-- End Piwik Hack --//
- }
- }
- }
- }
- }
-
- /**
- * Creates and posts a notification object
- *
- * The purpose of the optional associated object is generally to pass
- * the object posting the notification to the observers, so that the
- * observers can query the posting object for more information about
- * the event.
- *
- * Notifications are by default added to a pending notification list.
- * This way, if an observer is not registered by the time they are
- * posted, it will still be notified when it is added as an observer.
- * This behaviour can be turned off in order to make sure that only
- * the registered observers will be notified.
- *
- * The info array serves as a container for any kind of useful
- * information. It is added to the notification object and posted along.
- *
- * @access public
- * @param object Notification associated object
- * @param string Notification name
- * @param array Optional user information
- * @param bool Whether the notification is pending
- * @param bool Whether you want the notification to bubble up
- * @return object The notification object
- */
- function &post(&$object, $nName, $info = array(), $pending = true, $bubble = true)
- {
- $notification = new $this->_notificationClass($object, $nName, $info);
- return $this->postNotification($notification, $pending, $bubble);
- }
-
- /**
- * Posts the {@link Event_Notification} object
- *
- * @access public
- * @param object The Notification object
- * @param bool Whether to post the notification immediately
- * @param bool Whether you want the notification to bubble up
- * @see Event_Dispatcher::post()
- * @return object The notification object
- */
- function &postNotification(&$notification, $pending = true, $bubble = true)
- {
- $nName = $notification->getNotificationName();
- if ($pending === true) {
- $this->_pending[$nName][] =& $notification;
- }
-
- $object = $notification->getNotificationObject();
- $objClass = is_object($object) ? get_class($object) : null;
-
- // Find the registered observers
- if (isset($this->_ro[$nName])) {
- foreach (array_keys($this->_ro[$nName]) as $k) {
- $rObserver =& $this->_ro[$nName][$k];
- if ($notification->isNotificationCancelled()) {
- return $notification;
- }
- if (empty($rObserver['class']) ||
- strcasecmp($rObserver['class'], $objClass) == 0) {
- $callback = $rObserver['callback'];
- call_user_func_array($callback, array(&$notification));
- //-- Piwik Hack --//
- $notification->increaseNotificationCount($callback);
- //-- End Piwik Hack --//
- }
- }
- }
-
- // Notify globally registered observers
- if (isset($this->_ro[EVENT_DISPATCHER_GLOBAL])) {
- foreach (array_keys($this->_ro[EVENT_DISPATCHER_GLOBAL]) as $k) {
- $rObserver =& $this->_ro[EVENT_DISPATCHER_GLOBAL][$k];
- if ($notification->isNotificationCancelled()) {
- return $notification;
- }
- if (empty($rObserver['class']) ||
- strcasecmp($rObserver['class'], $objClass) == 0) {
- call_user_func_array($rObserver['callback'], array(&$notification));
- //-- Piwik Hack --//
- $notification->increaseNotificationCount(get_class($rObserver['callback'][0]), $rObserver['callback'][1]);
- //-- End Piwik Hack --//
- }
- }
- }
-
- if ($bubble === false) {
- return $notification;
- }
-
- // Notify in nested dispatchers
- foreach (array_keys($this->_nestedDispatchers) as $nested) {
- $notification =& $this->_nestedDispatchers[$nested]->postNotification($notification, $pending);
- }
-
- return $notification;
- }
-
- /**
- * Removes a registered observer that correspond to the given criteria
- *
- * @access public
- * @param mixed A PHP callback
- * @param string Notification name
- * @param string Contained object class
- * @return bool True if an observer was removed, false otherwise
- */
- function removeObserver($callback, $nName = EVENT_DISPATCHER_GLOBAL, $class = null)
- {
- if (is_array($callback)) {
- if (is_object($callback[0])) {
- $reg = get_class($callback[0]).'::'.$callback[1];
- } else {
- $reg = $callback[0].'::'.$callback[1];
- }
- } else {
- $reg = $callback;
- }
-
- $removed = false;
- if (isset($this->_ro[$nName][$reg])) {
- if (!empty($class)) {
- if (strcasecmp($this->_ro[$nName][$reg]['class'], $class) == 0) {
- unset($this->_ro[$nName][$reg]);
- $removed = true;
- }
- } else {
- unset($this->_ro[$nName][$reg]);
- $removed = true;
- }
- }
-
- if (isset($this->_ro[$nName]) && count($this->_ro[$nName]) == 0) {
- unset($this->_ro[$nName]);
- }
- return $removed;
- }
-
- /**
- * Check, whether the specified observer has been registered with the
- * dispatcher
- *
- * @access public
- * @param mixed A PHP callback
- * @param string Notification name
- * @param string Contained object class
- * @return bool True if the observer has been registered, false otherwise
- */
- function observerRegistered($callback, $nName = EVENT_DISPATCHER_GLOBAL, $class = null)
- {
- if (is_array($callback)) {
- if (is_object($callback[0])) {
- $reg = get_class($callback[0]).'::'.$callback[1];
- } else {
- $reg = $callback[0].'::'.$callback[1];
- }
- } else {
- $reg = $callback;
- }
-
- if (!isset($this->_ro[$nName][$reg])) {
- return false;
- }
- if (empty($class)) {
- return true;
- }
- if (strcasecmp($this->_ro[$nName][$reg]['class'], $class) == 0) {
- return true;
- }
- return false;
- }
-
- /**
- * Get all observers, that have been registered for a notification
- *
- * @access public
- * @param string Notification name
- * @param string Contained object class
- * @return array List of all observers
- */
- function getObservers($nName = EVENT_DISPATCHER_GLOBAL, $class = null)
- {
- $observers = array();
- if (!isset($this->_ro[$nName])) {
- return $observers;
- }
- foreach ($this->_ro[$nName] as $reg => $observer) {
- if ($class == null || $observer['class'] == null || strcasecmp($observer['class'], $class) == 0) {
- $observers[] = $reg;
- }
- }
- return $observers;
- }
-
- /**
- * Get the name of the dispatcher.
- *
- * The name is the unique identifier of a dispatcher.
- *
- * @access public
- * @return string name of the dispatcher
- */
- function getName()
- {
- return $this->_name;
- }
-
- /**
- * add a new nested dispatcher
- *
- * Notifications will be broadcasted to this dispatcher as well, which
- * allows you to create event bubbling.
- *
- * @access public
- * @param Event_Dispatcher The nested dispatcher
- */
- function addNestedDispatcher(&$dispatcher)
- {
- $name = $dispatcher->getName();
- $this->_nestedDispatchers[$name] =& $dispatcher;
- }
-
- /**
- * remove a nested dispatcher
- *
- * @access public
- * @param Event_Dispatcher Dispatcher to remove
- * @return boolean
- */
- function removeNestedDispatcher($dispatcher)
- {
- if (is_object($dispatcher)) {
- $dispatcher = $dispatcher->getName();
- }
- if (!isset($this->_nestedDispatchers[$dispatcher])) {
- return false;
- }
- unset($this->_nestedDispatchers[$dispatcher]);
- return true;
- }
-
- /**
- * Changes the class used for notifications
- *
- * You may call this method on an object to change it for a single
- * dispatcher or statically, to set the default for all dispatchers
- * that will be created.
- *
- * @access public
- * @param string name of the notification class
- * @return boolean
- */
- function setNotificationClass($class)
- {
- if (isset($this) && is_a($this, 'Event_Dispatcher')) {
- $this->_notificationClass = $class;
- return true;
- }
- $GLOBALS['_Event_Dispatcher']['NotificationClass'] = $class;
- return true;
- }
-
-}
diff --git a/libs/Event/Notification.php b/libs/Event/Notification.php
deleted file mode 100644
index 1ce2ccde8d..0000000000
--- a/libs/Event/Notification.php
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php
-// +-----------------------------------------------------------------------+
-// | Copyright (c) 2005, Bertrand Mansion |
-// | All rights reserved. |
-// | |
-// | Redistribution and use in source and binary forms, with or without |
-// | modification, are permitted provided that the following conditions |
-// | are met: |
-// | |
-// | o Redistributions of source code must retain the above copyright |
-// | notice, this list of conditions and the following disclaimer. |
-// | o Redistributions in binary form must reproduce the above copyright |
-// | notice, this list of conditions and the following disclaimer in the |
-// | documentation and/or other materials provided with the distribution.|
-// | o The names of the authors may not be used to endorse or promote |
-// | products derived from this software without specific prior written |
-// | permission. |
-// | |
-// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
-// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
-// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
-// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
-// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
-// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
-// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
-// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
-// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
-// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
-// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// | |
-// +-----------------------------------------------------------------------+
-// | Author: Bertrand Mansion <bmansion@mamasam.com> |
-// | Stephan Schmidt <schst@php.net> |
-// +-----------------------------------------------------------------------+
-//
-// $Id$
-
-/**
- * Default state of the notification
- */
-define('EVENT_NOTIFICATION_STATE_DEFAULT', 0);
-
-/**
- * Notification has been cancelled
- */
-define('EVENT_NOTIFICATION_STATE_CANCELLED', 1);
-
-/**
- * A Notification object
- *
- * The Notification object can be easily subclassed and serves as a container
- * for the information about the notification. It holds an object which is
- * usually a reference to the object that posted the notification,
- * a notification name used to identify the notification and some user
- * information which can be anything you need.
- *
- * @category Event
- * @package Event_Dispatcher
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Stephan Schmidt <schst@php.net>
- * @copyright 1997-2005 The PHP Group
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
- * @version Release: @package_version@
- * @link http://pear.php.net/package/Event_Dispatcher
- */
-class Event_Notification
-{
- /**
- * name of the notofication
- * @var string
- * @access private
- */
- var $_notificationName;
-
- /**
- * object of interesed (the sender of the notification, in most cases)
- * @var object
- * @access private
- */
- var $_notificationObject;
-
- /**
- * additional information about the notification
- * @var mixed
- * @access private
- */
- var $_notificationInfo = array();
-
- /**
- * state of the notification
- *
- * This may be:
- * - EVENT_NOTIFICATION_STATE_DEFAULT
- * - EVENT_NOTIFICATION_STATE_CANCELLED
- *
- * @var integer
- * @access private
- */
- var $_notificationState = EVENT_NOTIFICATION_STATE_DEFAULT;
-
- /**
- * amount of observers that received this notification
- * @var mixed
- * @access private
- */
- var $_notificationCount = 0;
-
- /**
- * Constructor
- *
- * @access public
- * @param object The object of interest for the notification,
- * usually is the posting object
- * @param string Notification name
- * @param array Free information array
- */
- function Event_Notification(&$object, $name, $info = array())
- {
- $this->_notificationObject =& $object;
- $this->_notificationName = $name;
- $this->_notificationInfo = $info;
- }
-
- /**
- * Returns the notification name
- * @return string Notification name
- */
- function getNotificationName()
- {
- return $this->_notificationName;
- }
-
- /**
- * Returns the contained object
- * @return object Contained object
- */
- function &getNotificationObject()
- {
- return $this->_notificationObject;
- }
-
- /**
- * Returns the user info array
- * @return array user info
- */
- function getNotificationInfo()
- {
- return $this->_notificationInfo;
- }
-
- /**
- * Increase the internal count
- *
- * @access public
- */
- function increaseNotificationCount()
- {
- ++$this->_notificationCount;
- }
-
- /**
- * Get the number of posted notifications
- *
- * @access public
- * @return int
- */
- function getNotificationCount()
- {
- return $this->_notificationCount;
- }
-
- /**
- * Cancel the notification
- *
- * @access public
- * @return void
- */
- function cancelNotification()
- {
- $this->_notificationState = EVENT_NOTIFICATION_STATE_CANCELLED;
- }
-
- /**
- * Checks whether the notification has been cancelled
- *
- * @access public
- * @return boolean
- */
- function isNotificationCancelled()
- {
- return ($this->_notificationState === EVENT_NOTIFICATION_STATE_CANCELLED);
- }
-}
diff --git a/piwik.php b/piwik.php
index efc2174310..0429c7792d 100644
--- a/piwik.php
+++ b/piwik.php
@@ -31,8 +31,6 @@ if (!defined('PIWIK_INCLUDE_PATH')) {
@ignore_user_abort(true);
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
-require_once PIWIK_INCLUDE_PATH . '/libs/Event/Dispatcher.php';
-require_once PIWIK_INCLUDE_PATH . '/libs/Event/Notification.php';
require_once PIWIK_INCLUDE_PATH . '/core/PluginsManager.php';
require_once PIWIK_INCLUDE_PATH . '/core/Plugin.php';
require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
diff --git a/plugins/API/API.php b/plugins/API/API.php
index 9843a2ce05..e7fdca482b 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -55,13 +55,8 @@ class Piwik_API extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/API/stylesheets/listAllAPI.css";
}
}
@@ -133,7 +128,7 @@ class Piwik_API_API
public function getSegmentsMetadata($idSites = array(), $_hideImplementationData = true)
{
$segments = array();
- Piwik_PostEvent('API.getSegmentsMetadata', $segments, $idSites);
+ Piwik_PostEvent('API.getSegmentsMetadata', array(&$segments, $idSites));
$isAuthenticatedWithViewAccess = Piwik::isUserHasViewAccess($idSites) && !Piwik::isUserIsAnonymous();
@@ -411,7 +406,6 @@ class Piwik_API_API
$reporter = new Piwik_API_ProcessedReport();
$metadata = $reporter->getReportMetadata($idSites, $period, $date, $hideMetricsDoc, $showSubtableReports);
return $metadata;
-
}
public function getProcessedReport($idSite, $period, $date, $apiModule, $apiAction, $segment = false,
diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php
index f37a2c6527..63cc65bde3 100644
--- a/plugins/API/ProcessedReport.php
+++ b/plugins/API/ProcessedReport.php
@@ -65,7 +65,7 @@ class Piwik_API_ProcessedReport
$parameters = array('idSites' => $idSites, 'period' => $period, 'date' => $date);
$availableReports = array();
- Piwik_PostEvent('API.getReportMetadata', $availableReports, $parameters);
+ Piwik_PostEvent('API.getReportMetadata', array(&$availableReports, $parameters));
foreach ($availableReports as &$availableReport) {
if (!isset($availableReport['metrics'])) {
$availableReport['metrics'] = Piwik_Metrics::getDefaultMetrics();
@@ -84,9 +84,7 @@ class Piwik_API_ProcessedReport
}
// Some plugins need to add custom metrics after all plugins hooked in
- Piwik_PostEvent('API.getReportMetadata.end', $availableReports, $parameters);
- // Oh this is not pretty! Until we have event listeners order parameter...
- Piwik_PostEvent('API.getReportMetadata.end.end', $availableReports, $parameters);
+ Piwik_PostEvent('API.getReportMetadata.end', array(&$availableReports, $parameters));
// Sort results to ensure consistent order
usort($availableReports, array($this, 'sort'));
@@ -540,4 +538,4 @@ class Piwik_API_ProcessedReport
);
}
-} \ No newline at end of file
+}
diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php
index 7af357ee76..505ecbb29d 100644
--- a/plugins/Actions/Actions.php
+++ b/plugins/Actions/Actions.php
@@ -42,12 +42,8 @@ class Piwik_Actions extends Piwik_Plugin
return $hooks;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
$sqlFilter = array($this, 'getIdActionFromSegment');
// entry and exit pages of visit
@@ -176,15 +172,8 @@ class Piwik_Actions extends Piwik_Plugin
);
}
- /**
- * Returns metadata for available reports
- *
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
-
$reports[] = array(
'category' => Piwik_Translate('Actions_Actions'),
'name' => Piwik_Translate('Actions_Actions') . ' - ' . Piwik_Translate('General_MainMetrics'),
@@ -561,30 +550,22 @@ class Piwik_Actions extends Piwik_Plugin
return Piwik_Site::isSiteSearchEnabledFor($idSite);
}
-
/**
* Compute all the actions along with their hierarchies.
*
* For each action we process the "interest statistics" :
* visits, unique visitors, bounce count, sum visit length.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- /* @var $archiveProcessor Piwik_ArchiveProcessor_Day */
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_Actions_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
- function archivePeriod($notification)
+ function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_Actions_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
diff --git a/plugins/Annotations/Annotations.php b/plugins/Annotations/Annotations.php
index f8fcf71394..f95617937d 100755
--- a/plugins/Annotations/Annotations.php
+++ b/plugins/Annotations/Annotations.php
@@ -47,23 +47,17 @@ class Piwik_Annotations extends Piwik_Plugin
/**
* Adds css files for this plugin to the list in the event notification.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
$cssFiles[] = "plugins/Annotations/stylesheets/annotations.css";
}
/**
* Adds js files for this plugin to the list in the event notification.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
$jsFiles[] = "plugins/Annotations/javascripts/annotations.js";
}
}
diff --git a/plugins/AnonymizeIP/AnonymizeIP.php b/plugins/AnonymizeIP/AnonymizeIP.php
index e7b311fc26..35942d18b2 100644
--- a/plugins/AnonymizeIP/AnonymizeIP.php
+++ b/plugins/AnonymizeIP/AnonymizeIP.php
@@ -65,12 +65,9 @@ class Piwik_AnonymizeIP extends Piwik_Plugin
/**
* Hook on Tracker.Visit.setVisitorIp to anonymize visitor IP addresses
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function setVisitorIpAddress($notification)
+ public function setVisitorIpAddress(&$ip)
{
- $ip =& $notification->getNotificationObject();
$ip = self::applyIPMask($ip, Piwik_Config::getInstance()->Tracker['ip_address_mask_length']);
}
}
diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php
index b23df6d5ac..bce5c3caaf 100644
--- a/plugins/CoreAdminHome/CoreAdminHome.php
+++ b/plugins/CoreAdminHome/CoreAdminHome.php
@@ -35,13 +35,8 @@ class Piwik_CoreAdminHome extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getScheduledTasks($notification)
+ public function getScheduledTasks(&$tasks)
{
- $tasks = & $notification->getNotificationObject();
-
// general data purge on older archive tables, executed daily
$purgeArchiveTablesTask = new Piwik_ScheduledTask ($this,
'purgeOutdatedArchives',
@@ -59,13 +54,8 @@ class Piwik_CoreAdminHome extends Piwik_Plugin
$tasks[] = $optimizeArchiveTableTask;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "libs/jquery/themes/base/jquery-ui.css";
$cssFiles[] = "plugins/CoreAdminHome/stylesheets/menu.css";
$cssFiles[] = "plugins/Zeitgeist/stylesheets/common.css";
@@ -73,13 +63,8 @@ class Piwik_CoreAdminHome extends Piwik_Plugin
$cssFiles[] = "plugins/CoreHome/stylesheets/donate.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "libs/jquery/jquery.js";
$jsFiles[] = "libs/jquery/jquery-ui.js";
$jsFiles[] = "libs/jquery/jquery.browser.js";
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php
index a10b7a0968..20312002c2 100644
--- a/plugins/CoreHome/CoreHome.php
+++ b/plugins/CoreHome/CoreHome.php
@@ -36,7 +36,6 @@ class Piwik_CoreHome extends Piwik_Plugin
/**
* Adds the donate form widget.
- *
*/
public function addWidgets()
{
@@ -44,13 +43,8 @@ class Piwik_CoreHome extends Piwik_Plugin
Piwik_AddWidget('Example Widgets', 'Installation_Welcome', 'CoreHome', 'getPromoVideo');
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "libs/jquery/themes/base/jquery-ui.css";
$cssFiles[] = "plugins/Zeitgeist/stylesheets/common.css";
$cssFiles[] = "plugins/CoreHome/stylesheets/corehome.css";
@@ -63,13 +57,8 @@ class Piwik_CoreHome extends Piwik_Plugin
$cssFiles[] = "plugins/CoreHome/stylesheets/promo.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "libs/jquery/jquery.js";
$jsFiles[] = "libs/jquery/jquery-ui.js";
$jsFiles[] = "libs/jquery/jquery.browser.js";
diff --git a/plugins/CustomVariables/CustomVariables.php b/plugins/CustomVariables/CustomVariables.php
index 3f3421fe41..9792032e6b 100644
--- a/plugins/CustomVariables/CustomVariables.php
+++ b/plugins/CustomVariables/CustomVariables.php
@@ -27,7 +27,7 @@ class Piwik_CustomVariables extends Piwik_Plugin
return $info;
}
- function getListHooksRegistered()
+ public function getListHooksRegistered()
{
$hooks = array(
'ArchiveProcessing_Day.compute' => 'archiveDay',
@@ -41,25 +41,21 @@ class Piwik_CustomVariables extends Piwik_Plugin
return $hooks;
}
- function addWidgets()
+ public function addWidgets()
{
Piwik_AddWidget('General_Visitors', 'CustomVariables_CustomVariables', 'CustomVariables', 'getCustomVariables');
}
- function addMenus()
+ public function addMenus()
{
Piwik_AddMenu('General_Visitors', 'CustomVariables_CustomVariables', array('module' => 'CustomVariables', 'action' => 'index'), $display = true, $order = 50);
}
/**
* Returns metadata for available reports
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
-
$documentation = Piwik_Translate('CustomVariables_CustomVariablesReportDocumentation',
array('<br />', '<a href="http://piwik.org/docs/custom-variables/" target="_blank">', '</a>'));
@@ -82,12 +78,8 @@ class Piwik_CustomVariables extends Piwik_Plugin
'order' => 15);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
for ($i = 1; $i <= Piwik_Tracker::MAX_CUSTOM_VARIABLES; $i++) {
$segments[] = array(
'type' => 'dimension',
@@ -126,12 +118,9 @@ class Piwik_CustomVariables extends Piwik_Plugin
/**
* Adds Goal dimensions, so that the dimensions are displayed in the UI Goal Overview page
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getReportsWithGoalMetrics($notification)
+ public function getReportsWithGoalMetrics(&$dimensions)
{
- $dimensions =& $notification->getNotificationObject();
$dimensions = array_merge($dimensions, array(
array('category' => Piwik_Translate('General_Visit'),
'name' => Piwik_Translate('CustomVariables_CustomVariables'),
@@ -143,29 +132,20 @@ class Piwik_CustomVariables extends Piwik_Plugin
/**
* Hooks on daily archive to trigger various log processing
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_CustomVariables_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
$archiving = new Piwik_CustomVariables_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
}
}
-
}
diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php
index 044e01ddc8..05f72ada33 100644
--- a/plugins/DBStats/DBStats.php
+++ b/plugins/DBStats/DBStats.php
@@ -46,13 +46,9 @@ class Piwik_DBStats extends Piwik_Plugin
/**
* Gets all scheduled tasks executed by this plugin.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function getScheduledTasks($notification)
+ public function getScheduledTasks(&$tasks)
{
- $tasks = & $notification->getNotificationObject();
-
$cacheDataByArchiveNameReportsTask = new Piwik_ScheduledTask(
$this,
'cacheDataByArchiveNameReports',
@@ -77,12 +73,8 @@ class Piwik_DBStats extends Piwik_Plugin
Piwik_SetOption(self::TIME_OF_LAST_TASK_RUN_OPTION, $now);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
$cssFiles[] = "plugins/DBStats/stylesheets/dbstatsTable.css";
}
diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php
index 716e055bd7..5ad1c74b7f 100644
--- a/plugins/Dashboard/Dashboard.php
+++ b/plugins/Dashboard/Dashboard.php
@@ -226,13 +226,8 @@ class Piwik_Dashboard extends Piwik_Plugin
Piwik_AddTopMenu('General_Dashboard', $urlParams, true, 1, $isHTML = false, $tooltip);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/Dashboard/javascripts/widgetMenu.js";
$jsFiles[] = "libs/javascript/json2.js";
$jsFiles[] = "plugins/Dashboard/javascripts/dashboardObject.js";
@@ -240,23 +235,14 @@ class Piwik_Dashboard extends Piwik_Plugin
$jsFiles[] = "plugins/Dashboard/javascripts/dashboard.js";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/CoreHome/stylesheets/datatable.css";
$cssFiles[] = "plugins/Dashboard/stylesheets/dashboard.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function deleteDashboardLayout($notification)
+ public function deleteDashboardLayout($userLogin)
{
- $userLogin = $notification->getNotificationObject();
Piwik_Query('DELETE FROM ' . Piwik_Common::prefixTable('user_dashboard') . ' WHERE login = ?', array($userLogin));
}
diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php
index 30c55ffe37..2409c58fb2 100644
--- a/plugins/DevicesDetection/DevicesDetection.php
+++ b/plugins/DevicesDetection/DevicesDetection.php
@@ -131,13 +131,10 @@ class Piwik_DevicesDetection extends Piwik_Plugin
/**
* Get segments meta data
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
// Note: only one field segmented so far: deviceType
- $segments =& $notification->getNotificationObject();
foreach ($this->getRawMetadataReports() as $report) {
@list($category, $name, $apiModule, $apiAction, $columnName, $segment, $sqlSegment, $acceptedValues) = $report;
@@ -154,14 +151,8 @@ class Piwik_DevicesDetection extends Piwik_Plugin
}
}
-
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
-
$i = 0;
foreach ($this->getRawMetadataReports() as $report) {
list($category, $name, $apiModule, $apiAction, $columnName) = $report;
@@ -211,11 +202,8 @@ class Piwik_DevicesDetection extends Piwik_Plugin
}
}
- public function parseMobileVisitData($notification)
+ public function parseMobileVisitData(&$visitorInfo, $extraInfo)
{
- $visitorInfo = &$notification->getNotificationObject();
-
- $extraInfo = $notification->getNotificationInfo();
$userAgent = $extraInfo['UserAgent'];
$UAParser = new UserAgentParserEnhanced($userAgent);
@@ -237,19 +225,16 @@ class Piwik_DevicesDetection extends Piwik_Plugin
printDebug($deviceInfo);
}
- public function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_DevicesDetection_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
- public function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
$archiving = new Piwik_DevicesDetection_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
@@ -260,5 +245,4 @@ class Piwik_DevicesDetection extends Piwik_Plugin
{
Piwik_AddMenu('General_Visitors', 'DevicesDetection_submenu', array('module' => 'DevicesDetection', 'action' => 'index'));
}
-
-} \ No newline at end of file
+}
diff --git a/plugins/DoNotTrack/DoNotTrack.php b/plugins/DoNotTrack/DoNotTrack.php
index 9d84d0d0e4..954827c2c6 100644
--- a/plugins/DoNotTrack/DoNotTrack.php
+++ b/plugins/DoNotTrack/DoNotTrack.php
@@ -44,10 +44,7 @@ class Piwik_DoNotTrack extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function checkHeader($notification)
+ function checkHeader(&$exclude)
{
if ((isset($_SERVER['HTTP_X_DO_NOT_TRACK']) && $_SERVER['HTTP_X_DO_NOT_TRACK'] === '1')
|| (isset($_SERVER['HTTP_DNT']) && substr($_SERVER['HTTP_DNT'], 0, 1) === '1')
@@ -59,7 +56,6 @@ class Piwik_DoNotTrack extends Piwik_Plugin
return;
}
- $exclude =& $notification->getNotificationObject();
$exclude = true;
printDebug("DoNotTrack found.");
diff --git a/plugins/ExamplePlugin/ExamplePlugin.php b/plugins/ExamplePlugin/ExamplePlugin.php
index 1334436bf4..4c054e4b8c 100644
--- a/plugins/ExamplePlugin/ExamplePlugin.php
+++ b/plugins/ExamplePlugin/ExamplePlugin.php
@@ -54,12 +54,8 @@ class Piwik_ExamplePlugin extends Piwik_Plugin
// Executed every time plugin is disabled
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function addUniqueVisitorsColumnToGivenReport($notification)
+ public function addUniqueVisitorsColumnToGivenReport($view)
{
- $view = $notification->getNotificationInfo();
$view = $view['view'];
if ($view->getCurrentControllerName() == 'Referers'
&& $view->getCurrentControllerAction() == 'getWebsites'
@@ -68,7 +64,7 @@ class Piwik_ExamplePlugin extends Piwik_Plugin
}
}
- function addWidgets()
+ public function addWidgets()
{
// we register the widgets so they appear in the "Add a new widget" window in the dashboard
// Note that the first two parameters can be either a normal string, or an index to a translation string
diff --git a/plugins/ExampleRssWidget/ExampleRssWidget.php b/plugins/ExampleRssWidget/ExampleRssWidget.php
index fdf1bc78d7..0df7ebb5d0 100644
--- a/plugins/ExampleRssWidget/ExampleRssWidget.php
+++ b/plugins/ExampleRssWidget/ExampleRssWidget.php
@@ -45,13 +45,8 @@ class Piwik_ExampleRssWidget extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/ExampleRssWidget/stylesheets/rss.css";
}
@@ -60,4 +55,4 @@ class Piwik_ExampleRssWidget extends Piwik_Plugin
Piwik_AddWidget('Example Widgets', 'Piwik.org Blog', 'ExampleRssWidget', 'rssPiwik');
Piwik_AddWidget('Example Widgets', 'Piwik Changelog', 'ExampleRssWidget', 'rssChangelog');
}
-} \ No newline at end of file
+}
diff --git a/plugins/Feedback/Feedback.php b/plugins/Feedback/Feedback.php
index d514245194..50bab49f99 100644
--- a/plugins/Feedback/Feedback.php
+++ b/plugins/Feedback/Feedback.php
@@ -46,24 +46,13 @@ class Piwik_Feedback extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/Feedback/stylesheets/feedback.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/Feedback/javascripts/feedback.js";
}
-
}
diff --git a/plugins/Goals/Goals.php b/plugins/Goals/Goals.php
index 2ae78f60cc..855adb9e30 100644
--- a/plugins/Goals/Goals.php
+++ b/plugins/Goals/Goals.php
@@ -24,7 +24,7 @@ class Piwik_Goals extends Piwik_Plugin
static public function getReportsWithGoalMetrics()
{
$dimensions = array();
- Piwik_PostEvent('Goals.getReportsWithGoalMetrics', $dimensions);
+ Piwik_PostEvent('Goals.getReportsWithGoalMetrics', array(&$dimensions));
$dimensionsByGroup = array();
foreach ($dimensions as $dimension) {
$group = $dimension['category'];
@@ -93,12 +93,9 @@ class Piwik_Goals extends Piwik_Plugin
/**
* Delete goals recorded for this site
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function deleteSiteGoals($notification)
+ function deleteSiteGoals($idSite)
{
- $idSite = & $notification->getNotificationObject();
Piwik_Query("DELETE FROM " . Piwik_Common::prefixTable('goal') . " WHERE idsite = ? ", array($idSite));
}
@@ -108,14 +105,10 @@ class Piwik_Goals extends Piwik_Plugin
* and for each goal.
*
* Also, this will update metadata of all other reports that have Goal segmentation
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports, $info)
{
- $info = $notification->getNotificationInfo();
$idSites = $info['idSites'];
- $reports = & $notification->getNotificationObject();
// Processed in AddColumnsProcessedMetricsGoal
// These metrics will also be available for some reports, for each goal
@@ -333,7 +326,7 @@ class Piwik_Goals extends Piwik_Plugin
* to all reports that have Goal segmentation
*/
$reportsWithGoals = array();
- Piwik_PostEvent('Goals.getReportsWithGoalMetrics', $reportsWithGoals);
+ Piwik_PostEvent('Goals.getReportsWithGoalMetrics', array(&$reportsWithGoals));
foreach ($reportsWithGoals as $reportWithGoals) {
// Select this report from the API metadata array
// and add the Goal metrics to it
@@ -367,12 +360,9 @@ class Piwik_Goals extends Piwik_Plugin
* This function executes when the 'Goals.getReportsWithGoalMetrics' event fires. It
* adds the 'visits to conversion' report metadata to the list of goal reports so
* this report will be displayed.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getActualReportsWithGoalMetrics($notification)
+ public function getActualReportsWithGoalMetrics(&$dimensions)
{
- $dimensions =& $notification->getNotificationObject();
$dimensions = array_merge($dimensions, array(
array('category' => Piwik_Translate('General_Visit'),
'name' => Piwik_Translate('Goals_VisitsUntilConv'),
@@ -387,12 +377,8 @@ class Piwik_Goals extends Piwik_Plugin
));
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
$segments[] = array(
'type' => 'dimension',
'category' => Piwik_Translate('General_Visit'),
@@ -403,37 +389,23 @@ class Piwik_Goals extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
$jsFiles[] = "plugins/Goals/javascripts/goalsForm.js";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
$cssFiles[] = "plugins/Goals/stylesheets/goals.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function fetchGoalsFromDb($notification)
+ public function fetchGoalsFromDb(&$array, $idSite)
{
- $idsite = $notification->getNotificationInfo();
-
// add the 'goal' entry in the website array
- $array =& $notification->getNotificationObject();
- $array['goals'] = Piwik_Goals_API::getInstance()->getGoals($idsite);
+ $array['goals'] = Piwik_Goals_API::getInstance()->getGoals($idSite);
}
- function addWidgets()
+ public function addWidgets()
{
$idSite = Piwik_Common::getRequestVar('idSite', null, 'int');
@@ -502,17 +474,9 @@ class Piwik_Goals extends Piwik_Plugin
* Hooks on the Daily archiving.
* Will process Goal stats overall and for each Goal.
* Also processes the New VS Returning visitors conversion stats.
- *
- * @param Piwik_Event_Notification $notification
- * @return void
*/
- function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- /**
- * @var Piwik_ArchiveProcessor_Day
- */
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_Goals_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
@@ -522,14 +486,9 @@ class Piwik_Goals extends Piwik_Plugin
/**
* Hooks on Period archiving.
* Sums up Goal conversions stats, and processes overall conversion rate
- *
- * @param Piwik_Event_Notification $notification
- * @return void
*/
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_Goals_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php
index 06e973f462..9ee7fa7f27 100644
--- a/plugins/ImageGraph/ImageGraph.php
+++ b/plugins/ImageGraph/ImageGraph.php
@@ -36,7 +36,8 @@ class Piwik_ImageGraph extends Piwik_Plugin
function getListHooksRegistered()
{
$hooks = array(
- 'API.getReportMetadata.end.end' => 'getReportMetadata',
+ 'API.getReportMetadata.end' => array('function' => 'getReportMetadata',
+ 'after' => true),
);
return $hooks;
}
@@ -45,13 +46,10 @@ class Piwik_ImageGraph extends Piwik_Plugin
const GRAPH_EVOLUTION_LAST_PERIODS = 30;
/**
- * @param Piwik_Event_Notification $notification notification object
* @return mixed
*/
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports, $info)
{
- $info = $notification->getNotificationInfo();
- $reports = & $notification->getNotificationObject();
$idSites = $info['idSites'];
// If only one website is selected, we add the Graph URL
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index 57cbae5dce..ba556775bc 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -39,7 +39,7 @@ class Piwik_Installation_Controller extends Piwik_Controller_Admin
$this->session->skipThisStep = array();
}
- Piwik_PostEvent('InstallationController.construct', $this);
+ Piwik_PostEvent('InstallationController.construct', array($this));
}
/**
diff --git a/plugins/Installation/Installation.php b/plugins/Installation/Installation.php
index b6301f5926..660be7c8ed 100644
--- a/plugins/Installation/Installation.php
+++ b/plugins/Installation/Installation.php
@@ -50,13 +50,9 @@ class Piwik_Installation extends Piwik_Plugin
return new $this->installationControllerName();
}
- /**
- * @param Piwik_Event_Notification|null $notification notification object
- */
- function dispatch($notification = null)
+ public function dispatch($exception = null)
{
- if ($notification) {
- $exception = $notification->getNotificationObject();
+ if ($exception) {
$message = $exception->getMessage();
} else {
$message = '';
@@ -64,7 +60,7 @@ class Piwik_Installation extends Piwik_Plugin
Piwik_Translate::getInstance()->loadCoreTranslation();
- Piwik_PostEvent('Installation.startInstallation', $this);
+ Piwik_PostEvent('Installation.startInstallation', array($this));
$step = Piwik_Common::getRequestVar('action', 'welcome', 'string');
$controller = $this->getInstallationController();
@@ -91,10 +87,8 @@ class Piwik_Installation extends Piwik_Plugin
/**
* Adds CSS files to list of CSS files for asset manager.
*/
- public function getCss($notification)
+ public function getCss(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/Installation/stylesheets/systemCheckPage.css";
}
}
diff --git a/plugins/LanguagesManager/LanguagesManager.php b/plugins/LanguagesManager/LanguagesManager.php
index a0cf7d0039..3d18f9eb49 100644
--- a/plugins/LanguagesManager/LanguagesManager.php
+++ b/plugins/LanguagesManager/LanguagesManager.php
@@ -38,30 +38,17 @@ class Piwik_LanguagesManager extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/Zeitgeist/stylesheets/styles.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/LanguagesManager/javascripts/languageSelector.js";
}
- /**
- * Show styled language selection drop-down list
- */
- function showLanguagesSelector()
+ public function showLanguagesSelector()
{
Piwik_AddTopMenu('LanguageSelector', $this->getLanguagesSelector(), true, $order = 30, true);
}
@@ -70,12 +57,9 @@ class Piwik_LanguagesManager extends Piwik_Plugin
* Adds the languages drop-down list to topbars other than the main one rendered
* in CoreHome/templates/top_bar.twig. The 'other' topbars are on the Installation
* and CoreUpdater screens.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function addLanguagesManagerToOtherTopBar($notification)
+ public function addLanguagesManagerToOtherTopBar(&$str)
{
- $str =& $notification->getNotificationObject();
// piwik object & scripts aren't loaded in 'other' topbars
$str .= "<script type='text/javascript'>if (!window.piwik) window.piwik={};</script>";
$str .= "<script type='text/javascript' src='plugins/LanguagesManager/javascripts/languageSelector.js'></script>";
@@ -96,12 +80,8 @@ class Piwik_LanguagesManager extends Piwik_Plugin
return $view->render();
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getLanguageToLoad($notification)
+ function getLanguageToLoad(&$language)
{
- $language =& $notification->getNotificationObject();
if (empty($language)) {
$language = self::getLanguageCodeForCurrentUser();
}
@@ -110,12 +90,8 @@ class Piwik_LanguagesManager extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function deleteUserLanguage($notification)
+ public function deleteUserLanguage($userLogin)
{
- $userLogin = $notification->getNotificationObject();
Piwik_Query('DELETE FROM ' . Piwik_Common::prefixTable('user_language') . ' WHERE login = ?', $userLogin);
}
diff --git a/plugins/Live/Live.php b/plugins/Live/Live.php
index 2b8ff54b42..95a86d96e2 100644
--- a/plugins/Live/Live.php
+++ b/plugins/Live/Live.php
@@ -35,23 +35,13 @@ class Piwik_Live extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/Live/stylesheets/live.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/Live/javascripts/live.js";
}
diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php
index ba3e3cf355..7b602d39e4 100644
--- a/plugins/Login/Controller.php
+++ b/plugins/Login/Controller.php
@@ -149,7 +149,7 @@ class Piwik_Login_Controller extends Piwik_Controller
'rememberMe' => $rememberMe,
);
Piwik_Nonce::discardNonce('Piwik_Login.login');
- Piwik_PostEvent('Login.initSession', $info);
+ Piwik_PostEvent('Login.initSession', array(&$info));
Piwik_Url::redirectToUrl($urlToRedirect);
}
diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php
index 5b92eaca87..575a05c6a4 100644
--- a/plugins/Login/Login.php
+++ b/plugins/Login/Login.php
@@ -26,7 +26,7 @@ class Piwik_Login extends Piwik_Plugin
return $info;
}
- function getListHooksRegistered()
+ public function getListHooksRegistered()
{
$hooks = array(
'FrontController.initAuthenticationObject' => 'initAuthenticationObject',
@@ -40,13 +40,9 @@ class Piwik_Login extends Piwik_Plugin
/**
* Redirects to Login form with error message.
* Listens to FrontController.NoAccessException hook.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function noAccess($notification)
+ public function noAccess(Exception $exception)
{
- /* @var Exception $exception */
- $exception = $notification->getNotificationObject();
$exceptionMessage = $exception->getMessage();
$controller = new Piwik_Login_Controller();
@@ -56,12 +52,9 @@ class Piwik_Login extends Piwik_Plugin
/**
* Set login name and autehntication token for authentication request.
* Listens to API.Request.authenticate hook.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function ApiRequestAuthenticate($notification)
+ public function ApiRequestAuthenticate($tokenAuth)
{
- $tokenAuth = $notification->getNotificationObject();
Zend_Registry::get('auth')->setLogin($login = null);
Zend_Registry::get('auth')->setTokenAuth($tokenAuth);
}
@@ -69,16 +62,12 @@ class Piwik_Login extends Piwik_Plugin
/**
* Initializes the authentication object.
* Listens to FrontController.initAuthenticationObject hook.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function initAuthenticationObject($notification)
+ function initAuthenticationObject($allowCookieAuthentication = false)
{
$auth = new Piwik_Login_Auth();
Zend_Registry::set('auth', $auth);
- $allowCookieAuthentication = $notification->getNotificationInfo();
-
$action = Piwik::getAction();
if (Piwik::getModule() === 'API'
&& (empty($action) || $action == 'index')
@@ -104,13 +93,11 @@ class Piwik_Login extends Piwik_Plugin
/**
* Authenticate user and initializes the session.
* Listens to Login.initSession hook.
- *
- * @param Piwik_Event_Notification $notification notification object
+ *
* @throws Exception
*/
- function initSession($notification)
+ public function initSession($info)
{
- $info = $notification->getNotificationObject();
$login = $info['login'];
$md5Password = $info['md5Password'];
$rememberMe = $info['rememberMe'];
diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php
index 76f994517f..6cc34fe5c4 100644
--- a/plugins/MobileMessaging/MobileMessaging.php
+++ b/plugins/MobileMessaging/MobileMessaging.php
@@ -103,34 +103,20 @@ class Piwik_MobileMessaging extends Piwik_Plugin
/**
* Get JavaScript files
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/MobileMessaging/javascripts/MobileMessagingSettings.js";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles($cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/MobileMessaging/stylesheets/MobileMessagingSettings.css";
}
-
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function validateReportParameters($notification)
+
+ public function validateReportParameters(&$parameters, $info)
{
- if (self::manageEvent($notification)) {
- $parameters = & $notification->getNotificationObject();
-
+ if (self::manageEvent($info)) {
// phone number validation
$availablePhoneNumbers = Piwik_MobileMessaging_API::getInstance()->getActivatedPhoneNumbers();
@@ -147,15 +133,9 @@ class Piwik_MobileMessaging extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportMetadata($notification)
+ public function getReportMetadata(&$availableReportMetadata, $notificationInfo)
{
- if (self::manageEvent($notification)) {
- $availableReportMetadata = & $notification->getNotificationObject();
-
- $notificationInfo = $notification->getNotificationInfo();
+ if (self::manageEvent($notificationInfo)) {
$idSite = $notificationInfo[Piwik_PDFReports_API::ID_SITE_INFO_KEY];
foreach (self::$availableReports as $availableReport) {
@@ -173,45 +153,28 @@ class Piwik_MobileMessaging extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportTypes($notification)
+ public function getReportTypes(&$reportTypes)
{
- $reportTypes = & $notification->getNotificationObject();
$reportTypes = array_merge($reportTypes, self::$managedReportTypes);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportFormats($notification)
+ public function getReportFormats(&$reportFormats, $info)
{
- if (self::manageEvent($notification)) {
- $reportFormats = & $notification->getNotificationObject();
+ if (self::manageEvent($info)) {
$reportFormats = array_merge($reportFormats, self::$managedReportFormats);
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportParameters($notification)
+ public function getReportParameters(&$availableParameters, $info)
{
- if (self::manageEvent($notification)) {
- $availableParameters = & $notification->getNotificationObject();
+ if (self::manageEvent($info)) {
$availableParameters = self::$availableParameters;
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getRendererInstance($notification)
+ public function getRendererInstance(&$reportRenderer, $info)
{
- if (self::manageEvent($notification)) {
- $reportRenderer = & $notification->getNotificationObject();
-
+ if (self::manageEvent($info)) {
if (Piwik_PluginsManager::getInstance()->isPluginActivated('MultiSites')) {
$reportRenderer = new Piwik_MobileMessaging_ReportRenderer_Sms();
} else {
@@ -222,35 +185,24 @@ class Piwik_MobileMessaging extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function allowMultipleReports($notification)
+ public function allowMultipleReports(&$allowMultipleReports, $info)
{
- if (self::manageEvent($notification)) {
- $allowMultipleReports = & $notification->getNotificationObject();
+ if (self::manageEvent($info)) {
$allowMultipleReports = false;
}
}
- function getReportRecipients($notification)
+ public function getReportRecipients(&$recipients, $notificationInfo)
{
- if (self::manageEvent($notification)) {
- $recipients = & $notification->getNotificationObject();
- $notificationInfo = $notification->getNotificationInfo();
-
+ if (self::manageEvent($notificationInfo)) {
$report = $notificationInfo[Piwik_PDFReports_API::REPORT_KEY];
$recipients = $report['parameters'][self::PHONE_NUMBERS_PARAMETER];
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function sendReport($notification)
+ public function sendReport($notificationInfo)
{
- if (self::manageEvent($notification)) {
- $notificationInfo = $notification->getNotificationInfo();
+ if (self::manageEvent($notificationInfo)) {
$report = $notificationInfo[Piwik_PDFReports_API::REPORT_KEY];
$contents = $notificationInfo[Piwik_PDFReports_API::REPORT_CONTENT_KEY];
$reportSubject = $notificationInfo[Piwik_PDFReports_API::REPORT_SUBJECT_KEY];
@@ -274,25 +226,20 @@ class Piwik_MobileMessaging extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- static public function template_reportParametersPDFReports($notification)
+ static public function template_reportParametersPDFReports(&$out)
{
if (Piwik::isUserIsAnonymous()) {
return;
}
- $out =& $notification->getNotificationObject();
$view = new Piwik_View('@MobileMessaging/reportParametersPDFReports');
$view->reportType = self::MOBILE_TYPE;
$view->phoneNumbers = Piwik_MobileMessaging_API::getInstance()->getActivatedPhoneNumbers();
$out .= $view->render();
}
- private static function manageEvent($notification)
+ private static function manageEvent($notificationInfo)
{
- $notificationInfo = $notification->getNotificationInfo();
return in_array($notificationInfo[Piwik_PDFReports_API::REPORT_TYPE_INFO_KEY], array_keys(self::$managedReportTypes));
}
diff --git a/plugins/MultiSites/MultiSites.php b/plugins/MultiSites/MultiSites.php
index aa23d48040..6d3f65af77 100644
--- a/plugins/MultiSites/MultiSites.php
+++ b/plugins/MultiSites/MultiSites.php
@@ -35,10 +35,7 @@ class Piwik_MultiSites extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
$metadataMetrics = array();
foreach (Piwik_MultiSites_API::getApiMetrics($enhanced = true) as $metricName => $metricSettings) {
@@ -48,8 +45,6 @@ class Piwik_MultiSites extends Piwik_Plugin
Piwik_Translate($metricSettings[Piwik_MultiSites_API::METRIC_TRANSLATION_KEY]) . " " . Piwik_Translate('MultiSites_Evolution');
}
- $reports = & $notification->getNotificationObject();
-
$reports[] = array(
'category' => Piwik_Translate('General_MultiSitesSummary'),
'name' => Piwik_Translate('General_AllWebsitesDashboard'),
@@ -82,23 +77,13 @@ class Piwik_MultiSites extends Piwik_Plugin
Piwik_AddTopMenu('General_MultiSitesSummary', $urlParams, true, 3, $isHTML = false, $tooltip);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/MultiSites/javascripts/multiSites.js";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/MultiSites/stylesheets/multiSites.css";
}
}
diff --git a/plugins/Overlay/API.php b/plugins/Overlay/API.php
index 413406fe43..9c06d11177 100644
--- a/plugins/Overlay/API.php
+++ b/plugins/Overlay/API.php
@@ -106,7 +106,8 @@ class Piwik_Overlay_API
private function authenticate($idSite)
{
$notification = null;
- Piwik_PostEvent('FrontController.initAuthenticationObject', $notification, $allowCookieAuthentication = true);
+ Piwik_PostEvent('FrontController.initAuthenticationObject',
+ array(&$notification, $allowCookieAuthentication = true));
$auth = Zend_Registry::get('auth');
$success = Zend_Registry::get('access')->reloadAccess($auth);
diff --git a/plugins/Overlay/Overlay.php b/plugins/Overlay/Overlay.php
index abf8faaf96..e317b748e6 100644
--- a/plugins/Overlay/Overlay.php
+++ b/plugins/Overlay/Overlay.php
@@ -28,11 +28,9 @@ class Piwik_Overlay extends Piwik_Plugin
);
}
- public function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
$jsFiles[] = 'plugins/Overlay/javascripts/rowaction.js';
$jsFiles[] = 'plugins/Overlay/javascripts/Overlay_Helper.js';
}
-
}
diff --git a/plugins/PDFReports/API.php b/plugins/PDFReports/API.php
index d3b0fccb95..4858f62ebe 100644
--- a/plugins/PDFReports/API.php
+++ b/plugins/PDFReports/API.php
@@ -400,16 +400,14 @@ class Piwik_PDFReports_API
// allow plugins to alter processed reports
Piwik_PostEvent(
self::PROCESS_REPORTS_EVENT,
- $processedReports,
- $notificationInfo
+ array(&$processedReports, $notificationInfo)
);
// retrieve report renderer instance
$reportRenderer = null;
Piwik_PostEvent(
self::GET_RENDERER_INSTANCE_EVENT,
- $reportRenderer,
- $notificationInfo
+ array(&$reportRenderer, $notificationInfo)
);
// init report renderer
@@ -518,19 +516,19 @@ class Piwik_PDFReports_API
$contents = fread($handle, filesize($outputFilename));
fclose($handle);
- $notificationObject = null;
Piwik_PostEvent(
self::SEND_REPORT_EVENT,
- $notificationObject,
- $notificationInfo = array(
- self::REPORT_TYPE_INFO_KEY => $report['type'],
- self::REPORT_KEY => $report,
- self::REPORT_CONTENT_KEY => $contents,
- self::FILENAME_KEY => $filename,
- self::PRETTY_DATE_KEY => $prettyDate,
- self::REPORT_SUBJECT_KEY => $reportSubject,
- self::REPORT_TITLE_KEY => $reportTitle,
- self::ADDITIONAL_FILES_KEY => $additionalFiles,
+ array(
+ $notificationInfo = array(
+ self::REPORT_TYPE_INFO_KEY => $report['type'],
+ self::REPORT_KEY => $report,
+ self::REPORT_CONTENT_KEY => $contents,
+ self::FILENAME_KEY => $filename,
+ self::PRETTY_DATE_KEY => $prettyDate,
+ self::REPORT_SUBJECT_KEY => $reportSubject,
+ self::REPORT_TITLE_KEY => $reportTitle,
+ self::ADDITIONAL_FILES_KEY => $additionalFiles,
+ )
)
);
@@ -570,7 +568,7 @@ class Piwik_PDFReports_API
self::REPORT_TYPE_INFO_KEY => $reportType
);
- Piwik_PostEvent(self::GET_REPORT_PARAMETERS_EVENT, $availableParameters, $notificationInfo);
+ Piwik_PostEvent(self::GET_REPORT_PARAMETERS_EVENT, array(&$availableParameters, $notificationInfo));
// unset invalid parameters
$availableParameterKeys = array_keys($availableParameters);
@@ -588,7 +586,7 @@ class Piwik_PDFReports_API
}
// delegate report parameter validation
- Piwik_PostEvent(self::VALIDATE_PARAMETERS_EVENT, $parameters, $notificationInfo);
+ Piwik_PostEvent(self::VALIDATE_PARAMETERS_EVENT, array(&$parameters, $notificationInfo));
return Piwik_Common::json_encode($parameters);
}
@@ -702,8 +700,7 @@ class Piwik_PDFReports_API
$availableReportMetadata = array();
Piwik_PostEvent(
self::GET_REPORT_METADATA_EVENT,
- $availableReportMetadata,
- $notificationInfo
+ array(&$availableReportMetadata, $notificationInfo)
);
return $availableReportMetadata;
@@ -717,9 +714,11 @@ class Piwik_PDFReports_API
$allowMultipleReports = null;
Piwik_PostEvent(
self::ALLOW_MULTIPLE_REPORTS_EVENT,
- $allowMultipleReports,
- $notificationInfo = array(
- self::REPORT_TYPE_INFO_KEY => $reportType,
+ array(
+ &$allowMultipleReports,
+ $notificationInfo = array(
+ self::REPORT_TYPE_INFO_KEY => $reportType,
+ )
)
);
return $allowMultipleReports;
@@ -731,7 +730,7 @@ class Piwik_PDFReports_API
static public function getReportTypes()
{
$reportTypes = array();
- Piwik_PostEvent(self::GET_REPORT_TYPES_EVENT, $reportTypes);
+ Piwik_PostEvent(self::GET_REPORT_TYPES_EVENT, array(&$reportTypes));
return $reportTypes;
}
@@ -745,9 +744,11 @@ class Piwik_PDFReports_API
Piwik_PostEvent(
self::GET_REPORT_FORMATS_EVENT,
- $reportFormats,
- $notificationInfo = array(
- self::REPORT_TYPE_INFO_KEY => $reportType
+ array(
+ &$reportFormats,
+ $notificationInfo = array(
+ self::REPORT_TYPE_INFO_KEY => $reportType
+ )
)
);
@@ -766,7 +767,7 @@ class Piwik_PDFReports_API
// retrieve report renderer instance
$recipients = array();
- Piwik_PostEvent(self::GET_REPORT_RECIPIENTS_EVENT, $recipients, $notificationInfo);
+ Piwik_PostEvent(self::GET_REPORT_RECIPIENTS_EVENT, array(&$recipients, $notificationInfo));
return $recipients;
}
diff --git a/plugins/PDFReports/PDFReports.php b/plugins/PDFReports/PDFReports.php
index 60f3055ffb..6df17b85f1 100644
--- a/plugins/PDFReports/PDFReports.php
+++ b/plugins/PDFReports/PDFReports.php
@@ -89,13 +89,9 @@ class Piwik_PDFReports extends Piwik_Plugin
/**
* Delete reports for the website
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function deleteSiteReport($notification)
+ public function deleteSiteReport(&$idSite)
{
- $idSite = & $notification->getNotificationObject();
-
$idReports = Piwik_PDFReports_API::getInstance()->getReports($idSite);
foreach ($idReports as $report) {
@@ -104,23 +100,14 @@ class Piwik_PDFReports extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
$jsFiles[] = "plugins/PDFReports/javascripts/pdf.js";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function validateReportParameters($notification)
+ public function validateReportParameters(&$parameters, $info)
{
- if (self::manageEvent($notification)) {
- $parameters = & $notification->getNotificationObject();
-
+ if (self::manageEvent($info)) {
$reportFormat = $parameters[self::DISPLAY_FORMAT_PARAMETER];
$availableDisplayFormats = array_keys(self::getDisplayFormats());
if (!in_array($reportFormat, $availableDisplayFormats)) {
@@ -160,15 +147,9 @@ class Piwik_PDFReports extends Piwik_Plugin
return $value == 'true' || $value == 1 || $value == '1' || $value === true;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportMetadata($notification)
+ public function getReportMetadata(&$reportMetadata, $notificationInfo)
{
- if (self::manageEvent($notification)) {
- $reportMetadata = & $notification->getNotificationObject();
-
- $notificationInfo = $notification->getNotificationInfo();
+ if (self::manageEvent($notificationInfo)) {
$idSite = $notificationInfo[Piwik_PDFReports_API::ID_SITE_INFO_KEY];
$availableReportMetadata = Piwik_API_API::getInstance()->getReportMetadata($idSite);
@@ -188,46 +169,28 @@ class Piwik_PDFReports extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportTypes($notification)
+ public function getReportTypes(&$reportTypes)
{
- $reportTypes = & $notification->getNotificationObject();
$reportTypes = array_merge($reportTypes, self::$managedReportTypes);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportFormats($notification)
+ public function getReportFormats(&$reportFormats, $info)
{
- if (self::manageEvent($notification)) {
- $reportFormats = & $notification->getNotificationObject();
+ if (self::manageEvent($info)) {
$reportFormats = self::$managedReportFormats;
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportParameters($notification)
+ public function getReportParameters(&$availableParameters, $info)
{
- if (self::manageEvent($notification)) {
- $availableParameters = & $notification->getNotificationObject();
+ if (self::manageEvent($info)) {
$availableParameters = self::$availableParameters;
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function processReports($notification)
+ public function processReports(&$processedReports, $notificationInfo)
{
- if (self::manageEvent($notification)) {
- $processedReports = & $notification->getNotificationObject();
-
- $notificationInfo = $notification->getNotificationInfo();
+ if (self::manageEvent($notificationInfo)) {
$report = $notificationInfo[Piwik_PDFReports_API::REPORT_KEY];
$displayFormat = $report['parameters'][self::DISPLAY_FORMAT_PARAMETER];
@@ -266,15 +229,9 @@ class Piwik_PDFReports extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getRendererInstance($notification)
+ public function getRendererInstance(&$reportRenderer, $notificationInfo)
{
- if (self::manageEvent($notification)) {
- $reportRenderer = & $notification->getNotificationObject();
- $notificationInfo = $notification->getNotificationInfo();
-
+ if (self::manageEvent($notificationInfo)) {
$reportFormat = $notificationInfo[Piwik_PDFReports_API::REPORT_KEY]['format'];
$outputType = $notificationInfo[Piwik_PDFReports_API::OUTPUT_TYPE_INFO_KEY];
@@ -286,24 +243,16 @@ class Piwik_PDFReports extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function allowMultipleReports($notification)
+ public function allowMultipleReports(&$allowMultipleReports, $info)
{
- if (self::manageEvent($notification)) {
- $allowMultipleReports = & $notification->getNotificationObject();
+ if (self::manageEvent($info)) {
$allowMultipleReports = true;
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function sendReport($notification)
+ public function sendReport($notificationInfo)
{
- if (self::manageEvent($notification)) {
- $notificationInfo = $notification->getNotificationInfo();
+ if (self::manageEvent($notificationInfo)) {
$report = $notificationInfo[Piwik_PDFReports_API::REPORT_KEY];
$reportTitle = $notificationInfo[Piwik_PDFReports_API::REPORT_TITLE_KEY];
$prettyDate = $notificationInfo[Piwik_PDFReports_API::PRETTY_DATE_KEY];
@@ -424,15 +373,9 @@ class Piwik_PDFReports extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportRecipients($notification)
+ public function getReportRecipients(&$recipients, $notificationInfo)
{
- if (self::manageEvent($notification)) {
- $recipients = & $notification->getNotificationObject();
- $notificationInfo = $notification->getNotificationInfo();
-
+ if (self::manageEvent($notificationInfo)) {
$report = $notificationInfo[Piwik_PDFReports_API::REPORT_KEY];
$parameters = $report['parameters'];
$eMailMe = $parameters[self::EMAIL_ME_PARAMETER];
@@ -449,13 +392,8 @@ class Piwik_PDFReports extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- static public function template_reportParametersPDFReports($notification)
+ static public function template_reportParametersPDFReports(&$out)
{
- $out =& $notification->getNotificationObject();
-
$view = new Piwik_View('@PDFReports/reportParametersPDFReports');
$view->currentUserEmail = Piwik::getCurrentUserEmail();
$view->displayFormats = self::getDisplayFormats();
@@ -466,22 +404,17 @@ class Piwik_PDFReports extends Piwik_Plugin
$out .= $view->render();
}
- private static function manageEvent($notification)
+ private static function manageEvent($info)
{
- $notificationInfo = $notification->getNotificationInfo();
return in_array(
- $notificationInfo[Piwik_PDFReports_API::REPORT_TYPE_INFO_KEY],
+ $info[Piwik_PDFReports_API::REPORT_TYPE_INFO_KEY],
array_keys(self::$managedReportTypes)
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getScheduledTasks($notification)
+ public function getScheduledTasks(&$tasks)
{
$arbitraryDateInUTC = Piwik_Date::factory('2011-01-01');
- $tasks = & $notification->getNotificationObject();
foreach (Piwik_PDFReports_API::getInstance()->getReports() as $report) {
if (!$report['deleted'] && $report['period'] != Piwik_ScheduledTime::PERIOD_NEVER) {
$midnightInSiteTimezone =
@@ -506,12 +439,8 @@ class Piwik_PDFReports extends Piwik_Plugin
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function segmentDeletion($notification)
+ public function segmentDeletion(&$idSegment)
{
- $idSegment = & $notification->getNotificationObject();
$reportsUsingSegment = Piwik_PDFReports_API::getInstance()->getReports(false, false, false, true, $idSegment);
if (count($reportsUsingSegment) > 0) {
@@ -579,16 +508,12 @@ class Piwik_PDFReports extends Piwik_Plugin
return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function deleteUserReport($notification)
+ public function deleteUserReport($userLogin)
{
- $userLogin = $notification->getNotificationObject();
Piwik_Query('DELETE FROM ' . Piwik_Common::prefixTable('report') . ' WHERE login = ?', $userLogin);
}
- function install()
+ public function install()
{
$queries[] = '
CREATE TABLE `' . Piwik_Common::prefixTable('report') . '` (
diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php
index dc0b436c61..afb59c3cc5 100644
--- a/plugins/PrivacyManager/PrivacyManager.php
+++ b/plugins/PrivacyManager/PrivacyManager.php
@@ -66,13 +66,8 @@ class Piwik_PrivacyManager extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getScheduledTasks($notification)
+ public function getScheduledTasks(&$tasks)
{
- $tasks = & $notification->getNotificationObject();
-
// both tasks are low priority so they will execute after most others, but not lowest, so
// they will execute before the optimize tables task
@@ -87,13 +82,8 @@ class Piwik_PrivacyManager extends Piwik_Plugin
$tasks[] = $purgeLogDataTask;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/PrivacyManager/javascripts/privacySettings.js";
}
diff --git a/plugins/Provider/Provider.php b/plugins/Provider/Provider.php
index f6d1ff1b68..14563a6dc6 100644
--- a/plugins/Provider/Provider.php
+++ b/plugins/Provider/Provider.php
@@ -42,12 +42,8 @@ class Piwik_Provider extends Piwik_Plugin
return $hooks;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
$reports[] = array(
'category' => Piwik_Translate('General_Visitors'),
'name' => Piwik_Translate('Provider_ColumnProvider'),
@@ -59,12 +55,8 @@ class Piwik_Provider extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
$segments[] = array(
'type' => 'dimension',
'category' => 'Visit Location',
@@ -116,13 +108,9 @@ class Piwik_Provider extends Piwik_Plugin
/**
* Logs the provider in the log_visit table
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function logProviderInfo($notification)
+ public function logProviderInfo(&$visitorInfo)
{
- $visitorInfo =& $notification->getNotificationObject();
-
// if provider info has already been set, abort
if (!empty($visitorInfo['location_provider'])) {
return;
@@ -174,7 +162,7 @@ class Piwik_Provider extends Piwik_Plugin
return 'Ip';
} else {
$cleanHostname = null;
- Piwik_PostEvent('Provider.getCleanHostname', $cleanHostname, $hostname);
+ Piwik_PostEvent('Provider.getCleanHostname', array(&$cleanHostname, $hostname));
if ($cleanHostname !== null) {
return $cleanHostname;
}
@@ -202,12 +190,8 @@ class Piwik_Provider extends Piwik_Plugin
return trim(strtolower(@Piwik_IP::getHostByAddr($ip)));
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- static public function footerUserCountry($notification)
+ static public function footerUserCountry(&$out)
{
- $out =& $notification->getNotificationObject();
$out = '<div>
<h2>' . Piwik_Translate('Provider_WidgetProviders') . '</h2>';
$out .= Piwik_FrontController::getInstance()->fetchDispatch('Provider', 'getProvider');
@@ -216,32 +200,20 @@ class Piwik_Provider extends Piwik_Plugin
/**
* Daily archive: processes the report Visits by Provider
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_Provider_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- * @return mixed
- */
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_Provider_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
}
}
-
-
}
diff --git a/plugins/Referers/Referers.php b/plugins/Referers/Referers.php
index 2c45b57592..80ad71d6e8 100644
--- a/plugins/Referers/Referers.php
+++ b/plugins/Referers/Referers.php
@@ -43,12 +43,8 @@ class Piwik_Referers extends Piwik_Plugin
return $hooks;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
$reports = array_merge($reports, array(
array(
'category' => Piwik_Translate('Referers_Referers'),
@@ -174,12 +170,8 @@ class Piwik_Referers extends Piwik_Plugin
));
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
$segments[] = array(
'type' => 'dimension',
'category' => 'Referers_Referers',
@@ -246,13 +238,9 @@ class Piwik_Referers extends Piwik_Plugin
/**
* Adds Goal dimensions, so that the dimensions are displayed in the UI Goal Overview page
- *
- * @param Piwik_Event_Notification $notification notification object
- * @return void
*/
- function getReportsWithGoalMetrics($notification)
+ public function getReportsWithGoalMetrics(&$dimensions)
{
- $dimensions =& $notification->getNotificationObject();
$dimensions = array_merge($dimensions, array(
array('category' => Piwik_Translate('Referers_Referers'),
'name' => Piwik_Translate('Referers_Keywords'),
@@ -284,13 +272,9 @@ class Piwik_Referers extends Piwik_Plugin
/**
* Hooks on daily archive to trigger various log processing
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_Referers_Archiver($archiveProcessor);
if ($archiving->shouldArchive()) {
$archiving->archiveDay();
@@ -300,12 +284,9 @@ class Piwik_Referers extends Piwik_Plugin
/**
* Period archiving: sums up daily stats and sums report tables,
* making sure that tables are still truncated.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
$archiving = new Piwik_Referers_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php
index ad420009ea..5d0aef113d 100644
--- a/plugins/SegmentEditor/API.php
+++ b/plugins/SegmentEditor/API.php
@@ -127,7 +127,7 @@ class Piwik_SegmentEditor_API
$this->checkUserIsNotAnonymous();
// allow plugins using the segment to throw an exception or propagate the deletion
- Piwik_PostEvent(self::DELETE_SEGMENT_EVENT, $idSegment);
+ Piwik_PostEvent(self::DELETE_SEGMENT_EVENT, array(&$idSegment));
$segment = $this->getSegmentOrFail($idSegment);
$db = Zend_Registry::get('db');
diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php
index d95f9b8a8c..ce1825a524 100644
--- a/plugins/SegmentEditor/SegmentEditor.php
+++ b/plugins/SegmentEditor/SegmentEditor.php
@@ -35,26 +35,22 @@ class Piwik_SegmentEditor extends Piwik_Plugin
);
}
- function getSegmentEditorHtml($notification)
+ function getSegmentEditorHtml(&$out)
{
- $out =& $notification->getNotificationObject();
$controller = new Piwik_SegmentEditor_Controller();
$out .= $controller->getSelector();
}
- public function getKnownSegmentsToArchiveAllSites($notification)
+ public function getKnownSegmentsToArchiveAllSites(&$segments)
{
- $segments =& $notification->getNotificationObject();
$segmentsToAutoArchive = Piwik_SegmentEditor_API::getInstance()->getAll($idSite = false, $returnAutoArchived = true);
foreach ($segmentsToAutoArchive as $segment) {
$segments[] = $segment['definition'];
}
}
- public function getKnownSegmentsToArchiveForSite($notification)
+ public function getKnownSegmentsToArchiveForSite(&$segments, $idSite)
{
- $segments =& $notification->getNotificationObject();
- $idSite = $notification->getNotificationInfo();
$segmentToAutoArchive = Piwik_SegmentEditor_API::getInstance()->getAll($idSite, $returnAutoArchived = true);
foreach ($segmentToAutoArchive as $segmentInfo) {
@@ -89,21 +85,18 @@ class Piwik_SegmentEditor extends Piwik_Plugin
}
}
- public function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
$jsFiles[] = "plugins/SegmentEditor/javascripts/jquery.jscrollpane.js";
$jsFiles[] = "plugins/SegmentEditor/javascripts/Segmentation.js";
$jsFiles[] = "plugins/SegmentEditor/javascripts/jquery.mousewheel.js";
$jsFiles[] = "plugins/SegmentEditor/javascripts/mwheelIntent.js";
}
- public function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
$cssFiles[] = "plugins/SegmentEditor/stylesheets/segmentation.css";
$cssFiles[] = "plugins/SegmentEditor/stylesheets/jquery.jscrollpane.css";
$cssFiles[] = "plugins/SegmentEditor/stylesheets/scroll.css";
}
-
}
diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php
index 77fc07d507..fcb5d7fbfe 100644
--- a/plugins/SitesManager/API.php
+++ b/plugins/SitesManager/API.php
@@ -518,7 +518,7 @@ class Piwik_SitesManager_API
Zend_Registry::get('access')->reloadAccess();
$this->postUpdateWebsite($idSite);
- Piwik_PostEvent('SitesManager.addSite', $idSite);
+ Piwik_PostEvent('SitesManager.addSite', array($idSite));
return (int)$idSite;
}
@@ -564,7 +564,7 @@ class Piwik_SitesManager_API
// we do not delete logs here on purpose (you can run these queries on the log_ tables to delete all data)
Piwik_Tracker_Cache::deleteCacheWebsiteAttributes($idSite);
- Piwik_PostEvent('SitesManager.deleteSite', $idSite);
+ Piwik_PostEvent('SitesManager.deleteSite', array($idSite));
}
@@ -1025,7 +1025,7 @@ class Piwik_SitesManager_API
}
$this->postUpdateWebsite($idSite);
- Piwik_PostEvent('SitesManager.updateSite', $idSite);
+ Piwik_PostEvent('SitesManager.updateSite', array($idSite));
}
private function checkAndReturnCommaSeparatedStringList($parameters)
diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php
index b2b5821d0a..81f7c8a60b 100644
--- a/plugins/SitesManager/SitesManager.php
+++ b/plugins/SitesManager/SitesManager.php
@@ -50,41 +50,32 @@ class Piwik_SitesManager extends Piwik_Plugin
/**
* Get CSS files
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/SitesManager/stylesheets/SitesManager.css";
$cssFiles[] = "plugins/Zeitgeist/stylesheets/styles.css";
}
/**
* Get JavaScript files
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/SitesManager/javascripts/SitesManager.js";
}
/**
* Hooks when a website tracker cache is flushed (website updated, cache deleted, or empty cache)
* Will record in the tracker config file all data needed for this website in Tracker.
- *
- * @param Piwik_Event_Notification $notification notification object
+ *
* @return void
*/
- function recordWebsiteDataInCache($notification)
+ public function recordWebsiteDataInCache(&$array, $idSite)
{
- $idSite = (int)$notification->getNotificationInfo();
+ $idSite = (int)$idSite;
+
// add the 'hosts' entry in the website array
- $array =& $notification->getNotificationObject();
$array['hosts'] = $this->getTrackerHosts($idSite);
$website = Piwik_SitesManager_API::getInstance()->getSiteFromId($idSite);
diff --git a/plugins/Transitions/Transitions.php b/plugins/Transitions/Transitions.php
index b503266fc3..2eabcbc643 100644
--- a/plugins/Transitions/Transitions.php
+++ b/plugins/Transitions/Transitions.php
@@ -33,17 +33,13 @@ class Piwik_Transitions extends Piwik_Plugin
);
}
- public function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
$cssFiles[] = 'plugins/Transitions/stylesheets/transitions.css';
}
- public function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
$jsFiles[] = 'plugins/Transitions/javascripts/transitions.js';
}
-
-
-} \ No newline at end of file
+}
diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php
index 1e69e344e4..bd74c18f79 100644
--- a/plugins/UserCountry/UserCountry.php
+++ b/plugins/UserCountry/UserCountry.php
@@ -52,45 +52,25 @@ class Piwik_UserCountry extends Piwik_Plugin
return $hooks;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getScheduledTasks($notification)
+ public function getScheduledTasks(&$tasks)
{
- $tasks = & $notification->getNotificationObject();
-
// add the auto updater task
$tasks[] = Piwik_UserCountry_GeoIPAutoUpdater::makeScheduledTask();
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/UserCountry/stylesheets/userCountry.css";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/UserCountry/javascripts/userCountry.js";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getVisitorLocation($notification)
+ public function getVisitorLocation(&$location, $visitorInfo)
{
require_once PIWIK_INCLUDE_PATH . "/plugins/UserCountry/LocationProvider.php";
- $location = & $notification->getNotificationObject();
- $visitorInfo = $notification->getNotificationInfo();
$id = Piwik_Common::getCurrentLocationProviderId();
$provider = Piwik_UserCountry_LocationProvider::getProviderById($id);
@@ -146,12 +126,8 @@ class Piwik_UserCountry extends Piwik_Plugin
$order = 8);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
$segments[] = array(
'type' => 'dimension',
'category' => 'Visit Location',
@@ -203,10 +179,7 @@ class Piwik_UserCountry extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
$metrics = array(
'nb_visits' => Piwik_Translate('General_ColumnNbVisits'),
@@ -214,8 +187,6 @@ class Piwik_UserCountry extends Piwik_Plugin
'nb_actions' => Piwik_Translate('General_ColumnNbActions'),
);
- $reports = & $notification->getNotificationObject();
-
$reports[] = array(
'category' => Piwik_Translate('General_Visitors'),
'name' => Piwik_Translate('UserCountry_Country'),
@@ -257,12 +228,8 @@ class Piwik_UserCountry extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportsWithGoalMetrics($notification)
+ public function getReportsWithGoalMetrics(&$dimensions)
{
- $dimensions =& $notification->getNotificationObject();
$dimensions = array_merge($dimensions, array(
array('category' => Piwik_Translate('General_Visit'),
'name' => Piwik_Translate('UserCountry_Country'),
@@ -285,28 +252,16 @@ class Piwik_UserCountry extends Piwik_Plugin
));
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- * @return mixed
- */
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_UserCountry_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
}
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- * @return mixed
- */
- function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_UserCountry_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
@@ -332,5 +287,4 @@ class Piwik_UserCountry extends Piwik_Plugin
return array('SQL' => "'" . implode("', '", $result) . "', ?",
'bind' => '-'); // HACK: SegmentExpression requires a $bind, even if there's nothing to bind
}
-
}
diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php
index adbf9d5dba..20cc857961 100644
--- a/plugins/UserCountryMap/UserCountryMap.php
+++ b/plugins/UserCountryMap/UserCountryMap.php
@@ -34,9 +34,8 @@ class Piwik_UserCountryMap extends Piwik_Plugin
Piwik_AddAction('template_leftColumnUserCountry', array('Piwik_UserCountryMap', 'insertMapInLocationReport'));
}
- static public function insertMapInLocationReport($notification)
+ static public function insertMapInLocationReport(&$out)
{
- $out =& $notification->getNotificationObject();
$out = '<h2>' . Piwik_Translate('UserCountryMap_VisitorMap') . '</h2>';
$out .= Piwik_FrontController::getInstance()->fetchDispatch('UserCountryMap', 'visitorMap');
}
@@ -51,17 +50,13 @@ class Piwik_UserCountryMap extends Piwik_Plugin
return $hooks;
}
- function addMenu()
+ public function addMenu()
{
Piwik_AddMenu('General_Visitors', 'UserCountryMap_RealTimeMap', array('module' => 'UserCountryMap', 'action' => 'realtimeWorldMap'), true, $order = 70);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
$jsFiles[] = "plugins/UserCountryMap/javascripts/vendor/raphael.min.js";
$jsFiles[] = "plugins/UserCountryMap/javascripts/vendor/jquery.qtip.min.js";
$jsFiles[] = "plugins/UserCountryMap/javascripts/vendor/kartograph.min.js";
@@ -70,11 +65,9 @@ class Piwik_UserCountryMap extends Piwik_Plugin
$jsFiles[] = "plugins/UserCountryMap/javascripts/realtime-map.js";
}
- public function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = &$notification->getNotificationObject();
$cssFiles[] = "plugins/UserCountryMap/stylesheets/visitor-map.css";
$cssFiles[] = "plugins/UserCountryMap/stylesheets/realtime-map.css";
}
-
}
diff --git a/plugins/UserSettings/UserSettings.php b/plugins/UserSettings/UserSettings.php
index 19b5252360..e3d9076280 100644
--- a/plugins/UserSettings/UserSettings.php
+++ b/plugins/UserSettings/UserSettings.php
@@ -177,13 +177,9 @@ class Piwik_UserSettings extends Piwik_Plugin
/*
* Registers reports metadata
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
-
$i = 0;
foreach ($this->reportMetadata as $report) {
list($category, $name, $apiModule, $apiAction, $columnName) = $report;
@@ -221,12 +217,9 @@ class Piwik_UserSettings extends Piwik_Plugin
/**
* Get segments meta data
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
foreach ($this->reportMetadata as $report) {
@list($category, $name, $apiModule, $apiAction, $columnName, $segment, $sqlSegment, $acceptedValues, $sqlFilter) = $report;
if (empty($segment)) continue;
@@ -267,30 +260,20 @@ class Piwik_UserSettings extends Piwik_Plugin
* Daily archive of User Settings report. Processes reports for Visits by Resolution,
* by Browser, Browser family, etc. Some reports are built from the logs, some reports
* are superset of an existing report (eg. Browser family is built from the Browser report)
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_UserSettings_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
-
/**
* Period archiving: simply sums up daily archives
- *
- * @param Piwik_Event_Notification $notification notification object
- * @return void
*/
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_UserSettings_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index 7937c90ec4..65ca931704 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -388,7 +388,7 @@ class Piwik_UsersManager_API
Zend_Registry::get('access')->reloadAccess();
Piwik_Tracker_Cache::deleteTrackerCache();
- Piwik_PostEvent('UsersManager.addUser', $userLogin);
+ Piwik_PostEvent('UsersManager.addUser', array($userLogin));
}
/**
@@ -445,7 +445,7 @@ class Piwik_UsersManager_API
);
Piwik_Tracker_Cache::deleteTrackerCache();
- Piwik_PostEvent('UsersManager.updateUser', $userLogin);
+ Piwik_PostEvent('UsersManager.updateUser', array($userLogin));
}
/**
@@ -630,7 +630,7 @@ class Piwik_UsersManager_API
$db = Zend_Registry::get('db');
$db->query("DELETE FROM " . Piwik_Common::prefixTable("user") . " WHERE login = ?", $userLogin);
- Piwik_PostEvent('UsersManager.deleteUser', $userLogin);
+ Piwik_PostEvent('UsersManager.deleteUser', array($userLogin));
}
diff --git a/plugins/UsersManager/Controller.php b/plugins/UsersManager/Controller.php
index 57063bfbdd..79388fef7e 100644
--- a/plugins/UsersManager/Controller.php
+++ b/plugins/UsersManager/Controller.php
@@ -312,7 +312,7 @@ class Piwik_UsersManager_Controller extends Piwik_Controller_Admin
'md5Password' => md5($newPassword),
'rememberMe' => false,
);
- Piwik_PostEvent('Login.initSession', $info);
+ Piwik_PostEvent('Login.initSession', array($info));
}
Piwik_UsersManager_API::getInstance()->setUserPreference($userLogin,
diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php
index 5046f34cae..1eea389e7e 100644
--- a/plugins/UsersManager/UsersManager.php
+++ b/plugins/UsersManager/UsersManager.php
@@ -45,7 +45,7 @@ class Piwik_UsersManager extends Piwik_Plugin
*
* @return array
*/
- function getListHooksRegistered()
+ public function getListHooksRegistered()
{
return array(
'AdminMenu.add' => 'addMenu',
@@ -62,12 +62,10 @@ class Piwik_UsersManager extends Piwik_Plugin
* Will record in the tracker config file the list of Admin token_auth for this website. This
* will be used when the Tracking API is used with setIp(), setForceDateTime(), setVisitorId(), etc.
*
- * @param Piwik_Event_Notification $notification notification object
* @return void
*/
- function recordAdminUsersInCache($notification)
+ public function recordAdminUsersInCache(&$array, $idSite)
{
- $idSite = $notification->getNotificationInfo();
// add the 'hosts' entry in the website array
$users = Piwik_UsersManager_API::getInstance()->getUsersWithSiteAccess($idSite, 'admin');
@@ -75,19 +73,13 @@ class Piwik_UsersManager extends Piwik_Plugin
foreach ($users as $user) {
$tokens[] = $user['token_auth'];
}
- $array =& $notification->getNotificationObject();
- $array['admin_token_auth'] = $tokens;
}
/**
* Delete user preferences associated with a particular site
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function deleteSite($notification)
+ public function deleteSite(&$idSite)
{
- $idSite = & $notification->getNotificationObject();
-
Piwik_Option::getInstance()->deleteLike('%\_' . Piwik_UsersManager_API::PREFERENCE_DEFAULT_REPORT, $idSite);
}
@@ -95,26 +87,18 @@ class Piwik_UsersManager extends Piwik_Plugin
* Return list of plug-in specific JavaScript files to be imported by the asset manager
*
* @see Piwik_AssetManager
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "plugins/UsersManager/javascripts/usersManager.js";
$jsFiles[] = "plugins/UsersManager/javascripts/usersSettings.js";
}
/**
* Get CSS files
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- function getCssFiles($notification)
+ function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/UsersManager/stylesheets/usersManager.css";
}
diff --git a/plugins/VisitFrequency/VisitFrequency.php b/plugins/VisitFrequency/VisitFrequency.php
index 717e3f8eae..a5bdf08f9a 100644
--- a/plugins/VisitFrequency/VisitFrequency.php
+++ b/plugins/VisitFrequency/VisitFrequency.php
@@ -36,12 +36,8 @@ class Piwik_VisitFrequency extends Piwik_Plugin
return $hooks;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
$reports[] = array(
'category' => Piwik_Translate('General_Visitors'),
'name' => Piwik_Translate('VisitFrequency_ColumnReturningVisits'),
@@ -76,4 +72,3 @@ class Piwik_VisitFrequency extends Piwik_Plugin
Piwik_AddMenu('General_Visitors', 'VisitFrequency_SubmenuFrequency', array('module' => 'VisitFrequency', 'action' => 'index'));
}
}
-
diff --git a/plugins/VisitTime/VisitTime.php b/plugins/VisitTime/VisitTime.php
index b74a48f59e..36ecd86f65 100644
--- a/plugins/VisitTime/VisitTime.php
+++ b/plugins/VisitTime/VisitTime.php
@@ -40,12 +40,8 @@ class Piwik_VisitTime extends Piwik_Plugin
return $hooks;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
$reports[] = array(
'category' => Piwik_Translate('VisitsSummary_VisitsSummary'),
'name' => Piwik_Translate('VisitTime_WidgetLocalTime'),
@@ -92,12 +88,8 @@ class Piwik_VisitTime extends Piwik_Plugin
Piwik_AddMenu('General_Visitors', 'VisitTime_SubmenuTimes', array('module' => 'VisitTime', 'action' => 'index'));
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getReportsWithGoalMetrics($notification)
+ public function getReportsWithGoalMetrics(&$dimensions)
{
- $dimensions =& $notification->getNotificationObject();
$dimensions[] = array('category' => Piwik_Translate('VisitTime_ColumnServerTime'),
'name' => Piwik_Translate('VisitTime_ColumnServerTime'),
'module' => 'VisitTime',
@@ -105,12 +97,8 @@ class Piwik_VisitTime extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getSegmentsMetadata($notification)
+ public function getSegmentsMetadata(&$segments)
{
- $segments =& $notification->getNotificationObject();
$acceptedValues = "0, 1, 2, 3, ..., 20, 21, 22, 23";
$segments[] = array(
'type' => 'dimension',
@@ -130,10 +118,8 @@ class Piwik_VisitTime extends Piwik_Plugin
);
}
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_VisitTime_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
@@ -141,14 +127,11 @@ class Piwik_VisitTime extends Piwik_Plugin
}
- public function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
$archiving = new Piwik_VisitTime_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
-
}
-
diff --git a/plugins/VisitorInterest/VisitorInterest.php b/plugins/VisitorInterest/VisitorInterest.php
index b3cd8a0023..32549798bc 100644
--- a/plugins/VisitorInterest/VisitorInterest.php
+++ b/plugins/VisitorInterest/VisitorInterest.php
@@ -38,12 +38,8 @@ class Piwik_VisitorInterest extends Piwik_Plugin
return $hooks;
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
$reports[] = array(
'category' => Piwik_Translate('General_Visitors'),
'name' => Piwik_Translate('VisitorInterest_WidgetLengths'),
@@ -123,42 +119,29 @@ class Piwik_VisitorInterest extends Piwik_Plugin
Piwik_AddAction('template_footerVisitsFrequency', array('Piwik_VisitorInterest', 'footerVisitsFrequency'));
}
- function archivePeriod($notification)
+ public function archivePeriod(Piwik_ArchiveProcessor_Period $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_VisitorInterest_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archivePeriod();
}
}
- public function archiveDay($notification)
+ public function archiveDay(Piwik_ArchiveProcessor_Day $archiveProcessor)
{
- $archiveProcessor = $notification->getNotificationObject();
-
$archiving = new Piwik_VisitorInterest_Archiver($archiveProcessor);
if($archiving->shouldArchive()) {
$archiving->archiveDay();
}
}
-
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- static public function headerVisitsFrequency($notification)
+ static public function headerVisitsFrequency(&$out)
{
- $out =& $notification->getNotificationObject();
$out = '<div id="leftcolumn">';
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- static public function footerVisitsFrequency($notification)
+ static public function footerVisitsFrequency(&$out)
{
- $out =& $notification->getNotificationObject();
$out = '</div>
<div id="rightcolumn">
';
@@ -166,4 +149,3 @@ class Piwik_VisitorInterest extends Piwik_Plugin
$out .= '</div>';
}
}
-
diff --git a/plugins/VisitsSummary/VisitsSummary.php b/plugins/VisitsSummary/VisitsSummary.php
index 0744b0424a..f7ba58937e 100644
--- a/plugins/VisitsSummary/VisitsSummary.php
+++ b/plugins/VisitsSummary/VisitsSummary.php
@@ -39,12 +39,8 @@ class Piwik_VisitsSummary extends Piwik_Plugin
);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- public function getReportMetadata($notification)
+ public function getReportMetadata(&$reports)
{
- $reports = & $notification->getNotificationObject();
$reports[] = array(
'category' => Piwik_Translate('VisitsSummary_VisitsSummary'),
'name' => Piwik_Translate('VisitsSummary_VisitsSummary'),
diff --git a/plugins/Widgetize/Widgetize.php b/plugins/Widgetize/Widgetize.php
index 31b5a95a5c..c8ba33afeb 100644
--- a/plugins/Widgetize/Widgetize.php
+++ b/plugins/Widgetize/Widgetize.php
@@ -44,13 +44,8 @@ class Piwik_Widgetize extends Piwik_Plugin
Piwik_AddTopMenu('General_Widgets', $urlParams, true, 5, $isHTML = false, $tooltip);
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getJsFiles($notification)
+ public function getJsFiles(&$jsFiles)
{
- $jsFiles = & $notification->getNotificationObject();
-
$jsFiles[] = "libs/jquery/jquery.truncate.js";
$jsFiles[] = "libs/jquery/jquery.scrollTo.js";
$jsFiles[] = "plugins/Zeitgeist/javascripts/piwikHelper.js";
@@ -59,13 +54,8 @@ class Piwik_Widgetize extends Piwik_Plugin
$jsFiles[] = "plugins/Widgetize/javascripts/widgetize.js";
}
- /**
- * @param Piwik_Event_Notification $notification notification object
- */
- function getCssFiles($notification)
+ public function getCssFiles(&$cssFiles)
{
- $cssFiles = & $notification->getNotificationObject();
-
$cssFiles[] = "plugins/Widgetize/stylesheets/widgetize.css";
$cssFiles[] = "plugins/CoreHome/stylesheets/corehome.css";
$cssFiles[] = "plugins/CoreHome/stylesheets/datatable.css";
diff --git a/tests/PHPUnit/Core/JsProxyTest.php b/tests/PHPUnit/Core/JsProxyTest.php
index 295cf5a682..2efbcdae74 100644
--- a/tests/PHPUnit/Core/JsProxyTest.php
+++ b/tests/PHPUnit/Core/JsProxyTest.php
@@ -35,8 +35,11 @@ class Test_Piwik_JsProxy extends PHPUnit_Framework_TestCase
curl_close($curlHandle);
$this->assertEquals($responseInfo["http_code"], 200, 'Ok response');
- $ok = $fullResponse == base64_decode("R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
- $this->assertTrue($ok, '1*1 pixel was expected, got: "'.$fullResponse.'"');
+ $this->assertEquals(
+ "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
+ base64_encode($fullResponse),
+ 'checking for image content'
+ );
}
/**
diff --git a/tests/PHPUnit/Core/PiwikTest.php b/tests/PHPUnit/Core/PiwikTest.php
index ade7e91778..1d8f075c2b 100644
--- a/tests/PHPUnit/Core/PiwikTest.php
+++ b/tests/PHPUnit/Core/PiwikTest.php
@@ -106,6 +106,10 @@ class PiwikTest extends DatabaseTestCase
*/
public function testGetPrettyTimeFromSeconds($seconds, $expected)
{
+ if (($seconds * 100) > PHP_INT_MAX) {
+ $this->markTestSkipped("Will not pass on 32-bit machine.");
+ }
+
Piwik_Translate::getInstance()->loadEnglishTranslation();
$sentenceExpected = str_replace(' ', '&nbsp;', $expected[0]);
diff --git a/tests/PHPUnit/Core/TaskSchedulerTest.php b/tests/PHPUnit/Core/TaskSchedulerTest.php
index a774666e5a..f168abc6ad 100644
--- a/tests/PHPUnit/Core/TaskSchedulerTest.php
+++ b/tests/PHPUnit/Core/TaskSchedulerTest.php
@@ -277,8 +277,15 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
*/
public function testRunTasks($expectedTimetable, $expectedExecutedTasks, $timetableBeforeTaskExecution, $configuredTasks)
{
- // stub the event dispatcher so we can control the returned event notification
- Piwik_PluginsManager::getInstance()->dispatcher = new MockEventDispatcher($configuredTasks);
+ // temporarily unload plugins
+ $plugins = Piwik_PluginsManager::getInstance()->getLoadedPlugins();
+ $plugins = array_map(function ($p) { return $p->getPluginName(); }, $plugins);
+ Piwik_PluginsManager::getInstance()->unloadPlugins();
+
+ // make sure the get tasks event returns our configured tasks
+ Piwik_AddAction(Piwik_TaskScheduler::GET_TASKS_EVENT, function(&$tasks) use($configuredTasks) {
+ $tasks = $configuredTasks;
+ });
// stub the piwik option object to control the returned option value
self::stubPiwikOption(serialize($timetableBeforeTaskExecution));
@@ -299,8 +306,9 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase
$getTimetableFromOptionTable->setAccessible(TRUE);
$this->assertEquals($expectedTimetable, $getTimetableFromOptionTable->invoke(new Piwik_TaskScheduler()));
- // restore event dispatcher & piwik options
- Piwik_PluginsManager::getInstance()->dispatcher = Event_Dispatcher::getInstance();
+ // restore loaded plugins & piwik options
+ Piwik_EventDispatcher::getInstance()->clearObservers(Piwik_TaskScheduler::GET_TASKS_EVENT);
+ Piwik_PluginsManager::getInstance()->loadPlugins($plugins);
self::resetPiwikOption();
}
diff --git a/tests/PHPUnit/MockEventDispatcher.php b/tests/PHPUnit/MockEventDispatcher.php
deleted file mode 100644
index a5528e61e0..0000000000
--- a/tests/PHPUnit/MockEventDispatcher.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-/**
- * Piwik - Open source web analytics
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-class MockEventDispatcher extends Event_Dispatcher
-{
- private $forcedNotificationObject = false;
-
- function __construct($forcedNotificationObject)
- {
- $this->forcedNotificationObject = $forcedNotificationObject;
- }
-
- function &postNotification(&$notification, $pending = true, $bubble = true)
- {
- $notification->_notificationObject = $this->forcedNotificationObject;
-
- return $notification;
- }
-}
diff --git a/tests/PHPUnit/Plugins/MobileMessagingTest.php b/tests/PHPUnit/Plugins/MobileMessagingTest.php
index 04689274c0..8843b3e2c6 100644
--- a/tests/PHPUnit/Plugins/MobileMessagingTest.php
+++ b/tests/PHPUnit/Plugins/MobileMessagingTest.php
@@ -230,17 +230,13 @@ class MobileMessagingTest extends DatabaseTestCase
*/
public function testSendReport($expectedReportContent, $expectedPhoneNumber, $expectedFrom, $reportContent, $phoneNumber, $reportSubject)
{
- $eventNotification = new Piwik_Event_Notification(
- $this,
- null,
- array(
- Piwik_PDFReports_API::REPORT_CONTENT_KEY => $reportContent,
- Piwik_PDFReports_API::REPORT_SUBJECT_KEY => $reportSubject,
- Piwik_PDFReports_API::REPORT_TYPE_INFO_KEY => Piwik_MobileMessaging::MOBILE_TYPE,
- Piwik_PDFReports_API::REPORT_KEY => array(
- 'parameters' => array(Piwik_MobileMessaging::PHONE_NUMBERS_PARAMETER => array($phoneNumber)),
- ),
- )
+ $notificationInfo = array(
+ Piwik_PDFReports_API::REPORT_CONTENT_KEY => $reportContent,
+ Piwik_PDFReports_API::REPORT_SUBJECT_KEY => $reportSubject,
+ Piwik_PDFReports_API::REPORT_TYPE_INFO_KEY => Piwik_MobileMessaging::MOBILE_TYPE,
+ Piwik_PDFReports_API::REPORT_KEY => array(
+ 'parameters' => array(Piwik_MobileMessaging::PHONE_NUMBERS_PARAMETER => array($phoneNumber)),
+ ),
);
$stubbedMobileMessagingAPI = $this->getMock('Piwik_MobileMessaging_API');
@@ -255,7 +251,7 @@ class MobileMessagingTest extends DatabaseTestCase
$stubbedMobileMessagingAPIClass->setValue($stubbedMobileMessagingAPI);
$mobileMessaging = new Piwik_MobileMessaging();
- $mobileMessaging->sendReport($eventNotification);
+ $mobileMessaging->sendReport($notificationInfo);
// restore Piwik_MobileMessaging_API
$stubbedMobileMessagingAPIClass->setValue(null);
diff --git a/tests/PHPUnit/Plugins/PDFReportsTest.php b/tests/PHPUnit/Plugins/PDFReportsTest.php
index 23777914db..3ddb0c1915 100644
--- a/tests/PHPUnit/Plugins/PDFReportsTest.php
+++ b/tests/PHPUnit/Plugins/PDFReportsTest.php
@@ -381,7 +381,7 @@ class PDFReportsTest extends DatabaseTestCase
$pdfReportPlugin = new Piwik_PDFReports();
$tasks = array();
- $pdfReportPlugin->getScheduledTasks(new Piwik_Event_Notification($tasks, 'fakeEvent'));
+ $pdfReportPlugin->getScheduledTasks($tasks);
$this->assertEquals($expectedTasks, $tasks);
// restore Piwik_PDFReports_API
diff --git a/tests/PHPUnit/Plugins/PrivacyManagerTest.php b/tests/PHPUnit/Plugins/PrivacyManagerTest.php
index d227c951d7..1d4b235c79 100755
--- a/tests/PHPUnit/Plugins/PrivacyManagerTest.php
+++ b/tests/PHPUnit/Plugins/PrivacyManagerTest.php
@@ -804,10 +804,8 @@ class PrivacyManagerTest extends IntegrationTestCase
* does the insert into the temporary table. When log_actions are deleted, this idaction should still
* be kept. w/ the wrong strategy, it won't be and there will be a dangling reference
* in the log_link_visit_action table.
- *
- * @param Piwik_Event_Notification $notification notification object
*/
- public function addReferenceToUnusedAction($notification)
+ public function addReferenceToUnusedAction()
{
$unusedIdAction = $this->unusedIdAction;
if (empty($unusedIdAction)) // make sure we only do this for one test case
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index 53a09c14db..e31ac8cc72 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -60,7 +60,6 @@ require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/DatabaseTestCase.php';
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/IntegrationTestCase.php';
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/FakeAccess.php';
require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockPiwikOption.php';
-require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockEventDispatcher.php';
require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php';
// required to build code coverage for uncovered files