Limit Login Attempts Reloaded - Version 2.12.0

Version Description

  • Small refactoring.
  • get_message() - fixed error notices.
  • This is the first time we are asking you for a feedback.
Download this release

Release Info

Developer wpchefgadget
Plugin Icon 128x128 Limit Login Attempts Reloaded
Version 2.12.0
Comparing to
See all releases

Code changes from version 2.11.0 to 2.12.0

assets/css/limit-login-attempts.css CHANGED
@@ -1,11 +1 @@
1
- .limit-login-page-settings .field-col {
2
- display: inline-block;
3
- margin-right: 20px; }
4
- .limit-login-page-settings .limit-login-log table {
5
- background-color: #fff; }
6
- .limit-login-page-settings .limit-login-log table th, .limit-login-page-settings .limit-login-log table td {
7
- padding: 10px; }
8
- .limit-login-page-settings .limit-login-log table tr:nth-child(even) {
9
- background-color: rgba(0, 0, 0, 0.09); }
10
- .limit-login-page-settings input[name="admin_notify_email"] {
11
- min-width: 243px; }
1
+ .limit-login-page-settings .field-col{display:inline-block;margin-right:20px}.limit-login-page-settings .limit-login-log table{background-color:#fff}.limit-login-page-settings .limit-login-log table th,.limit-login-page-settings .limit-login-log table td{padding:10px}.limit-login-page-settings .limit-login-log table tr:nth-child(even){background-color:rgba(0,0,0,0.09)}.limit-login-page-settings input[name="admin_notify_email"]{min-width:243px}.llar-notice-review{display:-webkit-box;display:-ms-flexbox;display:flex;padding:15px 20px 0 !important;border-left:4px solid #333 !important}.llar-notice-review .llar-review-image img{margin-top:10px}.llar-notice-review .llar-review-info{-webkit-box-flex:1;-ms-flex:1;flex:1;margin-left:30px}.llar-notice-review .llar-review-info .llar-buttons{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.llar-notice-review .llar-review-info .llar-buttons li{margin-right:10px}.llar-notice-review .llar-review-info .llar-buttons li .dashicons{margin-right:5px}
 
 
 
 
 
 
 
 
 
 
assets/img/icon-256x256.png ADDED
Binary file
assets/sass/limit-login-attempts.scss CHANGED
@@ -18,4 +18,33 @@
18
  input[name="admin_notify_email"] {
19
  min-width: 243px;
20
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
18
  input[name="admin_notify_email"] {
19
  min-width: 243px;
20
  }
21
+ }
22
+
23
+ .llar-notice-review {
24
+ display: flex;
25
+ padding: 15px 20px 0 !important;
26
+ border-left: 4px solid #333 !important;
27
+
28
+ .llar-review-image {
29
+ img {
30
+ margin-top: 10px;
31
+ }
32
+ }
33
+ .llar-review-info {
34
+ flex: 1;
35
+ margin-left: 30px;
36
+
37
+ .llar-buttons {
38
+ display: flex;
39
+ align-items: center;
40
+
41
+ li {
42
+ margin-right: 10px;
43
+
44
+ .dashicons {
45
+ margin-right: 5px;
46
+ }
47
+ }
48
+ }
49
+ }
50
  }
core/LimitLoginAttempts.php CHANGED
@@ -35,6 +35,8 @@ class Limit_Login_Attempts
35
  /* If notify by email, do so after this number of lockouts */
36
  'notify_email_after' => 4,
37
 
 
 
38
  'whitelist' => array(),
39
  'whitelist_usernames' => array(),
40
  'blacklist' => array(),
@@ -53,6 +55,11 @@ class Limit_Login_Attempts
53
  */
54
  public $_errors = array();
55
 
 
 
 
 
 
56
  public function __construct() {
57
  $this->hooks_init();
58
  }
@@ -68,7 +75,10 @@ class Limit_Login_Attempts
68
  add_filter( 'limit_login_whitelist_usernames', array( $this, 'check_whitelist_usernames' ), 10, 2 );
69
  add_filter( 'limit_login_blacklist_ip', array( $this, 'check_blacklist_ips' ), 10, 2 );
70
  add_filter( 'limit_login_blacklist_usernames', array( $this, 'check_blacklist_usernames' ), 10, 2 );
 
71
  add_filter( 'illegal_user_logins', array( $this, 'register_user_blacklist' ), 999 );
 
 
72
  }
73
 
74
  /**
@@ -467,7 +477,7 @@ class Limit_Login_Attempts
467
  * Enqueue js and css
468
  */
469
  public function enqueue() {
470
- wp_enqueue_style( 'lla-main', LLA_PLUGIN_URL . '/assets/css/limit-login-attempts.css' );
471
  }
472
 
473
  /**
@@ -1472,4 +1482,85 @@ class Limit_Login_Attempts
1472
  {
1473
  return isset($arr[$k]) ? $arr[$k] : 0;
1474
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1475
  }
35
  /* If notify by email, do so after this number of lockouts */
36
  'notify_email_after' => 4,
37
 
38
+ 'review_notice_shown' => false,
39
+
40
  'whitelist' => array(),
41
  'whitelist_usernames' => array(),
42
  'blacklist' => array(),
55
  */
56
  public $_errors = array();
57
 
58
+ /**
59
+ * @var null
60
+ */
61
+ private $use_local_options = null;
62
+
63
  public function __construct() {
64
  $this->hooks_init();
65
  }
75
  add_filter( 'limit_login_whitelist_usernames', array( $this, 'check_whitelist_usernames' ), 10, 2 );
76
  add_filter( 'limit_login_blacklist_ip', array( $this, 'check_blacklist_ips' ), 10, 2 );
77
  add_filter( 'limit_login_blacklist_usernames', array( $this, 'check_blacklist_usernames' ), 10, 2 );
78
+
79
  add_filter( 'illegal_user_logins', array( $this, 'register_user_blacklist' ), 999 );
80
+ add_action( 'admin_notices', array( $this, 'show_leave_review_notice' ) );
81
+ add_action( 'wp_ajax_dismiss_review_notice', array( $this, 'dismiss_review_notice_callback' ));
82
  }
