- Fixes shortcode category name for view in browser url
- Updates shortcode regex
This commit is contained in:
@ -147,7 +147,7 @@ class Link {
|
||||
case 'subscription_manage_url':
|
||||
$url = SubscriptionUrl::getManageUrl($subscriber);
|
||||
break;
|
||||
case 'view_in_browser_url':
|
||||
case 'newsletter_view_in_browser_url':
|
||||
$url = Link::getViewInBrowserUrl($newsletter, $subscriber, $queue);
|
||||
break;
|
||||
default:
|
||||
|
@ -34,7 +34,7 @@ class Shortcodes {
|
||||
|
||||
function match($shortcode) {
|
||||
preg_match(
|
||||
'/\[(?P<category>\w+):(?P<action>\w+)(?:.*?\|.*?default:(?P<default>\w+))?\]/ism',
|
||||
'/\[(?P<category>\w+)?:(?P<action>\w+)(?:.*?\|.*?default:(?P<default>.*?))?\]/',
|
||||
$shortcode,
|
||||
$match
|
||||
);
|
||||
@ -45,8 +45,12 @@ class Shortcodes {
|
||||
$processed_shortcodes = array_map(
|
||||
function($shortcode) use($content) {
|
||||
$shortcode_details = $this->match($shortcode);
|
||||
$shortcode_category = ucfirst($shortcode_details['category']);
|
||||
$shortcode_action = $shortcode_details['action'];
|
||||
$shortcode_category = isset($shortcode_details['category']) ?
|
||||
ucfirst($shortcode_details['category']) :
|
||||
false;
|
||||
$shortcode_action = isset($shortcode_details['action']) ?
|
||||
$shortcode_details['action'] :
|
||||
false;
|
||||
$shortcode_class =
|
||||
__NAMESPACE__ . '\\Categories\\' . $shortcode_category;
|
||||
$shortcode_default_value = isset($shortcode_details['default'])
|
||||
|
@ -7,7 +7,6 @@ use MailPoet\Models\SendingQueue;
|
||||
use MailPoet\Models\StatisticsClicks;
|
||||
use MailPoet\Models\Subscriber;
|
||||
use MailPoet\Newsletter\Shortcodes\Categories\Link;
|
||||
use MailPoet\Subscription\Url as SubscriptionUrl;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
@ -82,7 +81,7 @@ class Clicks {
|
||||
$subscriber,
|
||||
$queue
|
||||
);
|
||||
if (!$url) $this->abort();
|
||||
if(!$url) $this->abort();
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
Reference in New Issue
Block a user