From 42c4139ba5c2fd33c62a747b13c8c90ed1cbbb2f Mon Sep 17 00:00:00 2001 From: Vlad Date: Sun, 20 Mar 2016 11:37:59 -0400 Subject: [PATCH] - Minor adjustment to the shortcodes logic --- lib/Newsletter/Editor/PostTransformer.php | 2 +- lib/Newsletter/Shortcodes/Categories/Newsletter.php | 2 +- tests/unit/Newsletter/ShortcodesTest.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Newsletter/Editor/PostTransformer.php b/lib/Newsletter/Editor/PostTransformer.php index ebc7c68642..ae6228dab6 100644 --- a/lib/Newsletter/Editor/PostTransformer.php +++ b/lib/Newsletter/Editor/PostTransformer.php @@ -169,6 +169,6 @@ class PostTransformer { $alignment = (in_array($this->args['titleAlignment'], array('left', 'right', 'center'))) ? $this->args['titleAlignment'] : 'left'; - return '<' . $tag . ' class="mailpoet_alc_post" style="text-align: ' . $alignment . '">' . $title . ''; + return '<' . $tag . ' data-post-id="' . $post->ID . '" style="text-align: ' . $alignment . '">' . $title . ''; } } diff --git a/lib/Newsletter/Shortcodes/Categories/Newsletter.php b/lib/Newsletter/Shortcodes/Categories/Newsletter.php index 5b2d740ef8..93367d7978 100644 --- a/lib/Newsletter/Shortcodes/Categories/Newsletter.php +++ b/lib/Newsletter/Shortcodes/Categories/Newsletter.php @@ -42,7 +42,7 @@ class Newsletter { break; case 'total': - return substr_count($text, 'mailpoet_alc_post'); + return substr_count($text, 'data-post-id'); break; case 'post_title': diff --git a/tests/unit/Newsletter/ShortcodesTest.php b/tests/unit/Newsletter/ShortcodesTest.php index c96cf152b4..4f942ca090 100644 --- a/tests/unit/Newsletter/ShortcodesTest.php +++ b/tests/unit/Newsletter/ShortcodesTest.php @@ -27,8 +27,8 @@ class ShortcodesTest extends MailPoetTest { Thank you for subscribing with [user:email]. We already have [user:count] users. -

some post

-

another post

+

some post

+

another post

There are [newsletter:total] posts in this newsletter. You are reading [newsletter:subject]. @@ -87,8 +87,8 @@ class ShortcodesTest extends MailPoetTest { Thank you for subscribing with {$this->subscriber->email}. We already have {$subscriber_count} users. -

some post

-

another post

+

some post

+

another post

There are {$number_of_posts} posts in this newsletter. You are reading {$this->newsletter['subject']}.