PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.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 All 123 releases
← All changes | Inc/Core/Admin/Includes/Library.php +32 -154 1.0.8 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.8 Free
4 + * @version 3.1.14 Free
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2026 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\Includes;
@@ -15,130 +15,57 @@
15 15 {
16 16 exit; // Exit if accessed directly.
17 17 }
18 18
19 -use \FPFramework\Admin\Library\Library as FrameworkLibrary;
20 -
21 -class Library extends FrameworkLibrary
19 +class Library extends \FPFramework\Admin\Library\Library
22 20 {
23 - /**
24 - * The Modal ID.
25 - *
26 - * @var String
27 - */
28 - protected $modal_id = 'fbSelectTemplate';
29 -
30 - /**
31 - * Library categories.
32 - *
33 - * @var array
34 - */
35 - protected $categories = [
36 - 'all' => 'FPF_ALL',
37 - 'popup' => 'FB_POPUP',
38 - 'fullscreen' => 'FB_FULLSCREEN',
39 - 'slidein' => 'FB_SLIDEIN',
40 - 'floatingbar' => 'FB_FLOATING_BAR',
41 - 'sidebar' => 'FB_SIDEBAR',
42 - 'specials' => 'FB_SPECIALS'
43 - ];
44 -
45 - /**
46 - * The library settings
47 - *
48 - * @var array
49 - */
50 - protected $library_settings;
51 -
52 21 public function __construct()
53 22 {
54 - $this->setup();
23 + parent::__construct($this->getLibrarySettings());
55 24
56 25 add_action('current_screen', [$this, 'validate']);
57 -
58 - // set default post title
59 - add_filter('default_title', [$this, 'presetPostTitle'], 10, 2);
60 -
61 - // set default post content
62 - add_filter('default_content', [$this, 'presetPostContent']);
63 26 }
64 27
65 28 /**
66 - * Plugin library settings
29 + * Returns the library settings.
67 30 *
68 - * @return void
31 + * @return array
69 32 */
70 - private function setup()
33 + private function getLibrarySettings()
71 34 {
72 - $this->library_settings = [
73 - 'id' => $this->modal_id,
74 - 'title' => 'FB_LIBRARY',
75 - 'support_request_label' => 'FB_REQUEST_POPUP',
76 - 'categories' => $this->categories,
35 + return [
36 + 'id' => 'fbSelectTemplate',
37 + 'title' => firebox()->_('FB_CAMPAIGN_LIBRARY'),
38 + 'create_new_template_link' => admin_url('post-new.php?post_type=firebox'),
39 + 'main_category_label' => firebox()->_('FB_CAMPAIGN_TYPE'),
40 + 'plugin_license_settings_url' => admin_url('admin.php?page=firebox-settings#license_key'),
77 41 'plugin_dir' => FBOX_PLUGIN_DIR,
78 42 'plugin' => 'firebox',
43 + 'plugin_version' => FBOX_VERSION,
44 + 'plugin_license_type' => FBOX_LICENSE_TYPE,
79 45 'plugin_name' => firebox()->_('FB_PLUGIN_NAME'),
80 - 'blank_template_label' => 'FB_BLANK_POPUP',
81 - 'blank_template_desc' => 'FPF_START_FROM_SCRATCH',
82 - 'noresults_create_from_scratch_label' => 'FB_CREATE_FROM_SCRATCH',
83 - 'template_use_url' => 'post-new.php?post_type=firebox&template=',
84 - 'license_type' => FBOX_LICENSE_TYPE == 'pro' ? 'pro' : 'free'
46 +
47 + 'license_key' => false,
48 + 'license_key_status' => false,
49 +
50 +
51 + 'blank_template_label' => fpframework()->_('FPF_BLANK_TEMPLATE'),
52 + 'template_use_url' => 'post.php?action=edit&post='
85 53 ];
86 -
87 - $this->setupAjax();
88 54 }
89 55
90 56 /**
91 - * Set the default post title if we have selected a template via the Library
57 + * Old function used to find templates.
92 58 *
93 - * @param string $post_title
94 - * @param object $post
59 + * @param string $template
95 60 *
96 - * @return string
97 - */
98 - public function presetPostTitle($post_title, $post)
99 - {
100 - $template = isset($_GET['template']) ? sanitize_text_field($_GET['template']) : '';
101 -
102 - if ($template == 'blank')
103 - {
104 - return;
105 - }
106 -
107 - $box = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplate();
108 -
109 - if (empty($box))
110 - {
111 - return $post_title;
112 - }
113 -
114 - return $box->post_title;
115 - }
116 -
117 - /**
118 - * Sets the default post content if we have selected a template via the Library
61 + * @deprecated 1.1.0
119 62 *
120 - * @param string
121 - *
122 - * @return string
63 + * @return null
123 64 */
124 - public function presetPostContent($content)
65 + public function find($template = '')
125 66 {
126 - $template = isset($_GET['template']) ? sanitize_text_field($_GET['template']) : '';
127 -
128 - if ($template == 'blank')
129 - {
130 - return;
131 - }
132 -
133 - $box = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplate();
134 -
135 - if (empty($box))
136 - {
137 - return $content;
138 - }
139 -
140 - return $box->post_content;
67 + return;
141 68 }
142 69
143 70 /**
144 71 * Runs only on specific FireBox pages
@@ -150,8 +77,12 @@
150 77 $current_screen = get_current_screen();
151 78
152 79 $allowed_pages = [
153 80 'toplevel_page_firebox',
81 + 'firebox_page_firebox-analytics',
82 + 'firebox_page_firebox-campaigns',
83 + 'firebox_page_firebox-submissions',
84 + 'firebox_page_firebox-settings',
154 85 'edit-firebox'
155 86 ];
156 87
157 88 if (!in_array($current_screen->id, $allowed_pages))
@@ -158,60 +89,7 @@
158 89 {
159 90 return false;
160 91 }
161 92
162 - $this->run();
163 - }
164 -
165 - /**
166 - * Runs the module
167 - *
168 - * @return void
169 - */
170 - private function run()
171 - {
172 - // render custom actions
173 - add_action('fpframework/modal/' . $this->modal_id . '/header/prepend_actions', [$this, 'set_modal_actions']);
174 -
175 - // add custom footer links
176 - add_action('fpframework/library/' . $this->modal_id . '/footer/prepend_links', [$this, 'set_modal_footer_links']);
177 -
178 93 $this->init();
179 - }
180 -
181 - /**
182 - * Renders any other actions in the modal header
183 - *
184 - * @return void
185 - */
186 - public function set_modal_actions()
187 - {
188 - ?>
189 - <li>
190 - <a href="<?PHP echo admin_url('post-new.php?post_type=firebox&template=blank'); ?>" class="dashicons dashicons-plus-alt" title="<?php echo firebox()->_('FB_BLANK_POPUP'); ?>"></a>
191 - </li>
192 - <li>
193 - <a href="#" class="dashicons dashicons-update fpf-templates-refresh-btn" title="<?php echo fpframework()->_('FPF_REFRESH_TEMPLATES'); ?>"></a>
194 - </li>
195 - <li>
196 - <a href="<?php echo admin_url('admin.php?page=firebox-import'); ?>" class="dashicons dashicons-upload" title="<?php echo firebox()->_('FB_IMPORT_POPUP'); ?>"></a>
197 - </li>
198 - <li>
199 - <a href="<?php echo esc_url(FPF_SUPPORT_URL . '?topic=Custom%20Development&plugin=FireBox'); ?>" class="dashicons dashicons-email-alt" title="<?php echo firebox()->_('FB_REQUEST_POPUP'); ?>"></a>
200 - </li>
201 - <?php
202 - }
203 -
204 - /**
205 - * Renders any other actions in the modal header
206 - *
207 - * @return void
208 - */
209 - public function set_modal_footer_links()
210 - {
211 - ?>
212 - <li>
213 - <a class="parent" href="<?php echo admin_url('post-new.php?post_type=firebox&template=blank'); ?>"><?php echo esc_html(firebox()->_('FB_BLANK_POPUP')); ?></a>
214 - </li>
215 - <?php
216 94 }
217 95 }