Spider Blocker - Version 1.0.13

Version Description

Download this release

Release Info

Developer niteoweb
Plugin Icon 128x128 Spider Blocker
Version 1.0.13
Comparing to
See all releases

Code changes from version 1.0.12 to 1.0.13

Files changed (2) hide show
  1. index.php +30 -18
  2. readme.txt +3 -2
index.php CHANGED
@@ -3,7 +3,7 @@ namespace Niteoweb\SpiderBlocker;
3
  /**
4
  * Plugin Name: Spider Blocker
5
  * Description: Spider Blocker will block most common bots that consume bandwidth and slow down your server.
6
- * Version: 1.0.12
7
  * Runtime: 5.3+
8
  * Author: Easy Blog Networks
9
  * Author URI: www.easyblognetworks.com
@@ -37,8 +37,9 @@ class SpiderBlocker
37
  {
38
 
39
  public $default_bots = 'a:36:{i:0;O:8:"stdClass":4:{s:4:"name";s:10:"Ahrefs Bot";s:2:"re";s:9:"AhrefsBot";s:4:"desc";s:25:"https://ahrefs.com/robot/";s:5:"state";b:1;}i:1;O:8:"stdClass":4:{s:4:"name";s:8:"MJ12 bot";s:2:"re";s:7:"MJ12bot";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:2;O:8:"stdClass":4:{s:4:"name";s:9:"Roger Bot";s:2:"re";s:8:"Rogerbot";s:4:"desc";s:40:"http://moz.com/help/pro/rogerbot-crawler";s:5:"state";b:1;}i:3;O:8:"stdClass":4:{s:4:"name";s:11:"Semrush Bot";s:2:"re";s:10:"SemrushBot";s:4:"desc";s:31:"http://www.semrush.com/bot.html";s:5:"state";b:1;}i:4;O:8:"stdClass":4:{s:4:"name";s:11:"ia_archiver";s:2:"re";s:11:"ia_archiver";s:4:"desc";s:36:"http://archive.org/about/exclude.php";s:5:"state";b:1;}i:5;O:8:"stdClass":4:{s:4:"name";s:8:"ScoutJet";s:2:"re";s:8:"ScoutJet";s:4:"desc";s:19:"http://scoutjet.com";s:5:"state";b:1;}i:6;O:8:"stdClass":4:{s:4:"name";s:7:"sistrix";s:2:"re";s:7:"sistrix";s:4:"desc";s:26:"http://crawler.sistrix.net";s:5:"state";b:1;}i:7;O:8:"stdClass":4:{s:4:"name";s:16:"SearchmetricsBot";s:2:"re";s:16:"SearchmetricsBot";s:4:"desc";s:50:"http://www.searchmetrics.com/en/searchmetrics-bot/";s:5:"state";b:1;}i:8;O:8:"stdClass":4:{s:4:"name";s:14:"SEOkicks-Robot";s:2:"re";s:14:"SEOkicks-Robot";s:4:"desc";s:33:"http://www.seokicks.de/robot.html";s:5:"state";b:1;}i:9;O:8:"stdClass":4:{s:4:"name";s:16:"Lipperhey Spider";s:2:"re";s:16:"Lipperhey Spider";s:4:"desc";s:43:"http://www.lipperhey.com/en/website-spider/";s:5:"state";b:1;}i:10;O:8:"stdClass":4:{s:4:"name";s:6:"Exabot";s:2:"re";s:6:"Exabot";s:4:"desc";s:44:"http://www.exalead.com/search/webmasterguide";s:5:"state";b:1;}i:11;O:8:"stdClass":4:{s:4:"name";s:6:"NC Bot";s:2:"re";s:5:"NCBot";s:4:"desc";s:55:"https://twitter.com/NetComber/status/334476871691550721";s:5:"state";b:1;}i:12;O:8:"stdClass":4:{s:4:"name";s:15:"BacklinkCrawler";s:2:"re";s:15:"BacklinkCrawler";s:4:"desc";s:40:"http://www.backlinktest.com/crawler.html";s:5:"state";b:1;}i:13;O:8:"stdClass":4:{s:4:"name";s:15:"archive.org Bot";s:2:"re";s:15:"archive.org_bot";s:4:"desc";s:42:"http://archive.org/details/archive.org_bot";s:5:"state";b:1;}i:14;O:8:"stdClass":4:{s:4:"name";s:12:"MeanPath Bot";s:2:"re";s:11:"meanpathbot";s:4:"desc";s:37:"https://meanpath.com/meanpathbot.html";s:5:"state";b:1;}i:15;O:8:"stdClass":4:{s:4:"name";s:18:"PagesInventory Bot";s:2:"re";s:14:"PagesInventory";s:4:"desc";s:56:"http://www.botsvsbrowsers.com/details/1002332/index.html";s:5:"state";b:1;}i:16;O:8:"stdClass":4:{s:4:"name";s:12:"Aboundex Bot";s:2:"re";s:11:"Aboundexbot";s:4:"desc";s:32:"http://www.aboundex.com/crawler/";s:5:"state";b:1;}i:17;O:8:"stdClass":4:{s:4:"name";s:15:"SeoProfiler Bot";s:2:"re";s:5:"spbot";s:4:"desc";s:31:"http://www.seoprofiler.com/bot/";s:5:"state";b:1;}i:18;O:8:"stdClass":4:{s:4:"name";s:11:"Linkdex Bot";s:2:"re";s:10:"linkdexbot";s:4:"desc";s:34:"http://www.linkdex.com/about/bots/";s:5:"state";b:1;}i:19;O:8:"stdClass":4:{s:4:"name";s:7:"Gigabot";s:2:"re";s:7:"Gigabot";s:4:"desc";s:45:"http://www.useragentstring.com/pages/Gigabot/";s:5:"state";b:1;}i:20;O:8:"stdClass":4:{s:4:"name";s:6:"DotBot";s:2:"re";s:6:"dotbot";s:4:"desc";s:35:"http://en.wikipedia.org/wiki/DotBot";s:5:"state";b:1;}i:21;O:8:"stdClass":4:{s:4:"name";s:5:"Nutch";s:2:"re";s:5:"Nutch";s:4:"desc";s:32:"http://nutch.apache.org/bot.html";s:5:"state";b:1;}i:22;O:8:"stdClass":4:{s:4:"name";s:8:"BLEX Bot";s:2:"re";s:7:"BLEXBot";s:4:"desc";s:27:"http://webmeup-crawler.com/";s:5:"state";b:1;}i:23;O:8:"stdClass":4:{s:4:"name";s:6:"Ezooms";s:2:"re";s:6:"Ezooms";s:4:"desc";s:49:"http://graphicline.co.za/blogs/what-is-ezooms-bot";s:5:"state";b:1;}i:24;O:8:"stdClass":4:{s:4:"name";s:11:"Majestic 12";s:2:"re";s:11:"Majestic-12";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:25;O:8:"stdClass":4:{s:4:"name";s:12:"Majestic SEO";s:2:"re";s:12:"Majestic-SEO";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:26;O:8:"stdClass":4:{s:4:"name";s:7:"DSearch";s:2:"re";s:7:"DSearch";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:27;O:8:"stdClass":4:{s:4:"name";s:10:"Blekko Bot";s:2:"re";s:9:"BlekkoBot";s:4:"desc";s:33:"http://blekko.com/about/blekkobot";s:5:"state";b:1;}i:28;O:8:"stdClass":4:{s:4:"name";s:6:"Yandex";s:2:"re";s:6:"Yandex";s:4:"desc";s:41:"http://help.yandex.com/search/?id=1112030";s:5:"state";b:0;}i:29;O:8:"stdClass":4:{s:4:"name";s:10:"Google Bot";s:2:"re";s:9:"googlebot";s:4:"desc";s:57:"https://support.google.com/webmasters/answer/182072?hl=en";s:5:"state";b:0;}i:30;O:8:"stdClass":4:{s:4:"name";s:18:"Feedfetcher Google";s:2:"re";s:18:"Feedfetcher-Google";s:4:"desc";s:51:"https://support.google.com/webmasters/answer/178852";s:5:"state";b:0;}i:31;O:8:"stdClass":4:{s:4:"name";s:8:"Bing Bot";s:2:"re";s:7:"BingBot";s:4:"desc";s:36:"http://en.wikipedia.org/wiki/Bingbot";s:5:"state";b:0;}i:32;O:8:"stdClass":4:{s:4:"name";s:9:"Nerdy Bot";s:2:"re";s:8:"NerdyBot";s:4:"desc";s:20:"http://nerdybot.com/";s:5:"state";b:1;}i:33;O:8:"stdClass":4:{s:4:"name";s:9:"James BOT";s:2:"re";s:8:"JamesBOT";s:4:"desc";s:32:"http://cognitiveseo.com/bot.html";s:5:"state";b:1;}i:34;O:8:"stdClass":4:{s:4:"name";s:7:"Tin Eye";s:2:"re";s:6:"TinEye";s:4:"desc";s:34:"http://www.tineye.com/crawler.html";s:5:"state";b:1;}i:35;O:8:"stdClass":4:{s:5:"state";b:1;s:2:"re";s:11:"Baiduspider";s:4:"name";s:5:"Baidu";s:4:"desc";s:47:"http://www.baidu.com/search/robots_english.html";}}';
40
- protected $option_name = 'Niteoweb.SpiderBlocker.Bots';
41
- protected $nonce = 'Niteoweb.SpiderBlocker.Nonce';
 
42
 
43
  function __construct()
44
  {
@@ -50,13 +51,15 @@ class SpiderBlocker
50
  add_action('wp_ajax_NSB-reset_list', array(&$this, 'resetList'));
51
  }
52
  add_action('generate_rewrite_rules', array(&$this, "generateRewriteRules"));
 
 
 
 
53
 
54
  }
55
 
56
- function generateRewriteRules()
57
  {
58
- global $wp_rewrite;
59
-
60
  // Protect plugin from direct access
61
  $wp_rewrite->add_external_rule($this->pluginURL() . 'index.php', 'index.php%{REQUEST_URI}');
62
  $wp_rewrite->add_external_rule($this->pluginURL() . 'readme.txt', 'index.php%{REQUEST_URI}');
@@ -90,8 +93,8 @@ class SpiderBlocker
90
  */
