PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
← All changes | Inc/Core/FB/BoxBlocksParser.php +38 -5 3.1.7 → 3.1.14 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 3.1.7 Free
4 + * @version 3.1.14 Free
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 8 * @copyright Copyright © 2026 FirePlugins All Rights Reserved
@@ -19,13 +19,46 @@
19 19 class BoxBlocksParser
20 20 {
21 21 public function __construct()
22 22 {
23 - add_filter('render_block', [$this, 'maybe_load_block_extension_script'], 10, 2);
23 + add_filter('render_block', [$this, 'parse_block'], 10, 2);
24 + }
24 25
25 - add_filter('render_block', [$this, 'modify_block_output'], 10, 2);
26 + /**
27 + * Single entry point for all render_block work on this class. Bails immediately
28 + * when the block carries none of our FireBox attributes, before any preg_ /
29 + * get_post_type() work runs for every block on the page.
30 + *
31 + * @param string $block_content
32 + * @param array $block
33 + *
34 + * @return string
35 + */
36 + public function parse_block($block_content, $block)
37 + {
38 + if (empty($block['attrs']) || !$this->hasFireBoxAttrs($block['attrs']))
39 + {
40 + return $block_content;
41 + }
42 +
43 + $block_content = $this->maybe_load_block_extension_script($block_content, $block);
44 + $block_content = $this->modify_block_output($block_content, $block);
45 +
46 + return $block_content;
26 47 }
27 48
49 + /**
50 + * Whether the block's attributes contain any FireBox-specific key.
51 + *
52 + * @param array $attrs
53 + *
54 + * @return bool
55 + */
56 + private function hasFireBoxAttrs($attrs)
57 + {
58 + return isset($attrs['dataFBoxOnClick']) || isset($attrs['dataFBoxOnClickURLAddParameters']);
59 + }
60 +
28 61 public function maybe_load_block_extension_script($block_content, $block)
29 62 {
30 63 if (isset($block['attrs']['dataFBoxOnClick']) && in_array($block['attrs']['dataFBoxOnClick'], ['copy_clipboard', 'download_file']))
31 64 {
@@ -49,12 +82,12 @@
49 82
50 83 /**
51 84 * Filters the block output by appending out custom data attributes
52 85 * on our supported blocks
53 - *
86 + *
54 87 * @param string $block_content
55 88 * @param array $block
56 - *
89 + *
57 90 * @return string
58 91 */
59 92 public function modify_block_output($block_content, $block)
60 93 {