diff options
25 files changed, 635 insertions, 204 deletions
diff --git a/config/global.ini.php b/config/global.ini.php index 17df341682..49578eddb2 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -656,8 +656,6 @@ enable_auto_update = 1 ; If set to 0 it also disables the "sent plugin update emails" feature in general and the related setting in the UI. enable_update_communication = 1 - - ; Comma separated list of plugin names for which console commands should be loaded (applies when Matomo is not installed yet) always_load_commands_from_plugin= @@ -675,6 +673,9 @@ pivot_by_filter_default_column_limit = 10 ; If set to 0 it will disable advertisements for providers of Professional Support for Matomo. piwik_professional_support_ads_enabled = 1 +; The number of days to wait before sending the JavaScript tracking code email reminder. +num_days_before_tracking_code_reminder = 5 + [Tracker] ; Matomo uses "Privacy by default" model. When one of your users visit multiple of your websites tracked in this Matomo, diff --git a/core/Email/ContentGenerator.php b/core/Email/ContentGenerator.php new file mode 100644 index 0000000000..a27816b63b --- /dev/null +++ b/core/Email/ContentGenerator.php @@ -0,0 +1,32 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ + +namespace Piwik\Email; + +use Piwik\View; +use Piwik\View\HtmlReportEmailHeaderView; + +class ContentGenerator +{ + public function generateHtmlContent(View $body) + { + HtmlReportEmailHeaderView::assignCommonParameters($body); + $bodyHtml = $body->render(); + + $header = new View("@CoreHome/_htmlEmailHeader.twig"); + HtmlReportEmailHeaderView::assignCommonParameters($header); + $headerHtml = $header->render(); + + $footer = new View("@CoreHome/_htmlEmailFooter.twig"); + HtmlReportEmailHeaderView::assignCommonParameters($footer); + $footerHtml = $footer->render(); + + return $headerHtml . $bodyHtml . $footerHtml; + } +} diff --git a/core/Mail.php b/core/Mail.php index a3771f536d..ab671b4010 100644 --- a/core/Mail.php +++ b/core/Mail.php @@ -9,8 +9,10 @@ namespace Piwik; use Piwik\Container\StaticContainer; +use Piwik\Email\ContentGenerator; use Piwik\Plugins\CoreAdminHome\CustomLogo; use Piwik\Translation\Translator; +use Piwik\View\HtmlReportEmailHeaderView; use Zend_Mail; /** @@ -52,6 +54,13 @@ class Mail extends Zend_Mail $this->setFrom($fromEmailAddress, $fromEmailName); } + public function setWrappedHtmlBody(View $body) + { + $contentGenerator = StaticContainer::get(ContentGenerator::class); + $bodyHtml = $contentGenerator->generateHtmlContent($body); + $this->setBodyHtml($bodyHtml); + } + /** * Sets the sender. * @@ -123,7 +132,25 @@ class Mail extends Zend_Mail public function send($transport = null) { + if (!$this->shouldSendMail()) { + return $this; + } + + $mail = $this; + + /** + * This event is posted right before an email is sent. You can use it to customize the email by, for example, replacing + * the subject/body, changing the from address, etc. + * TODO: changelog + * @param Mail $this The Mail instance that is about to be sent. + */ + Piwik::postEvent('Mail.send', [$mail]); + if (defined('PIWIK_TEST_MODE')) { // hack + /** + * @ignore + * @deprecated + */ Piwik::postTestEvent("Test.Mail.send", array($this)); } else { return parent::send($transport); @@ -183,4 +210,21 @@ class Mail extends Zend_Mail $string = str_replace($search, $replace, $string); return $string; } + + private function shouldSendMail() + { + $shouldSendMail = true; + + $mail = $this; + + /** + * This event is posted before sending an email. You can use it to abort sending a specific email, if you want. + * TODO: changelog + * @param bool &$shouldSendMail Whether to send this email or not. Set to false to skip sending. + * @param Mail $mail The Mail instance that will be sent. + */ + Piwik::postEvent('Mail.shouldSend', [&$shouldSendMail, $mail]); + + return $shouldSendMail; + } } diff --git a/core/Scheduler/Schedule/SpecificTime.php b/core/Scheduler/Schedule/SpecificTime.php new file mode 100644 index 0000000000..ba6a8a3c8e --- /dev/null +++ b/core/Scheduler/Schedule/SpecificTime.php @@ -0,0 +1,33 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ + +namespace Piwik\Scheduler\Schedule; + +class SpecificTime extends Schedule +{ + /** + * @var int + */ + private $scheduledTime; + + public function __construct($scheduledTime) + { + $this->scheduledTime = $scheduledTime; + } + + public function getRescheduledTime() + { + return $this->scheduledTime; + } + + public function setDay($_day) + { + throw new \Exception('not supported'); + } +}
\ No newline at end of file diff --git a/core/Scheduler/Timetable.php b/core/Scheduler/Timetable.php index c3c01ab167..93980b7ac0 100644 --- a/core/Scheduler/Timetable.php +++ b/core/Scheduler/Timetable.php @@ -53,6 +53,7 @@ class Timetable unset($this->timetable[$taskName]); } } + $this->save(); } public function getScheduledTaskNames() diff --git a/core/Site.php b/core/Site.php index 1aab6c3d61..3ab026b43b 100644 --- a/core/Site.php +++ b/core/Site.php @@ -393,6 +393,16 @@ class Site } /** + * Returns the user that created this site. + * + * @return string|null If null, the site was created before the creation user was tracked. + */ + public function getCreatorLogin() + { + return $this->get('creator_login'); + } + + /** * Checks the given string for valid site IDs and returns them as an array. * * @param string|array $ids Comma separated idSite list, eg, `'1,2,3,4'` or an array of IDs, eg, diff --git a/core/View/HtmlEmailFooterView.php b/core/View/HtmlEmailFooterView.php index 123736a0df..959a0918ec 100644 --- a/core/View/HtmlEmailFooterView.php +++ b/core/View/HtmlEmailFooterView.php @@ -20,6 +20,6 @@ class HtmlEmailFooterView extends View { parent::__construct(self::TEMPLATE_FILE); - $this->hasWhiteLabel = \Piwik\Plugin\Manager::getInstance()->isPluginLoaded('WhiteLabel'); + HtmlReportEmailHeaderView::assignCommonParameters($this); } }
\ No newline at end of file diff --git a/core/View/HtmlReportEmailHeaderView.php b/core/View/HtmlReportEmailHeaderView.php index f70e00fb5d..bcefe7803d 100644 --- a/core/View/HtmlReportEmailHeaderView.php +++ b/core/View/HtmlReportEmailHeaderView.php @@ -47,10 +47,6 @@ class HtmlReportEmailHeaderView extends View $this->assign("idSite", $idSite); $this->assign("period", $period); - $customLogo = new CustomLogo(); - $this->assign("isCustomLogo", $customLogo->isEnabled() && CustomLogo::hasUserLogo()); - $this->assign("logoHeader", $customLogo->getHeaderLogoUrl($pathOnly = false)); - $date = Date::now()->setTimezone(Site::getTimezoneFor($idSite))->toString(); $this->assign("date", $date); @@ -72,6 +68,15 @@ class HtmlReportEmailHeaderView extends View $view->themeStyles = $themeStyles; $view->emailStyles = $emailStyles; + + $view->fontStyle = 'color:' . $themeStyles->colorText . ';font-family:' . $themeStyles->fontFamilyBase.';'; + $view->styleParagraph = 'font-size:15px;line-height:24px;margin:0 0 16px;'; + + $customLogo = new CustomLogo(); + $view->isCustomLogo = $customLogo->isEnabled() && CustomLogo::hasUserLogo(); + $view->logoHeader = $customLogo->getHeaderLogoUrl($pathOnly = false); + + $view->hasWhiteLabel = \Piwik\Plugin\Manager::getInstance()->isPluginLoaded('WhiteLabel'); } private static function getPeriodToFrequencyAsAdjective() diff --git a/plugins/CoreAdminHome/Emails/JsTrackingCodeMissingEmail.php b/plugins/CoreAdminHome/Emails/JsTrackingCodeMissingEmail.php new file mode 100644 index 0000000000..5dde04403c --- /dev/null +++ b/plugins/CoreAdminHome/Emails/JsTrackingCodeMissingEmail.php @@ -0,0 +1,101 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ + +namespace Piwik\Plugins\CoreAdminHome\Emails; + +use Piwik\Mail; +use Piwik\Piwik; +use Piwik\SettingsPiwik; +use Piwik\Site; +use Piwik\Url; +use Piwik\View; + +class JsTrackingCodeMissingEmail extends Mail +{ + /** + * @var string + */ + private $login; + + /** + * @var string + */ + private $emailAddress; + + /** + * @var int + */ + private $idSite; + + public function __construct($login, $emailAddress, $idSite) + { + parent::__construct(); + + $this->login = $login; + $this->emailAddress = $emailAddress; + $this->idSite = $idSite; + + $this->setUpEmail(); + } + + /** + * @return string + */ + public function getLogin() + { + return $this->login; + } + + /** + * @return string + */ + public function getEmailAddress() + { + return $this->emailAddress; + } + + /** + * @return int + */ + public function getIdSite() + { + return $this->idSite; + } + + private function setUpEmail() + { + $this->setDefaultFromPiwik(); + $this->addTo($this->emailAddress); + $this->setSubject($this->getDefaultSubject()); + $this->setReplyTo($this->getFrom()); + $this->setWrappedHtmlBody($this->getDefaultBodyView()); + } + + private function getDefaultSubject() + { + return Piwik::translate('CoreAdminHome_MissingTrackingCodeEmailSubject', ["'" . Site::getNameFor($this->idSite) . "'"]); + } + + private function getDefaultBodyView() + { + $view = new View('@CoreAdminHome/_jsTrackingCodeMissingEmail.twig'); + $view->login = $this->login; + $view->emailAddress = $this->emailAddress; + $view->idSite = $this->idSite; + $view->siteName = Site::getNameFor($this->idSite); + $view->trackingCodeUrl = SettingsPiwik::getPiwikUrl() . 'index.php?' . Url::getQueryStringFromParameters([ + 'idSite' => $this->idSite, + 'module' => 'CoreAdminHome', + 'action' => 'trackingCodeGenerator', + 'period' => 'day', + 'date' => 'yesterday', + ]); + return $view; + } +}
\ No newline at end of file diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php index b4542d23a7..719aa6b40d 100644 --- a/plugins/CoreAdminHome/Tasks.php +++ b/plugins/CoreAdminHome/Tasks.php @@ -8,20 +8,30 @@ */ namespace Piwik\Plugins\CoreAdminHome; +use Piwik\API\Request; use Piwik\ArchiveProcessor\Rules; use Piwik\Archive\ArchivePurger; +use Piwik\Config; use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Date; use Piwik\Db; use Piwik\Http; use Piwik\Option; +use Piwik\Plugins\CoreAdminHome\Emails\JsTrackingCodeMissingEmail; use Piwik\Plugins\CoreAdminHome\Tasks\ArchivesToPurgeDistributedList; +use Piwik\Plugins\SitesManager\SitesManager; +use Piwik\Scheduler\Schedule\Daily; +use Piwik\Scheduler\Schedule\Monthly; +use Piwik\Scheduler\Schedule\SpecificTime; +use Piwik\Settings\Storage\Backend\MeasurableSettingsTable; +use Piwik\Tests\Framework\Mock\Site; use Piwik\Tracker\Visit\ReferrerSpamFilter; use Psr\Log\LoggerInterface; use Piwik\SettingsPiwik; class Tasks extends \Piwik\Plugin\Tasks { + const TRACKING_CODE_CHECK_FLAG = 'trackingCodeExistsCheck'; /** * @var ArchivePurger */ @@ -52,6 +62,75 @@ class Tasks extends \Piwik\Plugin\Tasks if(SettingsPiwik::isInternetEnabled() === true){ $this->weekly('updateSpammerBlacklist'); } + + $this->scheduleTrackingCodeReminderChecks(); + } + + private function scheduleTrackingCodeReminderChecks() + { + $daysToTrackedVisitsCheck = (int) Config::getInstance()->General['num_days_before_tracking_code_reminder']; + if ($daysToTrackedVisitsCheck <= 0) { + return; + } + + // add check for a site's tracked visits + $sites = Request::processRequest('SitesManager.getAllSites'); + + foreach ($sites as $site) { + $createdTime = Date::factory($site['ts_created']); + $scheduledTime = $createdTime->addDay($daysToTrackedVisitsCheck)->setTime('02:00:00'); + + // we don't want to run this check for every site in an install when this code is introduced, + // so if the site is over 2 * $daysToTrackedVisitsCheck days old, assume the check has run. + $isSiteOld = $createdTime->isEarlier(Date::today()->subDay($daysToTrackedVisitsCheck * 2)); + + if ($isSiteOld || $this->hasTrackingCodeReminderRun($site['idsite'])) { + continue; + } + + $schedule = new SpecificTime($scheduledTime->getTimestamp()); + $this->custom($this, 'checkSiteHasTrackedVisits', $site['idsite'], $schedule); + } + } + + public function checkSiteHasTrackedVisits($idSite) + { + $this->rememberTrackingCodeReminderRan($idSite); + + if (!SitesManager::hasTrackedAnyTraffic($idSite)) { + return; + } + + // site is still empty after N days, so send an email to the user that created the site + $creatingUser = Site::getCreatorLoginFor($idSite); + if (empty($creatingUser)) { + return; + } + + $user = Request::processRequest('UsersManager.getUser', [ + 'userLogin' => $creatingUser, + ]); + if (empty($user['email'])) { + return; + } + + $email = new JsTrackingCodeMissingEmail($user['login'], $user['email'], $idSite); + $email->send(); + } + + private function hasTrackingCodeReminderRun($idSite) + { + $table = new MeasurableSettingsTable($idSite, 'CoreAdminHome'); + $settings = $table->load(); + return !empty($settings[self::TRACKING_CODE_CHECK_FLAG]); + } + + private function rememberTrackingCodeReminderRan($idSite) + { + $table = new MeasurableSettingsTable($idSite, 'CoreAdminHome'); + $settings = $table->load(); + $settings[self::TRACKING_CODE_CHECK_FLAG] = 1; + $table->save($settings); } /** diff --git a/plugins/CoreAdminHome/lang/en.json b/plugins/CoreAdminHome/lang/en.json index 349a838f3d..910e66a793 100644 --- a/plugins/CoreAdminHome/lang/en.json +++ b/plugins/CoreAdminHome/lang/en.json @@ -104,6 +104,10 @@ "YouMayOptOutBis": "To make that choice, please click below to receive an opt-out cookie.", "OptingYouOut": "Opting you out, please wait...", "ProtocolNotDetectedCorrectly": "You are currently viewing Matomo over a secure SSL connection (using https), but Matomo could only detect a non secure connection on the server. ", - "ProtocolNotDetectedCorrectlySolution": "To make sure Matomo securely requests and serves your content over HTTPS, you may edit your %1$s file and either configure your proxy settings, or you may add the line %2$s below the %3$s section. %4$sLearn more%5$s" + "ProtocolNotDetectedCorrectlySolution": "To make sure Matomo securely requests and serves your content over HTTPS, you may edit your %1$s file and either configure your proxy settings, or you may add the line %2$s below the %3$s section. %4$sLearn more%5$s", + "MissingTrackingCodeEmailSubject": "No traffic for %s recorded in Matomo Analytics, get started now", + "JsTrackingCodeMissingEmail1": "A few days ago you added the website '%s' to your Matomo Analytics. We just checked and your Matomo doesn't seem to have any recorded traffic for this website.", + "JsTrackingCodeMissingEmail2": "To begin tracking data and getting insights into your users, you'll need to setup tracking in your website or mobile app. For websites simply embed the tracking code right before the %s tag.", + "JsTrackingCodeMissingEmail3": "To find and customize your tracking code, %1$sclick here%2$s (or have a look at the %3$sJavaScript Tracking Client guide%4$s)." } } diff --git a/plugins/CoreAdminHome/templates/_jsTrackingCodeMissingEmail.twig b/plugins/CoreAdminHome/templates/_jsTrackingCodeMissingEmail.twig new file mode 100644 index 0000000000..0abbad62a0 --- /dev/null +++ b/plugins/CoreAdminHome/templates/_jsTrackingCodeMissingEmail.twig @@ -0,0 +1,5 @@ +{% set closingHeadTag %}<code>{{ '</head>'|e('html') }}</code>{% endset %} +<p>{{ 'General_HelloUser'|translate(login) }}</p> +<p>{{ 'CoreAdminHome_JsTrackingCodeMissingEmail1'|translate(siteName) }}</p> +<p>{{ 'CoreAdminHome_JsTrackingCodeMissingEmail2'|translate(closingHeadTag)|raw }}</p> +<p>{{ 'CoreAdminHome_JsTrackingCodeMissingEmail3'|translate('<a href="'~trackingCodeUrl~'">', '</a>', '<a href="https://developer.matomo.org/guides/tracking-javascript-guide">', '</a>')|raw }}</p> diff --git a/plugins/CoreAdminHome/tests/Integration/TasksTest.php b/plugins/CoreAdminHome/tests/Integration/TasksTest.php index 1b25833712..0c30071eb1 100644 --- a/plugins/CoreAdminHome/tests/Integration/TasksTest.php +++ b/plugins/CoreAdminHome/tests/Integration/TasksTest.php @@ -9,10 +9,16 @@ namespace Piwik\Plugins\CoreAdminHome\tests\Integration; use Piwik\Archive\ArchivePurger; use Piwik\ArchiveProcessor\Rules; +use Piwik\Common; use Piwik\Date; +use Piwik\Db; +use Piwik\Mail; +use Piwik\Plugins\CoreAdminHome\Emails\JsTrackingCodeMissingEmail; use Piwik\Plugins\CoreAdminHome\Tasks; use Piwik\Plugins\CoreAdminHome\Tasks\ArchivesToPurgeDistributedList; +use Piwik\Scheduler\Task; use Piwik\Tests\Fixtures\RawArchiveDataWithTempAndInvalidated; +use Piwik\Tests\Framework\Fixture; use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use Psr\Log\NullLogger; @@ -41,10 +47,17 @@ class TasksTest extends IntegrationTestCase */ private $february; + /** + * @var Mail + */ + private $mail; + public function setUp() { parent::setUp(); + self::$fixture->loginAsSuperUser(); + $this->january = Date::factory('2015-01-01'); $this->february = Date::factory('2015-02-01'); @@ -54,6 +67,8 @@ class TasksTest extends IntegrationTestCase $archivePurger->setNow(Date::factory('2015-02-27 08:00:00')->getTimestamp()); $this->tasks = new Tasks($archivePurger, new NullLogger()); + + $this->mail = null; } public function tearDown() @@ -97,6 +112,75 @@ class TasksTest extends IntegrationTestCase $this->assertTrue($wasPurged); } + public function test_schedule_addsRightAmountOfTasks() + { + Fixture::createWebsite('2012-01-01 00:00:00'); + Fixture::createWebsite(Date::now()->subDay(5)->getDatetime()); + Fixture::createWebsite(Date::now()->subDay(2)->getDatetime()); + Fixture::createWebsite(Date::now()->subDay(4)->getDatetime()); + Fixture::createWebsite(Date::now()->getDatetime()); + + $this->tasks->schedule(); + + $tasks = $this->tasks->getScheduledTasks(); + $tasks = array_map(function (Task $task) { return $task->getMethodName() . '.' . $task->getMethodParameter(); }, $tasks); + + $expected = [ + 'purgeOutdatedArchives.', + 'purgeInvalidatedArchives.', + 'optimizeArchiveTable.', + 'updateSpammerBlacklist.', + 'checkSiteHasTrackedVisits.2', + 'checkSiteHasTrackedVisits.3', + 'checkSiteHasTrackedVisits.4', + 'checkSiteHasTrackedVisits.5', + ]; + $this->assertEquals($expected, $tasks); + } + + public function test_checkSiteHasTrackedVisits_doesNothingIfTheSiteHasVisits() + { + $idSite = Fixture::createWebsite('2012-01-01 00:00:00'); + + $tracker = Fixture::getTracker($idSite, '2014-02-02 03:04:05'); + Fixture::checkResponse($tracker->doTrackPageView('alskdjfs')); + + $this->assertEquals(1, Db::fetchOne("SELECT COUNT(*) FROM " . Common::prefixTable('log_visit'))); + + $this->tasks->checkSiteHasTrackedVisits($idSite); + + $this->assertEmpty($this->mail); + } + + public function test_checkSiteHasTrackedVisits_doesNothingIfSiteHasNoCreationUser() + { + $idSite = Fixture::createWebsite('2012-01-01 00:00:00'); + Db::query("UPDATE " . Common::prefixTable('site') . ' SET creator_login = NULL WHERE idsite = ' . $idSite . ';'); + + $this->assertEquals(0, Db::fetchOne("SELECT COUNT(*) FROM " . Common::prefixTable('log_visit'))); + + $this->tasks->checkSiteHasTrackedVisits($idSite); + + $this->assertEmpty($this->mail); + } + + public function test_checkSitesHasTrackedVisits_sendsJsCodeMissingEmailIfSiteHasNoVisitsAndCreationUser() + { + $idSite = Fixture::createWebsite('2012-01-01 00:00:00'); + + $this->assertEquals(0, Db::fetchOne("SELECT COUNT(*) FROM " . Common::prefixTable('log_visit'))); + + $this->tasks->checkSiteHasTrackedVisits($idSite); + + $this->assertInstanceOf(JsTrackingCodeMissingEmail::class, $this->mail); + + /** @var JsTrackingCodeMissingEmail $mail */ + $mail = $this->mail; + $this->assertEquals($mail->getLogin(), 'superUserLogin'); + $this->assertEquals($mail->getEmailAddress(), 'hello@example.org'); + $this->assertEquals($mail->getIdSite(), $idSite); + } + /** * @param Date[] $dates */ @@ -110,6 +194,26 @@ class TasksTest extends IntegrationTestCase $archivesToPurgeDistributedList = new ArchivesToPurgeDistributedList(); $archivesToPurgeDistributedList->add($yearMonths); } + + public function provideContainerConfig() + { + return [ + 'observers.global' => [ + ['Mail.send', function (Mail $mail) { + $this->mail = $mail; + }], + ], + ]; + } + + /** + * @param Fixture $fixture + */ + protected static function configureFixture($fixture) + { + parent::configureFixture($fixture); + $fixture->createSuperUser = true; + } } TasksTest::$fixture = new RawArchiveDataWithTempAndInvalidated();
\ No newline at end of file diff --git a/plugins/CoreHome/templates/ReportRenderer/_htmlReportFooter.twig b/plugins/CoreHome/templates/ReportRenderer/_htmlReportFooter.twig index 4de5aae199..754fd1f355 100644 --- a/plugins/CoreHome/templates/ReportRenderer/_htmlReportFooter.twig +++ b/plugins/CoreHome/templates/ReportRenderer/_htmlReportFooter.twig @@ -1,17 +1 @@ -{% set fontStyle = 'color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Helvetica Neue", sans-serif; '%} -{% set styleParagraph = 'font-size:15px;line-height:24px;margin:0 0 16px;' %} - -{% if not hasWhiteLabel %} - <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> - - <p style='{{styleParagraph}}{{fontStyle}}text-align:center;font-size:13px; color:#666; padding:30px'> - {{'General_PoweredBy'|translate}} - <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> - <br /> - {{ 'CoreHome_LeadingAnalyticsPlatformRespectsYourPrivacy'|translate }} - </p> -{% endif %} - -</div> -</body> -</html> +{% include "@CoreHome/_htmlEmailFooter.twig" %}
\ No newline at end of file diff --git a/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig b/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig index 45247efa2d..c6b2fdf98f 100644 --- a/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig +++ b/plugins/CoreHome/templates/ReportRenderer/_htmlReportHeader.twig @@ -1,38 +1,5 @@ -{% set fontStyle %}color:{{ themeStyles.colorText }};font-family:{{ themeStyles.fontFamilyBase }};{% endset %} -{% set styleParagraph = 'font-size:15px;line-height:24px;margin:0 0 16px;' %} +{% include "@CoreHome/_htmlEmailHeader.twig" %} -<html style="background-color:#edecec"> - -<head> - <meta charset="utf-8"> - <meta name="robots" content="noindex,nofollow"> - <meta name="generator" content="Matomo Analytics"> -</head> - -<body style="{{fontStyle}} line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> - - <a name="reportTop"></a> - - <table style="width:100%; background-color: {{ themeStyles.colorHeaderBackground }}; color: {{ themeStyles.colorHeaderText }}; padding:10px 0; margin: 0 0 25px 0; height:64px;"> - <tr> - <td> - <a style="{{ fontStyle }}; font-size:16px;padding:0 15px;color: {{ themeStyles.colorHeaderText }};height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="{{ piwikUrl }}" style="lineheight:17px"> - {% if isCustomLogo and logoHeader %} - <img src="{{ logoHeader }}" height="20px" width="auto" /> - {% else %} - <img src="{{ piwikUrl }}/plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="{{ emailStyles.brandNameLong }}" /> - {% endif %} - </a> - </td> - <td align="right"> - <a style="{{ fontStyle }}; font-size:16px; padding:0 15px; color: {{ themeStyles.colorHeaderText }}" title="{{'Dashboard_TopLinkTooltip'|translate(websiteName)}}" target="_blank" href="{{ piwikUrl }}{{ linkTo({'module': 'CoreHome', 'action': 'index', 'idSite': idSite, 'period': period, 'date': date, 'token_auth': null, 'method': null, 'idReport': null, 'outputType': null, 'format': null})|raw }}"> - {{ 'Dashboard_Dashboard'|translate }} - </a> - </td> - </tr> - </table> - - <div style="margin:0 20px;"> <h2 style='{{fontStyle}} color:#37474f; line-height:30px; margin:25px 0 15px 0;'> {{'ScheduledReports_EmailHello'|translate}} </h2> diff --git a/plugins/CoreHome/templates/_htmlEmailFooter.twig b/plugins/CoreHome/templates/_htmlEmailFooter.twig new file mode 100644 index 0000000000..6117beebf8 --- /dev/null +++ b/plugins/CoreHome/templates/_htmlEmailFooter.twig @@ -0,0 +1,16 @@ +{% set fontStyle %}color:{{ themeStyles.colorText|e('html_attr') }};font-family:{{ themeStyles.fontFamilyBase|e('html_attr') }};{% endset %} + +{% if not hasWhiteLabel %} + <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> + + <p style='{{styleParagraph|raw}}{{fontStyle|raw}}text-align:center;font-size:13px; color:#666; padding:30px'> + {{'General_PoweredBy'|translate}} + <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> + <br /> + {{ 'CoreHome_LeadingAnalyticsPlatformRespectsYourPrivacy'|translate }} + </p> +{% endif %} + +</div> +</body> +</html> diff --git a/plugins/CoreHome/templates/_htmlEmailHeader.twig b/plugins/CoreHome/templates/_htmlEmailHeader.twig new file mode 100644 index 0000000000..30d0eedbab --- /dev/null +++ b/plugins/CoreHome/templates/_htmlEmailHeader.twig @@ -0,0 +1,36 @@ +{% set fontStyle %}color:{{ themeStyles.colorText|e('html_attr') }};font-family:{{ themeStyles.fontFamilyBase|e('html_attr') }};{% endset %} + +<html style="background-color:#edecec"> + +<head> + <meta charset="utf-8"> + <meta name="robots" content="noindex,nofollow"> + <meta name="generator" content="Matomo Analytics"> +</head> + +<body style="{{fontStyle|raw}} line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> + +<a name="reportTop"></a> + +<table style="width:100%; background-color: {{ themeStyles.colorHeaderBackground|e('html_attr') }}; color: {{ themeStyles.colorHeaderText|e('html_attr') }}; padding:10px 0; margin: 0 0 25px 0; height:64px;"> + <tr> + <td> + <a style="{{ fontStyle|raw }}; font-size:16px;padding:0 15px;color: {{ themeStyles.colorHeaderText|e('html_attr') }};height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="{{ piwikUrl }}" style="lineheight:17px"> + {% if isCustomLogo and logoHeader %} + <img src="{{ logoHeader }}" height="20px" width="auto" /> + {% else %} + <img src="{{ piwikUrl }}/plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="{{ emailStyles.brandNameLong|e('html_attr') }}" /> + {% endif %} + </a> + </td> + <td align="right"> + {% if idSite|default is not empty %} + <a style="{{ fontStyle|raw }}; font-size:16px; padding:0 15px; color: {{ themeStyles.colorHeaderText|e('html_attr') }}" {% if websiteName|default is not empty %}title="{{'Dashboard_TopLinkTooltip'|translate(websiteName)}}"{% endif %} target="_blank" href="{{ piwikUrl }}{{ linkTo({'module': 'CoreHome', 'action': 'index', 'idSite': idSite, 'period': period, 'date': date, 'token_auth': null, 'method': null, 'idReport': null, 'outputType': null, 'format': null})|raw }}"> + {{ 'Dashboard_Dashboard'|translate }} + </a> + {% endif %} + </td> + </tr> +</table> + +<div style="margin:0 20px;"> diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html index 4fb7a6af4a..7b4336740a 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_week.original.html @@ -7,26 +7,27 @@ <meta name="generator" content="Matomo Analytics"> </head> -<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> +<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> - <a name="reportTop"></a> +<a name="reportTop"></a> - <table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> +<table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> <tr> - <td> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> - <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> - </a> - </td> - <td align="right"> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Piwik test." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> - Dashboard - </a> - </td> + <td> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> + <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> + </a> + </td> + <td align="right"> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Piwik test." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> + Dashboard + </a> + </td> </tr> - </table> +</table> + +<div style="margin:0 20px;"> - <div style="margin:0 20px;"> <h2 style='color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; color:#37474f; line-height:30px; margin:25px 0 15px 0;'> Hello, </h2> @@ -56,14 +57,14 @@ Back to top ↑ </a></p> - <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> + <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> - <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Helvetica Neue", sans-serif; text-align:center;font-size:13px; color:#666; padding:30px'> - Powered by - <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> - <br /> - The leading open analytics platform that respects your privacy. - </p> + <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;text-align:center;font-size:13px; color:#666; padding:30px'> + Powered by + <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> + <br /> + The leading open analytics platform that respects your privacy. + </p> </div> </body> diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html index b1fedf85f1..546f02fbd2 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_week.original.html @@ -7,26 +7,27 @@ <meta name="generator" content="Matomo Analytics"> </head> -<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> +<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> - <a name="reportTop"></a> +<a name="reportTop"></a> - <table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> +<table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> <tr> - <td> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> - <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> - </a> - </td> - <td align="right"> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Piwik test." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> - Dashboard - </a> - </td> + <td> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> + <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> + </a> + </td> + <td align="right"> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Piwik test." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> + Dashboard + </a> + </td> </tr> - </table> +</table> + +<div style="margin:0 20px;"> - <div style="margin:0 20px;"> <h2 style='color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; color:#37474f; line-height:30px; margin:25px 0 15px 0;'> Hello, </h2> @@ -7110,14 +7111,14 @@ There is no data for this report. - <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> + <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> - <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Helvetica Neue", sans-serif; text-align:center;font-size:13px; color:#666; padding:30px'> - Powered by - <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> - <br /> - The leading open analytics platform that respects your privacy. - </p> + <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;text-align:center;font-size:13px; color:#666; padding:30px'> + Powered by + <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> + <br /> + The leading open analytics platform that respects your privacy. + </p> </div> </body> diff --git a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html index c36012bdfc..027b24bacb 100644 --- a/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html +++ b/plugins/Ecommerce/tests/System/expected/test_ecommerceOrderWithItems_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_week.original.html @@ -7,26 +7,27 @@ <meta name="generator" content="Matomo Analytics"> </head> -<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> +<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> - <a name="reportTop"></a> +<a name="reportTop"></a> - <table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> +<table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> <tr> - <td> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> - <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> - </a> - </td> - <td align="right"> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Piwik test." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> - Dashboard - </a> - </td> + <td> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> + <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> + </a> + </td> + <td align="right"> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Piwik test." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> + Dashboard + </a> + </td> </tr> - </table> +</table> + +<div style="margin:0 20px;"> - <div style="margin:0 20px;"> <h2 style='color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; color:#37474f; line-height:30px; margin:25px 0 15px 0;'> Hello, </h2> @@ -6746,14 +6747,14 @@ There is no data for this report. - <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> + <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> - <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Helvetica Neue", sans-serif; text-align:center;font-size:13px; color:#666; padding:30px'> - Powered by - <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> - <br /> - The leading open analytics platform that respects your privacy. - </p> + <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;text-align:center;font-size:13px; color:#666; padding:30px'> + Powered by + <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> + <br /> + The leading open analytics platform that respects your privacy. + </p> </div> </body> diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index 15c1129d03..8c77fe78e7 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -68,6 +68,19 @@ class SitesManager extends \Piwik\Plugin return; } + if (self::hasTrackedAnyTraffic($siteId)) { + $session = new SessionNamespace('siteWithoutData'); + if (!empty($session->ignoreMessage)) { + return; + } + + $module = 'SitesManager'; + $action = 'siteWithoutData'; + } + } + + public static function hasTrackedAnyTraffic($siteId) + { $shouldPerformEmptySiteCheck = true; /** @@ -82,17 +95,7 @@ class SitesManager extends \Piwik\Plugin Piwik::postEvent('SitesManager.shouldPerformEmptySiteCheck', [&$shouldPerformEmptySiteCheck, $siteId]); $trackerModel = new TrackerModel(); - if ($shouldPerformEmptySiteCheck - && $trackerModel->isSiteEmpty($siteId) - ) { - $session = new SessionNamespace('siteWithoutData'); - if (!empty($session->ignoreMessage)) { - return; - } - - $module = 'SitesManager'; - $action = 'siteWithoutData'; - } + return $shouldPerformEmptySiteCheck && $trackerModel->isSiteEmpty($siteId); } public function onSiteDeleted($idSite) diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html index ad4f5696a8..9089f077ca 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_row_evolution_graph__ScheduledReports.generateReport_month.original.html @@ -7,26 +7,27 @@ <meta name="generator" content="Matomo Analytics"> </head> -<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> +<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> - <a name="reportTop"></a> +<a name="reportTop"></a> - <table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> +<table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> <tr> - <td> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> - <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> - </a> - </td> - <td align="right"> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Site 1." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> - Dashboard - </a> - </td> + <td> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> + <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> + </a> + </td> + <td align="right"> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Site 1." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> + Dashboard + </a> + </td> </tr> - </table> +</table> + +<div style="margin:0 20px;"> - <div style="margin:0 20px;"> <h2 style='color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; color:#37474f; line-height:30px; margin:25px 0 15px 0;'> Hello, </h2> @@ -56,14 +57,14 @@ Back to top ↑ </a></p> - <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> + <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> - <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Helvetica Neue", sans-serif; text-align:center;font-size:13px; color:#666; padding:30px'> - Powered by - <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> - <br /> - The leading open analytics platform that respects your privacy. - </p> + <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;text-align:center;font-size:13px; color:#666; padding:30px'> + Powered by + <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> + <br /> + The leading open analytics platform that respects your privacy. + </p> </div> </body> diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html index 865f1fdeec..9aade610ca 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_and_graph__ScheduledReports.generateReport_month.original.html @@ -7,26 +7,27 @@ <meta name="generator" content="Matomo Analytics"> </head> -<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> +<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> - <a name="reportTop"></a> +<a name="reportTop"></a> - <table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> +<table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> <tr> - <td> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> - <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> - </a> - </td> - <td align="right"> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Site 1." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> - Dashboard - </a> - </td> + <td> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> + <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> + </a> + </td> + <td align="right"> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Site 1." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> + Dashboard + </a> + </td> </tr> - </table> +</table> + +<div style="margin:0 20px;"> - <div style="margin:0 20px;"> <h2 style='color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; color:#37474f; line-height:30px; margin:25px 0 15px 0;'> Hello, </h2> @@ -5646,14 +5647,14 @@ There is no data for this report. - <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> + <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> - <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Helvetica Neue", sans-serif; text-align:center;font-size:13px; color:#666; padding:30px'> - Powered by - <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> - <br /> - The leading open analytics platform that respects your privacy. - </p> + <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;text-align:center;font-size:13px; color:#666; padding:30px'> + Powered by + <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> + <br /> + The leading open analytics platform that respects your privacy. + </p> </div> </body> diff --git a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html index af32f6b443..413238ef98 100644 --- a/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html +++ b/tests/PHPUnit/System/expected/test_TwoVisitors_twoWebsites_differentDays_scheduled_report_in_html_tables_only__ScheduledReports.generateReport_month.original.html @@ -7,26 +7,27 @@ <meta name="generator" content="Matomo Analytics"> </head> -<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> +<body style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; line-height: 24px; margin:0 auto; max-width:1000px; background-color:rgb(255, 255, 255);box-shadow: 0px 0px 5px 1px rgba(0,0,0,0.75);"> - <a name="reportTop"></a> +<a name="reportTop"></a> - <table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> +<table style="width:100%; background-color: #37474f; color: #fff; padding:10px 0; margin: 0 0 25px 0; height:64px;"> <tr> - <td> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> - <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> - </a> - </td> - <td align="right"> - <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Site 1." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> - Dashboard - </a> - </td> + <td> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px;padding:0 15px;color: #fff;height: 22px;display: inline-block;vertical-align: inherit;" rel="noreferrer noopener" target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/" style="lineheight:17px"> + <img src="http://example.com/piwik/tests/PHPUnit/proxy//plugins/Morpheus/images/logo-email.png" height="20px" width="auto" alt="Matomo, free/libre analytics platform" /> + </a> + </td> + <td align="right"> + <a style="color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;; font-size:16px; padding:0 15px; color: #fff" title="View Web Analytics reports for Site 1." target="_blank" href="http://example.com/piwik/tests/PHPUnit/proxy/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today-date-removed-in-tests"> + Dashboard + </a> + </td> </tr> - </table> +</table> + +<div style="margin:0 20px;"> - <div style="margin:0 20px;"> <h2 style='color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif; color:#37474f; line-height:30px; margin:25px 0 15px 0;'> Hello, </h2> @@ -5366,14 +5367,14 @@ There is no data for this report. - <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> + <hr style=" border: 0; margin-top: 50px; height: 1px; background-image: linear-gradient(to right, rgba(231, 231, 231, 0), rgba(231, 231, 231, 1), rgba(2311, 2311, 231, 0));"> - <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Cantarell, "Helvetica Neue", sans-serif; text-align:center;font-size:13px; color:#666; padding:30px'> - Powered by - <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> - <br /> - The leading open analytics platform that respects your privacy. - </p> + <p style='font-size:15px;line-height:24px;margin:0 0 16px;color:#0d0d0d;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Cantarell, 'Helvetica Neue', sans-serif;text-align:center;font-size:13px; color:#666; padding:30px'> + Powered by + <a style="color:#439fe0; " href="https://matomo.org/" title="Matomo Analytics">Matomo Analytics</a> + <br /> + The leading open analytics platform that respects your privacy. + </p> </div> </body> diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png index a090cbfaa5..6781361281 100644 --- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png +++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24aa51619de3fa59baa671e9a1df7e7c2e7a6459777f87836a464c4d50c5362b -size 4009728 +oid sha256:b3b2edfe9c85e4c6908439fe829585618d97b6150f0487f2d1c5fa336aab01bd +size 4019722 |