This commit refactors the code that handles exporting e-mails opens and clicks when generating the personal data file to use Doctrine instead of Paris. I opted to do this in this task as opens and clicks code share some functionality, and I didn't want to add more code that relies on Paris, as we are eventually going to remove it. [MAILPOET-3738]
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace MailPoet\Subscribers\ImportExport\PersonalDataExporters;
|
|
|
|
use MailPoet\Statistics\StatisticsClicksRepository;
|
|
use MailPoet\WP\Functions as WPFunctions;
|
|
|
|
class NewsletterClicksExporter extends NewsletterStatsBaseExporter {
|
|
protected $statsClassName = StatisticsClicksRepository::class;
|
|
|
|
protected function getEmailStats(array $row) {
|
|
$newsletterData = [];
|
|
$newsletterData[] = [
|
|
'name' => WPFunctions::get()->__('Email subject', 'mailpoet'),
|
|
'value' => $row['newsletterRenderedSubject'],
|
|
];
|
|
$newsletterData[] = [
|
|
'name' => WPFunctions::get()->__('Timestamp of the click event', 'mailpoet'),
|
|
'value' => $row['createdAt']->format("Y-m-d H:i:s"),
|
|
];
|
|
$newsletterData[] = [
|
|
'name' => WPFunctions::get()->__('URL', 'mailpoet'),
|
|
'value' => $row['url'],
|
|
];
|
|
|
|
if (!is_null($row['userAgent'])) {
|
|
$userAgent = $row['userAgent'];
|
|
} else {
|
|
$userAgent = WPFunctions::get()->__('Unknown', 'mailpoet');
|
|
}
|
|
|
|
$newsletterData[] = [
|
|
'name' => WPFunctions::get()->__('User-agent', 'mailpoet'),
|
|
'value' => $userAgent,
|
|
];
|
|
|
|
return [
|
|
'group_id' => 'mailpoet-newsletter-clicks',
|
|
'group_label' => WPFunctions::get()->__('MailPoet Emails Clicks', 'mailpoet'),
|
|
'item_id' => 'newsletter-' . $row['id'],
|
|
'data' => $newsletterData,
|
|
];
|
|
}
|
|
}
|