- Fixes 'Using $this when not in object context' error in PHP 5.3

This commit is contained in:
Vlad
2016-11-06 18:46:56 -05:00
parent 8df4da768a
commit 61c255564f
4 changed files with 20 additions and 16 deletions

View File

@@ -48,9 +48,10 @@ class Shortcodes {
}
function process($shortcodes, $content = false) {
$_this = $this;
$processed_shortcodes = array_map(
function($shortcode) use ($content) {
$shortcode_details = $this->match($shortcode);
function($shortcode) use ($content, $_this) {
$shortcode_details = $_this->match($shortcode);
$shortcode_category = !empty($shortcode_details['category']) ?
ucfirst($shortcode_details['category']) :
false;
@@ -66,9 +67,9 @@ class Shortcodes {
$custom_shortcode = apply_filters(
'mailpoet_newsletter_shortcode',
$shortcode,
$this->newsletter,
$this->subscriber,
$this->queue,
$_this->newsletter,
$_this->subscriber,
$_this->queue,
$content
);
return ($custom_shortcode === $shortcode) ?
@@ -78,9 +79,9 @@ class Shortcodes {
return $shortcode_class::process(
$shortcode_action,
$shortcode_default_value,
$this->newsletter,
$this->subscriber,
$this->queue,
$_this->newsletter,
$_this->subscriber,
$_this->queue,
$content
);
}, $shortcodes);