public function load() { require_once HM_LIMIT_LOGIN_DIR . 'inc/class-options.php'; require_once HM_LIMIT_LOGIN_DIR . 'inc/class-errors.php'; require_once HM_LIMIT_LOGIN_DIR . 'inc/class-cookies.php'; require_once HM_LIMIT_LOGIN_DIR . 'inc/class-validation.php'; require_once HM_LIMIT_LOGIN_DIR . 'inc/class-notifications.php'; if (HM_LIMIT_LOGIN_VERSION !== get_option('hm_limit_login_version')) { $this->set_default_variables(); } load_plugin_textdomain('limit-login-attempts', false, dirname(plugin_basename(__FILE__))); Options::get_instance(); Errors::get_instance(); Cookies::get_instance(); Validation::get_instance(); Notifications::get_instance(); }
/** * Action when login attempt failed * * Increase nr of retries (if necessary). Reset valid value. Setup * lockout if nr of retries are above threshold. And more! * * A note on external whitelist: retries and statistics are still counted and * notifications done as usual, but no lockout is done. */ public function failed() { // Get lockouts list($lockouts, $retries, $valid) = $this->process_lockouts(); // Return early if already locked out or not locked out yet if ($this->locked_out) { return; } /* do housecleaning and save values */ $this->cleanup($retries, $lockouts, $valid); /* do any notification */ $notifcation_object = Notifications::get_instance(); $notifcation_object->notify(); /* increase statistics */ $total = get_option('hm_limit_login_lockouts_total'); if ($total === false || !is_numeric($total)) { add_option('hm_limit_login_lockouts_total', 1, '', 'no'); } else { update_option('hm_limit_login_lockouts_total', $total + 1); } }