PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 2.0.10
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v2.0.10
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/Includes/Library.php +53 -138 1.0.22.0.10 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FireBox
4 - * @version 1.0.2 Free
4 + * @version 2.0.10 Free
5 5 *
6 6 * @author FirePlugins <info@fireplugins.com>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2021 FirePlugins All Rights Reserved
8 + * @copyright Copyright © 2023 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,63 @@
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 26
58 27 // set default post title
59 - add_filter('default_title', [$this, 'presetPostTitle'], 10, 2);
28 + add_filter('default_title', [$this, 'presetPostTitle'], 100, 2);
60 29
61 30 // set default post content
62 - add_filter('default_content', [$this, 'presetPostContent']);
31 + add_filter('default_content', [$this, 'presetPostContent'], 200, 2);
63 32 }
64 33
65 34 /**
66 - * Plugin library settings
35 + * Returns the library settings.
67 36 *
68 - * @return void
37 + * @return array
69 38 */
70 - private function setup()
39 + private function getLibrarySettings()
71 40 {
72 - $this->library_settings = [
73 - 'id' => $this->modal_id,
74 - 'title' => 'FB_LIBRARY',
75 - 'support_request_label' => 'FB_REQUEST_POPUP',
76 - 'categories' => $this->categories,
41 + return [
42 + 'id' => 'fbSelectTemplate',
43 + 'title' => firebox()->_('FB_POPUP_LIBRARY'),
44 + 'create_new_template_link' => admin_url('post-new.php?post_type=firebox'),
45 + 'main_category_label' => firebox()->_('FB_POPUP_TYPES'),
46 + 'plugin_license_settings_url' => admin_url('admin.php?page=firebox-settings#license_key'),
77 47 'plugin_dir' => FBOX_PLUGIN_DIR,
78 48 'plugin' => 'firebox',
79 - 'plugin_name' => firebox()->_('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'
49 + 'plugin_version' => FBOX_VERSION,
50 + 'plugin_license_type' => FBOX_LICENSE_TYPE,
51 + 'plugin_name' => firebox()->_('FB_PLUGIN_NAME'),
52 +
53 + 'license_key' => false,
54 + 'license_key_status' => false,
55 +
56 +
57 + 'blank_template_label' => firebox()->_('FB_BLANK_POPUP'),
58 + 'template_use_url' => 'post-new.php?post_type=firebox&fpf_use_template=true&template='
85 59 ];
86 -
87 - $this->setupAjax();
88 60 }
89 61
90 62 /**
91 - * Set the default post title if we have selected a template via the Library
63 + * Old function used to find templates.
92 64 *
93 - * @param string $post_title
94 - * @param object $post
65 + * @param string $template
95 66 *
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
67 + * @deprecated 1.1.0
119 68 *
120 - * @param string
121 - *
122 - * @return string
69 + * @return null
123 70 */
124 - public function presetPostContent($content)
71 + public function find($template = '')
125 72 {
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;
73 + return;
141 74 }
142 75
143 76 /**
144 77 * Runs only on specific FireBox pages
@@ -158,60 +91,42 @@
158 91 {
159 92 return false;
160 93 }
161 94
162 - $this->run();
95 + $this->init();
163 96 }
164 97
165 98 /**
166 - * Runs the module
99 + * Set the default post title if we have selected a template via the Library
167 100 *
168 - * @return void
101 + * @param string $post_title
102 + * @param object $post
103 + *
104 + * @return string
169 105 */
170 - private function run()
106 + public function presetPostTitle($post_title, $post)
171 107 {
172 - // render custom actions
173 - add_action('fpframework/modal/' . $this->modal_id . '/header/prepend_actions', [$this, 'set_modal_actions']);
108 + if (!$template = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplateURL())
109 + {
110 + return;
111 + }
174 112
175 - // add custom footer links
176 - add_action('fpframework/library/' . $this->modal_id . '/footer/prepend_links', [$this, 'set_modal_footer_links']);
177 -
178 - $this->init();
113 + return $template['template']['post_title'];
179 114 }
180 115
181 116 /**
182 - * Renders any other actions in the modal header
117 + * Sets the default post content if we have selected a template via the Library
183 118 *
184 - * @return void
119 + * @param string
120 + *
121 + * @return string
185 122 */
186 - public function set_modal_actions()
123 + public function presetPostContent($content)
187 124 {
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 - }
125 + if (!$template = \FireBox\Core\Helpers\BoxHelper::getBoxFromTemplateURL())
126 + {
127 + return;
128 + }
203 129
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
130 + return $template['template']['post_content'];
216 131 }
217 132 }