83
 
84
  /**
477
  * Enqueue js and css
478
  */
479
  public function enqueue() {
480
+ wp_enqueue_style( 'lla-main', LLA_PLUGIN_URL . 'assets/css/limit-login-attempts.css' );
481
  }
482
 
483
  /**
1482
  {
1483
  return isset($arr[$k]) ? $arr[$k] : 0;
1484
  }
1485
+
1486
+ public function show_leave_review_notice() {
1487
+
1488
+ $screen = get_current_screen();
1489
+ if ( $screen->parent_base === 'edit' ) return;
1490
+
1491
+ $activation_timestamp = $this->get_option('activation_timestamp');
1492
+
1493
+ if(!$activation_timestamp) {
1494
+
1495
+ $activation_timestamp = filemtime(LLA_PLUGIN_DIR . 'core/Helpers.php');
1496
+ $this->update_option( 'activation_timestamp', $activation_timestamp );
1497
+ }
1498
+
1499
+ if ( !$this->get_option('review_notice_shown') && $activation_timestamp && $activation_timestamp < strtotime("-1 month") ) { ?>
1500
+
1501
+ <div id="message" class="updated fade notice llar-notice-review">
1502
+ <div class="llar-review-image">
1503
+ <img width="80px" src="<?php echo LLA_PLUGIN_URL?>assets/img/icon-256x256.png" alt="review-logo">
1504
+ </div>
1505
+ <div class="llar-review-info">
1506
+ <p><?php _e('Hey <strong>Limit Login Attempts Reloaded</strong> user!', 'limit-login-attempts-reloaded'); ?></p>
1507
+ <p><?php _e('A <strong>crazy idea</strong> we wanted to share! What if we put an image from YOU on the <a href="https://wordpress.org/plugins/limit-login-attempts-reloaded/" target="_blank">LLAR page</a>?! (<a href="https://wordpress.org/plugins/hello-dolly/" target="_blank">example</a>) A drawing made by you or your child would cheer people up! Send us your drawing by <a href="mailto:wpchef.me@gmail.com" target="_blank">email</a> and we like it, we\'ll add it in the next release. Let\'s have some fun!', 'limit-login-attempts-reloaded'); ?></p>
1508
+ <p><?php _e('Also, we would really like to hear your feedback about the plugin! Please take a couple minutes to write a few words <a href="https://wordpress.org/support/plugin/limit-login-attempts-reloaded/reviews/#new-post" target="_blank">here</a>. Thank you!', 'limit-login-attempts-reloaded'); ?></p>
1509
+
1510
+ <ul class="llar-buttons">
1511
+ <li><a href="#" class="llar-review-dismiss" data-type="dismiss"><?php _e('Don\'t show again', 'limit-login-attempts-reloaded'); ?></a></li>
1512
+ <li><i class=""></i><a href="#" class="llar-review-dismiss button" data-type="later"><?php _e('Maybe later', 'limit-login-attempts-reloaded'); ?></a></li>
1513
+ <li><a class="button button-primary" target="_blank" href="https://wordpress.org/support/plugin/limit-login-attempts-reloaded/reviews/#new-post"><?php _e('Leave a review', 'limit-login-attempts-reloaded'); ?></a></li>
1514
+ </ul>
1515
+ </div>
1516
+ </div>
1517
+ <script type="text/javascript">
1518
+ (function($){
1519
+
1520
+ $(document).ready(function(){
1521
+ $('.llar-review-dismiss').on('click', function(e) {
1522
+ e.preventDefault();
1523
+
1524
+ var type = $(this).data('type');
1525
+
1526
+ $.post(ajaxurl, {
1527
+ action: 'dismiss_review_notice',
1528
+ type: type,
1529
+ sec: '<?php echo wp_create_nonce( "llar-action" ); ?>'
1530
+ })
1531
+
1532
+ $(this).closest('.llar-notice-review').remove();
1533
+
1534
+ })
1535
+ });
1536
+
1537
+ })(jQuery);
1538
+ </script>
1539
+ <?php
1540
+ }
1541
+ }
1542
+
1543
+ public function dismiss_review_notice_callback() {
1544
+
1545
+ if ( !current_user_can('activate_plugins') ) {
1546
+
1547
+ wp_send_json_error([]);
1548
+ }
1549
+
1550
+ check_ajax_referer('llar-action', 'sec');
1551
+
1552
+ $type = isset( $_POST['type'] ) ? $_POST['type'] : false;
1553
+
1554
+ if ($type === 'dismiss'){
1555
+
1556
+ $this->update_option( 'review_notice_shown', true );
1557
+ }
1558
+
1559
+ if ($type === 'later') {
1560
+
1561
+ $this->update_option( 'activation_timestamp', time() );
1562
+ }
1563
+
1564
+ wp_send_json_success([]);
1565
+ }
1566
  }
core/Logger.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Class LLA_Logger
5
- */
6
- class LLA_Logger {
7
-
8
- private static $_log_file_name = 'log.txt';
9
-
10
- /**
11
- * TODO
12
- * @param $msg
13
- * @return int|void
14
- */
15
- public static function add_log( $msg ) {
16
- if( ! $msg ) {
17
- return;
18
- }
19
-
20
- return file_put_contents( LLA_PLUGIN_DIR . DIRECTORY_SEPARATOR . self::$_log_file_name, $msg . "\n\r", FILE_APPEND );
21
- }
22
-
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
limit-login-attempts-reloaded.php CHANGED
@@ -5,7 +5,7 @@ Description: Limit the rate of login attempts, including by way of cookies and f
5
  Author: WPChef
6
  Author URI: https://wpchef.org
7
  Text Domain: limit-login-attempts-reloaded
8
- Version: 2.11.0
9
 
10
  Copyright 2008 - 2012 Johan Eenfeldt, 2016 - 2020 WPChef
11
  */
@@ -33,7 +33,6 @@ $limit_login_nonempty_credentials = false; /* user and pwd nonempty */
33
  * Include files
34
  **************************************************************************************/
35
  require_once( LLA_PLUGIN_DIR . '/core/Helpers.php' );
36
- require_once( LLA_PLUGIN_DIR . '/core/Logger.php' );
37
  require_once( LLA_PLUGIN_DIR . '/core/LimitLoginAttempts.php' );
38
 
39
  $limit_login_attempts_obj = new Limit_Login_Attempts();
5
  Author: WPChef
6
  Author URI: https://wpchef.org
7
  Text Domain: limit-login-attempts-reloaded
8
+ Version: 2.12.0
9
 
10
  Copyright 2008 - 2012 Johan Eenfeldt, 2016 - 2020 WPChef
11
  */
33
  * Include files
34
  **************************************************************************************/
35
  require_once( LLA_PLUGIN_DIR . '/core/Helpers.php' );
 
36
  require_once( LLA_PLUGIN_DIR . '/core/LimitLoginAttempts.php' );
37
 
38
  $limit_login_attempts_obj = new Limit_Login_Attempts();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wpchefgadget
3
  Tags: brute force, login, security, GDPR, protection
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
- Stable tag: 2.11.0
7
 
8
  Reloaded version of the original Limit Login Attempts plugin for Login Protection by a team of WordPress developers. GDPR compliant.
9
 
@@ -51,6 +51,11 @@ Based on the original code from Limit Login Attemps plugin by Johan Eenfeldt.
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
54
  = 2.11.0 =
55
  * Blacklisted usernames can't be registered anymore.
56
 
3
  Tags: brute force, login, security, GDPR, protection
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
+ Stable tag: 2.12.0
7
 
8
  Reloaded version of the original Limit Login Attempts plugin for Login Protection by a team of WordPress developers. GDPR compliant.
9
 
51
 
52
  == Changelog ==
53
 
54
+ = 2.12.0 =
55
+ * Small refactoring.
56
+ * get_message() - fixed error notices.
57
+ * This is the first time we are asking you for a feedback.
58
+
59
  = 2.11.0 =
60
  * Blacklisted usernames can't be registered anymore.
61