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:
authorThomas Steur <tsteur@users.noreply.github.com>2017-11-28 00:56:39 +0300
committerGitHub <noreply@github.com>2017-11-28 00:56:39 +0300
commit1ff4c85d61409bef3431eb620cfe5d886aac768c (patch)
tree0d6c19731d8a852fe8ce500518240817afb2c78a
parent6e1185a0f4cab86e7f24cea39cdaba6f13b45e0d (diff)
parent87cdde0237bdcc63fac171c9cb20939c5034ed13 (diff)
Merge pull request #12303 from piwik/profilesummaryevents
Added events for adding and filtering profile summaries
-rw-r--r--CHANGELOG.md1
-rw-r--r--plugins/Live/Controller.php35
2 files changed, 34 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de60a62dd6..227606f039 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The Product Changelog at **[piwik.org/changelog](https://piwik.org/changelog)**
### New APIs
* Themes can now customize the header text color using `@theme-color-header-text`
* New event `Widgetize.shouldEmbedIframeEmpty` added so plugins can optionally define the output of the widgetized HTML themselves
+ * New events added to add and filter visitor details: `Live.addProfileSummaries` and `Live.filterProfileSummaries`
## Piwik 3.2.0
diff --git a/plugins/Live/Controller.php b/plugins/Live/Controller.php
index de76e6736a..5ad68b809b 100644
--- a/plugins/Live/Controller.php
+++ b/plugins/Live/Controller.php
@@ -228,11 +228,42 @@ class Controller extends \Piwik\Plugin\Controller
if (!$cache->contains($cacheId)) {
$instances = [];
+ /**
+ * Triggered to add new live profile summaries.
+ *
+ * **Example**
+ *
+ * public function addProfileSummary(&$profileSummaries)
+ * {
+ * $profileSummaries[] = new MyCustomProfileSummary();
+ * }
+ *
+ * @param ProfileSummaryAbstract[] $profileSummaries An array of profile summaries
+ */
+ Piwik::postEvent('Live.addProfileSummaries', array(&$instances));
+
foreach (self::getAllProfileSummaryClasses() as $className) {
- $instance = new $className();
- $instances[] = $instance;
+ $instances[] = new $className();
}
+ /**
+ * Triggered to filter / restrict profile summaries.
+ *
+ * **Example**
+ *
+ * public function filterProfileSummary(&$profileSummaries)
+ * {
+ * foreach ($profileSummaries as $index => $profileSummary) {
+ * if ($profileSummary->getId() === 'myid') {}
+ * unset($profileSummaries[$index]); // remove all summaries having this ID
+ * }
+ * }
+ * }
+ *
+ * @param ProfileSummaryAbstract[] $profileSummaries An array of profile summaries
+ */
+ Piwik::postEvent('Live.filterProfileSummaries', array(&$instances));
+
$cache->save($cacheId, $instances);
}