Updated shortcodes for unsubscribe/manage/browser links
- fixed all issues in #387 except the custom mailpoet pages
This commit is contained in:
48
lib/Newsletter/Shortcodes/Categories/Subscription.php
Normal file
48
lib/Newsletter/Shortcodes/Categories/Subscription.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
namespace MailPoet\Newsletter\Shortcodes\Categories;
|
||||
use MailPoet\Subscription\Url as SubscriptionUrl;
|
||||
|
||||
class Subscription {
|
||||
/*
|
||||
{
|
||||
text: '<%= __('Unsubscribe') %>',-
|
||||
shortcode: 'subscription:unsubscribe',
|
||||
},
|
||||
{
|
||||
text: '<%= __('Manage subscriptions') %>',
|
||||
shortcode: 'subscription:manage',
|
||||
},
|
||||
*/
|
||||
static function process(
|
||||
$action,
|
||||
$default_value = false,
|
||||
$newsletter = false,
|
||||
$subscriber = false
|
||||
) {
|
||||
switch($action) {
|
||||
case 'unsubscribe':
|
||||
return '<a target="_blank" href="'.
|
||||
esc_attr(SubscriptionUrl::getUnsubscribeUrl($subscriber))
|
||||
.'">'.__('Unsubscribe').'</a>';
|
||||
break;
|
||||
|
||||
case 'unsubscribe_url':
|
||||
return SubscriptionUrl::getUnsubscribeUrl($subscriber);
|
||||
break;
|
||||
|
||||
case 'manage':
|
||||
return '<a target="_blank" href="'.
|
||||
esc_attr(SubscriptionUrl::getManageUrl($subscriber))
|
||||
.'">'.__('Manage subscription').'</a>';
|
||||
break;
|
||||
|
||||
case 'manage_url':
|
||||
return SubscriptionUrl::getManageUrl($subscriber);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user