Replace shortcodes with human readable text

[MAILPOET-2085]
This commit is contained in:
Pavel Dohnal
2019-06-25 13:18:06 +02:00
committed by M. Shull
parent e6608a5cd7
commit 6ff194e8e5
2 changed files with 78 additions and 21 deletions

View File

@ -139,7 +139,8 @@ class Worker {
];
if ($link) {
$context['topLinkClicks'] = (int)$link->clicksCount;
$context['topLink'] = $link->url;
$mappings = self::getShortcodeLinksMapping();
$context['topLink'] = isset($mappings[$link->url]) ? $mappings[$link->url] : $link->url;
}
return $context;
}
@ -151,4 +152,12 @@ class Worker {
$task->save();
}
public static function getShortcodeLinksMapping() {
return [
'[link:subscription_unsubscribe_url]' => __('Unsubscribe link', 'mailpoet'),
'[link:subscription_manage_url]' => __('Manage subscription link', 'mailpoet'),
'[link:newsletter_view_in_browser_url]' => __('View in browser link', 'mailpoet'),
];
}
}