PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 1.3.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v1.3.1
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / Mail / EmailStyles.php
matomo / app / core / Mail Last commit date
EmailStyles.php 6 years ago
EmailStyles.php
126 lines
1 <?php
2 /**
3 * Piwik - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 *
8 */
9
10 namespace Piwik\Mail;
11
12 use Piwik\Piwik;
13 use Piwik\ReportRenderer;
14
15 class EmailStyles
16 {
17 const REPORT_TITLE_TEXT_SIZE = 24;
18 const REPORT_TABLE_HEADER_TEXT_SIZE = 11;
19 const REPORT_TABLE_ROW_TEXT_SIZE = '13px';
20 const REPORT_BACK_TO_TOP_TEXT_SIZE = 9;
21
22 /**
23 * @var string
24 */
25 public $reportFontFamily = ReportRenderer::DEFAULT_REPORT_FONT_FAMILY;
26
27 /**
28 * @var string
29 */
30 public $reportTitleTextColor;
31
32 /**
33 * @var int
34 */
35 public $reportTitleTextSize = self::REPORT_TITLE_TEXT_SIZE;
36
37 /**
38 * @var string
39 */
40 public $reportTextColor;
41
42 /**
43 * @var string
44 */
45 public $tableHeaderBgColor;
46
47 /**
48 * @var string
49 */
50 public $tableHeaderTextColor;
51
52 /**
53 * @var string
54 */
55 public $tableCellBorderColor;
56
57 /**
58 * @var string
59 */
60 public $tableBgColor;
61
62 /**
63 * @var string
64 */
65 public $reportTableHeaderTextWeight = ReportRenderer::TABLE_HEADER_TEXT_WEIGHT;
66
67 /**
68 * @var int
69 */
70 public $reportTableHeaderTextSize = self::REPORT_TABLE_HEADER_TEXT_SIZE;
71
72 /**
73 * @var string
74 */
75 public $reportTableHeaderTextTransform = ReportRenderer::TABLE_HEADER_TEXT_TRANSFORM;
76
77 /**
78 * @var string
79 */
80 public $reportTableRowTextSize = self::REPORT_TABLE_ROW_TEXT_SIZE;
81
82 /**
83 * @var int
84 */
85 public $reportBackToTopTextSize = self::REPORT_BACK_TO_TOP_TEXT_SIZE;
86
87 /**
88 * @var string
89 */
90 public $brandNameLong;
91
92 public function __construct()
93 {
94 $this->reportTitleTextColor = self::rgbToHex(ReportRenderer::REPORT_TITLE_TEXT_COLOR);
95 $this->reportTextColor = self::rgbToHex(ReportRenderer::REPORT_TEXT_COLOR);
96 $this->tableHeaderBgColor = self::rgbToHex(ReportRenderer::TABLE_HEADER_BG_COLOR);
97 $this->tableHeaderTextColor = self::rgbToHex(ReportRenderer::TABLE_HEADER_TEXT_COLOR);
98 $this->tableCellBorderColor = self::rgbToHex(ReportRenderer::TABLE_CELL_BORDER_COLOR);
99 $this->tableBgColor = self::rgbToHex(ReportRenderer::TABLE_BG_COLOR);
100
101 $this->brandNameLong = 'Matomo, ' . Piwik::translate('General_OpenSourceWebAnalytics');
102 }
103
104 public static function rgbToHex($rgbValues)
105 {
106 list($r, $g, $b) = explode(',', $rgbValues);
107
108 $r = str_pad(dechex($r), 2, "0", STR_PAD_LEFT);
109 $g = str_pad(dechex($g), 2, "0", STR_PAD_LEFT);
110 $b = str_pad(dechex($b), 2, "0", STR_PAD_LEFT);
111
112 return '#' . $r . $g . $b;
113 }
114
115 public static function get()
116 {
117 $result = new self();
118
119 /**
120 * @ignore
121 */
122 Piwik::postEvent('Email.configureEmailStyle', [$result]);
123
124 return $result;
125 }
126 }