PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / trunk
Matomo Analytics – Powerful, Privacy-First Insights for WordPress vtrunk
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 / View / HtmlReportEmailHeaderView.php
matomo / app / core / View Last commit date
HtmlEmailFooterView.php 2 years ago HtmlReportEmailHeaderView.php 1 month ago MethodCallExpression.php 1 year ago OneClickDone.php 6 months ago RenderTokenParser.php 1 year ago SecurityPolicy.php 1 month ago UIControl.php 1 month ago ViewInterface.php 1 year ago
HtmlReportEmailHeaderView.php
69 lines
1 <?php
2
3 /**
4 * Matomo - free/libre analytics platform
5 *
6 * @link https://matomo.org
7 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
8 */
9 namespace Piwik\View;
10
11 use Piwik\Common;
12 use Piwik\Date;
13 use Piwik\Mail\EmailStyles;
14 use Piwik\Plugin\ThemeStyles;
15 use Piwik\Plugins\CoreAdminHome\CustomLogo;
16 use Piwik\Scheduler\Schedule\Schedule;
17 use Piwik\SettingsPiwik;
18 use Piwik\Site;
19 use Piwik\View;
20 use Piwik\Plugin\Manager;
21 class HtmlReportEmailHeaderView extends View
22 {
23 public const TEMPLATE_FILE = '@CoreHome/ReportRenderer/_htmlReportHeader';
24 private static $reportFrequencyTranslationByPeriod = [Schedule::PERIOD_NEVER => '', Schedule::PERIOD_DAY => 'General_DailyReport', Schedule::PERIOD_WEEK => 'General_WeeklyReport', Schedule::PERIOD_MONTH => 'General_MonthlyReport', Schedule::PERIOD_YEAR => 'General_YearlyReport', Schedule::PERIOD_RANGE => 'General_RangeReports'];
25 public function __construct($reportTitle, $prettyDate, $description, $reportMetadata, $segment, $idSite, $period)
26 {
27 parent::__construct(self::TEMPLATE_FILE);
28 self::assignCommonParameters($this);
29 $periods = self::getPeriodToFrequencyAsAdjective();
30 $this->assign("frequency", $periods[$period]);
31 $this->assign("reportTitle", $reportTitle);
32 $this->assign("prettyDate", $prettyDate);
33 $this->assign("description", $description);
34 $this->assign("reportMetadata", $reportMetadata);
35 $this->assign("websiteName", Site::getNameFor($idSite));
36 $this->assign("idSite", $idSite);
37 $this->assign("period", $period);
38 $date = Date::now()->setTimezone(Site::getTimezoneFor($idSite))->toString();
39 $this->assign("date", $date);
40 // segment
41 $displaySegment = $segment != null;
42 $this->assign("displaySegment", $displaySegment);
43 if ($displaySegment) {
44 $this->assign("segmentName", $segment['name']);
45 }
46 }
47 public static function assignCommonParameters(View $view)
48 {
49 $themeStyles = ThemeStyles::get(ThemeStyles::LIGHT_MODE);
50 $emailStyles = EmailStyles::get();
51 $view->currentPath = SettingsPiwik::getPiwikUrl();
52 $view->themeStyles = $themeStyles;
53 $view->emailStyles = $emailStyles;
54 $view->fontStyle = 'color:' . $themeStyles->getPropertyValue('colorText') . ';font-family:' . $themeStyles->getPropertyValue('fontFamilyBase') . ';';
55 $view->styleParagraphText = 'font-size:15px;line-height:24px;';
56 $view->styleParagraph = $view->styleParagraphText . 'margin:0 0 16px;';
57 $customLogo = new CustomLogo();
58 $view->isCustomLogo = $customLogo->isEnabled() && CustomLogo::hasUserLogo();
59 $view->logoHeader = $customLogo->getHeaderLogoUrl($pathOnly = \false);
60 $pluginManager = Manager::getInstance();
61 $view->hasWhiteLabel = $pluginManager->isPluginLoaded('WhiteLabel') && $pluginManager->isPluginActivated('WhiteLabel') && $pluginManager->isPluginInFilesystem('WhiteLabel');
62 $view->idSite = Common::getRequestVar('idSite', \false);
63 }
64 private static function getPeriodToFrequencyAsAdjective()
65 {
66 return array_map(['\\Piwik\\Piwik', 'translate'], self::$reportFrequencyTranslationByPeriod);
67 }
68 }
69