- Joins bulk and individual processing into one method

- Refactors code as per code review comments
This commit is contained in:
Vlad
2016-06-20 23:12:32 -04:00
parent e807aad814
commit f32d6bb331
10 changed files with 155 additions and 178 deletions

View File

@@ -2,10 +2,9 @@
namespace MailPoet\Newsletter\Renderer\PostProcess;
use MailPoet\Newsletter\Links\Links;
use MailPoet\Newsletter\Renderer\Renderer;
class OpenTracking {
const OPEN_TRACKING_FILTER_NAME = 'mailpoet_rendering_post_process';
static function process($template) {
$DOM = new \pQuery();
$DOM = $DOM->parseStr($template);
@@ -20,11 +19,9 @@ class OpenTracking {
}
static function addTrackingImage() {
if(array_key_exists(self::OPEN_TRACKING_FILTER_NAME, $GLOBALS['wp_filter'])) {
return;
};
add_filter('mailpoet_rendering_post_process', function ($template) {
add_filter(Renderer::POST_PROCESS_FILTER, function ($template) {
return OpenTracking::process($template);
});
return true;
}
}