PluginProbe
SiteLock Security – WP Hardening, Login Security & Malware Scans / 3.3.0
SiteLock Security – WP Hardening, Login Security & Malware Scans v3.3.0
trunk 1.2.1 2.0 2.1.0 2.1.1 3.0.0 3.1.0 3.1.1 3.1.2 3.2.1 3.3.0 3.4.0 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 5.0.0 All 31 releases
sitelock / sitelock.php

sitelock.php in SiteLock Security – WP Hardening, Login Security & Malware Scans 3.3.0, at sitelock.php

134 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The plugin bootstrap file
5 *
6 * This file is read by WordPress to generate the plugin information in the plugin
7 * admin area. This file also includes all of the dependencies used by the plugin,
8 * registers the activation and deactivation functions, and defines a function
9 * that starts the plugin.
10 *
11 * @link http://www.sitelock.com
12 * @since 1.9.0
13 * @package Sitelock
14 *
15 * @wordpress-plugin
16 * Plugin Name: SiteLock
17 * Plugin URI: http://www.sitelock.com/wordpress
18 * Description: Offers deep scan and site compliance
19 * Version: 3.3.0
20 * Author: SiteLock
21 * Author URI: http://www.sitelock.com
22 * License: GPL-2.0+
23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
24 * Text Domain: sitelock
25 * Domain Path: /languages
26 */
27
28 // If this file is called directly, abort.
29 if ( ! defined( 'WPINC' ) ) {
30 die;
31 }
32
33 // name of HTTP header with an initial IP
34 define( 'SITELOCK_IP_HEADER', "\x48\x54\x54\x50\x5f\x49\x4e\x43\x41\x50\x5f\x43\x4c\x49\x45\x4e\x54\x5f\x49\x50" );
35
36 try {
37 //stop process if there is no header
38 if ( empty( $_SERVER[ 'SITELOCK_IP_HEADER' ] ) ) {
39 throw new Exception( 'No header defined', 1 );
40 }
41
42 //validate header value
43 if ( function_exists( 'filter_var' ) ) {
44 $ip = filter_var( $_SERVER[ 'SITELOCK_IP_HEADER' ], FILTER_VALIDATE_IP );
45
46 if ( false === $ip ) {
47 throw new Exception( 'The value is not a valid IP address', 2 );
48 }
49 } else {
50 $ip = trim( $_SERVER[ 'SITELOCK_IP_HEADER' ] );
51
52 if ( false === preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $ip ) ) {
53 throw new Exception( 'The value is not a valid IP address', 2 );
54 }
55 }
56
57 //At this point the initial IP value is exist and validated
58 $_SERVER[ 'REMOTE_ADDR' ] = $ip;
59 } catch (Exception $e) {}
60
61 /**
62 * The code that runs during plugin activation.
63 * This action is documented in includes/class-sitelock-activator.php
64 */
65 function activate_sitelock() {
66 require_once plugin_dir_path( __FILE__ ) . 'includes/class-sitelock-activator.php';
67 Sitelock_Activator::activate();
68 }
69
70 /**
71 * The code that runs during plugin deactivation.
72 * This action is documented in includes/class-sitelock-deactivator.php
73 */
74 function deactivate_sitelock() {
75 require_once plugin_dir_path( __FILE__ ) . 'includes/class-sitelock-deactivator.php';
76 Sitelock_Deactivator::deactivate();
77 }
78
79 register_activation_hook( __FILE__, 'activate_sitelock' );
80 register_deactivation_hook( __FILE__, 'deactivate_sitelock' );
81
82 /**
83 * The core plugin class that is used to define internationalization,
84 * admin-specific hooks, and public-facing site hooks.
85 */
86 require plugin_dir_path( __FILE__ ) . 'includes/class-sitelock.php';
87
88 /**
89 * Begins execution of the plugin.
90 *
91 * Since everything within the plugin is registered via hooks,
92 * then kicking off the plugin from this point in the file does
93 * not affect the page life cycle.
94 *
95 * @since 1.9.0
96 */
97 function run_sitelock() {
98
99 $plugin = new Sitelock();
100 $plugin->run();
101
102 }
103 run_sitelock();
104
105
106 /**
107 * Handles the auth connection
108 */
109 $sitelockapi = new Sitelock_API;
110 add_action( 'admin_post_handle_auth_key', array( $sitelockapi, 'handle_auth' ) );
111
112
113 /**
114 * WP Head stuff
115 */
116 add_action( 'wp_head', 'sitelock_add_meta_tag' );
117
118
119 /**
120 * Manage Columns Addition
121 */
122 add_filter( 'manage_pages_columns', 'sitelock_page_sitelock_scan' );
123 add_action( 'manage_pages_custom_column', 'sitelock_page_sitelock_scan_results' );
124
125
126 /**
127 * Manage Columns Addition
128 */
129 add_action( 'wp_footer', 'sitelock_add_this_script_footer' );
130
131
132
133
134