Depreciates and removes server-side rendering of subscription_unsubscribe,
subscription_manage and newsletter_view_in_browser
This commit is contained in:
@ -11,13 +11,13 @@
|
|||||||
/*jshint unused:false */
|
/*jshint unused:false */
|
||||||
/*global tinymce:true */
|
/*global tinymce:true */
|
||||||
tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
|
tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
|
||||||
var appendLabelAndClose = function(text) {
|
var appendLabelAndClose = function(shortcode) {
|
||||||
editor.insertContent('[' + text + ']');
|
editor.insertContent(shortcode);
|
||||||
editor.windowManager.close();
|
editor.windowManager.close();
|
||||||
},
|
},
|
||||||
generateOnClickFunc = function(id) {
|
generateOnClickFunc = function(shortcode) {
|
||||||
return function() {
|
return function() {
|
||||||
appendLabelAndClose(id);
|
appendLabelAndClose(shortcode);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,20 +18,6 @@ class Link {
|
|||||||
$wp_user_preview
|
$wp_user_preview
|
||||||
) {
|
) {
|
||||||
switch($action) {
|
switch($action) {
|
||||||
case 'subscription_unsubscribe':
|
|
||||||
$action = 'subscription_unsubscribe_url';
|
|
||||||
$url = self::processUrl(
|
|
||||||
$action,
|
|
||||||
SubscriptionUrl::getUnsubscribeUrl($subscriber),
|
|
||||||
$queue,
|
|
||||||
$wp_user_preview
|
|
||||||
);
|
|
||||||
return sprintf(
|
|
||||||
'<a target="_blank" href="%s">%s</a>',
|
|
||||||
$url,
|
|
||||||
__('Unsubscribe', 'mailpoet')
|
|
||||||
);
|
|
||||||
|
|
||||||
case 'subscription_unsubscribe_url':
|
case 'subscription_unsubscribe_url':
|
||||||
return self::processUrl(
|
return self::processUrl(
|
||||||
$action,
|
$action,
|
||||||
@ -40,19 +26,6 @@ class Link {
|
|||||||
$wp_user_preview
|
$wp_user_preview
|
||||||
);
|
);
|
||||||
|
|
||||||
case 'subscription_manage':
|
|
||||||
$url = self::processUrl(
|
|
||||||
$action = 'subscription_manage_url',
|
|
||||||
SubscriptionUrl::getManageUrl($subscriber),
|
|
||||||
$queue,
|
|
||||||
$wp_user_preview
|
|
||||||
);
|
|
||||||
return sprintf(
|
|
||||||
'<a target="_blank" href="%s">%s</a>',
|
|
||||||
$url,
|
|
||||||
__('Manage subscription', 'mailpoet')
|
|
||||||
);
|
|
||||||
|
|
||||||
case 'subscription_manage_url':
|
case 'subscription_manage_url':
|
||||||
return self::processUrl(
|
return self::processUrl(
|
||||||
$action,
|
$action,
|
||||||
@ -61,22 +34,6 @@ class Link {
|
|||||||
$wp_user_preview
|
$wp_user_preview
|
||||||
);
|
);
|
||||||
|
|
||||||
case 'newsletter_view_in_browser':
|
|
||||||
$action = 'newsletter_view_in_browser_url';
|
|
||||||
$url = NewsletterUrl::getViewInBrowserUrl(
|
|
||||||
$type = null,
|
|
||||||
$newsletter,
|
|
||||||
$subscriber,
|
|
||||||
$queue,
|
|
||||||
$wp_user_preview
|
|
||||||
);
|
|
||||||
$url = self::processUrl($action, $url, $queue, $wp_user_preview);
|
|
||||||
return sprintf(
|
|
||||||
'<a target="_blank" href="%s">%s</a>',
|
|
||||||
$url,
|
|
||||||
__('View in your browser', 'mailpoet')
|
|
||||||
);
|
|
||||||
|
|
||||||
case 'newsletter_view_in_browser_url':
|
case 'newsletter_view_in_browser_url':
|
||||||
$url = NewsletterUrl::getViewInBrowserUrl(
|
$url = NewsletterUrl::getViewInBrowserUrl(
|
||||||
$type = null,
|
$type = null,
|
||||||
@ -88,7 +45,7 @@ class Link {
|
|||||||
return self::processUrl($action, $url, $queue, $wp_user_preview);
|
return self::processUrl($action, $url, $queue, $wp_user_preview);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$shortcode = self::getShortcode($action);
|
$shortcode = self::getFullShortcode($action);
|
||||||
$url = apply_filters(
|
$url = apply_filters(
|
||||||
'mailpoet_newsletter_shortcode_link',
|
'mailpoet_newsletter_shortcode_link',
|
||||||
$shortcode,
|
$shortcode,
|
||||||
@ -106,7 +63,7 @@ class Link {
|
|||||||
static function processUrl($action, $url, $queue, $wp_user_preview = false) {
|
static function processUrl($action, $url, $queue, $wp_user_preview = false) {
|
||||||
if($wp_user_preview) return '#';
|
if($wp_user_preview) return '#';
|
||||||
return ($queue !== false && (boolean)Setting::getValue('tracking.enabled')) ?
|
return ($queue !== false && (boolean)Setting::getValue('tracking.enabled')) ?
|
||||||
self::getShortcode($action) :
|
self::getFullShortcode($action) :
|
||||||
$url;
|
$url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +91,7 @@ class Link {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$shortcode = self::getShortcode($shortcode_action);
|
$shortcode = self::getFullShortcode($shortcode_action);
|
||||||
$url = apply_filters(
|
$url = apply_filters(
|
||||||
'mailpoet_newsletter_shortcode_link',
|
'mailpoet_newsletter_shortcode_link',
|
||||||
$shortcode,
|
$shortcode,
|
||||||
@ -149,7 +106,7 @@ class Link {
|
|||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getShortcode($action) {
|
private static function getFullShortcode($action) {
|
||||||
return sprintf('[link:%s]', $action);
|
return sprintf('[link:%s]', $action);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,83 +10,95 @@ class ShortcodesHelper {
|
|||||||
__('Subscriber', 'mailpoet') => array(
|
__('Subscriber', 'mailpoet') => array(
|
||||||
array(
|
array(
|
||||||
'text' => __('First Name', 'mailpoet'),
|
'text' => __('First Name', 'mailpoet'),
|
||||||
'shortcode' => 'subscriber:firstname | default:reader',
|
'shortcode' => '[subscriber:firstname | default:reader]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Last Name', 'mailpoet'),
|
'text' => __('Last Name', 'mailpoet'),
|
||||||
'shortcode' => 'subscriber:lastname | default:reader',
|
'shortcode' => '[subscriber:lastname | default:reader]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Email Address', 'mailpoet'),
|
'text' => __('Email Address', 'mailpoet'),
|
||||||
'shortcode' => 'subscriber:email',
|
'shortcode' => '[subscriber:email]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('WordPress User Display Name', 'mailpoet'),
|
'text' => __('WordPress User Display Name', 'mailpoet'),
|
||||||
'shortcode' => 'subscriber:displayname | default:member',
|
'shortcode' => '[subscriber:displayname | default:member]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Total Number of Subscribers', 'mailpoet'),
|
'text' => __('Total Number of Subscribers', 'mailpoet'),
|
||||||
'shortcode' => 'subscriber:count',
|
'shortcode' => '[subscriber:count]',
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
__('Newsletter', 'mailpoet') => array(
|
__('Newsletter', 'mailpoet') => array(
|
||||||
array(
|
array(
|
||||||
'text' => __('Newsletter Subject', 'mailpoet'),
|
'text' => __('Newsletter Subject', 'mailpoet'),
|
||||||
'shortcode' => 'newsletter:subject',
|
'shortcode' => '[newsletter:subject]',
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
__('Post Notifications', 'mailpoet') => array(
|
__('Post Notifications', 'mailpoet') => array(
|
||||||
array(
|
array(
|
||||||
'text' => __('Total Number of Posts or Pages', 'mailpoet'),
|
'text' => __('Total Number of Posts or Pages', 'mailpoet'),
|
||||||
'shortcode' => 'newsletter:total',
|
'shortcode' => '[newsletter:total]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Most Recent Post Title', 'mailpoet'),
|
'text' => __('Most Recent Post Title', 'mailpoet'),
|
||||||
'shortcode' => 'newsletter:post_title',
|
'shortcode' => '[newsletter:post_title]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Issue Number', 'mailpoet'),
|
'text' => __('Issue Number', 'mailpoet'),
|
||||||
'shortcode' => 'newsletter:number',
|
'shortcode' => '[newsletter:number]',
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
__('Date', 'mailpoet') => array(
|
__('Date', 'mailpoet') => array(
|
||||||
array(
|
array(
|
||||||
'text' => __('Current day of the month number', 'mailpoet'),
|
'text' => __('Current day of the month number', 'mailpoet'),
|
||||||
'shortcode' => 'date:d',
|
'shortcode' => '[date:d]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Current day of the month in ordinal form, i.e. 2nd, 3rd, 4th, etc.', 'mailpoet'),
|
'text' => __('Current day of the month in ordinal form, i.e. 2nd, 3rd, 4th, etc.', 'mailpoet'),
|
||||||
'shortcode' => 'date:dordinal',
|
'shortcode' => '[date:dordinal]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Full name of current day', 'mailpoet'),
|
'text' => __('Full name of current day', 'mailpoet'),
|
||||||
'shortcode' => 'date:dtext',
|
'shortcode' => '[date:dtext]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Current month number', 'mailpoet'),
|
'text' => __('Current month number', 'mailpoet'),
|
||||||
'shortcode' => 'date:m',
|
'shortcode' => '[date:m]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Full name of current month', 'mailpoet'),
|
'text' => __('Full name of current month', 'mailpoet'),
|
||||||
'shortcode' => 'date:mtext',
|
'shortcode' => '[date:mtext]',
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Year', 'mailpoet'),
|
'text' => __('Year', 'mailpoet'),
|
||||||
'shortcode' => 'date:y',
|
'shortcode' => '[date:y]',
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
__('Links', 'mailpoet') => array(
|
__('Links', 'mailpoet') => array(
|
||||||
array(
|
array(
|
||||||
'text' => __('Unsubscribe link', 'mailpoet'),
|
'text' => __('Unsubscribe link', 'mailpoet'),
|
||||||
'shortcode' => 'link:subscription_unsubscribe',
|
'shortcode' => sprintf(
|
||||||
|
'<a target="_blank" href="%s">%s',
|
||||||
|
'[link:subscription_unsubscribe_url]',
|
||||||
|
__('Unsubscribe', 'mailpoet')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('Edit subscription page link', 'mailpoet'),
|
'text' => __('Edit subscription page link', 'mailpoet'),
|
||||||
'shortcode' => 'link:subscription_manage',
|
'shortcode' => sprintf(
|
||||||
|
'<a target="_blank" href="%s">%s',
|
||||||
|
'[link:subscription_manage_url]',
|
||||||
|
__('Manage subscription', 'mailpoet')
|
||||||
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'text' => __('View in browser link', 'mailpoet'),
|
'text' => __('View in browser link', 'mailpoet'),
|
||||||
'shortcode' => 'link:newsletter_view_in_browser',
|
'shortcode' => sprintf(
|
||||||
|
'<a target="_blank" href="%s">%s',
|
||||||
|
'[link:newsletter_view_in_browser_url]',
|
||||||
|
__('View in your browser', 'mailpoet')
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user