PHP 8.2.31
Preview: NewsletterCoupon.php Size: 1.08 KB
/home/nshryvcy/himaltourism.com/wp-content/plugins/mailpoet/lib/Newsletter/NewsletterCoupon.php

<?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;
  }
}

Directory Contents

Dirs: 12 × Files: 12

Name Size Perms Modified Actions
Editor DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Links DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Listing DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Options DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Preview DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Renderer DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Scheduler DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Segment DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
Sending DIR
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
- drwxr-xr-x 2023-04-04 05:35:40
Edit Download
1.69 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
3.95 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
2.10 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
5.76 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
0 B lrw-r--r-- 2023-04-04 05:35:40
Edit Download
1.08 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
2.85 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
441 B lrw-r--r-- 2023-04-04 05:35:40
Edit Download
15.33 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
22.10 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
3.58 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download
2.25 KB lrw-r--r-- 2023-04-04 05:35:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).