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