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-ap.php

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

59 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Do not run if already executed.
4 if ( defined( 'PS_FW_MU_RAN' ) ) {
5 return;
6 }
7
8 // Attempt to load config file.
9 if ( ! file_exists( __DIR__ . '/../../../pslogs/config.php' ) || ! file_exists ( __DIR__ . '/../lib/patchstack/vendor/autoload.php' ) ) {
10 return;
11 }
12
13 // Define path to pslogs.
14 define( 'PS_LOGS', __DIR__ . '/../../../pslogs/' );
15 define( 'PS_PATH', __DIR__ . '/../' );
16
17 // Parse options.
18 $ps_options = @include( PS_LOGS . 'config.php' );
19 if ( ! is_array( $ps_options ) || count( $ps_options ) === 0 ) {
20 return;
21 }
22
23 // Include the helper functions.
24 require_once __DIR__ . '/mu-plugin-helper.php';
25
26 // Attempt to load the proper config, if on multisite.
27 if ( count( $ps_options ) != 1 ) {
28 $ps_options = patchstack_get_active_domain( $ps_options );
29 } else {
30 $ps_options = $ps_options[0];
31 }
32
33 // Do not run if we're not supposed to.
34 if ( ! patchstack_get_should_run( $ps_options ) ) {
35 return;
36 }
37
38 // Initialize and launch.
39 try {
40 // Load the extension.
41 require_once __DIR__ . '/../lib/patchstack/vendor/autoload.php';
42 $extension = new Patchstack\Extensions\WordPress\ExtensionAP( $ps_options );
43
44 // Initiate the firewall processor with our settings.
45 $firewall = new Patchstack\Processor(
46 $extension,
47 json_decode( base64_decode( $ps_options['patchstack_firewall_rules_v3_ap'] ), true ),
48 [],
49 ['mustUsePluginCall' => true],
50 [],
51 []
52 );
53
54 // Launch the firewall.
55 $firewall->launch();
56 } catch ( \Exception $e ) {
57 //
58 }
59