قرینه از
https://github.com/matomo-org/matomo.git
synced 2025-08-21 22:47:43 +00:00

* [Coding Style] Enable rule PSR12.Files.FileHeader * Apply CS * Replace Piwik with Matomo in file headers * Unify file headers (position, no. of lines, https links) * Rebuild dist files * Apply CS * Fix system test that relies on line numbers in a file that had the file header updated --------- Co-authored-by: Stefan Giehl <stefan@matomo.org>
59 خطوط
1.6 KiB
PHP
59 خطوط
1.6 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Matomo - free/libre analytics platform
|
|
*
|
|
* @link https://matomo.org
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
|
*/
|
|
|
|
namespace Piwik\Plugins\Resolution\Columns;
|
|
|
|
use Piwik\Plugin\Dimension\VisitDimension;
|
|
use Piwik\Tracker\Action;
|
|
use Piwik\Tracker\Request;
|
|
use Piwik\Tracker\Visitor;
|
|
|
|
class Resolution extends VisitDimension
|
|
{
|
|
protected $columnName = 'config_resolution';
|
|
protected $columnType = 'VARCHAR(18) NULL';
|
|
protected $acceptValues = '1280x1024, 800x600, etc.';
|
|
protected $segmentName = 'resolution';
|
|
protected $nameSingular = 'Resolution_ColumnResolution';
|
|
protected $namePlural = 'Resolution_Resolutions';
|
|
protected $type = self::TYPE_TEXT;
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @param Visitor $visitor
|
|
* @param Action|null $action
|
|
* @return mixed
|
|
*/
|
|
public function onNewVisit(Request $request, Visitor $visitor, $action)
|
|
{
|
|
$resolution = $request->getParam('res');
|
|
|
|
if (!empty($resolution)) {
|
|
return substr($resolution, 0, 9);
|
|
}
|
|
|
|
return $resolution;
|
|
}
|
|
/**
|
|
* @param Request $request
|
|
* @param Visitor $visitor
|
|
* @param Action|null $action
|
|
* @return mixed
|
|
*/
|
|
public function onExistingVisit(Request $request, Visitor $visitor, $action)
|
|
{
|
|
// In case the value was initially unknown, update it from a subsequent action
|
|
if ($visitor->getVisitorColumn($this->columnName) === Request::UNKNOWN_RESOLUTION) {
|
|
return $this->onNewVisit($request, $visitor, $action);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|