diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-07-06 03:44:45 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-07-06 03:44:45 +0400 |
commit | ddd7aac6f2d1e3b1660f38045cab4214a26f2325 (patch) | |
tree | 8e49b4362a6a88505d1b790d64a546a719056188 /plugins/VisitTime | |
parent | 3a3517e48823a4d7dc521e5a754c51ddbcf5d210 (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.
Diffstat (limited to 'plugins/VisitTime')
-rw-r--r-- | plugins/VisitTime/VisitTime.php | 27 |
1 files changed, 5 insertions, 22 deletions
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(); } } - } - |