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/Framework/init.php +59 -82 1.1.0 → 3.1.14 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2 /**
3 3 * @package FirePlugins Framework
4 - * @version 1.0.29
4 + * @version 1.2.6
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 - * @copyright Copyright © 2022 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 if (!function_exists('add_action'))
@@ -25,16 +25,24 @@
25 25 * @return void
26 26 */
27 27 function firepluginsframework_getFrameworkVersion($dir)
28 28 {
29 + // Memoize the parsed framework.xml per directory so it is only parsed once per request.
30 + static $versions = [];
31 +
32 + if (isset($versions[$dir]))
33 + {
34 + return $versions[$dir];
35 + }
36 +
29 37 $framework_file = 'framework.xml';
30 -
38 +
31 39 $xmlFile = $dir . '/Framework/' . $framework_file;
32 -
40 +
33 41 /**
34 42 * On development the xml file is located in /framework/source/framework.xml.
35 43 * On final zip, the file will rest on /Framework/framework.xml.
36 - *
44 + *
37 45 * Thus the check below.
38 46 */
39 47 $xmlFile = file_exists($xmlFile) ? $xmlFile : $dir . '/source/' . $framework_file;
40 48
@@ -45,9 +53,9 @@
45 53 {
46 54 $xml = simplexml_load_file($xmlFile);
47 55 }
48 56
49 - return isset($xml->version) ? (string) $xml->version : '1.0.0';
57 + return ($versions[$dir] = isset($xml->version) ? (string) $xml->version : '1.0.0');
50 58 }
51 59 }
52 60
53 61 if (!function_exists('firepluginsframework_getFrameworkPriority'))
@@ -60,14 +68,32 @@
60 68 * @return void
61 69 */
62 70 function firepluginsframework_getFrameworkPriority($dir)
63 71 {
64 - $max_int_size = PHP_INT_MAX;
72 + static $priorities = [];
65 73
74 + if (isset($priorities[$dir]))
75 + {
76 + return $priorities[$dir];
77 + }
78 +
66 79 $version = firepluginsframework_getFrameworkVersion($dir);
67 - $version = str_replace('.', '', $version);
80 + $version = array_map('intval', array_pad(explode('.', $version), 3, 0));
68 81
69 - return $max_int_size - (int) $version;
82 + /**
83 + * Order the bundled frameworks so the newest one always registers first.
84 + *
85 + * Each component is weighted so it can never be outranked by the components below it.
86 + * The previous weights (105 / 55 / 1) let the patch number outgrow a minor bump, so
87 + * 1.1.150 loaded ahead of 1.2.0 and the older framework won.
88 + *
89 + * Bundles still shipping those weights produce offsets in the low hundreds, so any
90 + * bundle using the weights below outranks them. That is the correct outcome, as every
91 + * such bundle is by definition newer than the ones using the old weights.
92 + */
93 + $id = PHP_INT_MAX - (($version[0] * 1000000) + ($version[1] * 1000) + $version[2]);
94 +
95 + return ($priorities[$dir] = $id);
70 96 }
71 97 }
72 98
73 99 /**
@@ -99,9 +125,9 @@
99 125
100 126 // Site URL
101 127 if (!defined('FPF_SITE_URL'))
102 128 {
103 - define('FPF_SITE_URL', 'http://www.fireplugins.com/');
129 + define('FPF_SITE_URL', 'https://www.fireplugins.com/');
104 130 }
105 131
106 132 // Framework Folder Path
107 133 if (!defined('FPF_BASE_DIR'))
@@ -123,9 +149,9 @@
123 149
124 150 // Support URL
125 151 if (!defined('FPF_SUPPORT_URL'))
126 152 {
127 - define('FPF_SUPPORT_URL', FPF_SITE_URL . 'contact');
153 + define('FPF_SUPPORT_URL', FPF_SITE_URL . 'contact/');
128 154 }
129 155
130 156 // Site Tower Endpoint
131 157 if (!defined('FPF_TOWER_ENDPOINT'))
@@ -156,14 +182,8 @@
156 182 {
157 183 define('FPF_TEMPLATE_GET_URL', FPF_TEMPLATES_TOWER_ENDPOINT . 'template/{{PLUGIN}}/{{TEMPLATE}}/{{LICENSE_KEY}}/{{SITE_URL}}/get');
158 184 }
159 185
160 - // URL to check a license
161 - if (!defined('FPF_CHECK_LICENSE'))
162 - {
163 - define('FPF_CHECK_LICENSE', 'https://fireplugins.com/wp-json/tower/v1/license/check/{{LICENSE}}/{{PLUGIN}}/{{SITE_URL}}');
164 - }
165 -
166 186 /**
167 187 * Get License Version URL
168 188 */
169 189 if (!defined('FPF_GET_LICENSE_VERSION_URL'))
@@ -178,10 +198,8 @@
178 198 {
179 199 define('FPF_PLUGIN_CHANGELOG_URL', FPF_SITE_URL . '%s/changelog/');
180 200 }
181 201
182 - firepluginsframework_load_textdomain(dirname(__DIR__));
183 -
184 202 // Now kick off the class autoloader.
185 203 spl_autoload_register(
186 204 /**
187 205 * Autoload classes
@@ -191,44 +209,40 @@
191 209 * @return void
192 210 */
193 211 function ($class)
194 212 {
195 - $base = dirname(__FILE__) . '/Inc/';
213 + static $namespaces = null;
196 214
197 - $namespaces = [
198 - 'FPFramework\\' => [ $base ],
199 - 'GeoIp2\\' => [ $base . 'Libs/Vendors/geoip2/geoip2/src/' ],
200 - 'MaxMind\\Db\\' => [ $base . 'Libs/Vendors/maxmind-db/reader/src/MaxMind/Db/' ],
201 - 'MaxMind\\' => [ $base . 'Libs/Vendors/maxmind/web-service-common/src/' ],
202 - 'splitbrain\\PHPArchive\\' => [$base . 'Libs/Vendors/splitbrain/php-archive/src/' ],
203 - ];
204 -
205 - $found = false;
206 - foreach ($namespaces as $key => $value)
215 + if ($namespaces === null)
207 216 {
208 - if (strpos($class, $key) === 0)
209 - {
210 - $found = true;
211 - break;
212 - }
217 + $base = dirname(__FILE__) . '/Inc/';
218 +
219 + $namespaces = [
220 + 'FPFramework\\GeoIp2\\' => $base . 'Libs/Vendors/geoip2/geoip2/src/',
221 + 'FPFramework\\' => $base,
222 + 'MaxMind\\Db\\' => $base . 'Libs/Vendors/maxmind-db/reader/src/MaxMind/Db/',
223 + 'MaxMind\\' => $base . 'Libs/Vendors/maxmind/web-service-common/src/',
224 + 'splitbrain\\PHPArchive\\' => $base . 'Libs/Vendors/splitbrain/php-archive/src/',
225 + ];
213 226 }
214 227
215 - if (!$found)
228 + foreach ($namespaces as $prefix => $dir)
216 229 {
217 - return;
218 - }
219 -
220 - $class = firepluginsframework_fixClassBasedOnNamespace($namespaces, $class);
230 + if (strpos($class, $prefix) === 0)
231 + {
232 + $file = $dir . str_replace('\\', '/', substr($class, strlen($prefix))) . '.php';
221 233
222 - $file = str_replace('\\', '/', $class) . '.php';
234 + if (file_exists($file))
235 + {
236 + require_once $file;
237 + }
223 238
224 - if (file_exists($file))
225 - {
226 - require_once $file;
239 + return;
240 + }
227 241 }
228 242 }
229 243 );
230 -
244 +
231 245 // load once
232 246 if (FPF_LOADED == $priority)
233 247 {
234 248 /**
@@ -244,41 +258,4 @@
244 258 do_action('fpf_admin_init');
245 259 }
246 260 }
247 261 }, firepluginsframework_getFrameworkPriority(dirname(__DIR__)));
248 -
249 -if (!function_exists('firepluginsframework_load_textdomain'))
250 -{
251 - /**
252 - * Load textdomain of plugin
253 - *
254 - * @return void
255 - */
256 - function firepluginsframework_load_textdomain($dir)
257 - {
258 - load_plugin_textdomain('fpf-framework', false, $dir . '/Framework/languages/');
259 - }
260 -}
261 -
262 -if (!function_exists('firepluginsframework_fixClassBasedOnNamespace'))
263 -{
264 - /**
265 - * Fixes the class paths
266 - *
267 - * @param string $namespaces
268 - * @param string $class
269 - *
270 - * @return void
271 - */
272 - function firepluginsframework_fixClassBasedOnNamespace($namespaces, $class)
273 - {
274 - foreach ($namespaces as $key => $value)
275 - {
276 - if (strpos($class, $key) !== FALSE)
277 - {
278 - $class = str_replace($key, $value[0], $class);
279 - }
280 - }
281 -
282 - return $class;
283 - }
284 -}