Disable XML-RPC-API - Version 1.0.9

Version Description

  • Wordpress 5.7 compatible
  • Fix some issues
Download this release

Release Info

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

Code changes from version 1.0.8 to 1.0.9

admin/admin.php CHANGED
@@ -1,18 +1,65 @@
1
  <?php
2
 
3
 
4
- function sample_admin_notice__success() {
5
- if ( ! PAnD::is_admin_notice_active( 'dsxmlrpc-notice-15' ) ) {
 
 
 
6
  return;
7
  }
8
 
9
  ?>
10
- <div data-dismissible="dsxmlrpc-notice-15" class="updated notice notice-success is-dismissible">
11
- <h2>Your website is protected from XML-RPC DDOS attacks!</h2>
12
  <div class="dsxmlrpc-notice-innner">
 
13
  <p>You can help us make this plugin better by reviewing and giving it 5 stars</p>
14
- <a href="https://wordpress.org/support/plugin/disable-xml-rpc-api/reviews/#new-post" target="_blank" class="wporg-ratings" aria-label="4 out of 5 stars" data-title-template="%s out of 5 stars" data-rating="4" style="margin: 8px;text-decoration:none;color:#ffb900;"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a>
 
 
 
 
 
 
15
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  </div>
17
  <style>
18
  a.wporg-ratings span:hover {
@@ -22,8 +69,27 @@ function sample_admin_notice__success() {
22
  .dsxmlrpc-notice-innner {
23
  display: flex;
24
  }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  </style>
26
  <?php
27
  }
28
 
29
- add_action( 'admin_notices', 'sample_admin_notice__success' );
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
+ }
8
+ if ( ! PAnD::is_admin_notice_active( 'dsxmlrpc-notice-15' ) || get_option('dsxmlrpc-notice-forever') ) {
9
  return;
10
  }
11
 
12
  ?>
13
+ <div data-dismissible="dsxmlrpc-notice-15" id="dsxmlrpc-notice" class="updated notice notice-success is-dismissible">
14
+ <h2>Your website is protected from XML-RPC Brute-force and DDOS attacks!</h2>
15
  <div class="dsxmlrpc-notice-innner">
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" />
23
+ </form>
24
+
25
  </div>
26
+
27
+ <script>
28
+
29
+ jQuery( document ).ready( function( $ ) {
30
+ var ratings = $( '.rating-stars' );
31
+ var selectedClass = 'dashicons-star-filled';
32
+
33
+ function dxtoggleStyles( currentInput ) {
34
+ var thisInput = $( currentInput );
35
+ var index = parseInt( thisInput.val() );
36
+
37
+ stars.removeClass( selectedClass );
38
+ stars.slice( 0, index ).addClass( selectedClass );
39
+ }
40
+
41
+ // If the ratings exist on the page
42
+ if ( ratings.length !== 0 ) {
43
+ var inputs = ratings.find( 'input[type="radio"]' );
44
+ var labels = ratings.find( 'label' );
45
+ var stars = inputs.next();
46
+
47
+ inputs.on( 'change', function( event ) {
48
+ dxtoggleStyles( event.target )
49
+ } );
50
+ inputs.on( 'click', function( event ) {
51
+ window.open("https://wordpress.org/support/plugin/disable-xml-rpc-api/reviews/#new-post");
52
+ } );
53
+ labels.hover( function( event ) {
54
+ $curInput = $( event.currentTarget ).find( 'input' );
55
+ dxtoggleStyles( $curInput );
56
+ }, function () {
57
+ $currentSelected = ratings.find( 'input[type="radio"]:checked' );
58
+ dxtoggleStyles( $currentSelected )
59
+ } );
60
+ }
61
+ });
62
+ </script>
63
  </div>
64
  <style>
65
  a.wporg-ratings span:hover {
69
  .dsxmlrpc-notice-innner {
70
  display: flex;
71
  }}
72
+ .hidden, #accessibility {
73
+ height: 0;
74
+ width: 0;
75
+ overflow: hidden;
76
+ overflow-x: hidden;
77
+ overflow-y: hidden;
78
+ position: absolute;
79
+ background: none;
80
+ left: -999em;
81
+ }
82
+ .dsxmlrpc-rate {
83
+ top: 5px;
84
+ padding-left: 10px;
85
+ position: relative;
86
+ }
87
+ .dsxmlrpc_button {
88
+ margin: 3px 0 15px 15px !important;
89
+ transition: 500ms;
90
+ }
91
  </style>
