-
Notifications
You must be signed in to change notification settings - Fork 1
/
wpaudit.php
71 lines (53 loc) · 1.73 KB
/
wpaudit.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
<?php
/*
* Plugin Name: WPAudit
* Description: Enhance the security of your WordPress website with a plugin designed to verify the integrity of your installed plugins
* Version: 1.0
* Plugin URI: https://wpaudit.unitedover.com/
* Author URI: https://www.unitedover.com/
* Author: UnitedOver
* Text Domain: wpaudit
* Requires PHP: 5.5
* Domain Path: /languages
* Update URI: https://wpaudit.unitedover.com/
*/
use WPAudit\core\HashVerifier;
use WPAudit\core\renderer\Settings;
defined('ABSPATH') || exit;
require_once plugin_dir_path(__FILE__) . 'core/class-menu.php';
require_once plugin_dir_path(__FILE__) . 'core/renderer/class-settings.php';
function wpaudit_version()
{
return '1.0';
}
function wpaudit()
{
\WPAudit\core\Menu::admin_menu();
}
function wpaudit_supported_plugins()
{
$response = wp_remote_request(Settings::hash_base_url() . 'plugins.json');
if ($response instanceof WP_Error) {
wp_die($response->get_error_message());
}
$response_object = $response['http_response']->get_response_object();
$status_code = $response_object->status_code;
if ($status_code != 200) {
$error = esc_attr__('Error occurred while fetching plugins list, Status Code:%s', 'wpaudit');
wp_die(sprintf($error, $status_code));
}
$plugins_list = $response_object->body;
return json_decode($plugins_list, JSON_OBJECT_AS_ARRAY);
}
function wpaudit_verify_plugin()
{
require_once plugin_dir_path(__FILE__) . 'core/class-hashverifier.php';
$verifier = new HashVerifier();
$verifier->process_request($_REQUEST);
}
add_action('wp_ajax_wpaudit_verify_plugin', 'wpaudit_verify_plugin');
function get_wpaudit_asset_uri($path)
{
return plugins_url($path, __FILE__);
}
wpaudit();