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:
-rw-r--r--plugins/DevicesDetection/VisitorDetails.php14
-rw-r--r--plugins/DevicesDetection/templates/_profileSummary.twig6
-rw-r--r--plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml10
-rw-r--r--plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml10
-rw-r--r--tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getVisitorProfile.xml5
-rw-r--r--tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__Live.getVisitorProfile.xml5
6 files changed, 32 insertions, 18 deletions
diff --git a/plugins/DevicesDetection/VisitorDetails.php b/plugins/DevicesDetection/VisitorDetails.php
index d358c2d1ef..5b17fdc4e6 100644
--- a/plugins/DevicesDetection/VisitorDetails.php
+++ b/plugins/DevicesDetection/VisitorDetails.php
@@ -6,6 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
+
namespace Piwik\Plugins\DevicesDetection;
use Piwik\Plugins\Live\VisitorDetailsAbstract;
@@ -151,7 +152,7 @@ class VisitorDetails extends VisitorDetailsAbstract
public function finalizeProfile($visits, &$profile)
{
$devices = $this->devices;
- uksort($this->devices, function($a, $b) use ($devices) {
+ uksort($this->devices, function ($a, $b) use ($devices) {
$cmp = strcmp($devices[$b]['count'], $devices[$a]['count']);
if (0 == $cmp) {
$cmp = strcmp($a, $b);
@@ -159,6 +160,8 @@ class VisitorDetails extends VisitorDetailsAbstract
return $cmp;
});
+ $devices = [];
+
foreach ($this->devices as $type => $devicesData) {
$typeDevices = [];
foreach ($devicesData['devices'] as $name => $count) {
@@ -167,9 +170,14 @@ class VisitorDetails extends VisitorDetailsAbstract
'count' => $count
];
}
- $this->devices[$type]['devices'] = $typeDevices;
+ $devices[] = [
+ 'type' => $type,
+ 'count' => $devicesData['count'],
+ 'icon' => $devicesData['icon'],
+ 'devices' => $typeDevices,
+ ];
}
- $profile['devices'] = $this->devices;
+ $profile['devices'] = $devices;
}
} \ No newline at end of file
diff --git a/plugins/DevicesDetection/templates/_profileSummary.twig b/plugins/DevicesDetection/templates/_profileSummary.twig
index 05348864c5..b124302684 100644
--- a/plugins/DevicesDetection/templates/_profileSummary.twig
+++ b/plugins/DevicesDetection/templates/_profileSummary.twig
@@ -2,13 +2,13 @@
<div class="visitor-profile-summary visitor-profile-devices">
<h1>{{ 'DevicesDetection_Devices'|translate }}</h1>
<div>
- {%- for type,entry in visitorData.devices -%}
+ {%- for entry in visitorData.devices -%}
<p>
<img height="16" src="{{ entry.icon }}" />
{% if entry.devices|length == 1 and 'General_Unknown'|translate in entry.devices[0].name %}
- <span>{{ 'DevicesDetection_XVisitsFromDevices'|translate('<strong>' ~ entry.count ~ '</strong>', '<strong>' ~ type ~ '</strong>')|raw }}
+ <span>{{ 'DevicesDetection_XVisitsFromDevices'|translate('<strong>' ~ entry.count ~ '</strong>', '<strong>' ~ entry.type ~ '</strong>')|raw }}
{% else %}
- <span>{{ 'DevicesDetection_XVisitsFromDevices'|translate('<strong>' ~ entry.count ~ '</strong>', '<strong>' ~ type ~ '</strong>')|raw }}:
+ <span>{{ 'DevicesDetection_XVisitsFromDevices'|translate('<strong>' ~ entry.count ~ '</strong>', '<strong>' ~ entry.type ~ '</strong>')|raw }}:
{% for device in entry.devices -%}
{{ device.name }} ({{ device.count }}x){% if not loop.last %}, {% endif %}
{%- endfor -%}
diff --git a/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml b/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml
index 878232f0c4..b65956d80a 100644
--- a/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml
+++ b/plugins/Live/tests/System/expected/test___Live.getVisitorProfile.xml
@@ -1210,7 +1210,8 @@
</row>
</visitedPages>
<devices>
- <Unknown>
+ <row>
+ <type>Unknown</type>
<count>30</count>
<icon>plugins/Morpheus/icons/dist/devices/unknown.png</icon>
<devices>
@@ -1219,8 +1220,9 @@
<count>30</count>
</row>
</devices>
- </Unknown>
- <Desktop>
+ </row>
+ <row>
+ <type>Desktop</type>
<count>1</count>
<icon>plugins/Morpheus/icons/dist/devices/desktop.png</icon>
<devices>
@@ -1229,7 +1231,7 @@
<count>1</count>
</row>
</devices>
- </Desktop>
+ </row>
</devices>
<continents>
<row>
diff --git a/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml b/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml
index 4071574fdc..09df3a8344 100644
--- a/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml
+++ b/plugins/Live/tests/System/expected/test_higherLimit__Live.getVisitorProfile.xml
@@ -2360,7 +2360,8 @@
</row>
</visitedPages>
<devices>
- <Unknown>
+ <row>
+ <type>Unknown</type>
<count>30</count>
<icon>plugins/Morpheus/icons/dist/devices/unknown.png</icon>
<devices>
@@ -2369,8 +2370,9 @@
<count>30</count>
</row>
</devices>
- </Unknown>
- <Desktop>
+ </row>
+ <row>
+ <type>Desktop</type>
<count>1</count>
<icon>plugins/Morpheus/icons/dist/devices/desktop.png</icon>
<devices>
@@ -2379,7 +2381,7 @@
<count>1</count>
</row>
</devices>
- </Desktop>
+ </row>
</devices>
<continents>
<row>
diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getVisitorProfile.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getVisitorProfile.xml
index 7d19d39bce..d12817f379 100644
--- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getVisitorProfile.xml
+++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI__Live.getVisitorProfile.xml
@@ -309,7 +309,8 @@
</row>
</visitedPages>
<devices>
- <Desktop>
+ <row>
+ <type>Desktop</type>
<count>2</count>
<icon>plugins/Morpheus/icons/dist/devices/desktop.png</icon>
<devices>
@@ -318,7 +319,7 @@
<count>2</count>
</row>
</devices>
- </Desktop>
+ </row>
</devices>
<continents>
<row>
diff --git a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__Live.getVisitorProfile.xml b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__Live.getVisitorProfile.xml
index 7d19d39bce..d12817f379 100644
--- a/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__Live.getVisitorProfile.xml
+++ b/tests/PHPUnit/System/expected/test_periodIsRange_dateIsLastN_MetadataAndNormalAPI_pagesegment__Live.getVisitorProfile.xml
@@ -309,7 +309,8 @@
</row>
</visitedPages>
<devices>
- <Desktop>
+ <row>
+ <type>Desktop</type>
<count>2</count>
<icon>plugins/Morpheus/icons/dist/devices/desktop.png</icon>
<devices>
@@ -318,7 +319,7 @@
<count>2</count>
</row>
</devices>
- </Desktop>
+ </row>
</devices>
<continents>
<row>