PluginProbe
SiteLock Security – WP Hardening, Login Security & Malware Scans / 4.0.2
SiteLock Security – WP Hardening, Login Security & Malware Scans v4.0.2
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 4.0.2, at sitelock.php

171 lines 4.5 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: 4.0.2
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 /* Create transient data */
70 set_transient( 'slwp-plugin-activation-notice', true, 5 );
71 }
72
73 /**
74 * The code that runs during plugin deactivation.
75 * This action is documented in includes/class-sitelock-deactivator.php
76 */
77 function deactivate_sitelock() {
78 require_once plugin_dir_path( __FILE__ ) . 'includes/class-sitelock-deactivator.php';
79 Sitelock_Deactivator::deactivate();
80 }
81
82 register_activation_hook( __FILE__, 'activate_sitelock' );
83 register_deactivation_hook( __FILE__, 'deactivate_sitelock' );
84
85 /**
86 * The core plugin class that is used to define internationalization,
87 * admin-specific hooks, and public-facing site hooks.
88 */
89 require plugin_dir_path( __FILE__ ) . 'includes/class-sitelock.php';
90
91 /**
92 * Begins execution of the plugin.
93 *
94 * Since everything within the plugin is registered via hooks,
95 * then kicking off the plugin from this point in the file does
96 * not affect the page life cycle.
97 *
98 * @since 1.9.0
99 */
100 function run_sitelock() {
101
102 $plugin = new Sitelock();
103 $plugin->run();
104
105 return $plugin->get_version();
106
107 }
108
109 $plugin_version = run_sitelock();
110
111
112 /**
113 * Handles the auth connection
114 */
115 $sitelockapi = new Sitelock_API( $plugin_version );
116 add_action( 'admin_post_handle_auth_key', array( $sitelockapi, 'handle_auth' ) );
117
118
119 /**
120 * WP Head stuff
121 */
122 add_action( 'wp_head', 'sitelock_add_meta_tag' );
123
124
125 /**
126 * Manage Columns Addition
127 */
128 add_filter( 'manage_pages_columns', 'sitelock_page_sitelock_scan' );
129 add_action( 'manage_pages_custom_column', 'sitelock_page_sitelock_scan_results' );
130
131
132 /**
133 * Manage Columns Addition
134 */
135 add_action( 'wp_footer', 'sitelock_add_this_script_footer' );
136
137
138 /**
139 * Add admin notice
140 */
141 add_action( 'admin_notices', 'slwp_plugin_activation_notice' );
142
143
144 /**
145 * Admin Notice on Activation.
146 *
147 * @since 3.5.0
148 */
149 function slwp_plugin_activation_notice()
150 {
151 /* Check transient, if available display notice */
152 if( get_transient( 'slwp-plugin-activation-notice' ) )
153 {
154 ?>
155 <div class="updated notice is-dismissible">
156 <p>Thank you for installing the SiteLock plugin. <a href="<?php echo admin_url( 'tools.php?page=sitelock' ); ?>">Click here</a> to get started.</p>
157 </div>
158 <?php
159
160 /**
161 * Delete transient, only display this notice once.
162 */
163 delete_transient( 'slwp-plugin-activation-notice' );
164 }
165 }
166
167
168
169
170
171