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 +54 -74 3.1.8 → 3.1.14 View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2 /**
3 3 * @package FirePlugins Framework
4 - * @version 1.1.146
4 + * @version 1.2.6
5 5 *
6 6 * @author FirePlugins <[email protected]>
7 7 * @link https://www.fireplugins.com
8 8 * @copyright Copyright © 2026 FirePlugins All Rights Reserved
@@ -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,30 +68,32 @@
60 68 * @return void
61 69 */
62 70 function firepluginsframework_getFrameworkPriority($dir)
63 71 {
64 - $id = 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 = array_map('intval', explode('.', $version));
80 + $version = array_map('intval', array_pad(explode('.', $version), 3, 0));
68 81
69 - for ($i = 0; $i < count($version); $i++)
70 - {
71 - if ($i == 0)
72 - {
73 - $id -= $version[$i] * 105;
74 - }
75 - else if ($i == 1)
76 - {
77 - $id -= $version[$i] * 55;
78 - }
79 - else
80 - {
81 - $id -= $version[$i];
82 - }
83 - }
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]);
84 94
85 - return $id;
95 + return ($priorities[$dir] = $id);
86 96 }
87 97 }
88 98
89 99 /**
@@ -199,46 +209,40 @@
199 209 * @return void
200 210 */
201 211 function ($class)
202 212 {
203 - $base = dirname(__FILE__) . '/Inc/';
213 + static $namespaces = null;
204 214
205 - $namespaces = [
206 - 'FPFramework\\GeoIp2\\' => [ $base . 'Libs/Vendors/geoip2/geoip2/src/' ],
207 - 'FPFramework\\' => [ $base ],
208 - 'MaxMind\\Db\\' => [ $base . 'Libs/Vendors/maxmind-db/reader/src/MaxMind/Db/' ],
209 - 'MaxMind\\' => [ $base . 'Libs/Vendors/maxmind/web-service-common/src/' ],
210 - 'splitbrain\\PHPArchive\\' => [$base . 'Libs/Vendors/splitbrain/php-archive/src/' ],
211 - ];
212 -
213 - $found = false;
214 - foreach ($namespaces as $key => $value)
215 + if ($namespaces === null)
215 216 {
216 - if (strpos($class, $key) === 0)
217 - {
218 - $found = true;
219 - break;
220 - }
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 + ];
221 226 }
222 227
223 - if (!$found)
228 + foreach ($namespaces as $prefix => $dir)
224 229 {
225 - return;
226 - }
227 -
228 - $class = firepluginsframework_fixClassBasedOnNamespace($namespaces, $class);
230 + if (strpos($class, $prefix) === 0)
231 + {
232 + $file = $dir . str_replace('\\', '/', substr($class, strlen($prefix))) . '.php';
229 233
230 - $file = str_replace('\\', '/', $class) . '.php';
234 + if (file_exists($file))
235 + {
236 + require_once $file;
237 + }
231 238
232 - if (file_exists($file))
233 - {
234 - require_once $file;
239 + return;
240 + }
235 241 }
236 242 }
237 243 );
238 244
239 - \FPFramework\Base\Session::getInstance()->init();
240 -
241 245 // load once
242 246 if (FPF_LOADED == $priority)
243 247 {
244 248 /**
@@ -254,28 +258,4 @@
254 258 do_action('fpf_admin_init');
255 259 }
256 260 }
257 261 }, firepluginsframework_getFrameworkPriority(dirname(__DIR__)));
258 -
259 -if (!function_exists('firepluginsframework_fixClassBasedOnNamespace'))
260 -{
261 - /**
262 - * Fixes the class paths
263 - *
264 - * @param string $namespaces
265 - * @param string $class
266 - *
267 - * @return void
268 - */
269 - function firepluginsframework_fixClassBasedOnNamespace($namespaces, $class)
270 - {
271 - foreach ($namespaces as $key => $value)
272 - {
273 - if (strpos($class, $key) !== FALSE)
274 - {
275 - $class = str_replace($key, $value[0], $class);
276 - }
277 - }
278 -
279 - return $class;
280 - }
281 -}