PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.3.51
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.3.51
1.4.17 1.4.16 1.4.15 1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 All 180 releases
disco / vendor / inpsyde / assets / inc / bootstrap.php

bootstrap.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.3.51, at vendor/inpsyde/assets/inc/bootstrap.php

72 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Assets package.
5 *
6 * (c) Inpsyde GmbH
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 declare(strict_types=1);
13
14 namespace Inpsyde\Assets;
15
16 // Exit early in case multiple Composer autoloaders try to include this file.
17 if (defined(__NAMESPACE__.'\BOOTSTRAPPED')) {
18 return;
19 }
20
21 const BOOTSTRAPPED = true;
22
23 function bootstrap(): bool
24 {
25 // Prevent function is called more than once with same path as argument (which would mean load same file again)
26 static $done;
27 if ($done) {
28 return false;
29 }
30 $done = true;
31
32 (new AssetManager())->setup();
33
34 return $done;
35 }
36
37 /*
38 * This file is loaded by Composer autoload, and that may happen before `add_action` is available.
39 * In that case, we first try to load `plugin.php` before calling `add_action`.
40 */
41
42 $addActionExists = function_exists('add_action');
43 if (
44 $addActionExists
45 || (defined('ABSPATH') && defined('WP_INC') && file_exists(ABSPATH . WP_INC . '/plugin.php'))
46 ) {
47 if (!$addActionExists) {
48 require_once ABSPATH . WP_INC . '/plugin.php';
49 }
50
51 unset($addActionExists);
52 add_action('wp_loaded', __NAMESPACE__ . '\\bootstrap', 99);
53
54 return;
55 }
56
57 unset($addActionExists);
58
59 /**
60 * If here, this file is loaded very early, probably too-much early, even before ABSPATH was defined
61 * so only option we have is to "manually" write in global `$wp_filter` array.
62 */
63
64 global $wp_filter;
65 is_array($wp_filter) or $wp_filter = [];
66 isset($wp_filter['wp_loaded']) or $wp_filter['wp_loaded'] = [];
67 isset($wp_filter['wp_loaded'][99]) or $wp_filter['wp_loaded'][99] = [];
68 $wp_filter['wp_loaded'][99][__NAMESPACE__ . '\\bootstrap'] = [
69 'function' => __NAMESPACE__ . '\\bootstrap',
70 'accepted_args' => 0,
71 ];
72