PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.0.16
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.0.16
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.0.16, at Inc/Core/Frontend.php

105 lines 1.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 2.0.16 Free
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2023 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 use FPFramework\Libs\Registry;
20
21 class Frontend
22 {
23 public function __construct()
24 {
25 // ensure we run only on front-end
26 if (is_admin())
27 {
28 return;
29 }
30
31 // Prepare Gutenberg Blocks that contain attributes by FireBox
32 new \FireBox\Core\FB\BoxBlocksParser();
33
34 $this->prepare();
35
36 /**
37 * Event that runs before any rendering of popups.
38 */
39 do_action('firebox/boxes/before_render');
40
41 add_action('template_redirect', [$this, 'render']);
42
43 \FireBox\Core\Helpers\Actions::run();
44
45 /**
46 * Event that runs after popups have been rendered.
47 */
48 do_action('firebox/boxes/after_render');
49 }
50
51 private function prepare()
52 {
53 add_filter('the_content', [$this, 'prepareContent'], 0);
54 }
55
56 public function prepareContent($content)
57 {
58 global $post;
59
60 if (!$post instanceof \WP_Post)
61 {
62 return $content;
63 }
64
65 // Check if the current post type is 'firebox'
66 if ($post->post_type === 'firebox')
67 {
68 remove_filter('the_content', 'wptexturize');
69 }
70
71 return $content;
72 }
73
74 /**
75 * Renders all boxes on front-end
76 *
77 * @return void
78 */
79 public function render()
80 {
81 if ($this->checkForBoxPreview())
82 {
83 return;
84 }
85
86 // increment session counter
87 \FPFramework\Libs\Functions::incrementSession();
88
89 /**
90 * Adds all boxes at the end of page.
91 */
92 firebox()->boxes->render();
93 }
94
95 /**
96 * Check if we are previewing a box and do not show other boxes.
97 *
98 * @return boolean
99 */
100 private function checkForBoxPreview()
101 {
102 $previewer = new Previewer();
103 return $previewer->init();
104 }
105 }