PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.0.1
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.0.1
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
firebox / Inc / Core / Admin / Media.php

Media.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 3.0.1, at Inc/Core/Admin/Media.php

211 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FireBox
4 * @version 3.0.1 Free
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2025 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FireBox\Core\Admin;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 class Media
20 {
21 public function __construct()
22 {
23 if (!is_admin())
24 {
25 return;
26 }
27
28 add_action('enqueue_block_editor_assets', [$this, 'block_editor_only_assets']);
29
30 add_action('enqueue_block_assets', [$this, 'enqueue_block_assets']);
31 }
32
33 public function block_editor_only_assets()
34 {
35 if (!is_admin())
36 {
37 return;
38 }
39
40 // Enqueue block editor script only in Gutenberg editor
41 if (function_exists('get_current_screen'))
42 {
43 $screen = get_current_screen();
44 if ($screen->is_block_editor)
45 {
46 wp_enqueue_script(
47 'firebox-gutenberg-store',
48 FBOX_MEDIA_ADMIN_URL . 'js/blocks/gutenberg_store.js',
49 ['wp-data'],
50 FBOX_VERSION,
51 true
52 );
53
54 if (FBOX_LICENSE_TYPE === 'lite')
55 {
56 wp_enqueue_style(
57 'firebox-editor-free',
58 FBOX_MEDIA_ADMIN_URL . 'css/editor-free.css',
59 [],
60 FBOX_VERSION
61 );
62
63 wp_enqueue_script(
64 'firebox-plugins-free-modals',
65 FBOX_MEDIA_ADMIN_URL . 'js/blocks/plugins/free-modals.js',
66 [],
67 FBOX_VERSION,
68 true
69 );
70
71 wp_enqueue_script('firebox-blocks-free', FBOX_MEDIA_ADMIN_URL . 'js/blocks/blocks-free.js', [], FBOX_VERSION, true);
72 }
73 else if (FBOX_LICENSE_TYPE === 'pro')
74 {
75 wp_enqueue_script('firebox-blocks-pro', FBOX_MEDIA_ADMIN_URL . 'js/blocks/blocks-pro.js', [], FBOX_VERSION, true);
76 }
77 }
78 }
79 }
80
81 /**
82 * Loads Gutenberg editor assets
83 *
84 * @return void
85 */
86 public function enqueue_block_assets()
87 {
88 if (!is_admin())
89 {
90 return;
91 }
92
93 // Enqueue block editor script only in Gutenberg editor
94 if (function_exists('get_current_screen'))
95 {
96 $screen = get_current_screen();
97 if ($screen->is_block_editor)
98 {
99 wp_enqueue_code_editor(['type' => 'text/css']);
100 wp_enqueue_code_editor(['type' => 'javascript']);
101
102 // Add the block editor styling for our blocks
103 wp_enqueue_style(
104 'firebox-blocks-editor-styles',
105 FBOX_MEDIA_ADMIN_URL . 'css/admin/blocks.css',
106 [],
107 FBOX_VERSION
108 );
109
110 // Add the FireBox block editor script only to FireBox post type
111 if (get_post_type() === 'firebox')
112 {
113 wp_enqueue_script(
114 'firebox-gutenberg-store',
115 FBOX_MEDIA_ADMIN_URL . 'js/blocks/gutenberg_store.js',
116 ['wp-data'],
117 FBOX_VERSION,
118 true
119 );
120
121 // FireBox main CSS file
122 wp_enqueue_style(
123 'firebox',
124 FBOX_MEDIA_PUBLIC_URL . 'css/firebox.css',
125 [],
126 FBOX_VERSION
127 );
128
129 wp_enqueue_style(
130 'firebox-animations',
131 FBOX_MEDIA_PUBLIC_URL . 'css/vendor/animate.min.css',
132 [],
133 FBOX_VERSION
134 );
135
136 wp_enqueue_style(
137 'firebox-block-editor',
138 FBOX_MEDIA_ADMIN_URL . 'css/block-editor.css',
139 [],
140 FBOX_VERSION
141 );
142
143 wp_enqueue_script(
144 'firebox-editor',
145 FBOX_MEDIA_ADMIN_URL . 'js/blocks/editor.js',
146 ['wp-edit-post'],
147 FBOX_VERSION,
148 true
149 );
150
151 wp_enqueue_script(
152 'firebox-slotfills-general',
153 FBOX_MEDIA_ADMIN_URL . 'js/blocks/slotfills/general.js',
154 [],
155 FBOX_VERSION,
156 true
157 );
158
159
160 if (FBOX_LICENSE_TYPE === 'lite')
161 {
162 wp_enqueue_style(
163 'firebox-editor-free',
164 FBOX_MEDIA_ADMIN_URL . 'css/editor-free.css',
165 [],
166 FBOX_VERSION
167 );
168
169 wp_enqueue_script(
170 'firebox-plugins-free-modals',
171 FBOX_MEDIA_ADMIN_URL . 'js/blocks/plugins/free-modals.js',
172 [],
173 FBOX_VERSION,
174 true
175 );
176
177 wp_enqueue_script(
178 'firebox-slotfills-free',
179 FBOX_MEDIA_ADMIN_URL . 'js/blocks/slotfills/free.js',
180 [],
181 FBOX_VERSION,
182 true
183 );
184 }
185
186
187
188 }
189
190
191
192 $data = [
193 'google_fonts' => \FPFramework\Libs\GoogleFonts::getFonts(),
194 'google_fonts_names' => \FPFramework\Libs\GoogleFonts::getFontsNames(),
195 'icons' => \FireBox\Core\Libs\Icons::getAll(),
196 'turnstile_site_key' => \FireBox\Core\Helpers\Captcha\Turnstile::getSiteKey(),
197 'turnstile_secret_key' => \FireBox\Core\Helpers\Captcha\Turnstile::getSecretKey(),
198 'hcaptcha_site_key' => \FireBox\Core\Helpers\Captcha\HCaptcha::getSiteKey(),
199 'hcaptcha_secret_key' => \FireBox\Core\Helpers\Captcha\HCaptcha::getSecretKey(),
200 'settings_url' => admin_url('admin.php?page=firebox-settings'),
201 'media_url' => FBOX_MEDIA_URL,
202
203 ];
204
205 wp_register_script('firebox-block-editor-script', false);
206 wp_enqueue_script('firebox-block-editor-script');
207 wp_localize_script('firebox-block-editor-script', 'fbox_block_editor_object', $data);
208 }
209 }
210 }
211 }