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/SegmentEditor | |
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/SegmentEditor')
-rw-r--r-- | plugins/SegmentEditor/API.php | 2 | ||||
-rw-r--r-- | plugins/SegmentEditor/SegmentEditor.php | 17 |
2 files changed, 6 insertions, 13 deletions
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"; } - } |