コード例 #1
0
 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();
 }
コード例 #2
0
 /**
  * Filter: allow login attempt? (called from wp_authenticate())
  *
  * @param \WP_User|\WP_Error $user
  * @return \WP_User|\WP_Error
  */
 public function authenticate($user)
 {
     if ($this->is_ok_to_login()) {
         if ($user instanceof \WP_User) {
             $this->cleanup_on_login();
         }
         return $user;
     }
     $error = new \WP_Error();
     // This error should be the same as in "shake it" filter below
     $errors_object = Errors::get_instance();
     $errors_object->show_error();
     $error->add('too_many_retries', $errors_object->error_msg());
     return $error;
 }