- Updates code based on Taut's comments

This commit is contained in:
Vlad
2016-04-14 19:36:12 -04:00
parent 84294b7ee6
commit 599661e028
6 changed files with 36 additions and 25 deletions

View File

@@ -4,6 +4,7 @@ namespace MailPoet\Newsletter\Shortcodes;
class Shortcodes {
public $newsletter;
public $subscriber;
static $shortcodes_regex = '/\[(?:\w+):.*?\]/ism';
function __construct(
$newsletter = false,
@@ -14,7 +15,7 @@ class Shortcodes {
}
function extract($text) {
preg_match_all('/\[(?:\w+):.*?\]/', $text, $shortcodes);
preg_match_all(self::$shortcodes_regex, $text, $shortcodes);
return array_unique($shortcodes[0]);
}
@@ -43,7 +44,8 @@ class Shortcodes {
$shortcode_default_value,
$this->newsletter,
$this->subscriber,
$text
$text,
$shortcode
);
}, $shortcodes);
return $processed_shortcodes;