PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 1.1.0
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v1.1.0
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 / Framework / init.php

init.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 1.1.0, at Inc/Framework/init.php

284 lines 6.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FirePlugins Framework
4 * @version 1.0.29
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2022 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 if (!function_exists('add_action'))
13 {
14 // We are running outside of the context of WordPress.
15 return;
16 }
17
18 if (!function_exists('firepluginsframework_getFrameworkVersion'))
19 {
20 /**
21 * Return the framework version
22 *
23 * @param string $dir
24 *
25 * @return void
26 */
27 function firepluginsframework_getFrameworkVersion($dir)
28 {
29 $framework_file = 'framework.xml';
30
31 $xmlFile = $dir . '/Framework/' . $framework_file;
32
33 /**
34 * On development the xml file is located in /framework/source/framework.xml.
35 * On final zip, the file will rest on /Framework/framework.xml.
36 *
37 * Thus the check below.
38 */
39 $xmlFile = file_exists($xmlFile) ? $xmlFile : $dir . '/source/' . $framework_file;
40
41 $xml = [];
42
43 // load XML file
44 if (function_exists('simplexml_load_file'))
45 {
46 $xml = simplexml_load_file($xmlFile);
47 }
48
49 return isset($xml->version) ? (string) $xml->version : '1.0.0';
50 }
51 }
52
53 if (!function_exists('firepluginsframework_getFrameworkPriority'))
54 {
55 /**
56 * Return the framework priority
57 *
58 * @param string $dir
59 *
60 * @return void
61 */
62 function firepluginsframework_getFrameworkPriority($dir)
63 {
64 $max_int_size = PHP_INT_MAX;
65
66 $version = firepluginsframework_getFrameworkVersion($dir);
67 $version = str_replace('.', '', $version);
68
69 return $max_int_size - (int) $version;
70 }
71 }
72
73 /**
74 * Initialize the Framework
75 *
76 * @return void
77 */
78 add_action('init', function()
79 {
80 if (class_exists('\FPFramework\Framework'))
81 {
82 return;
83 }
84
85 $version = firepluginsframework_getFrameworkVersion(dirname(__DIR__));
86 $priority = firepluginsframework_getFrameworkPriority(dirname(__DIR__));
87
88 // Framework priority
89 if (!defined('FPF_LOADED'))
90 {
91 define('FPF_LOADED', $priority);
92 }
93
94 // Framework version
95 if (!defined('FPF_VERSION'))
96 {
97 define('FPF_VERSION', $version);
98 }
99
100 // Site URL
101 if (!defined('FPF_SITE_URL'))
102 {
103 define('FPF_SITE_URL', 'http://www.fireplugins.com/');
104 }
105
106 // Framework Folder Path
107 if (!defined('FPF_BASE_DIR'))
108 {
109 define('FPF_BASE_DIR', dirname(__DIR__));
110 }
111
112 // Framework Folder Path
113 if (!defined('FPF_DIR'))
114 {
115 define('FPF_DIR', plugin_dir_path(__FILE__) . 'Inc');
116 }
117
118 // Framework Layouts Folder Path
119 if (!defined('FPF_LAYOUTS_DIR'))
120 {
121 define('FPF_LAYOUTS_DIR', FPF_DIR . '/Layouts/');
122 }
123
124 // Support URL
125 if (!defined('FPF_SUPPORT_URL'))
126 {
127 define('FPF_SUPPORT_URL', FPF_SITE_URL . 'contact');
128 }
129
130 // Site Tower Endpoint
131 if (!defined('FPF_TOWER_ENDPOINT'))
132 {
133 define('FPF_TOWER_ENDPOINT', FPF_SITE_URL . 'wp-json/tower/v1/');
134 }
135
136 // The templates.fireplugins.com Site URL
137 if (!defined('FPF_TEMPLATES_SITE_URL'))
138 {
139 define('FPF_TEMPLATES_SITE_URL', 'https://templates.fireplugins.com/');
140 }
141
142 // Site Tower Endpoint
143 if (!defined('FPF_TEMPLATES_TOWER_ENDPOINT'))
144 {
145 define('FPF_TEMPLATES_TOWER_ENDPOINT', FPF_TEMPLATES_SITE_URL . 'wp-json/tower/v1/');
146 }
147
148 // URL to retrieve templates
149 if (!defined('FPF_TEMPLATES_GET_URL'))
150 {
151 define('FPF_TEMPLATES_GET_URL', FPF_TEMPLATES_TOWER_ENDPOINT . 'templates/{{PLUGIN}}/{{LICENSE_KEY}}/{{PLUGIN_VERSION}}/{{SITE_URL}}/get');
152 }
153
154 // URL to retrieve a template
155 if (!defined('FPF_TEMPLATE_GET_URL'))
156 {
157 define('FPF_TEMPLATE_GET_URL', FPF_TEMPLATES_TOWER_ENDPOINT . 'template/{{PLUGIN}}/{{TEMPLATE}}/{{LICENSE_KEY}}/{{SITE_URL}}/get');
158 }
159
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 /**
167 * Get License Version URL
168 */
169 if (!defined('FPF_GET_LICENSE_VERSION_URL'))
170 {
171 define('FPF_GET_LICENSE_VERSION_URL', FPF_TOWER_ENDPOINT . 'plugins/get_version/');
172 }
173
174 /**
175 * Plugin Changelog URL
176 */
177 if (!defined('FPF_PLUGIN_CHANGELOG_URL'))
178 {
179 define('FPF_PLUGIN_CHANGELOG_URL', FPF_SITE_URL . '%s/changelog/');
180 }
181
182 firepluginsframework_load_textdomain(dirname(__DIR__));
183
184 // Now kick off the class autoloader.
185 spl_autoload_register(
186 /**
187 * Autoload classes
188 *
189 * @param string $class
190 *
191 * @return void
192 */
193 function ($class)
194 {
195 $base = dirname(__FILE__) . '/Inc/';
196
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)
207 {
208 if (strpos($class, $key) === 0)
209 {
210 $found = true;
211 break;
212 }
213 }
214
215 if (!$found)
216 {
217 return;
218 }
219
220 $class = firepluginsframework_fixClassBasedOnNamespace($namespaces, $class);
221
222 $file = str_replace('\\', '/', $class) . '.php';
223
224 if (file_exists($file))
225 {
226 require_once $file;
227 }
228 }
229 );
230
231 // load once
232 if (FPF_LOADED == $priority)
233 {
234 /**
235 * Fires when FPFramework is included/loaded
236 */
237 do_action('fpf_init');
238
239 if (is_admin())
240 {
241 /**
242 * Fires on the admin side when FPFramework is included/loaded.
243 */
244 do_action('fpf_admin_init');
245 }
246 }
247 }, 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 }