PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.1.37
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.1.37
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 / Helpers / Embed.php

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

115 lines 3.0 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.37 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\Helpers;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 class Embed
20 {
21 public static function renderCampaign($id = '')
22 {
23 if (!$id)
24 {
25 return;
26 }
27
28 $box = new \FireBox\Core\FB\Box($id);
29
30 if (!$box->getBox())
31 {
32 return;
33 }
34
35 // Abort if not enabled
36 if ($box->getBox()->post_status !== 'publish')
37 {
38 return;
39 }
40
41 wp_enqueue_style('fb-block-embed-campaign');
42
43 // Set mode to embed
44 $box->getCampaignParams()->set('mode', 'embed');
45
46 // Empty height
47 $box->getCampaignParams()->set('height_control', '');
48
49 // Remove cookie setting
50 $box->getCampaignParams()->set('assign_cookietype', 'never');
51
52 // Empty Display Conditions
53 $box->getCampaignParams()->set('rules', '');
54
55 // Empty actions
56 $box->getCampaignParams()->set('actions', '');
57
58 // Empty PHP Scripts > State > Open/Close
59 $box->getCampaignParams()->set('phpscripts.open', '');
60 $box->getCampaignParams()->set('phpscripts.close', '');
61
62 // Remove background overlay.
63 $box->getCampaignParams()->set('overlay', '0');
64
65 // Add a class suffix to the campaign.
66 $box->getCampaignParams()->set('classsuffix', $box->getCampaignParams()->get('classsuffix') . ' firebox-embedded-campaign');
67
68 // Disable prevent page scrolling.
69 $box->getCampaignParams()->set('preventpagescroll', '0');
70 $box->getCampaignParams()->set('zindex', '');
71
72 // Set it to appear on page load.
73 $box->getCampaignParams()->set('triggermethod', 'pageload');
74 $box->getCampaignParams()->set('triggerdelay', '0');
75 $box->getCampaignParams()->set('floating_button_show_on_close', '0');
76
77 // Remove the animation.
78 $box->getCampaignParams()->set('animationin', false);
79 $box->getCampaignParams()->set('animationout', false);
80
81 // Hide the close button.
82 $box->getCampaignParams()->set('closebutton.show', '0');
83
84 $isEditor = isset($_GET['editor']) && sanitize_key(wp_unslash($_GET['editor'])); //phpcs:ignore WordPress.Security.NonceVerification.Recommended
85 if ($isEditor)
86 {
87 /**
88 * Ignore Opening/Closing Behavior and Display Conditions.
89 *
90 * We need to display the campaign in the editor regardless.
91 */
92 $box->getCampaignParams()->set('rules', '');
93 $box->getCampaignParams()->set('assign_impressions_param_type', 'always');
94 $box->getCampaignParams()->set('assign_cookietype', 'never');
95
96 $box->prepare();
97
98 $payload = [
99 'box' => $box->getBox(),
100 'params' => $box->getParams(),
101 ];
102
103 $html = firebox()->renderer->public->render('box', $payload, true);
104
105 $css = $box->getCustomCSS();
106 $html = '<style>' . $css . '</style>' . $html;
107 }
108 else
109 {
110 $html = $box->renderEmbed();
111 }
112
113 return $html;
114 }
115 }