Spider Blocker - Version 1.0.15

Version Description

Download this release

Release Info

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

Code changes from version 1.0.14 to 1.0.15

Files changed (2) hide show
  1. index.php +18 -2
  2. readme.txt +1 -1
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.14
7
  * Runtime: 5.3+
8
  * Author: Easy Blog Networks
9
  * Author URI: www.easyblognetworks.com
@@ -329,6 +329,14 @@ class SpiderBlocker
329
  }
330
  }
331
 
 
 
 
 
 
 
 
 
332
  /**
333
  * @codeCoverageIgnore
334
  */
@@ -428,6 +436,9 @@ class SpiderBlocker
428
  {
429
  $list = array();
430
  foreach ($this->getBots() as $bot) {
 
 
 
431
  if ($bot->state) {
432
  $list[] = 'SetEnvIfNoCase User-Agent "' . $bot->re . '" block_bot';
433
  }
@@ -444,7 +455,11 @@ class SpiderBlocker
444
 
445
  private function getBots()
446
  {
447
- return maybe_unserialize(get_option(self::OptionName, $this->default_bots));
 
 
 
 
448
  }
449
 
450
 
@@ -764,6 +779,7 @@ class SpiderBlocker
764
  // Inside WordPress
765
  if (defined('ABSPATH')) {
766
  $NiteowebSpiderBlocker_ins = new SpiderBlocker;
 
767
  register_activation_hook(__FILE__, array(&$NiteowebSpiderBlocker_ins, 'activatePlugin'));
768
  register_deactivation_hook(__FILE__, array(&$NiteowebSpiderBlocker_ins, 'removeBlockRules'));
769
  }
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.15
7
  * Runtime: 5.3+
8
  * Author: Easy Blog Networks
9
  * Author URI: www.easyblognetworks.com
329
  }
330
  }
331
 
332
+ /**
333
+ * @codeCoverageIgnore
334
+ */
335
+ function onPluginUpgrade()
336
+ {
337
+ $this->generateBlockRules();
338
+ }
339
+
340
  /**
341
  * @codeCoverageIgnore
342
  */
436
  {
437
  $list = array();
438
  foreach ($this->getBots() as $bot) {
439
+ if(is_array($bot)){
440
+ $bot = (object) $bot;
441
+ }
442
  if ($bot->state) {
443
  $list[] = 'SetEnvIfNoCase User-Agent "' . $bot->re . '" block_bot';
444
  }
455
 
456
  private function getBots()
457
  {
458
+ $data = get_option(self::OptionName);
459
+ if($data && is_array($data) && count($data) > 0){
460
+ return maybe_unserialize($data);
461
+ }
462
+ return $this->default_bots;
463
  }
464
 
465
 
779
  // Inside WordPress
780
  if (defined('ABSPATH')) {
781
  $NiteowebSpiderBlocker_ins = new SpiderBlocker;
782
+ add_action( "upgrader_process_complete", array(&$NiteowebSpiderBlocker_ins, 'onPluginUpgrade'), 10, 2);
783
  register_activation_hook(__FILE__, array(&$NiteowebSpiderBlocker_ins, 'activatePlugin'));
784
  register_deactivation_hook(__FILE__, array(&$NiteowebSpiderBlocker_ins, 'removeBlockRules'));
785
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: niteoweb
3
  Tags: seo, block, bots, htaccess, apache, secure
4
  Requires at least: 4.0
5
  Tested up to: 4.7.3
6
- Stable tag: 1.0.14
7
 
8
  SpiderBlocker will block most common bots that consume bandwidth and slow down your server.
9
 
3
  Tags: seo, block, bots, htaccess, apache, secure
4
  Requires at least: 4.0
5
  Tested up to: 4.7.3
6
+ Stable tag: 1.0.15
7
 
8
  SpiderBlocker will block most common bots that consume bandwidth and slow down your server.
9