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:
authorStefan Giehl <stefan@piwik.org>2017-10-13 12:52:47 +0300
committerGitHub <noreply@github.com>2017-10-13 12:52:47 +0300
commit056acce6981bade35404b5fe87d03eeeea5bb263 (patch)
tree6cadc12665681bd939d4737972f2751ca1e594c4 /plugins/DevicesDetection
parent49c423fa99cc6f985c914eab3566638fecbf2d95 (diff)
Do not use device type as XML tag name (#12190)
Diffstat (limited to 'plugins/DevicesDetection')
-rw-r--r--plugins/DevicesDetection/VisitorDetails.php14
-rw-r--r--plugins/DevicesDetection/templates/_profileSummary.twig6
2 files changed, 14 insertions, 6 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 -%}