| @@ -1,56 +1,52 @@ | ||
| 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 ); | |
| 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 ( 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 plugin folder exists. | |
| 22 | +$pluginDir = WP_PLUGIN_DIR . '/patchstack'; | |
| 23 | +if ( ! is_dir( $pluginDir ) || ! is_plugin_active( 'patchstack/patchstack.php' ) ) { | |
| 24 | + return; | |
| 25 | +} | |
| 26 | + | |
| 27 | +// Determine if the core file exists. | |
| 28 | +if ( ! file_exists( $pluginDir . '/includes/core.php' ) || ! file_exists( $pluginDir . '/includes/firewall.php' ) ) { | |
| 29 | + return; | |
| 30 | +} | |
| 31 | + | |
| 32 | +// Make sure to load essential files. | |
| 33 | +if ( ! class_exists( 'P_Firewall' ) || ! class_exists( 'P_Core' ) ) { | |
| 34 | + // Require the core and firewall files. | |
| 35 | + require_once $pluginDir . '/includes/core.php'; | |
| 36 | + require_once $pluginDir . '/includes/firewall.php'; | |
| 37 | + | |
| 38 | + // For rare situations where it did not load properly. | |
| 39 | + if ( ! class_exists( 'P_Firewall' ) || ! class_exists( 'P_Core' ) ) { | |
| 40 | + return; | |
| 41 | + } | |
| 42 | +} | |
| 43 | + | |
| 44 | +// Initialize and launch. | |
| 45 | +try { | |
| 46 | + $core = new P_Core( null ); | |
| 47 | + new P_Firewall( true, $core, false, true ); | |
| 48 | +} catch (\Exception $e) { | |
| 49 | + // | |
| 50 | +} | |
| 51 | + | |
| 52 | +define( 'PS_FW_MU_RAN', true ); | |