PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.4
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.4
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/Blocks.php +59 -21 3.1.72.1.4 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 3.1.7 Free
4 + * @version 2.1.4 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2026 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2024 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;
@@ -51,17 +51,20 @@
51 51 * @return array
52 52 */
53 53 public function register_categories($categories, $context)
54 54 {
55 - return array_merge(
55 + // Add FireBox category
56 + $categories = array_merge(
56 57 $categories,
57 - [
58 - [
59 - 'slug' => 'firebox',
60 - 'title' => 'FireBox'
61 - ]
62 - ]
58 + array(
59 + array(
60 + 'slug' => 'firebox',
61 + 'title' => firebox()->_('FB_PLUGIN_NAME')
62 + ),
63 + )
63 64 );
65 +
66 + return $categories;
64 67 }
65 68
66 69 /**
67 70 * Initialize all blocks
@@ -73,9 +76,9 @@
73 76 $ds = DIRECTORY_SEPARATOR;
74 77
75 78 $base_dir = implode($ds, [__DIR__, 'Blocks']);
76 79
77 - $files = array_diff(scandir($base_dir), ['.', '..', '.DS_Store', 'index.php', 'Block.php']);
80 + $files = array_diff(scandir($base_dir), ['.', '..', '.DS_Store', 'index.php', 'FormBlock.php', 'Block.php']);
78 81
79 82 $namespace = '\FireBox\Core\Blocks\\';
80 83
81 84 foreach ($files as $item)
@@ -81,21 +84,38 @@
81 84 foreach ($files as $item)
82 85 {
83 86 // Check if this is a single file and load it
84 87 $file = implode($ds, [$base_dir, $item]);
88 + if (is_file($file))
89 + {
90 + $class_name = preg_replace('/.php$/', '', $item);
91 + $this->registerBlock($namespace . $class_name);
92 + continue;
93 + }
94 +
95 + // If that's not a file, we assume it is a directory of files
96 + $blocks = array_diff(scandir($file), ['.', '..', 'index.php']);
85 97
86 - if (!is_file($file))
87 - {
88 - continue;
98 + foreach ($blocks as $key => $block_name)
99 + {
100 + $class_name = preg_replace('/.php$/', '', $block_name);
101 + $class = $namespace . $item . '\\' . $class_name;
102 + $this->registerBlock($class);
89 103 }
104 + }
105 + }
90 106
91 - $class_name = preg_replace('/.php$/', '', $item);
92 -
93 - $class = $namespace . $class_name;
94 -
95 - $block = new $class();
96 - $block->register();
97 - }
107 + /**
108 + * Registers the block.
109 + *
110 + * @param string $class
111 + *
112 + * @return void
113 + */
114 + private function registerBlock($class)
115 + {
116 + $block = new $class();
117 + $block->register();
98 118 }
99 119
100 120 /**
101 121 * Blocks assets.
@@ -111,11 +131,29 @@
111 131 }
112 132
113 133 wp_enqueue_script(
114 134 'fb-blocks-extend',
115 - FBOX_MEDIA_ADMIN_URL . 'js/blocks/fb_blocks_extend.js',
135 + FBOX_MEDIA_ADMIN_URL . 'js/fb_blocks_extend.js',
116 136 ['wp-i18n', 'wp-blocks', 'wp-editor', 'wp-components', 'wp-api-fetch', 'lodash'],
117 137 FBOX_VERSION,
118 138 true
119 139 );
140 +
141 + // Enqueue block editor style only in Gutenberg editor
142 + if (function_exists('get_current_screen'))
143 + {
144 + $screen = get_current_screen();
145 + if ($screen->is_block_editor)
146 + {
147 + if (get_post_type() === 'firebox')
148 + {
149 + wp_enqueue_style(
150 + 'firebox-block-editor',
151 + FBOX_MEDIA_ADMIN_URL . 'css/block-editor.css',
152 + [],
153 + FBOX_VERSION
154 + );
155 + }
156 + }
157 + }
120 158 }
121 159 }