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:
Diffstat (limited to 'plugins/MultiSites')
-rwxr-xr-xplugins/MultiSites/API.php39
-rw-r--r--plugins/MultiSites/lang/zh-tw.json6
2 files changed, 42 insertions, 3 deletions
diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php
index 8e2ce0c1a3..2312ebfec3 100755
--- a/plugins/MultiSites/API.php
+++ b/plugins/MultiSites/API.php
@@ -440,7 +440,11 @@ class API extends \Piwik\Plugin\API
$totals[$label] = 0;
}
- foreach ($dataTable->getRows() as $row) {
+ $rows = $dataTable->getRows();
+
+ $rows = $this->filterRowsForTotalsCalculation($rows);
+
+ foreach ($rows as $row) {
foreach ($apiMetrics as $totalMetadataName => $recordName) {
$totals[$totalMetadataName] += $row->getColumn($recordName);
}
@@ -462,7 +466,10 @@ class API extends \Piwik\Plugin\API
$total = 0;
$metric = 'nb_visits';
- foreach ($pastTable->getRows() as $row) {
+ $rows = $pastTable->getRows();
+ $rows = $this->filterRowsForTotalsCalculation($rows);
+
+ foreach ($rows as $row) {
$total += $row->getColumn($metric);
}
@@ -470,6 +477,34 @@ class API extends \Piwik\Plugin\API
}
}
+ /**
+ * @param Row[] $rows
+ * @return mixed
+ */
+ private function filterRowsForTotalsCalculation($rows)
+ {
+ /**
+ * Triggered to filter / restrict which rows should be included in the MultiSites (All Websites Dashboard)
+ * totals calculation
+ *
+ * **Example**
+ *
+ * public function filterMultiSitesRows(&$rows)
+ * {
+ * foreach ($rows as $index => $row) {
+ * if ($row->getColumn('label') === 5) {
+ * unset($rows[$index]); // remove idSite 5 from totals
+ * }
+ * }
+ * }
+ *
+ * @param Row[] &$rows An array containing rows, one row for each site. The label columns equals the idSite.
+ */
+ Piwik::postEvent('MultiSites.filterRowsForTotalsCalculation', array(&$rows));
+
+ return $rows;
+ }
+
private static function getTotalMetadataName($name)
{
return 'total_' . $name;
diff --git a/plugins/MultiSites/lang/zh-tw.json b/plugins/MultiSites/lang/zh-tw.json
index 1d7fa7b687..8364389732 100644
--- a/plugins/MultiSites/lang/zh-tw.json
+++ b/plugins/MultiSites/lang/zh-tw.json
@@ -1,5 +1,9 @@
{
"MultiSites": {
- "Evolution": "發展趨勢"
+ "Evolution": "發展趨勢",
+ "LoadingWebsites": "網站載入中",
+ "PluginDescription": "在這個方便的「所有網站」展示板中查看並比較你所有的網站和應用程式。",
+ "TopLinkTooltip": "比較你所有網站的網頁分析統計。",
+ "Pagination": "第 %1$s - %2$s 項,共 %3$s 項"
}
} \ No newline at end of file