91
  function activatePluginNotice()
92
  {
93
- if (get_option($this->option_name) === false) {
94
- update_option($this->option_name, $this->default_bots);
95
  ?>
96
  <div class="notice notice-success">
97
  <p>SpiderBlocker plugin has enabled blocking of some bots, please review settings by visiting <a
@@ -135,6 +138,15 @@ class SpiderBlocker
135
 
136
  }
137
 
 
 
 
 
 
 
 
 
 
138
  /**
139
  * @codeCoverageIgnore
140
  * @return bool
@@ -216,19 +228,19 @@ class SpiderBlocker
216
 
217
  private function getBots()
218
  {
219
- return maybe_unserialize(get_option($this->option_name, $this->default_bots));
220
  }
221
 
222
  function loadList()
223
  {
224
- check_ajax_referer($this->nonce, 'nonce');
225
  wp_send_json_success($this->getBots());
226
  }
227
 
228
  function resetList()
229
  {
230
- check_ajax_referer($this->nonce, 'nonce');
231
- delete_option($this->option_name);
232
  $this->generateBlockRules();
233
  wp_send_json_success($this->getBots());
234
  }
@@ -236,7 +248,7 @@ class SpiderBlocker
236
  function removeBlockRules()
237
  {
238
  global $wp_rewrite;
239
- delete_option($this->option_name);
240
  $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
241
  $htaccess_file = $home_path . '.htaccess';
242
  $empty = array();
@@ -250,7 +262,7 @@ class SpiderBlocker
250
  function saveList()
251
  {
252
 
253
- check_ajax_referer($this->nonce, 'nonce');
254
  $data = json_decode(stripcslashes($_POST['data']));
255
 
256
  if (json_last_error()) {
@@ -261,10 +273,10 @@ class SpiderBlocker
261
  }
262
 
263
  }
264
- if (get_option($this->option_name) !== false) {
265
- update_option($this->option_name, maybe_serialize($data));
266
  } else {
267
- add_option($this->option_name, maybe_serialize($data), null, 'no');
268
  }
269
 
270
  $this->generateBlockRules();
@@ -298,7 +310,7 @@ class SpiderBlocker
298
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"
299
  type="text/javascript"></script>
300
  <script>
301
- window.sb_nonce = "<?php echo wp_create_nonce($this->nonce); ?>";
302
  -(function () {
303
  var spiderBlockApp = angular.module('spiderBlockApp', []);
304
 
3
  /**
4
  * Plugin Name: Spider Blocker
5
  * Description: Spider Blocker will block most common bots that consume bandwidth and slow down your server.
6
+ * Version: 1.0.13
7
  * Runtime: 5.3+
8
  * Author: Easy Blog Networks
9
  * Author URI: www.easyblognetworks.com
37
  {
38
 
39
  public $default_bots = 'a:36:{i:0;O:8:"stdClass":4:{s:4:"name";s:10:"Ahrefs Bot";s:2:"re";s:9:"AhrefsBot";s:4:"desc";s:25:"https://ahrefs.com/robot/";s:5:"state";b:1;}i:1;O:8:"stdClass":4:{s:4:"name";s:8:"MJ12 bot";s:2:"re";s:7:"MJ12bot";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:2;O:8:"stdClass":4:{s:4:"name";s:9:"Roger Bot";s:2:"re";s:8:"Rogerbot";s:4:"desc";s:40:"http://moz.com/help/pro/rogerbot-crawler";s:5:"state";b:1;}i:3;O:8:"stdClass":4:{s:4:"name";s:11:"Semrush Bot";s:2:"re";s:10:"SemrushBot";s:4:"desc";s:31:"http://www.semrush.com/bot.html";s:5:"state";b:1;}i:4;O:8:"stdClass":4:{s:4:"name";s:11:"ia_archiver";s:2:"re";s:11:"ia_archiver";s:4:"desc";s:36:"http://archive.org/about/exclude.php";s:5:"state";b:1;}i:5;O:8:"stdClass":4:{s:4:"name";s:8:"ScoutJet";s:2:"re";s:8:"ScoutJet";s:4:"desc";s:19:"http://scoutjet.com";s:5:"state";b:1;}i:6;O:8:"stdClass":4:{s:4:"name";s:7:"sistrix";s:2:"re";s:7:"sistrix";s:4:"desc";s:26:"http://crawler.sistrix.net";s:5:"state";b:1;}i:7;O:8:"stdClass":4:{s:4:"name";s:16:"SearchmetricsBot";s:2:"re";s:16:"SearchmetricsBot";s:4:"desc";s:50:"http://www.searchmetrics.com/en/searchmetrics-bot/";s:5:"state";b:1;}i:8;O:8:"stdClass":4:{s:4:"name";s:14:"SEOkicks-Robot";s:2:"re";s:14:"SEOkicks-Robot";s:4:"desc";s:33:"http://www.seokicks.de/robot.html";s:5:"state";b:1;}i:9;O:8:"stdClass":4:{s:4:"name";s:16:"Lipperhey Spider";s:2:"re";s:16:"Lipperhey Spider";s:4:"desc";s:43:"http://www.lipperhey.com/en/website-spider/";s:5:"state";b:1;}i:10;O:8:"stdClass":4:{s:4:"name";s:6:"Exabot";s:2:"re";s:6:"Exabot";s:4:"desc";s:44:"http://www.exalead.com/search/webmasterguide";s:5:"state";b:1;}i:11;O:8:"stdClass":4:{s:4:"name";s:6:"NC Bot";s:2:"re";s:5:"NCBot";s:4:"desc";s:55:"https://twitter.com/NetComber/status/334476871691550721";s:5:"state";b:1;}i:12;O:8:"stdClass":4:{s:4:"name";s:15:"BacklinkCrawler";s:2:"re";s:15:"BacklinkCrawler";s:4:"desc";s:40:"http://www.backlinktest.com/crawler.html";s:5:"state";b:1;}i:13;O:8:"stdClass":4:{s:4:"name";s:15:"archive.org Bot";s:2:"re";s:15:"archive.org_bot";s:4:"desc";s:42:"http://archive.org/details/archive.org_bot";s:5:"state";b:1;}i:14;O:8:"stdClass":4:{s:4:"name";s:12:"MeanPath Bot";s:2:"re";s:11:"meanpathbot";s:4:"desc";s:37:"https://meanpath.com/meanpathbot.html";s:5:"state";b:1;}i:15;O:8:"stdClass":4:{s:4:"name";s:18:"PagesInventory Bot";s:2:"re";s:14:"PagesInventory";s:4:"desc";s:56:"http://www.botsvsbrowsers.com/details/1002332/index.html";s:5:"state";b:1;}i:16;O:8:"stdClass":4:{s:4:"name";s:12:"Aboundex Bot";s:2:"re";s:11:"Aboundexbot";s:4:"desc";s:32:"http://www.aboundex.com/crawler/";s:5:"state";b:1;}i:17;O:8:"stdClass":4:{s:4:"name";s:15:"SeoProfiler Bot";s:2:"re";s:5:"spbot";s:4:"desc";s:31:"http://www.seoprofiler.com/bot/";s:5:"state";b:1;}i:18;O:8:"stdClass":4:{s:4:"name";s:11:"Linkdex Bot";s:2:"re";s:10:"linkdexbot";s:4:"desc";s:34:"http://www.linkdex.com/about/bots/";s:5:"state";b:1;}i:19;O:8:"stdClass":4:{s:4:"name";s:7:"Gigabot";s:2:"re";s:7:"Gigabot";s:4:"desc";s:45:"http://www.useragentstring.com/pages/Gigabot/";s:5:"state";b:1;}i:20;O:8:"stdClass":4:{s:4:"name";s:6:"DotBot";s:2:"re";s:6:"dotbot";s:4:"desc";s:35:"http://en.wikipedia.org/wiki/DotBot";s:5:"state";b:1;}i:21;O:8:"stdClass":4:{s:4:"name";s:5:"Nutch";s:2:"re";s:5:"Nutch";s:4:"desc";s:32:"http://nutch.apache.org/bot.html";s:5:"state";b:1;}i:22;O:8:"stdClass":4:{s:4:"name";s:8:"BLEX Bot";s:2:"re";s:7:"BLEXBot";s:4:"desc";s:27:"http://webmeup-crawler.com/";s:5:"state";b:1;}i:23;O:8:"stdClass":4:{s:4:"name";s:6:"Ezooms";s:2:"re";s:6:"Ezooms";s:4:"desc";s:49:"http://graphicline.co.za/blogs/what-is-ezooms-bot";s:5:"state";b:1;}i:24;O:8:"stdClass":4:{s:4:"name";s:11:"Majestic 12";s:2:"re";s:11:"Majestic-12";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:25;O:8:"stdClass":4:{s:4:"name";s:12:"Majestic SEO";s:2:"re";s:12:"Majestic-SEO";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:26;O:8:"stdClass":4:{s:4:"name";s:7:"DSearch";s:2:"re";s:7:"DSearch";s:4:"desc";s:56:"http://www.majestic12.co.uk/projects/dsearch/mj12bot.php";s:5:"state";b:1;}i:27;O:8:"stdClass":4:{s:4:"name";s:10:"Blekko Bot";s:2:"re";s:9:"BlekkoBot";s:4:"desc";s:33:"http://blekko.com/about/blekkobot";s:5:"state";b:1;}i:28;O:8:"stdClass":4:{s:4:"name";s:6:"Yandex";s:2:"re";s:6:"Yandex";s:4:"desc";s:41:"http://help.yandex.com/search/?id=1112030";s:5:"state";b:0;}i:29;O:8:"stdClass":4:{s:4:"name";s:10:"Google Bot";s:2:"re";s:9:"googlebot";s:4:"desc";s:57:"https://support.google.com/webmasters/answer/182072?hl=en";s:5:"state";b:0;}i:30;O:8:"stdClass":4:{s:4:"name";s:18:"Feedfetcher Google";s:2:"re";s:18:"Feedfetcher-Google";s:4:"desc";s:51:"https://support.google.com/webmasters/answer/178852";s:5:"state";b:0;}i:31;O:8:"stdClass":4:{s:4:"name";s:8:"Bing Bot";s:2:"re";s:7:"BingBot";s:4:"desc";s:36:"http://en.wikipedia.org/wiki/Bingbot";s:5:"state";b:0;}i:32;O:8:"stdClass":4:{s:4:"name";s:9:"Nerdy Bot";s:2:"re";s:8:"NerdyBot";s:4:"desc";s:20:"http://nerdybot.com/";s:5:"state";b:1;}i:33;O:8:"stdClass":4:{s:4:"name";s:9:"James BOT";s:2:"re";s:8:"JamesBOT";s:4:"desc";s:32:"http://cognitiveseo.com/bot.html";s:5:"state";b:1;}i:34;O:8:"stdClass":4:{s:4:"name";s:7:"Tin Eye";s:2:"re";s:6:"TinEye";s:4:"desc";s:34:"http://www.tineye.com/crawler.html";s:5:"state";b:1;}i:35;O:8:"stdClass":4:{s:5:"state";b:1;s:2:"re";s:11:"Baiduspider";s:4:"name";s:5:"Baidu";s:4:"desc";s:47:"http://www.baidu.com/search/robots_english.html";}}';
40
+ const OptionName = 'Niteoweb.SpiderBlocker.Bots';
41
+ const nonce = 'Niteoweb.SpiderBlocker.Nonce';
42
+ const CheckHook = 'Niteoweb.SpiderBlocker.CheckHook';
43
 
44
  function __construct()
45
  {
51
  add_action('wp_ajax_NSB-reset_list', array(&$this, 'resetList'));
52
  }
53
  add_action('generate_rewrite_rules', array(&$this, "generateRewriteRules"));
54
+ add_action(self::CheckHook, array(&$this, "htaccessCheckHook"));
55
+ if (!wp_next_scheduled(self::CheckHook)) {
56
+ wp_schedule_event(time(), 'daily', self::CheckHook);
57
+ }
58
 
59
  }
60
 
61
+ function generateRewriteRules($wp_rewrite)
62
  {
 
 
63
  // Protect plugin from direct access
64
  $wp_rewrite->add_external_rule($this->pluginURL() . 'index.php', 'index.php%{REQUEST_URI}');
65
  $wp_rewrite->add_external_rule($this->pluginURL() . 'readme.txt', 'index.php%{REQUEST_URI}');
93
  */
94
  function activatePluginNotice()
95
  {
96
+ if (get_option(self::OptionName) === false) {
97
+ update_option(self::OptionName, $this->default_bots);
98
  ?>
99
  <div class="notice notice-success">
100
  <p>SpiderBlocker plugin has enabled blocking of some bots, please review settings by visiting <a
138
 
139
  }
140
 
141
+ /**
142
+ * @codeCoverageIgnore
143
+ */
144
+ public function htaccessCheckHook()
145
+ {
146
+
147
+ }
148
+
149
+
150
  /**
151
  * @codeCoverageIgnore
152
  * @return bool
228
 
229
  private function getBots()
230
  {
231
+ return maybe_unserialize(get_option(self::OptionName, $this->default_bots));
232
  }
233
 
234
  function loadList()
235
  {
236
+ check_ajax_referer(self::nonce, 'nonce');
237
  wp_send_json_success($this->getBots());
238
  }
239
 
240
  function resetList()
241
  {
242
+ check_ajax_referer(self::nonce, 'nonce');
243
+ delete_option(self::OptionName);
244
  $this->generateBlockRules();
245
  wp_send_json_success($this->getBots());
246
  }
248
  function removeBlockRules()
249
  {
250
  global $wp_rewrite;
251
+ delete_option(self::OptionName);
252
  $home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
253
  $htaccess_file = $home_path . '.htaccess';
254
  $empty = array();
262
  function saveList()
263
  {
264
 
265
+ check_ajax_referer(self::nonce, 'nonce');
266
  $data = json_decode(stripcslashes($_POST['data']));
267
 
268
  if (json_last_error()) {
273
  }
274
 
275
  }
276
+ if (get_option(self::OptionName) !== false) {
277
+ update_option(self::OptionName, maybe_serialize($data));
278
  } else {
279
+ add_option(self::OptionName, maybe_serialize($data), null, 'no');
280
  }
281
 
282
  $this->generateBlockRules();
310
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"
311
  type="text/javascript"></script>
312
  <script>
313
+ window.sb_nonce = "<?php echo wp_create_nonce(self::nonce); ?>";
314
  -(function () {
315
  var spiderBlockApp = angular.module('spiderBlockApp', []);
316
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: niteoweb
3
  Tags: seo, block, bots, htaccess, apache, secure
4
  Requires at least: 4.0
5
- Tested up to: 4.5
6
- Stable tag: 1.0.12
7
 
8
  SpiderBlocker will block most common bots that consume bandwidth and slow down your server.
9
 
@@ -23,3 +23,4 @@ with Apache server and mod_rewrite enabled.
23
  1. Upload 'spider-blocker' directory to the '/wp-content/plugins/' directory
24
  2. Activate the plugin through the 'Plugins' menu in WordPress
25
  3. Go to **Tools** menu and then **SpiderBlocker* to configure
 
2
  Contributors: niteoweb
3
  Tags: seo, block, bots, htaccess, apache, secure
4
  Requires at least: 4.0
5
+ Tested up to: 4.6
6
+ Stable tag: 1.0.13
7
 
8
  SpiderBlocker will block most common bots that consume bandwidth and slow down your server.
9
 
23
  1. Upload 'spider-blocker' directory to the '/wp-content/plugins/' directory
24
  2. Activate the plugin through the 'Plugins' menu in WordPress
25
  3. Go to **Tools** menu and then **SpiderBlocker* to configure
26
+ 4. If you use any other plugin to edit .htaacess file, make sure that content of file is valid