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/Admin/Admin.php +81 -589 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\Admin;
@@ -36,32 +36,16 @@
36 36 * Admin constructor
37 37 */
38 38 public function __construct()
39 39 {
40 - new \FireBox\Core\Notices\Ajax();
41 -
42 - $this->maybeExportSubmsissions();
43 -
44 - add_action('admin_head', [$this, 'set_gutenberg_editor_logo']);
45 40
46 - add_action('wp_trash_post', [$this, 'on_campaign_trash'], 10, 2);
47 - add_action('untrash_post', [$this, 'on_campaign_untrash'], 10, 2);
48 -
49 -
50 41 add_action('admin_enqueue_scripts', [$this, 'global_backend_assets'], 20);
51 42
52 43
44 + add_action('enqueue_block_editor_assets', [$this, 'block_editor_assets'], -100);
45 +
53 46 add_action('current_screen', [$this, 'current_screen']);
54 47
55 - add_action('firebox/admin/content', [$this, 'showNotices'], -5);
56 -
57 - // Init onboarding for new users
58 - add_action('admin_init', [$this, 'initOnboarding']);
59 - add_action('admin_init', [$this, 'redirectAfterActivation']);
60 -
61 - // Register AJAX handler for onboarding (always available, not limited by page check)
62 - add_action('wp_ajax_firebox_onboarding_complete', [Includes\Onboarding::class, 'handleOnboardingComplete']);
63 -
64 48 // init dependencies
65 49 $this->initDependencies();
66 50
67 51 // Admin Page Settings
@@ -71,297 +55,21 @@
71 55 $this->handleActions();
72 56
73 57 // run filters
74 58 $this->handleFilters();
75 -
76 - add_action('save_post', [$this, 'onSave'], 20);
77 59 }
78 -
79 - /**
80 - * On Save, clear the campaign cookie if closing behavior > when closed is set to "never".
81 - *
82 - * @param string $post_id
83 - *
84 - * @return void
85 - */
86 - public function onSave($post_id)
87 - {
88 - if (!isset($_POST['post_type']) || $_POST['post_type'] !== 'firebox')
89 - {
90 - return;
91 - }
92 60
93 - if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
94 - {
95 - return;
96 - }
97 -
98 - if ($parent_id = wp_is_post_revision($post_id))
99 - {
100 - $post_id = $parent_id;
101 - }
102 -
103 - $meta = get_post_meta($post_id, 'firebox_meta');
104 -
105 - $assign_cookietype = isset($meta[0]['assign_cookietype']) ? $meta[0]['assign_cookietype'] : '';
106 -
107 - if ($assign_cookietype === 'never')
108 - {
109 - setcookie('firebox_' . $post_id, '', time() - 3600, '/');
110 - }
111 - }
112 -
113 - /**
114 - * Set the FireBox logo in the Gutenberg editor.
115 - *
116 - * @return void
117 - */
118 - public function set_gutenberg_editor_logo()
61 + public function block_editor_assets()
119 62 {
120 - if (get_post_type() !== 'firebox')
121 - {
122 - return;
123 - }
124 -
125 - ?>
126 - <style>
127 - @media screen and (min-width: 782px) {
128 - .editor-header {
129 - grid-template: auto / auto minmax(0, max-content) minmax(min-content, 1fr) 60px;
130 - }
131 -
132 - .editor-header:has(>.editor-header__center) {
133 - grid-template: auto / auto minmax(min-content, 1fr) 2fr minmax(min-content, 1fr) 60px;
134 - }
135 - }
136 - .editor-header__back-button .edit-post-fullscreen-mode-close {
137 - background: transparent !important;
138 - background-image: url("<?php echo esc_url(FBOX_MEDIA_ADMIN_URL); ?>images/logo_full.svg") !important;
139 - background-size: 105px !important;
140 - margin-right: 0 !important;
141 - margin-left: 17px !important;
142 - background-repeat: no-repeat !important;
143 - background-position: center center !important;
144 - width: 120px !important;
145 - }
146 - .editor-header__back-button .edit-post-fullscreen-mode-close:before,
147 - .editor-header__back-button .edit-post-fullscreen-mode-close:after,
148 - .editor-header__back-button img,
149 - .editor-header__back-button svg {
150 - display: none !important;
151 - }
152 - </style>
153 - <?php
63 + wp_register_script(
64 + 'firebox-store',
65 + FBOX_MEDIA_ADMIN_URL . 'js/helpers/store.js',
66 + [],
67 + FBOX_VERSION,
68 + false
69 + );
154 70 }
155 71
156 - private function maybeExportSubmsissions()
157 - {
158 - if (!isset($_GET['task']) || $_GET['task'] !== 'export') //phpcs:ignore WordPress.Security.NonceVerification.Recommended
159 - {
160 - return;
161 - }
162 -
163 - if (!isset($_GET['form_id'])) //phpcs:ignore WordPress.Security.NonceVerification.Recommended
164 - {
165 - return;
166 - }
167 -
168 - if (!isset($_GET['page']) || $_GET['page'] !== 'firebox-submissions') //phpcs:ignore WordPress.Security.NonceVerification.Recommended
169 - {
170 - return;
171 - }
172 -
173 - $form_id = sanitize_text_field(wp_unslash($_GET['form_id'])); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
174 -
175 - $payload = [
176 - 'where' => [
177 - 'form_id' => " = '" . sanitize_key($form_id) . "'",
178 - 'state' => ' = 1'
179 - ],
180 - 'offset' => 0,
181 - 'limit' => 99999,
182 - 'orderby' => 'created_at ASC'
183 - ];
184 -
185 - if (!$submissions = firebox()->tables->submission->getResults($payload))
186 - {
187 - return;
188 - }
189 -
190 - if (!$form = \FireBox\Core\Helpers\Form\Form::getFormByID($form_id, true))
191 - {
192 - return;
193 - }
194 -
195 - $prepared = [];
196 -
197 - // Set submission fields values
198 - foreach ($submissions as $item)
199 - {
200 - $prepared_payload = [
201 - 'id' => $item->id,
202 - 'created' => get_date_from_gmt($item->created_at),
203 - 'state' => $item->state === '1' ? 'Published' : 'Unpublished'
204 - ];
205 -
206 - // Find field values
207 - $meta = firebox()->tables->submissionmeta->getResults([
208 - 'where' => [
209 - 'submission_id' => " = " . absint($item->id)
210 - ]
211 - ]);
212 -
213 - if ($meta && $form['fields'])
214 - {
215 - foreach ($form['fields'] as $field)
216 - {
217 - foreach ($meta as $meta_item)
218 - {
219 - if ($field->getOptionValue('id') === $meta_item->meta_key)
220 - {
221 - $prepared_payload[$field->getOptionValue('name')] = $field->prepareValue($meta_item->meta_value);
222 - }
223 - }
224 - }
225 - }
226 -
227 - $prepared[] = $prepared_payload;
228 - }
229 -
230 -
231 - $filename = get_temp_dir() . 'submissions_' . $form['name'] . '_' . date('Y-m-d_H-i-s') . '.csv';
232 - self::toCSV($prepared, $filename);
233 -
234 - // Prompt to download the file
235 - error_reporting(0);
236 -
237 - // Send the appropriate headers to force the download in the browser
238 - header('Content-Description: File Transfer');
239 - header('Content-Type: application/octet-stream');
240 - header('Content-Disposition: attachment; filename="' . basename($filename) . '"');
241 - header('Expires: 0');
242 - header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
243 - header('Cache-Control: public', false);
244 - header('Pragma: public');
245 - header('Content-Length: ' . @filesize($filename));
246 -
247 - // Clear the output buffer and disable output buffering
248 - ob_clean();
249 - flush();
250 -
251 - readfile($filename);
252 -
253 - unlink($filename);
254 -
255 - exit;
256 - }
257 -
258 - /**
259 - * Create a CSV file with given data
260 - *
261 - * @param array $data The data to populate the file
262 - * @param string $destination The path where the store the CSV file
263 - * @param bool $append If true, given data will be appended to the end of the file.
264 - * @param boolean $excel_security If enabled, certain row values will be prefixed by a tab to avoid any CSV injection.
265 - *
266 - * @return void
267 - */
268 - private static function toCSV($data, $destination, $append = false, $excel_security = true, $check_for_duplicates = true)
269 - {
270 - $resource = fopen($destination, $append ? 'a+' : 'w');
271 -
272 - if (!$append)
273 - {
274 - // Support UTF-8 on Microsoft Excel
275 - fputs($resource, "\xEF\xBB\xBF");
276 -
277 - // Add column names in the first line
278 - fputcsv($resource, array_keys($data[0]));
279 - }
280 -
281 - // Get CSV content
282 - $existingRows = [];
283 - if ($append && $check_for_duplicates)
284 - {
285 - while (($existingData = fgetcsv($resource)) !== false)
286 - {
287 - $existingRows[(int) $existingData[0]] = $existingData;
288 - }
289 - }
290 -
291 - foreach ($data as $row)
292 - {
293 - if (!empty($existingRows) && isset($row['id']) && array_key_exists($row['id'], $existingRows))
294 - {
295 - continue;
296 - }
297 -
298 - // Prevent CSV Injection: https://vel.joomla.org/articles/2140-introducing-csv-injection
299 - if ($excel_security)
300 - {
301 - foreach ($row as &$value)
302 - {
303 - $value = is_array($value) ? implode(', ', $value) : $value;
304 -
305 - $firstChar = substr($value, 0, 1);
306 -
307 - // Prefixe values starting with a =, +, - or @ by a tab character
308 - if (in_array($firstChar, array('=', '+', '-', '@')))
309 - {
310 - $value = ' ' . $value;
311 - }
312 - }
313 - }
314 -
315 - fputcsv($resource, $row);
316 - }
317 -
318 - fclose($resource);
319 - }
320 -
321 - /**
322 - * Fires when a campaign is trashed.
323 - *
324 - * @param int $post_id
325 - * @param string $previous_status
326 - *
327 - * @return void
328 - */
329 - public function on_campaign_trash($post_id, $previous_status)
330 - {
331 - $post_type = get_post_type($post_id);
332 - $post_status = get_post_status($post_id);
333 -
334 - if ($post_type === 'firebox' && $post_status === 'draft')
335 - {
336 - \FPFramework\Libs\AdminNotice::displaySuccess(firebox()->_('FB_CAMPAIGN_HAS_BEEN_TRASHED'));
337 - }
338 - }
339 -
340 - /**
341 - * Fires when a campaign is untrashed.
342 - *
343 - * @param int $post_id
344 - * @param string $previous_status
345 - *
346 - * @return void
347 - */
348 - public function on_campaign_untrash($post_id, $previous_status)
349 - {
350 - $post_type = get_post_type($post_id);
351 - $post_status = get_post_status($post_id);
352 -
353 - if ($post_type === 'firebox' && $post_status === 'trash')
354 - {
355 - \FPFramework\Libs\AdminNotice::displaySuccess(firebox()->_('FB_CAMPAIGN_HAS_BEEN_RESTORED'));
356 - }
357 - }
358 -
359 - public function showNotices()
360 - {
361 - \FireBox\Core\Notices\Notices::getInstance()->show();
362 - }
363 -
364 72
365 73 public function global_backend_assets()
366 74 {
367 75 wp_register_style(
@@ -376,16 +84,13 @@
376 84
377 85
378 86 public function current_screen($screen)
379 87 {
380 - add_action('admin_enqueue_scripts', [$this, 'registerEditorMedia'], 11);
381 - add_action('enqueue_block_assets', [$this, 'registerCampaignEditorAssets'], 12);
88 + if ($screen->id === 'firebox' && $screen->post_type === 'firebox')
89 + {
90 + add_action('admin_enqueue_scripts', [$this, 'registerMedia'], 11);
91 + }
382 92
383 - // Check for classic editor with firebox post type
384 - if (isset($screen->id) && $screen->id === 'firebox' && !$screen->is_block_editor) {
385 - add_action('admin_notices', [$this, 'showClassicEditorNotice']);
386 - }
387 -
388 93 $allowed_pages = [
389 94 'toplevel_page_firebox',
390 95 'firebox_page_firebox-campaigns',
391 96 'firebox_page_firebox-analytics',
@@ -401,135 +106,21 @@
401 106 add_filter('admin_footer_text', [$this, 'admin_footer_text']);
402 107 }
403 108 }
404 109
405 - /**
406 - * Shows a notice when using classic editor with firebox post type
407 - *
408 - * @return void
409 - */
410 - public function showClassicEditorNotice()
411 - {
412 - ?>
413 - <div class="notice notice-warning">
414 - <p><?php echo esc_html(firebox()->_('FB_CLASSIC_EDITOR_NOT_SUPPORTED')); ?></p>
415 - </div>
416 - <?php
417 - }
418 -
419 - public function registerEditorMedia()
110 + public function registerMedia()
420 111 {
421 112 wp_register_script('firebox-admin-editor', false);
422 113 wp_enqueue_script('firebox-admin-editor');
423 114
424 115 $data = [
425 - 'media_url' => FBOX_MEDIA_URL,
426 - 'timezone' => $this->getTimezone(),
427 - 'license_type' => FBOX_LICENSE_TYPE,
428 - 'license_plan' => FBOX_LICENSE_PLAN,
429 - 'langs' => [
430 - 'LITE' => fpframework()->_('FPF_LITE'),
431 - ]
116 + 'timezone' => $this->getTimezone()
432 117 ];
433 118
434 119 wp_localize_script('firebox-admin-editor', 'fbox_admin_editor_js_object', $data);
435 - }
436 120
437 - public function registerCampaignEditorAssets()
438 - {
439 - if (!is_admin())
440 - {
441 - return;
442 - }
443 -
444 - // Enqueue block editor style only in Gutenberg editor
445 - if (!function_exists('get_current_screen'))
446 - {
447 - return;
448 - }
449 -
450 - $screen = get_current_screen();
451 - if (!$screen->is_block_editor)
452 - {
453 - return;
454 - }
455 -
456 - wp_enqueue_script(
457 - 'firebox-helper-store',
458 - FBOX_MEDIA_ADMIN_URL . 'js/blocks/helper_store.js',
459 - ['wp-data'],
460 - FBOX_VERSION,
461 - false
462 - );
463 -
464 - wp_enqueue_style(
465 - 'firebox-blocks',
466 - FBOX_MEDIA_PUBLIC_URL . 'css/blocks.css',
467 - [],
468 - FBOX_VERSION
469 - );
470 -
471 - $css = '
472 - :root {
473 - --firebox-editor-background-image: url(' . FBOX_MEDIA_ADMIN_URL . 'images/browser-bg.png);
474 - }
475 - ';
476 - wp_add_inline_style('firebox-blocks', $css);
477 -
478 - if (get_post_type() !== 'firebox')
479 - {
480 - return;
481 - }
482 -
483 - wp_register_script('firebox-campaign-editor', false);
484 - wp_enqueue_script('firebox-campaign-editor');
485 -
486 - $data = [
487 - 'plugins' => [
488 - 'wpml_active' => \is_plugin_active('sitepress-multilingual-cms/sitepress.php'),
489 - 'edd_active' => \is_plugin_active('easy-digital-downloads/easy-digital-downloads.php') || \is_plugin_active('easy-digital-downloads-pro/easy-digital-downloads.php'),
490 - 'woo_active' => \is_plugin_active('woocommerce/woocommerce.php')
491 - ],
492 - 'geolocation_updated' => !\FPFramework\Helpers\Geolocation::geoNeedsUpdate(),
493 - 'geolocation_update_url' => admin_url('admin.php?page=firebox-settings#geolocation'),
494 - 'geolocation_city_notice' => (new \FPFramework\Base\Conditions\Conditions\Geo\City())->getValueHint(),
495 - 'geolocation_country_notice' => (new \FPFramework\Base\Conditions\Conditions\Geo\Country())->getValueHint(),
496 - 'geolocation_region_notice' => (new \FPFramework\Base\Conditions\Conditions\Geo\Region())->getValueHint(),
497 - 'geolocation_continent_notice' => (new \FPFramework\Base\Conditions\Conditions\Geo\Continent())->getValueHint(),
498 - 'countries_list' => \FPFramework\Helpers\CountriesHelper::getCountriesList(),
499 - 'user_ip' => \FPFramework\Base\User::getIP(),
500 - 'currency' => $this->getCurrency()
501 - ];
502 -
503 - wp_localize_script('firebox-campaign-editor', 'firebox_campaign_editor', $data);
504 121 }
505 122
506 - /**
507 - * Returns the current eCommerce solution's currency.
508 - *
509 - * @return string
510 - */
511 - private function getCurrency()
512 - {
513 - $output = '';
514 -
515 - $eddActive = \is_plugin_active('easy-digital-downloads/easy-digital-downloads.php') || \is_plugin_active('easy-digital-downloads-pro/easy-digital-downloads.php');
516 - if ($eddActive)
517 - {
518 - $output = \edd_get_currency();
519 - }
520 - else
521 - {
522 - $wooActive = \is_plugin_active('woocommerce/woocommerce.php');
523 - if ($wooActive)
524 - {
525 - $output = \get_woocommerce_currency();
526 - }
527 - }
528 -
529 - return $output;
530 - }
531 -
532 123 public function admin_footer_text()
533 124 {
534 125 return;
535 126 }
@@ -543,8 +134,32 @@
543 134 {
544 135 new Media();
545 136
546 137 $this->library = firebox()->library;
138 +
139 + // Update Notice
140 + $valid_pages = [
141 + 'firebox',
142 + 'firebox-campaigns',
143 + 'firebox-analytics',
144 + 'firebox-import',
145 + 'firebox-submissions',
146 + 'firebox-settings'
147 + ];
148 + $updateNotice = new \FPFramework\Admin\Includes\UpdateNotice(
149 + firebox()->plugin_slug,
150 + firebox()->plugin_name,
151 + FBOX_VERSION,
152 + $valid_pages
153 + );
154 + $updateNotice->init();
155 +
156 + // Review Reminder
157 + new \FPFramework\Admin\Includes\ReviewReminder(
158 + firebox()->plugin_slug,
159 + firebox()->plugin_name,
160 + FBOX_MEDIA_ADMIN_URL
161 + );
547 162 }
548 163
549 164 /**
550 165 * Runs all Admin Actions
@@ -564,16 +179,11 @@
564 179 {
565 180 wp_register_style('firebox-global-admin', false);
566 181 wp_enqueue_style('firebox-global-admin');
567 182 $css = '
568 - #adminmenu li.toplevel_page_firebox .wp-menu-image {
569 - padding: 4px 0 0 0;
570 - height: auto;
571 - }
572 183 #adminmenu li.toplevel_page_firebox img {
573 - width: 20px !important;
574 - padding: 0;
575 - padding-top: 3px !important;
184 + max-height: 22px;
185 + padding-top: 6px;
576 186 }
577 187 ';
578 188 wp_add_inline_style('firebox-global-admin', $css);
579 189 }
@@ -589,9 +199,9 @@
589 199 */
590 200 public function plugin_action_links($links)
591 201 {
592 202 $links = array_merge( $links, array(
593 - '<a href="' . sprintf(FBOX_GO_PRO_URL, 'pro') . '" class="firebox-go-pro-link" title="' . fpframework()->_('FPF_UNLOCK_MORE_FEATURES_WITH_PRO_READ_MORE') . '">' . firebox()->_('FB_UPGRADE_20_OFF') . '</a>'
203 + '<a href="' . FBOX_GO_PRO_URL . '" class="firebox-go-pro-link" title="' . fpframework()->_('FPF_UNLOCK_MORE_FEATURES_WITH_PRO_READ_MORE') . '">' . firebox()->_('FB_UPGRADE_20_OFF') . '</a>'
594 204 ) );
595 205
596 206 return $links;
597 207 }
@@ -621,10 +231,10 @@
621 231 public function addPluginMetaLinks($links, $file, $plugin_data, $status)
622 232 {
623 233 if ($file === FBOX_PLUGIN_BASENAME)
624 234 {
625 - $links['rate'] = '<a href="https://wordpress.org/support/plugin/firebox/reviews/#new-post" aria-label="' . esc_attr(firebox()->_('FB_RATE_FIREBOX')) . '" target="_blank">' . esc_html(firebox()->_('FB_RATE_FIREBOX')) . '</a>';
626 - $links['support'] = '<a href="' . \FPFramework\Base\Functions::getUTMURL('https://www.fireplugins.com/contact/', '', 'misc', 'support') . '" aria-label="' . esc_attr(fpframework()->_('FPF_SUPPORT')) . '" target="_blank">' . esc_html(fpframework()->_('FPF_SUPPORT')) . '</a>';
235 + $links['rate'] = '<a href="https://wordpress.org/support/plugin/firebox/reviews/?filter=5#new-post" aria-label="' . esc_attr__(firebox()->_('FB_RATE_FIREBOX')) . '" target="_blank">' . esc_html__(firebox()->_('FB_RATE_FIREBOX')) . '</a>';
236 + $links['support'] = '<a href="https://www.fireplugins.com/contact/" aria-label="' . esc_attr__(fpframework()->_('FPF_SUPPORT')) . '" target="_blank">' . esc_html__(fpframework()->_('FPF_SUPPORT')) . '</a>';
627 237 }
628 238
629 239 return $links;
630 240 }
@@ -652,9 +262,9 @@
652 262 $fireplugins_theme = isset($_COOKIE['fireplugins_theme']) ? sanitize_key($_COOKIE['fireplugins_theme']) : 'light';
653 263 $classes .= ' ' . $fireplugins_theme;
654 264
655 265 // Set admin template sidebar toggle class
656 - $sidebar_state = isset($_COOKIE['fireplugins_sidebar_state']) ? sanitize_key($_COOKIE['fireplugins_sidebar_state']) : 'expand';
266 + $sidebar_state = isset($_COOKIE['fireplugins_sidebar_state']) ? $_COOKIE['fireplugins_sidebar_state'] : 'expand';
657 267 $classes .= ' ' . ($sidebar_state === 'expand' ? 'fpf-admin-sidebar-expand' : 'fpf-admin-sidebar-shrink');
658 268
659 269 return $classes;
660 270 }
@@ -665,9 +275,9 @@
665 275 * @return boolean
666 276 */
667 277 private function isPluginPage()
668 278 {
669 - if (in_array($this->getPageNow(), ['edit.php', 'post-new.php']) && isset($_GET['post_type']) && $_GET['post_type'] == 'firebox') //phpcs:ignore WordPress.Security.NonceVerification.Recommended
279 + if (in_array($this->getPageNow(), ['edit.php', 'post-new.php']) && isset($_GET['post_type']) && $_GET['post_type'] == 'firebox')
670 280 {
671 281 return true;
672 282 }
673 283
@@ -772,22 +382,18 @@
772 382 {
773 383 wp_register_script('firebox-admin', false);
774 384 wp_enqueue_script('firebox-admin');
775 385
776 -
777 -
778 386 $data = array(
387 + 'media_url' => FBOX_MEDIA_URL,
779 388 'campaigns_item_new_url' => admin_url('post-new.php?post_type=firebox'),
780 389 'campaigns_list_url' => admin_url('admin.php?page=firebox-campaigns'),
781 390 'campaigns_item_edit_url' => admin_url('post.php?post={{ID}}&action=edit'),
782 391 'campaigns_item_analytics_url' => admin_url('admin.php?page=firebox-analytics&campaign={{ID}}'),
783 392 'campaigns_analytics_url' => admin_url('admin.php?page=firebox-analytics'),
393 + 'admin_url' => get_admin_url(),
784 394 'submissions_page' => admin_url('admin.php?page=firebox-submissions'),
785 395 'flags_url' => FBOX_PLUGIN_URL . 'Inc/Framework/media/admin/images/flags/{{FLAG}}.png',
786 - 'license_type' => FBOX_LICENSE_TYPE,
787 - 'license_plan' => FBOX_LICENSE_PLAN,
788 -
789 -
790 396 'langs' => [
791 397 'CAMPAIGN_INFO' => firebox()->_('FB_CAMPAIGN_INFO'),
792 398 'EDIT_CAMPAIGN' => firebox()->_('FB_EDIT_CAMPAIGN'),
793 399 'STATUS' => fpframework()->_('FPF_STATUS'),
@@ -794,16 +400,15 @@
794 400 'CREATED' => fpframework()->_('FPF_CREATED'),
795 401 'LAST_VIEWED' => firebox()->_('FB_LAST_VIEWED'),
796 402 'ACTIVE' => firebox()->_('FB_ACTIVE'),
797 403 'DISABLED' => fpframework()->_('FPF_DISABLED'),
404 + 'POPUP_TRIGGER' => firebox()->_('FB_POPUP_TRIGGER'),
405 + 'POPUP_POSITION' => firebox()->_('FB_POPUP_POSITION'),
798 406 'ID' => fpframework()->_('FPF_ID'),
799 407 'CAMPAIGN' => firebox()->_('FB_CAMPAIGN'),
800 - 'VIEW' => firebox()->_('FB_VIEW'),
801 408 'VIEWS' => firebox()->_('FB_VIEWS'),
802 - 'CLICK' => firebox()->_('FB_CLICK'),
803 - 'CLICKS' => firebox()->_('FB_CLICKS'),
804 409 'ACTIONS' => firebox()->_('FB_ACTIONS'),
805 - 'CONVERSION' => firebox()->_('FB_CONVERSION'),
410 + 'AVERAGE_TIME_OPEN' => firebox()->_('FB_AVERAGE_TIME_OPEN'),
806 411 'CONVERSIONS' => firebox()->_('FB_CONVERSIONS'),
807 412 'CONVERSION_RATE' => firebox()->_('FB_CONVERSION_RATE'),
808 413 'NO_DATA_AVAILABLE' => firebox()->_('FB_NO_DATA_AVAILABLE'),
809 414 'COUNTRIES' => fpframework()->_('FPF_COUNTRIES'),
@@ -837,11 +442,32 @@
837 442 'RECENT_CAMPAIGNS' => firebox()->_('FB_RECENT_CAMPAIGNS'),
838 443 'VIEW_ALL' => firebox()->_('FB_VIEW_ALL'),
839 444 'YOU_HAVENT_CREATED_ANY_CAMPAIGNS_YET' => firebox()->_('FB_YOU_HAVENT_CREATED_ANY_CAMPAIGNS_YET'),
840 445 'NEW_CAMPAIGN' => firebox()->_('FB_NEW_CAMPAIGN'),
446 + 'ON_PAGE_LOAD' => firebox()->_('FB_ON_PAGE_LOAD'),
447 + 'ON_PAGE_READY' => firebox()->_('FB_ON_PAGE_READY'),
448 + 'ON_SCROLL_DEPTH' => firebox()->_('FB_ON_SCROLL_DEPTH'),
449 + 'ON_ELEMENT_VISIBILITY' => firebox()->_('FB_ON_ELEMENT_VISIBILITY'),
450 + 'ON_EXIT_INTENT' => firebox()->_('FB_ON_EXIT_INTENT'),
451 + 'ON_CLICK' => firebox()->_('FB_ON_CLICK'),
452 + 'ON_EXTERNAL_LINK_CLICK' => firebox()->_('FB_ON_EXTERNAL_LINK_CLICK'),
453 + 'ON_HOVER' => firebox()->_('FB_ON_HOVER'),
454 + 'ON_ADBLOCK_DETECT' => firebox()->_('FB_ON_ADBLOCK_DETECT'),
455 + 'ON_IDLDE' => firebox()->_('FB_ON_IDLDE'),
456 + 'VIA_FLOATING_BUTTON' => firebox()->_('FB_VIA_FLOATING_BUTTON'),
457 + 'MANUALLY' => firebox()->_('FB_METABOX_TRIGGER_METHOD_OD'),
458 + 'TOP_LEFT' => fpframework()->_('FPF_TOP_LEFT'),
459 + 'TOP_CENTER' => fpframework()->_('FPF_TOP_CENTER'),
460 + 'TOP_RIGHT' => fpframework()->_('FPF_TOP_RIGHT'),
461 + 'MIDDLE_LEFT' => fpframework()->_('FPF_MIDDLE_LEFT'),
462 + 'CENTER' => fpframework()->_('FPF_CENTER'),
463 + 'MIDDLE_RIGHT' => fpframework()->_('FPF_MIDDLE_RIGHT'),
464 + 'BOTTOM_LEFT' => fpframework()->_('FPF_BOTTOM_LEFT'),
465 + 'BOTTOM_CENTER' => fpframework()->_('FPF_BOTTOM_CENTER'),
466 + 'BOTTOM_RIGHT' => fpframework()->_('FPF_BOTTOM_RIGHT'),
467 + 'TRIGGER' => firebox()->_('FB_TRIGGER'),
468 + 'POSITION' => firebox()->_('FB_METABOX_POSITION'),
841 469 'NUMBER_OF_VIEWS_IN_THE_LAST_30_DAYS' => firebox()->_('FB_NUMBER_OF_VIEWS_IN_THE_LAST_30_DAYS'),
842 - 'NUMBER_OF_CONVERSIONS_IN_THE_LAST_30_DAYS' => firebox()->_('FB_NUMBER_OF_CONVERSIONS_IN_THE_LAST_30_DAYS'),
843 - 'CONVERSION_RATE_IN_THE_LAST_30_DAYS' => firebox()->_('FB_CONVERSION_RATE_IN_THE_LAST_30_DAYS'),
844 470 'LOADING_CAMPAIGNS' => firebox()->_('FB_LOADING_CAMPAIGNS'),
845 471 'NO_CAMPAIGNS_FOUND' => firebox()->_('FB_NO_CAMPAIGNS_FOUND'),
846 472 'SEARCH_DOTS' => firebox()->_('FB_SEARCH_DOTS'),
847 473 'TODAY' => firebox()->_('FB_TODAY'),
@@ -848,12 +474,11 @@
848 474 'YESTERDAY' => firebox()->_('FB_YESTERDAY'),
849 475 'LAST_7_DAYS' => firebox()->_('FB_LAST_7_DAYS'),
850 476 'LAST_30_DAYS' => firebox()->_('FB_LAST_30_DAYS'),
851 477 'LAST_WEEK' => firebox()->_('FB_LAST_WEEK'),
852 - 'MONTH_TO_DATE' => firebox()->_('FB_MONTH_TO_DATE'),
853 478 'LAST_MONTH' => firebox()->_('FB_LAST_MONTH'),
854 - 'YEAR_TO_DATE' => firebox()->_('FB_YEAR_TO_DATE'),
855 479 'CUSTOM' => firebox()->_('FB_CUSTOM'),
480 + 'AVG_TIME_OPEN_TOOLTIP_DESC' => firebox()->_('FB_AVG_TIME_OPEN_TOOLTIP_DESC'),
856 481 'READ_MORE' => firebox()->_('FB_READ_MORE'),
857 482 'AVG_TIME_OPEN' => firebox()->_('FB_AVG_TIME_OPEN'),
858 483 'CONVERSION_RATE_TOOLTIP_DESC' => firebox()->_('FB_CONVERSION_RATE_TOOLTIP_DESC'),
859 484 'CONVERSIONS_TOOLTIP_DESC' => firebox()->_('FB_CONVERSIONS_TOOLTIP_DESC'),
@@ -858,9 +483,8 @@
858 483 'CONVERSION_RATE_TOOLTIP_DESC' => firebox()->_('FB_CONVERSION_RATE_TOOLTIP_DESC'),
859 484 'CONVERSIONS_TOOLTIP_DESC' => firebox()->_('FB_CONVERSIONS_TOOLTIP_DESC'),
860 485 'VS_PREVIOUS_PERIOD' => firebox()->_('FB_VS_PREVIOUS_PERIOD'),
861 486 'VIEWS_TOOLTIP_DESC' => firebox()->_('FB_VIEWS_TOOLTIP_DESC'),
862 - 'CLICKS_TOOLTIP_DESC' => firebox()->_('FB_CLICKS_TOOLTIP_DESC'),
863 487 'NO' => firebox()->_('FB_NO'),
864 488 'DATA_AVAILABLE' => firebox()->_('FB_DATA_AVAILABLE'),
865 489 'PERFORMANCE' => firebox()->_('FB_PERFORMANCE'),
866 490 'TRENDING_TEMPLATES' => firebox()->_('FB_TRENDING_TEMPLATES'),
@@ -874,61 +498,11 @@
874 498 'UPGRADE_TO_PRO' => fpframework()->_('FPF_UPGRADE_TO_PRO'),
875 499 'ALL_CAMPAIGNS' => firebox()->_('FB_ALL_CAMPAIGNS'),
876 500 'OVERVIEW' => fpframework()->_('FPF_OVERVIEW'),
877 501 'TO' => fpframework()->_('FPF_TO'),
878 - 'SHOWING_TOP_30_RESULTS' => firebox()->_('FB_SHOWING_TOP_30_RESULTS'),
502 + 'SHOWING_FIRST_30_RESULTS' => firebox()->_('FB_SHOWING_FIRST_30_RESULTS'),
879 503 'DAY_OF_THE_WEEK' => firebox()->_('FB_DAY_OF_THE_WEEK'),
880 - 'ANALYTICS' => fpframework()->_('FPF_ANALYTICS'),
881 - 'SALES_FUNNEL' => firebox()->_('FB_SALES_FUNNEL'),
882 - 'SALES_FUNNEL_LOCKED_COPY' => firebox()->_('FB_SALES_FUNNEL_LOCKED_COPY'),
883 - 'PURCHASE' => firebox()->_('FB_PURCHASE'),
884 - 'PURCHASES' => firebox()->_('FB_PURCHASES'),
885 - 'INTERACTIONS' => firebox()->_('FB_INTERACTIONS'),
886 - 'FUNNEL_VISUALIZATION' => firebox()->_('FB_FUNNEL_VISUALIZATION'),
887 - 'OVERALL_CONVERSION_RATE' => firebox()->_('FB_OVERALL_CONVERSION_RATE'),
888 - 'REVENUE_CONVERSIONS' => firebox()->_('FB_REVENUE_CONVERSIONS'),
889 - 'LITE' => fpframework()->_('FPF_LITE'),
890 - 'FREE' => fpframework()->_('FPF_FREE'),
891 - 'PRO' => fpframework()->_('FPF_PRO'),
892 - 'FROM' => firebox()->_('FB_FROM'),
893 - 'OF' => firebox()->_('FB_OF'),
894 - 'USERS' => firebox()->_('FB_USERS'),
895 - 'TOTAL' => firebox()->_('FB_TOTAL'),
896 - 'TOTAL_POPUP_IMPRESSIONS' => firebox()->_('FB_TOTAL_POPUP_IMPRESSIONS'),
897 - 'REVENUE' => firebox()->_('FB_REVENUE'),
898 - 'REVENUE_TOOLTIP_DESC' => firebox()->_('FB_REVENUE_TOOLTIP_DESC'),
899 - 'VIEW_THROUGH_REVENUE' => firebox()->_('FB_VIEW_THROUGH_REVENUE'),
900 - 'VIEW_THROUGH_REVENUE_TOOLTIP_DESC' => firebox()->_('FB_VIEW_THROUGH_REVENUE_TOOLTIP_DESC'),
901 - 'CONVERSION_THROUGH_REVENUE' => firebox()->_('FB_CONVERSION_THROUGH_REVENUE'),
902 - 'CONVERSION_THROUGH_REVENUE_TOOLTIP_DESC' => firebox()->_('FB_CONVERSION_THROUGH_REVENUE_TOOLTIP_DESC'),
903 - 'REVENUE_ROI' => firebox()->_('FB_REVENUE_ROI'),
904 - 'REVENUE_ROI_TOOLTIP_TITLE' => firebox()->_('FB_REVENUE_ROI_TOOLTIP_TITLE'),
905 - 'REVENUE_ROI_TOTAL_REVENUE_GENERATED' => firebox()->_('FB_REVENUE_ROI_TOTAL_REVENUE_GENERATED'),
906 - 'REVENUE_ROI_LITE_MESSAGE' => firebox()->_('FB_REVENUE_ROI_LITE_MESSAGE'),
907 - 'REVENUE_ROI_PRO_MESSAGE' => firebox()->_('FB_REVENUE_ROI_PRO_MESSAGE'),
908 - 'LAST_4_WEEKS' => firebox()->_('FB_LAST_4_WEEKS'),
909 - 'LAST_6_MONTHS' => firebox()->_('FB_LAST_6_MONTHS'),
910 - 'LAST_12_MONTHS' => firebox()->_('FB_LAST_12_MONTHS'),
911 - 'QUARTER_TO_DATE' => firebox()->_('FB_QUARTER_TO_DATE'),
912 - 'AVAILABLE_IN_PRO' => firebox()->_('FB_AVAILABLE_IN_PRO'),
913 - 'PLAN_COST' => firebox()->_('FB_PLAN_COST'),
914 - 'LIFETIME_REVENUE' => firebox()->_('FB_LIFETIME_REVENUE'),
915 - 'YOUR_ROI' => firebox()->_('FB_YOUR_ROI'),
916 - 'UNLOCK_REVENUE_ROI' => firebox()->_('FB_UNLOCK_REVENUE_ROI'),
917 - 'GROWTH' => firebox()->_('FB_GROWTH'),
918 - 'AVAILABLE_IN' => firebox()->_('FB_AVAILABLE_IN'),
919 - 'PRO' => firebox()->_('FB_PRO'),
920 - 'BASIC' => firebox()->_('FB_BASIC'),
921 - 'UPGRADE_TO_X' => fpframework()->_('FPF_UPGRADE_TO_X'),
922 - 'UPGRADE_TO_X_PLAN' => fpframework()->_('FPF_UPGRADE_TO_X_PLAN'),
923 - 'FEATURE_AVAILABLE_IN_X_PLAN' => firebox()->_('FB_FEATURE_AVAILABLE_IN_X_PLAN'),
924 - 'SORRY_FEATURE_NOT_AVAILABLE_IN_YOUR_PLAN' => fpframework()->_('FPF_SORRY_FEATURE_NOT_AVAILABLE_IN_YOUR_PLAN'),
925 - 'PRO_MODAL_IS_PRO_FEATURE' => fpframework()->_('FPF_PRO_MODAL_IS_PRO_FEATURE'),
926 - 'PRO_MODAL_WERE_SORRY' => fpframework()->_('FPF_PRO_MODAL_WERE_SORRY'),
927 - 'PRO_MODAL_PERCENTAGE_OFF' => fpframework()->_('FPF_PRO_MODAL_PERCENTAGE_OFF'),
928 - 'CLICKS_TOOLTIP_DESC' => firebox()->_('FB_CLICKS_TOOLTIP_DESC'),
929 - 'VIEW_REVENUE' => firebox()->_('FB_VIEW_REVENUE'),
930 - 'CONVERSION_REVENUE' => firebox()->_('FB_CONVERSION_REVENUE'),
504 + 'ANALYTICS' => fpframework()->_('FPF_ANALYTICS')
931 505 ]
932 506 );
933 507
934 508 wp_localize_script('firebox-admin', 'fbox_admin_js_object', $data);
@@ -945,87 +519,5 @@
945 519 $hours = (int) $offset;
946 520 $minutes = abs(($offset - (int) $offset) * 60);
947 521 return sprintf('%+03d:%02d', $hours, $minutes);
948 522 }
949 -
950 -
951 -
952 -
953 -
954 - /**
955 - * Initialize onboarding for new users
956 - * Show on FireBox dashboard and all FireBox admin pages
957 - *
958 - * @return void
959 - */
960 - public function initOnboarding()
961 - {
962 - if (!current_user_can('manage_options'))
963 - {
964 - return;
965 - }
966 -
967 - $current_page = isset($_GET['page']) ? sanitize_key($_GET['page']) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
968 - $post_type = isset($_GET['post_type']) ? sanitize_key($_GET['post_type']) : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
969 - $post_id = isset($_GET['post']) ? absint($_GET['post']) : 0; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
970 -
971 - $resolved_post_type = $post_type;
972 - if (!$resolved_post_type && $post_id)
973 - {
974 - $post = get_post($post_id);
975 - $resolved_post_type = $post ? $post->post_type : '';
976 - }
977 -
978 - // Allowed FireBox dashboard pages
979 - $allowed_pages = [
980 - 'firebox',
981 - 'firebox-campaigns',
982 - 'firebox-analytics',
983 - 'firebox-submissions',
984 - 'firebox-settings',
985 - 'firebox-import'
986 - ];
987 -
988 - $on_firebox_admin_page = in_array($current_page, $allowed_pages, true);
989 - $on_firebox_editor = ($resolved_post_type === 'firebox');
990 -
991 - if (!$on_firebox_admin_page && !$on_firebox_editor)
992 - {
993 - return;
994 - }
995 -
996 - new Includes\Onboarding();
997 - }
998 -
999 - /**
1000 - * Redirect to FireBox dashboard after plugin activation
1001 - *
1002 - * @return void
1003 - */
1004 - public function redirectAfterActivation()
1005 - {
1006 - // Check if activation redirect option exists
1007 - if (!get_option('firebox_activation_redirect'))
1008 - {
1009 - return;
1010 - }
1011 -
1012 - // Clear the option
1013 - delete_option('firebox_activation_redirect');
1014 -
1015 - // Only redirect on the plugins page
1016 - if (!isset($_GET['activate'])) //phpcs:ignore WordPress.Security.NonceVerification.Recommended
1017 - {
1018 - return;
1019 - }
1020 -
1021 - // Prevent redirect if activating multiple plugins
1022 - if (is_network_admin() || isset($_GET['activate-multi'])) //phpcs:ignore WordPress.Security.NonceVerification.Recommended
1023 - {
1024 - return;
1025 - }
1026 -
1027 - // Redirect to FireBox dashboard
1028 - wp_safe_redirect(admin_url('admin.php?page=firebox'));
1029 - exit;
1030 - }
1031 -}
523 +}