92
  <?php
93
  }
94
 
95
+ add_action( 'admin_notices', 'dsxmlrpc_admin_notice__review' );
admin/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
disable-xml-rpc-api.php CHANGED
@@ -3,17 +3,27 @@
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.8
7
- Tested up to: 5.6
8
  Requires at least: 3.5
9
  Author: Neatmarketing
10
  Author URI: https://neatma.com/
11
  License: GPLv2
12
  */
13
 
 
 
 
 
 
 
14
  define('dsxmlrpc_plugin_url', plugin_dir_path(__FILE__));
15
  define('dsxmlrpc_home_path', function_exists('get_home_path') ? get_home_path() : ABSPATH);
 
 
16
  require_once(dsxmlrpc_plugin_url . '/lib/admin-notices/persist-admin-notices-dismissal.php');
 
 
17
  require_once(dsxmlrpc_plugin_url . 'admin/admin.php');
18
 
19
  add_action( 'admin_init', array( 'PAnD', 'init' ) );
@@ -42,9 +52,9 @@ function dsxmlrpc_file_chmod() {
42
  // Disable access to xmlrpc.php entirely with .htaccess file
43
  function dsxmlrpc_add_htaccess() {
44
 
45
- $filename = dsxmlrpc_plugin_url . '/admin/dsxmlrpc-htaccess';
46
- $htaccess_file = dsxmlrpc_home_path . '.htaccess';
47
- insert_with_markers($htaccess_file, 'DS-XML-RPC-API', extract_from_markers($filename, 'DS-XML-RPC-API')) ? : dsxmlrpc_file_chmod();
48
  }
49
  add_action('admin_init', 'dsxmlrpc_add_htaccess', 1, 2 );
50
 
@@ -52,9 +62,15 @@ add_action('admin_init', 'dsxmlrpc_add_htaccess', 1, 2 );
52
  //Remove .htaccess codes when disabled
53
  function dsxmlrpc_remove_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', '') ? : dsxmlrpc_file_chmod();
58
-
59
  }
60
- add_action( 'deactivated_plugin', 'dsxmlrpc_remove_htaccess', 2, 2 );
 
 
 
 
 
 
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
10
  Author URI: https://neatma.com/
11
  License: GPLv2
12
  */
13
 
14
+ //
15
+ // Exit if accessed directly.
16
+ 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' ) );
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 );
60
 
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
+
72
+ //
73
+ // unistallation actions
74
+ function dsxmlrpc_uninstall_action(){
75
+ delete_option('dsxmlrpc-notice-forever');
76
+ }
index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
lib/admin-notices/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
lib/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
readme.txt CHANGED
@@ -4,9 +4,9 @@ Plugin Name: Disable XML-RPC-API
4
  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, xmlrpc.php, XML-RPC API, stop brute force attacks
8
- Version: 1.0.8
9
- Tested up to: 5.6
10
  Requires at least: 3.5
11
  Author: Neatmarketing
12
  Author URI: https://neatma.com
@@ -87,4 +87,8 @@ screenshot-1.png
87
  * Fix blank page when using W3 Total Cache and some other cache plugins
88
 
89
  = 1.0.8 =
90
- * Fix code conflict with Autoptimize plugin
 
 
 
 
4
  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
12
  Author URI: https://neatma.com
87
  * Fix blank page when using W3 Total Cache and some other cache plugins
88
 
89
  = 1.0.8 =
90
+ * Fix code conflict with Autoptimize plugin
91
+
92
+ = 1.0.9 =
93
+ * Wordpress 5.7 compatible
94
+ * Fix some issues