PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.14
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 / Frontend.php

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

106 lines 2.1 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 2.1.14 Free
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2024 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FireBox\Core;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 class Frontend
20 {
21 public function __construct()
22 {
23 // ensure we run only on front-end
24 if (is_admin())
25 {
26 return;
27 }
28
29 // Prepare Gutenberg Blocks that contain attributes by FireBox
30 new \FireBox\Core\FB\BoxBlocksParser();
31
32 /**
33 * Event that runs before any rendering of popups.
34 */
35 do_action('firebox/boxes/before_render');
36
37 add_action('template_redirect', [$this, 'render']);
38
39 \FireBox\Core\Helpers\Actions::run();
40
41 /**
42 * Event that runs after popups have been rendered.
43 */
44 do_action('firebox/boxes/after_render');
45 }
46
47 /**
48 * Renders all boxes on front-end
49 *
50 * @return void
51 */
52 public function render()
53 {
54 if ($this->checkForBoxPreview())
55 {
56 return;
57 }
58
59 // Don't render the popup if previewing with third party page builders
60 if (!$this->canRenderInEditors())
61 {
62 return;
63 }
64
65 // increment session counter
66 \FPFramework\Libs\Functions::incrementSession();
67
68 /**
69 * Adds all boxes at the end of page.
70 */
71 firebox()->boxes->render();
72 }
73
74 /**
75 * Don't render when previewing with third party page builders.
76 *
77 * @return boolean
78 */
79 private function canRenderInEditors()
80 {
81 // Don't render the popup if previewing with Elementor
82 if (class_exists('\Elementor\Plugin') && \Elementor\Plugin::$instance->preview->is_preview_mode())
83 {
84 return;
85 }
86
87 // Don't render the popup if previewing with Beaver Builder
88 if (class_exists('\FLBuilderModel') && method_exists('\FLBuilderModel', 'is_builder_active') && \FLBuilderModel::is_builder_active())
89 {
90 return;
91 }
92
93 return true;
94 }
95
96 /**
97 * Check if we are previewing a box and do not show other boxes.
98 *
99 * @return boolean
100 */
101 private function checkForBoxPreview()
102 {
103 $previewer = new Previewer();
104 return $previewer->init();
105 }
106 }