<?php declare(strict_types = 1); namespace MailPoet\Newsletter; if (!defined('ABSPATH')) exit; use MailPoet\Newsletter\Renderer\Blocks\Coupon; class NewsletterCoupon { public function cleanupBodySensitiveData(array $newsletterBody): array { if (!is_array($newsletterBody) || empty($newsletterBody['content'])) { return $newsletterBody; } $cleanBlocks = $this->cleanupCouponBlocks($newsletterBody['content']['blocks']); return array_merge( $newsletterBody, [ 'content' => array_merge( $newsletterBody['content'], ['blocks' => $cleanBlocks] ), ] ); } private function cleanupCouponBlocks(array &$blocks): array { foreach ($blocks as &$block) { if (isset($block['blocks']) && !empty($block['blocks'])) { $this->cleanupCouponBlocks($block['blocks']); } if (isset($block['type']) && $block['type'] === Coupon::TYPE) { $block['code'] = Coupon::CODE_PLACEHOLDER; if(isset($block['couponId'])) unset($block['couponId']); } } return $blocks; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Editor | Folder | 0755 |
|
|
Links | Folder | 0755 |
|
|
Listing | Folder | 0755 |
|
|
Options | Folder | 0755 |
|
|
Preview | Folder | 0755 |
|
|
Renderer | Folder | 0755 |
|
|
Scheduler | Folder | 0755 |
|
|
Segment | Folder | 0755 |
|
|
Sending | Folder | 0755 |
|
|
Shortcodes | Folder | 0755 |
|
|
Statistics | Folder | 0755 |
|
|
ViewInBrowser | Folder | 0755 |
|
|
ApiDataSanitizer.php | File | 1.69 KB | 0644 |
|
AutomatedLatestContent.php | File | 4.34 KB | 0644 |
|
AutomaticEmailsRepository.php | File | 2.1 KB | 0644 |
|
BlockPostQuery.php | File | 5.9 KB | 0644 |
|
NewsletterCoupon.php | File | 1.08 KB | 0644 |
|
NewsletterDeleteController.php | File | 6.85 KB | 0644 |
|
NewsletterHtmlSanitizer.php | File | 2.94 KB | 0644 |
|
NewsletterPostsRepository.php | File | 1.01 KB | 0644 |
|
NewsletterSaveController.php | File | 17.11 KB | 0644 |
|
NewsletterValidator.php | File | 4.59 KB | 0644 |
|
NewslettersRepository.php | File | 21.2 KB | 0644 |
|
Url.php | File | 2.27 KB | 0644 |
|
index.php | File | 6 B | 0644 |
|