1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 06:57:53 +00:00
Files
matomo/plugins/Marketplace/Emails/RequestTrialNotificationEmail.php
Stefan Giehl 75290a04f4 Use https URLs (#23072)
* Use https URLs

* Build vue files

* use matomo.org instead of piwik.org in some links

* updates expected UI test file

---------

Co-authored-by: innocraft-automation <innocraft-automation@users.noreply.github.com>
2025-02-27 16:34:08 +01:00

94 خطوط
2.2 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
*/
declare(strict_types=1);
namespace Piwik\Plugins\Marketplace\Emails;
use Piwik\Mail;
use Piwik\Piwik;
use Piwik\SettingsPiwik;
use Piwik\View;
class RequestTrialNotificationEmail extends Mail
{
/**
* @var string
*/
private $emailAddress;
/**
* @var string
*/
private $login;
/**
* @var string
*/
private $pluginName;
/**
* @var string
*/
private $pluginDisplayName;
public function __construct(string $login, string $emailAddress, string $pluginName, string $pluginDisplayName)
{
parent::__construct();
$this->emailAddress = $emailAddress;
$this->login = $login;
$this->pluginName = $pluginName;
$this->pluginDisplayName = $pluginDisplayName;
$this->setUpEmail();
}
/**
* @return string
*/
protected function getDefaultSubject(): string
{
return Piwik::translate(
'Marketplace_RequestTrialNotificationEmailSubject',
[
$this->pluginDisplayName,
]
);
}
/**
* @return View
*/
protected function getDefaultBodyView(): View
{
$piwikUrl = SettingsPiwik::getPiwikUrl();
$view = new View('@Marketplace/_requestTrialNotificationEmail.twig');
$view->login = $this->login;
$view->marketplaceLink = $piwikUrl . 'index.php?module=Marketplace&action=overview';
$view->pluginName = $this->pluginDisplayName;
// @see JavaScript broadcast#propagateNewPopoverParameter
$view->pluginLink =
$piwikUrl
. 'index.php?module=Marketplace&action=overview#?showPlugin=' . $this->pluginName;
return $view;
}
private function setUpEmail(): void
{
$this->setDefaultFromPiwik();
$this->addTo($this->emailAddress);
$this->setSubject($this->getDefaultSubject());
$this->addReplyTo($this->getFrom(), $this->getFromName());
$this->setWrappedHtmlBody($this->getDefaultBodyView());
}
}