-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsoter.php
103 lines (83 loc) · 2.13 KB
/
soter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* This plugin checks your site for vulnerabilities against the WPScan vulnerabilities database API.
*
* @package soter
*/
/**
* Plugin Name: Soter
* Plugin URI: https://github.com/ssnepenthe/soter
* Description: This plugin checks your site for vulnerabilities against the WPScan vulnerabilities database API.
* Version: 0.5.0
* Author: Ryan McLaughlin
* Author URI: https://github.com/ssnepenthe
* License: GPL-2.0
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain:
* Domain Path:
*/
if ( ! defined( 'ABSPATH' ) ) {
die;
}
/**
* Initializes the plugin.
*
* @return void
*/
function _soter_init() {
static $initialized = false;
if ( $initialized ) {
return;
}
$checker = new WP_Requirements\Plugin_Checker( 'Soter', __FILE__ );
// Short array syntax.
$checker->php_at_least( '5.4' );
// Register_setting() with args array.
$checker->wp_at_least( '4.7' );
if ( ! $checker->requirements_met() ) {
$checker->deactivate_and_notify();
return;
}
$plugin = _soter_instance();
register_activation_hook( $plugin['file'], [ $plugin, 'activate' ] );
register_deactivation_hook( $plugin['file'], [ $plugin, 'deactivate' ] );
add_action( 'plugins_loaded', [ $plugin, 'boot' ] );
$initialized = true;
}
/**
* Gets the plugin instance or a service contained within.
*
* @param string $id ID of container entry.
*
* @return mixed
*/
function _soter_instance( $id = null ) {
static $instance = null;
if ( null !== $instance ) {
return null === $id ? $instance : $instance[ $id ];
}
$instance = new Metis\Container( [
'dir' => plugin_dir_path( __FILE__ ),
'file' => __FILE__,
'name' => 'Soter',
'prefix' => 'soter',
'url' => 'https://github.com/ssnepenthe/soter',
'version' => '0.5.0',
] );
$instance->register( new Soter\Plugin_Provider() );
return _soter_instance( $id );
}
/**
* Require a file (once) if it exists.
*
* @param string $file The file to check and require.
*
* @return void
*/
function _soter_require_if_exists( $file ) {
if ( file_exists( $file ) ) {
require_once $file;
}
}
_soter_require_if_exists( __DIR__ . '/vendor/autoload.php' );
_soter_init();