Disable XML-RPC-API - Version 2.0.0

Version Description

  • Fix code conflict with some other plugin
  • Fix hiding data in WooCommerce Product Tabs
Download this release

Release Info

Developer aminnz
Plugin Icon 128x128 Disable XML-RPC-API
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.0.9 to 2.0.0

admin/admin.php CHANGED
@@ -1,7 +1,51 @@
1
  <?php
 
 
 
 
 
 
 
 
 
2
 
 
 
 
3
 
4
- function dsxmlrpc_admin_notice__review() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  if (isset($_POST['dsxmlrpc-notice-forever'])){
6
  update_option('dsxmlrpc-notice-forever','forever',false);
7
  }
@@ -16,7 +60,7 @@ function dsxmlrpc_admin_notice__review() {
16
 
17
  <p>You can help us make this plugin better by reviewing and giving it 5 stars</p>
18
  <div class="dsxmlrpc-rate">
19
- <fieldset class="wporg-ratings rating-stars"><label for="rating_1"><input class="hidden" id="rating_1" type="radio" name="rating" value="1"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Poor"></span><span class="screen-reader-text">Poor</span></label><label for="rating_2"><input class="hidden" id="rating_2" type="radio" name="rating" value="2"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Works"></span><span class="screen-reader-text">Works</span></label><label for="rating_3"><input class="hidden" id="rating_3" type="radio" name="rating" value="3"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Good"></span><span class="screen-reader-text">Good</span></label><label for="rating_4"><input class="hidden" id="rating_4" type="radio" name="rating" value="4"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Great"></span><span class="screen-reader-text">Great</span></label><label for="rating_5"><input class="hidden" id="rating_5" type="radio" name="rating" checked="checked" value="5"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Fantastic!"></span><span class="screen-reader-text">Fantastic!</span></label></fieldset><input type="hidden" name="rating" id="rating" value="5">
20
  </div>
21
  <form action="" method="post" >
22
  <input class="button button-primary dsxmlrpc_button" type="submit" name="dsxmlrpc-notice-forever" value="Already Rated" />
@@ -62,14 +106,14 @@ function dsxmlrpc_admin_notice__review() {
62
  </script>
63
  </div>
64
  <style>
65
- a.wporg-ratings span:hover {
66
  color: #FF9800 !important;
67
  }
68
  @media screen and (min-width: 782px) {
69
  .dsxmlrpc-notice-innner {
70
  display: flex;
71
  }}
72
- .hidden, #accessibility {
73
  height: 0;
74
  width: 0;
75
  overflow: hidden;
@@ -92,4 +136,5 @@ function dsxmlrpc_admin_notice__review() {
92
  <?php
93
  }
94
 
95
- add_action( 'admin_notices', 'dsxmlrpc_admin_notice__review' );
 
1
  <?php
2
+ if(!function_exists('add_action')){
3
+ echo 'You are not allowed to access this page directly.';
4
+ exit;
5
+ }
6
+
7
+ function dsxmlrpc_action_links($links) {
8
+ $plugin_shortcuts = array(
9
+ '<a style="color:green;" rel="noopener" href="https://wordpress.org/support/plugin/disable-xml-rpc-api/reviews/#new-post" target="_blank">' . __('Rate Plugin', 'dsxmlrpc') . '</a>',
10
+ '<a style="color:#f44336;" rel="noopener" href="https://bit.ly/324BrbO/" target="_blank">' . __('More Protection', 'dsxmlrpc') . '</a>',
11
 
12
+ );
13
+ return array_merge($links, $plugin_shortcuts);
14
+ }
15
 
16
+ function dsxmlrpc_admin_notice_wpsg() {
17
+ if ( ! PAnD::is_admin_notice_active( 'dsxmlrpc-wpsg-notice-10' ) ) {
18
+ return;
19
+ }
20
+
21
+ ?>
22
+ <div data-dismissible="dsxmlrpc-wpsg-notice-10" id="dsxmlrpc-wpsg-notice" class="notice notice-warning is-dismissible">
23
+ <img src="<?=DSXMLRPC_URL?>/admin/logo-icon.png" style="float:left; margin:10px 20px 10px 10px" width="100">
24
+ <h2>You can improve your website security by using WP Security Guard!</h2>
25
+ <div class="dsxmlrpc-wpsg-notice-innner">
26
+ <p>Brand new <strong>lightweight</strong> security plugin is ready now you can buy it with special discount offer. Use <strong style="color:green;">"xmlrpc20"</strong> promo code to get 20% off in your purchase. </p>
27
+ <a class="button button-primary dsxmlrpc_button" target="_blank" href="https://neatma.com/wpsg-plugin/" >More Info</a>
28
+ </div>
29
+ </div>
30
+ <style>
31
+ div#dsxmlrpc-wpsg-notice {
32
+ background-image: url('<?=DSXMLRPC_URL?>/admin/xmlrpc20.png');
33
+ background-repeat: no-repeat;
34
+ background-position: 95%;
35
+ background-size: contain;
36
+ height: 140px;
37
+ }
38
+ .dsxmlrpc_button {
39
+ margin: 3px 0 15px 15px !important;
40
+ transition: 500ms;
41
+ }
42
+ </style>
43
+ <?php
44
+ }
45
+
46
+ function dsxmlrpc_admin_notice_review() {
47
+
48
+
49
  if (isset($_POST['dsxmlrpc-notice-forever'])){
50
  update_option('dsxmlrpc-notice-forever','forever',false);
51
  }
60
 
61
  <p>You can help us make this plugin better by reviewing and giving it 5 stars</p>
62
  <div class="dsxmlrpc-rate">
63
+ <fieldset class="dsxmlrpc-ratings rating-stars"><label for="rating_1"><input class="hidden dsxmlrpc-hidden" id="rating_1" type="radio" name="rating" value="1"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Poor"></span><span class="screen-reader-text">Poor</span></label><label for="rating_2"><input class="hidden dsxmlrpc-hidden" id="rating_2" type="radio" name="rating" value="2"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Works"></span><span class="screen-reader-text">Works</span></label><label for="rating_3"><input class="hidden dsxmlrpc-hidden" id="rating_3" type="radio" name="rating" value="3"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Good"></span><span class="screen-reader-text">Good</span></label><label for="rating_4"><input class="hidden dsxmlrpc-hidden" id="rating_4" type="radio" name="rating" value="4"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Great"></span><span class="screen-reader-text">Great</span></label><label for="rating_5"><input class="hidden dsxmlrpc-hidden" id="rating_5" type="radio" name="rating" checked="checked" value="5"><span class="dashicons dashicons-star-empty dashicons-star-filled" style="color:#ffb900 !important;" title="Fantastic!"></span><span class="screen-reader-text">Fantastic!</span></label></fieldset><input type="hidden" name="rating" id="rating" value="5">
64
  </div>
65
  <form action="" method="post" >
66
  <input class="button button-primary dsxmlrpc_button" type="submit" name="dsxmlrpc-notice-forever" value="Already Rated" />
106
  </script>
107
  </div>
108
  <style>
109
+ a.dsxmlrpc-ratings span:hover {
110
  color: #FF9800 !important;
111
  }
112
  @media screen and (min-width: 782px) {
113
  .dsxmlrpc-notice-innner {
114
  display: flex;
115
  }}
116
+ .dsxmlrpc-hidden {
117
  height: 0;
118
  width: 0;
119
  overflow: hidden;
136
  <?php
137
  }
138
 
139
+ add_action( 'admin_notices', 'dsxmlrpc_admin_notice_review' );
140
+ add_action( 'admin_notices', 'dsxmlrpc_admin_notice_wpsg' );
admin/logo-icon.png ADDED
Binary file
admin/xmlrpc20.png ADDED
Binary file
disable-xml-rpc-api.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Disable XML-RPC-API
4
  Plugin URI: https://neatma.com/
5
  Description: Lightweight plugin to disable XML-RPC API and Pingbacks,Trackbacks for faster and more secure website.
6
- Version: 1.0.9
7
  Tested up to: 5.7
8
  Requires at least: 3.5
9
  Author: Neatmarketing
@@ -17,14 +17,15 @@ if ( ! defined( 'ABSPATH' ) ) {
17
  exit;
18
  }
19
 
20
- define('dsxmlrpc_plugin_url', plugin_dir_path(__FILE__));
21
- define('dsxmlrpc_home_path', function_exists('get_home_path') ? get_home_path() : ABSPATH);
 
22
 
23
  if ( ! class_exists( 'PAnD' ) ) {
24
- require_once(dsxmlrpc_plugin_url . '/lib/admin-notices/persist-admin-notices-dismissal.php');
25
  }
26
 
27
- require_once(dsxmlrpc_plugin_url . 'admin/admin.php');
28
 
29
  add_action( 'admin_init', array( 'PAnD', 'init' ) );
30
  add_filter('xmlrpc_enabled', '__return_false');
@@ -33,6 +34,7 @@ add_filter('xmlrpc_enabled', '__return_false');
33
  // Disable X-Pingback to header
34
  add_filter( 'wp_headers', 'dsxmlrpc_x_pingback' );
35
  add_filter('pings_open', '__return_false', PHP_INT_MAX);
 
36
 
37
  function dsxmlrpc_x_pingback( $headers ) {
38
 
@@ -44,7 +46,7 @@ function dsxmlrpc_x_pingback( $headers ) {
44
  //
45
  // Fix htaccess permissions
46
  function dsxmlrpc_file_chmod() {
47
- $htaccess_file = dsxmlrpc_home_path . '.htaccess';
48
  chmod($htaccess_file, 0755);
49
  }
50
 
@@ -52,8 +54,8 @@ function dsxmlrpc_file_chmod() {
52
  // Disable access to xmlrpc.php entirely with .htaccess file
53
  function dsxmlrpc_add_htaccess() {
54
 
55
- $filename = dsxmlrpc_plugin_url . '/admin/dsxmlrpc-htaccess';
56
- $htaccess_file = dsxmlrpc_home_path . '.htaccess';
57
  insert_with_markers($htaccess_file, 'DS-XML-RPC-API', extract_from_markers($filename, 'DS-XML-RPC-API')) ? : dsxmlrpc_file_chmod();
58
  }
59
  add_action('admin_init', 'dsxmlrpc_add_htaccess', 1, 2 );
@@ -62,10 +64,9 @@ add_action('admin_init', 'dsxmlrpc_add_htaccess', 1, 2 );
62
  //Remove .htaccess codes when disabled
63
  function dsxmlrpc_remove_htaccess() {
64
 
65
- $filename = dsxmlrpc_plugin_url . '/admin/dsxmlrpc-htaccess';
66
- $htaccess_file = dsxmlrpc_home_path . '.htaccess';
67
- insert_with_markers($htaccess_file, 'DS-XML-RPC-API', '') ? : dsxmlrpc_file_chmod();
68
- delete_option('dsxmlrpc-notice-forever');
69
  }
70
  add_action( 'deactivated_plugin', 'dsxmlrpc_remove_htaccess', 2, 2 );
71
 
3
  Plugin Name: Disable XML-RPC-API
4
  Plugin URI: https://neatma.com/
5
  Description: Lightweight plugin to disable XML-RPC API and Pingbacks,Trackbacks for faster and more secure website.
6
+ Version: 2.0.0
7
  Tested up to: 5.7
8
  Requires at least: 3.5
9
  Author: Neatmarketing
17
  exit;
18
  }
19
 
20
+ define('DSXMLRPC_FILE', plugin_dir_path(__FILE__));
21
+ define('DSXMLRPC_URL', plugin_dir_url( __FILE__ ));
22
+ define('DSXMLRPC_HOME_PATH', function_exists('get_home_path') ? get_home_path() : ABSPATH);
23
 
24
  if ( ! class_exists( 'PAnD' ) ) {
25
+ require_once(DSXMLRPC_FILE . '/lib/admin-notices/persist-admin-notices-dismissal.php');
26
  }
27
 
28
+ require_once(DSXMLRPC_FILE . 'admin/admin.php');
29
 
30
  add_action( 'admin_init', array( 'PAnD', 'init' ) );
31
  add_filter('xmlrpc_enabled', '__return_false');
34
  // Disable X-Pingback to header
35
  add_filter( 'wp_headers', 'dsxmlrpc_x_pingback' );
36
  add_filter('pings_open', '__return_false', PHP_INT_MAX);
37
+ add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'dsxmlrpc_action_links');
38
 
39
  function dsxmlrpc_x_pingback( $headers ) {
40
 
46
  //
47
  // Fix htaccess permissions
48
  function dsxmlrpc_file_chmod() {
49
+ $htaccess_file = DSXMLRPC_HOME_PATH . '.htaccess';
50
  chmod($htaccess_file, 0755);
51
  }
52
 
54
  // Disable access to xmlrpc.php entirely with .htaccess file
55
  function dsxmlrpc_add_htaccess() {
56
 
57
+ $filename = DSXMLRPC_FILE . '/admin/dsxmlrpc-htaccess';
58
+ $htaccess_file = DSXMLRPC_HOME_PATH . '.htaccess';
59
  insert_with_markers($htaccess_file, 'DS-XML-RPC-API', extract_from_markers($filename, 'DS-XML-RPC-API')) ? : dsxmlrpc_file_chmod();
60
  }
61
  add_action('admin_init', 'dsxmlrpc_add_htaccess', 1, 2 );
64
  //Remove .htaccess codes when disabled
65
  function dsxmlrpc_remove_htaccess() {
66
 
67
+ $filename = DSXMLRPC_FILE . '/admin/dsxmlrpc-htaccess';
68
+ $htaccess_file = DSXMLRPC_HOME_PATH . '.htaccess';
69
+ insert_with_markers($htaccess_file, 'DS-XML-RPC-API', '') ? : dsxmlrpc_file_chmod();
 
70
  }
71
  add_action( 'deactivated_plugin', 'dsxmlrpc_remove_htaccess', 2, 2 );
72
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://neatma.com
5
  Contributors: aminnz,neatmarketing
6
  Description: Simple plugin to disable XML-RPC API and X-Pingback for faster and more secure website.
7
  Tags: disable xml-rpc, disable xmlrpc,remove xmlrpc, XML-RPC, pingback, stop brute force attacks
8
- Version: 1.0.9
9
  Tested up to: 5.7
10
  Requires at least: 3.5
11
  Author: Neatmarketing
@@ -91,4 +91,8 @@ screenshot-1.png
91
 
92
  = 1.0.9 =
93
  * Wordpress 5.7 compatible
94
- * Fix some issues
 
 
 
 
5
  Contributors: aminnz,neatmarketing
6
  Description: Simple plugin to disable XML-RPC API and X-Pingback for faster and more secure website.
7
  Tags: disable xml-rpc, disable xmlrpc,remove xmlrpc, XML-RPC, pingback, stop brute force attacks
8
+ Version: 2.0.0
9
  Tested up to: 5.7
10
  Requires at least: 3.5
11
  Author: Neatmarketing
91
 
92
  = 1.0.9 =
93
  * Wordpress 5.7 compatible
94
+ * Fix some issues
95
+
96
+ = 2.0.0 =
97
+ * Fix code conflict with some other plugin
98
+ * Fix hiding data in WooCommerce Product Tabs