| @@ -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 <[email protected]> |
| 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\Admin; |
| @@ -24,99 +24,12 @@ | ||
| 24 | 24 | { |
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - add_action('enqueue_block_editor_assets', [$this, 'block_editor_only_assets']); | |
| 29 | - | |
| 30 | 28 | add_action('enqueue_block_assets', [$this, 'enqueue_block_assets']); |
| 31 | - | |
| 32 | - add_filter('block_editor_settings_all', [$this, 'filterBlockEditorSettings'], 10, 2); | |
| 33 | 29 | } |
| 34 | 30 | |
| 35 | 31 | /** |
| 36 | - * Disable template mode for FireBox campaigns. | |
| 37 | - * | |
| 38 | - * @param array $settings | |
| 39 | - * @param mixed $editor_context | |
| 40 | - * | |
| 41 | - * @return array | |
| 42 | - */ | |
| 43 | - public function filterBlockEditorSettings($settings, $editor_context) | |
| 44 | - { | |
| 45 | - if (!is_admin() || !is_array($settings)) | |
| 46 | - { | |
| 47 | - return $settings; | |
| 48 | - } | |
| 49 | - | |
| 50 | - if ( | |
| 51 | - !is_object($editor_context) || | |
| 52 | - !property_exists($editor_context, 'post') || | |
| 53 | - !is_object($editor_context->post) || | |
| 54 | - !property_exists($editor_context->post, 'post_type') || | |
| 55 | - $editor_context->post->post_type !== 'firebox' | |
| 56 | - ) | |
| 57 | - { | |
| 58 | - return $settings; | |
| 59 | - } | |
| 60 | - | |
| 61 | - $settings['supportsTemplateMode'] = false; | |
| 62 | - | |
| 63 | - return $settings; | |
| 64 | - } | |
| 65 | - | |
| 66 | - public function block_editor_only_assets() | |
| 67 | - { | |
| 68 | - if (!is_admin()) | |
| 69 | - { | |
| 70 | - return; | |
| 71 | - } | |
| 72 | - | |
| 73 | - // Enqueue block editor script only in Gutenberg editor | |
| 74 | - if (function_exists('get_current_screen')) | |
| 75 | - { | |
| 76 | - $screen = get_current_screen(); | |
| 77 | - if ($screen->is_block_editor) | |
| 78 | - { | |
| 79 | - wp_enqueue_script( | |
| 80 | - 'firebox-gutenberg-store', | |
| 81 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/gutenberg_store.js', | |
| 82 | - ['wp-data'], | |
| 83 | - FBOX_VERSION, | |
| 84 | - true | |
| 85 | - ); | |
| 86 | - | |
| 87 | - // Required for ProOnlyButton hover icon swap (closed/open lock) across plans. | |
| 88 | - wp_enqueue_style( | |
| 89 | - 'firebox-editor-free', | |
| 90 | - FBOX_MEDIA_ADMIN_URL . 'css/editor-free.css', | |
| 91 | - [], | |
| 92 | - FBOX_VERSION | |
| 93 | - ); | |
| 94 | - | |
| 95 | - if ($this->shouldLoadFreeUpgradeModalsScript()) | |
| 96 | - { | |
| 97 | - wp_enqueue_script( | |
| 98 | - 'firebox-plugins-free-modals', | |
| 99 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/plugins/free-modals.js', | |
| 100 | - [], | |
| 101 | - FBOX_VERSION, | |
| 102 | - true | |
| 103 | - ); | |
| 104 | - } | |
| 105 | - | |
| 106 | - if (FBOX_LICENSE_TYPE === 'lite') | |
| 107 | - { | |
| 108 | - wp_enqueue_script('firebox-blocks-free', FBOX_MEDIA_ADMIN_URL . 'js/blocks/blocks-free.js', [], FBOX_VERSION, true); | |
| 109 | - } | |
| 110 | - else if (FBOX_LICENSE_TYPE === 'pro') | |
| 111 | - { | |
| 112 | - wp_enqueue_script('firebox-blocks-pro', FBOX_MEDIA_ADMIN_URL . 'js/blocks/blocks-pro.js', [], FBOX_VERSION, true); | |
| 113 | - } | |
| 114 | - } | |
| 115 | - } | |
| 116 | - } | |
| 117 | - | |
| 118 | - /** | |
| 119 | 32 | * Loads Gutenberg editor assets |
| 120 | 33 | * |
| 121 | 34 | * @return void |
| 122 | 35 | */ |
| @@ -132,11 +45,8 @@ | ||
| 132 | 45 | { |
| 133 | 46 | $screen = get_current_screen(); |
| 134 | 47 | if ($screen->is_block_editor) |
| 135 | 48 | { |
| 136 | - wp_enqueue_code_editor(['type' => 'text/css']); | |
| 137 | - wp_enqueue_code_editor(['type' => 'javascript']); | |
| 138 | - | |
| 139 | 49 | // Add the block editor styling for our blocks |
| 140 | 50 | wp_enqueue_style( |
| 141 | 51 | 'firebox-blocks-editor-styles', |
| 142 | 52 | FBOX_MEDIA_ADMIN_URL . 'css/admin/blocks.css', |
| @@ -147,117 +57,22 @@ | ||
| 147 | 57 | // Add the FireBox block editor script only to FireBox post type |
| 148 | 58 | if (get_post_type() === 'firebox') |
| 149 | 59 | { |
| 150 | 60 | wp_enqueue_script( |
| 151 | - 'firebox-gutenberg-store', | |
| 152 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/gutenberg_store.js', | |
| 153 | - ['wp-data'], | |
| 154 | - FBOX_VERSION, | |
| 155 | - true | |
| 156 | - ); | |
| 157 | - | |
| 158 | - // FireBox main CSS file | |
| 159 | - wp_enqueue_style( | |
| 160 | - 'firebox', | |
| 161 | - FBOX_MEDIA_PUBLIC_URL . 'css/firebox.css', | |
| 162 | - [], | |
| 163 | - FBOX_VERSION | |
| 164 | - ); | |
| 165 | - | |
| 166 | - wp_enqueue_style( | |
| 167 | - 'firebox-animations', | |
| 168 | - FBOX_MEDIA_PUBLIC_URL . 'css/vendor/animate.min.css', | |
| 169 | - [], | |
| 170 | - FBOX_VERSION | |
| 171 | - ); | |
| 172 | - | |
| 173 | - wp_enqueue_style( | |
| 174 | 61 | 'firebox-block-editor', |
| 175 | - FBOX_MEDIA_ADMIN_URL . 'css/block-editor.css', | |
| 62 | + FBOX_MEDIA_ADMIN_URL . 'js/block-editor.js', | |
| 176 | 63 | [], |
| 177 | - FBOX_VERSION | |
| 178 | - ); | |
| 179 | - | |
| 180 | - wp_enqueue_script( | |
| 181 | - 'firebox-editor', | |
| 182 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/editor.js', | |
| 183 | - ['wp-edit-post'], | |
| 184 | 64 | FBOX_VERSION, |
| 185 | - false | |
| 186 | - ); | |
| 187 | - | |
| 188 | - wp_enqueue_script( | |
| 189 | - 'firebox-slotfills-general', | |
| 190 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/slotfills/general.js', | |
| 191 | - [], | |
| 192 | - FBOX_VERSION, | |
| 193 | 65 | true |
| 194 | 66 | ); |
| 195 | 67 | |
| 196 | - // Required for ProOnlyButton hover icon swap (closed/open lock) across plans. | |
| 197 | - wp_enqueue_style( | |
| 198 | - 'firebox-editor-free', | |
| 199 | - FBOX_MEDIA_ADMIN_URL . 'css/editor-free.css', | |
| 200 | - [], | |
| 201 | - FBOX_VERSION | |
| 202 | - ); | |
| 203 | - | |
| 204 | - if ($this->shouldLoadFreeUpgradeModalsScript()) | |
| 205 | - { | |
| 206 | - wp_enqueue_script( | |
| 207 | - 'firebox-plugins-free-modals', | |
| 208 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/plugins/free-modals.js', | |
| 209 | - [], | |
| 210 | - FBOX_VERSION, | |
| 211 | - true | |
| 212 | - ); | |
| 213 | - } | |
| 214 | - | |
| 215 | 68 | |
| 216 | - if (FBOX_LICENSE_TYPE === 'lite') | |
| 217 | - { | |
| 218 | - wp_enqueue_script( | |
| 219 | - 'firebox-slotfills-free', | |
| 220 | - FBOX_MEDIA_ADMIN_URL . 'js/blocks/slotfills/free.js', | |
| 221 | - [], | |
| 222 | - FBOX_VERSION, | |
| 223 | - true | |
| 224 | - ); | |
| 225 | - } | |
| 226 | - | |
| 227 | - | |
| 228 | - | |
| 229 | 69 | } |
| 230 | 70 | |
| 231 | - | |
| 232 | - | |
| 233 | - $integrations_registry = \FireBox\Core\Helpers\Integrations::getFormEditorIntegrationsRegistry(); | |
| 234 | - $integration_connections = []; | |
| 235 | - foreach ($integrations_registry as $integration) | |
| 236 | - { | |
| 237 | - if (!is_array($integration) || empty($integration['slug'])) | |
| 238 | - { | |
| 239 | - continue; | |
| 240 | - } | |
| 241 | - | |
| 242 | - $integration_connections[$integration['slug']] = !empty($integration['connected']); | |
| 243 | - } | |
| 244 | - | |
| 245 | - $data = [ | |
| 246 | - 'google_fonts' => \FPFramework\Libs\GoogleFonts::getFonts(), | |
| 247 | - 'google_fonts_names' => \FPFramework\Libs\GoogleFonts::getFontsNames(), | |
| 248 | - 'icons' => \FireBox\Core\Libs\Icons::getAll(), | |
| 249 | - 'turnstile_site_key' => \FireBox\Core\Helpers\Captcha\Turnstile::getSiteKey(), | |
| 250 | - 'turnstile_secret_key' => \FireBox\Core\Helpers\Captcha\Turnstile::getSecretKey(), | |
| 251 | - 'hcaptcha_site_key' => \FireBox\Core\Helpers\Captcha\HCaptcha::getSiteKey(), | |
| 252 | - 'hcaptcha_secret_key' => \FireBox\Core\Helpers\Captcha\HCaptcha::getSecretKey(), | |
| 253 | - 'settings_url' => admin_url('admin.php?page=firebox-settings'), | |
| 254 | - 'integrations_registry' => $integrations_registry, | |
| 255 | - 'integration_connections' => $integration_connections, | |
| 256 | - 'license_type' => defined('FBOX_LICENSE_TYPE') ? FBOX_LICENSE_TYPE : '', | |
| 257 | - 'license_plan' => defined('FBOX_LICENSE_PLAN') ? FBOX_LICENSE_PLAN : '', | |
| 258 | - 'media_url' => FBOX_MEDIA_URL, | |
| 259 | - | |
| 71 | + $data = [ | |
| 72 | + 'google_fonts' => \FPFramework\Libs\GoogleFonts::getFonts(), | |
| 73 | + 'google_fonts_names' => \FPFramework\Libs\GoogleFonts::getFontsNames(), | |
| 74 | + 'icons' => \FireBox\Core\Libs\Icons::getAll() | |
| 260 | 75 | ]; |
| 261 | 76 | |
| 262 | 77 | wp_register_script('firebox-block-editor-script', false); |
| 263 | 78 | wp_enqueue_script('firebox-block-editor-script'); |
| @@ -264,13 +79,5 @@ | ||
| 264 | 79 | wp_localize_script('firebox-block-editor-script', 'fbox_block_editor_object', $data); |
| 265 | 80 | } |
| 266 | 81 | } |
| 267 | 82 | } |
| 268 | - | |
| 269 | - private function shouldLoadFreeUpgradeModalsScript() | |
| 270 | - { | |
| 271 | - $license_type = defined('FBOX_LICENSE_TYPE') ? strtolower(trim((string) FBOX_LICENSE_TYPE)) : ''; | |
| 272 | - $license_plan = defined('FBOX_LICENSE_PLAN') ? strtolower(trim((string) FBOX_LICENSE_PLAN)) : ''; | |
| 273 | - | |
| 274 | - return $license_type === 'lite' || in_array($license_plan, ['free', 'basic'], true); | |
| 275 | - } | |
| 276 | -} | |
| 83 | +} | |