File size: 2,913 Bytes
f8ce8bb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | <?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\Mail;
use Piwik\Piwik;
use Piwik\ReportRenderer;
class EmailStyles
{
public const REPORT_TITLE_TEXT_SIZE = 24;
public const REPORT_TABLE_HEADER_TEXT_SIZE = 11;
public const REPORT_TABLE_ROW_TEXT_SIZE = '13px';
public const REPORT_BACK_TO_TOP_TEXT_SIZE = 9;
/**
* @var string
*/
public $reportFontFamily = ReportRenderer::DEFAULT_REPORT_FONT_FAMILY;
/**
* @var string
*/
public $reportTitleTextColor;
/**
* @var int
*/
public $reportTitleTextSize = self::REPORT_TITLE_TEXT_SIZE;
/**
* @var string
*/
public $reportTextColor;
/**
* @var string
*/
public $tableHeaderBgColor;
/**
* @var string
*/
public $tableHeaderTextColor;
/**
* @var string
*/
public $tableCellBorderColor;
/**
* @var string
*/
public $tableBgColor;
/**
* @var string
*/
public $reportTableHeaderTextWeight = ReportRenderer::TABLE_HEADER_TEXT_WEIGHT;
/**
* @var int
*/
public $reportTableHeaderTextSize = self::REPORT_TABLE_HEADER_TEXT_SIZE;
/**
* @var string
*/
public $reportTableHeaderTextTransform = ReportRenderer::TABLE_HEADER_TEXT_TRANSFORM;
/**
* @var string
*/
public $reportTableRowTextSize = self::REPORT_TABLE_ROW_TEXT_SIZE;
/**
* @var int
*/
public $reportBackToTopTextSize = self::REPORT_BACK_TO_TOP_TEXT_SIZE;
/**
* @var string
*/
public $brandNameLong;
public function __construct()
{
$this->reportTitleTextColor = self::rgbToHex(ReportRenderer::REPORT_TITLE_TEXT_COLOR);
$this->reportTextColor = self::rgbToHex(ReportRenderer::REPORT_TEXT_COLOR);
$this->tableHeaderBgColor = self::rgbToHex(ReportRenderer::TABLE_HEADER_BG_COLOR);
$this->tableHeaderTextColor = self::rgbToHex(ReportRenderer::TABLE_HEADER_TEXT_COLOR);
$this->tableCellBorderColor = self::rgbToHex(ReportRenderer::TABLE_CELL_BORDER_COLOR);
$this->tableBgColor = self::rgbToHex(ReportRenderer::TABLE_BG_COLOR);
$this->brandNameLong = 'Matomo, ' . Piwik::translate('General_OpenSourceWebAnalytics');
}
public static function rgbToHex($rgbValues)
{
list($r, $g, $b) = explode(',', $rgbValues);
$r = str_pad(dechex($r), 2, "0", STR_PAD_LEFT);
$g = str_pad(dechex($g), 2, "0", STR_PAD_LEFT);
$b = str_pad(dechex($b), 2, "0", STR_PAD_LEFT);
return '#' . $r . $g . $b;
}
public static function get()
{
$result = new self();
/**
* @ignore
*/
Piwik::postEvent('Email.configureEmailStyle', [$result]);
return $result;
}
}
|