PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.0.12
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.0.12
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 1.1.1 All 122 releases
← All changes | Inc/Core/FB/BoxBlocksParser.php +16 -12 1.0.112.0.12 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.11 Free
4 + * @version 2.0.12 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2022 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2023 FirePlugins All Rights Reserved
9 9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 10 */
11 11
12 12 namespace FireBox\Core\FB;
@@ -42,8 +42,10 @@
42 42
43 43 $blockName = $block['blockName'];
44 44
45 45 $parsable_blocks = [
46 + 'firebox/buttons',
47 + 'firebox/image',
46 48 'core/buttons',
47 49 'core/image'
48 50 ];
49 51
@@ -54,9 +56,9 @@
54 56
55 57 /**
56 58 * Handle Core Buttons Block
57 59 */
58 - if ($blockName == 'core/buttons')
60 + if (in_array($blockName, ['core/buttons', 'firebox/buttons']))
59 61 {
60 62 $buttons = isset($block['innerBlocks']) ? $block['innerBlocks'] : [];
61 63 if (!$buttons)
62 64 {
@@ -70,9 +72,9 @@
70 72 }
71 73 /**
72 74 * Handle Core Image Block
73 75 */
74 - else if ($blockName == 'core/image')
76 + else if (in_array($blockName, ['core/image', 'firebox/image']))
75 77 {
76 78 $new_block_html = $block['innerHTML'];
77 79
78 80 // check if we have an anchor element and add attributes to this elem.
@@ -119,16 +121,13 @@
119 121 $new_block_html = str_replace('<' . $element . ' ', '<' . $element . ' data-fbox-cmd="' . esc_attr($atts['cmd']) . '" ', $new_block_html);
120 122 }
121 123
122 124 // prevent default
123 - if ($atts['preventDefault'])
124 - {
125 - $new_block_html = str_replace('<' . $element . ' ', '<' . $element . ' data-fbox-prevent="' . esc_attr((int) $atts['preventDefault']) . '" ', $new_block_html);
126 - }
125 + $new_block_html = str_replace('<' . $element . ' ', '<' . $element . ' data-fbox-prevent="1" ', $new_block_html);
127 126 }
128 127
129 128 // class
130 - if ($atts['class'])
129 + if (isset($atts['class']) && !empty($atts['class']))
131 130 {
132 131 $new_block_html = preg_replace('/<' . $element . '(.*)class="/', "<" . $element . "$1class=\"" . esc_attr($atts['class']) . ' ', $new_block_html);
133 132 }
134 133
@@ -144,14 +143,19 @@
144 143 */
145 144 private function getBlockAttributes($block)
146 145 {
147 146 $atts = [];
147 +
148 + $atts['enabled'] = isset($block['attrs']['dataFBoxEnabled']) ?: false;
149 +
150 + if (!$atts['enabled'])
151 + {
152 + return $atts;
153 + }
148 154
149 - $atts['enabled'] = isset($block['attrs']['dataFBoxEnabled']) ?: false;
150 155 $atts['box'] = isset($block['attrs']['dataFBox']) ? $block['attrs']['dataFBox'] : null;
151 - $atts['cmd'] = isset($block['attrs']['dataFBoxCmd']) ? $block['attrs']['dataFBoxCmd'] : 'close';
156 + $atts['cmd'] = isset($block['attrs']['dataFBoxCmd']) ? $block['attrs']['dataFBoxCmd'] : 'open';
152 157 $atts['class'] = isset($block['attrs']['dataFBoxClass']) ? $block['attrs']['dataFBoxClass'] : '';
153 - $atts['preventDefault'] = isset($block['attrs']['dataFBoxPreventDefault']) ? $block['attrs']['dataFBoxPreventDefault'] : 1;
154 158
155 159 return $atts;
156 160 }
157 161 }