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/VisitorInterest | |
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/VisitorInterest')
-rw-r--r-- | plugins/VisitorInterest/VisitorInterest.php | 28 |
1 files changed, 5 insertions, 23 deletions
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>'; } } - |