PluginProbe
Patchstack – WordPress & Plugins Security / trunk
Patchstack – WordPress & Plugins Security vtrunk
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
patchstack / includes / mu-plugin.php

mu-plugin.php in Patchstack – WordPress & Plugins Security trunk, at includes/mu-plugin.php

57 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Do not allow the file to be called directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 // Do not run if already executed.
9 if ( defined( 'PS_FW_MU_RAN' ) ) {
10 return;
11 }
12
13 // Do not run if we're not supposed to.
14 if ( (int) get_option( 'patchstack_license_activated', 0 ) == 0 || get_option( 'patchstack_basic_firewall', 0 ) != 1 || get_option( 'patchstack_license_free', 0 ) == 1 ) {
15 return;
16 }
17
18 // Load essential WP core file.
19 require_once ABSPATH . 'wp-admin/includes/plugin.php';
20
21 // Determine if the Patchstack mu-plugin folder exists first, then fallback to checking normal plugin.
22 $pluginDir = WPMU_PLUGIN_DIR . '/patchstack';
23 if ( ! is_file( $pluginDir . '/patchstack.php' ) ) {
24 // Determine if the Patchstack plugin folder exists.
25 $pluginDir = WP_PLUGIN_DIR . '/patchstack';
26 if ( ! is_dir( $pluginDir ) || ! is_plugin_active( 'patchstack/patchstack.php' ) ) {
27 return;
28 }
29 }
30
31 // Determine if the core file exists.
32 if ( ! file_exists( $pluginDir . '/includes/core.php' ) || ! file_exists( $pluginDir . '/includes/firewall.php' ) ) {
33 return;
34 }
35
36 // Make sure to load essential files.
37 if ( ! class_exists( 'P_Firewall' ) || ! class_exists( 'P_Core' ) ) {
38 // Require the core and firewall files.
39 require_once $pluginDir . '/includes/core.php';
40 require_once $pluginDir . '/includes/firewall.php';
41
42 // For rare situations where it did not load properly.
43 if ( ! class_exists( 'P_Firewall' ) || ! class_exists( 'P_Core' ) ) {
44 return;
45 }
46 }
47
48 // Initialize and launch.
49 try {
50 $core = new P_Core( null );
51 new P_Firewall( true, $core, false, true );
52 } catch (\Exception $e) {
53 //
54 }
55
56 define( 'PS_FW_MU_RAN', true );
57