2020-05-20 10:41:04 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Piwik\Plugins\ProfileAvatar;
|
|
|
|
|
2021-02-14 21:33:02 +01:00
|
|
|
use Piwik\DataTable\Row;
|
2020-05-20 10:41:04 +02:00
|
|
|
use Piwik\Plugin;
|
|
|
|
|
|
|
|
class ProfileAvatar extends Plugin
|
|
|
|
{
|
2021-02-14 21:33:02 +01:00
|
|
|
public function registerEvents()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'Live.renderVisitorDetails' => 'addImageToTemplate',
|
|
|
|
);
|
|
|
|
}
|
2020-05-20 10:41:04 +02:00
|
|
|
|
2021-02-14 21:33:02 +01:00
|
|
|
public function addImageToTemplate(string &$outString, Row $visit)
|
|
|
|
{
|
|
|
|
$settings = new UserSettings();
|
|
|
|
if (!$settings->showInVisitorLog->getValue()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$visitorID = $visit->getColumn("visitorId");
|
|
|
|
$hash = hash("sha256", $visitorID);
|
|
|
|
|
|
|
|
$outString .= "<img width='32' height='32' alt='user profile' src='?module=ProfileAvatar&action=getProfileAvatar&hash=$hash' aria-hidden='true'>";
|
|
|
|
}
|
2020-05-20 10:41:04 +02:00
|
|
|
}
|