PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.8.7
SiteGuard WP Plugin v1.8.7
1.8.7 1.8.6 1.8.6-beta1 1.8.6-beta2 1.8.4 1.8.5 1.8.3 1.8.2 1.8.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.4.3 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.11 1.7.12 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.0-beta1 1.8.0-beta2 1.8.0-beta3 1.8.0-beta4
siteguard / classes / siteguard-disable-xmlrpc.php
siteguard / classes Last commit date
siteguard-admin-filter.php 1 month ago siteguard-base.php 1 month ago siteguard-captcha.php 1 month ago siteguard-config.php 11 months ago siteguard-disable-author-query.php 2 weeks ago siteguard-disable-pingback.php 1 month ago siteguard-disable-xmlrpc.php 1 month ago siteguard-htaccess.php 2 weeks ago siteguard-login-alert.php 1 month ago siteguard-login-history.php 1 month ago siteguard-login-lock.php 1 month ago siteguard-rename-login.php 1 week ago siteguard-updates-notify.php 1 month ago siteguard-waf-exclude-rule.php 1 month ago
siteguard-disable-xmlrpc.php
63 lines
1 <?php
2
3 class SiteGuard_Disable_XMLRPC extends SiteGuard_Base {
4 public static $htaccess_mark = '#==== SITEGUARD_DISABLE_XMLRPC_SETTINGS';
5
6 function __construct() {
7 global $siteguard_config;
8 if ( '1' === $siteguard_config->get( 'disable_xmlrpc_enable' ) ) {
9 $this->add_filters();
10 }
11 }
12
13 static function get_mark() {
14 return self::$htaccess_mark;
15 }
16
17 function init() {
18 global $siteguard_config;
19 $siteguard_config->set( 'disable_xmlrpc_enable', '0' );
20 $siteguard_config->update();
21 }
22
23 private function add_filters() {
24 add_filter( 'xmlrpc_enabled', '__return_false', 99 );
25 add_filter( 'wp_headers', array( $this, 'remove_pingback_header' ), 99 );
26 add_action( 'plugins_loaded', array( $this, 'early_block_xmlrpc' ), 0 );
27 }
28
29 public function remove_pingback_header( $headers ) {
30 if ( isset( $headers['X-Pingback'] ) ) {
31 unset( $headers['X-Pingback'] );
32 }
33 return $headers;
34 }
35
36 public function early_block_xmlrpc() {
37 global $siteguard_config;
38 if ( '1' !== $siteguard_config->get( 'disable_xmlrpc_enable' ) ) {
39 return;
40 }
41 if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
42 status_header( 403 );
43 nocache_headers();
44 exit;
45 }
46 }
47
48 function feature_on() {
49 global $siteguard_config;
50 $siteguard_config->set( 'disable_xmlrpc_enable', '1' );
51 $siteguard_config->update();
52 $this->add_filters();
53 return true;
54 }
55
56 static function feature_off() {
57 global $siteguard_config;
58 $siteguard_config->set( 'disable_xmlrpc_enable', '0' );
59 $siteguard_config->update();
60 return true;
61 }
62 }
63