__( 'You have been locked out due to too many invalid login attempts.', 'wpdef' ), ); } protected function before_load() { $default_values = $this->get_default_values(); $this->lockout_message = $default_values['message']; } /** * Return the blacklisted username as array. * * @return array */ public function get_blacklisted_username() { // Since 2.4.7 $usernames = apply_filters( 'wp_defender_banned_usernames', $this->username_blacklist ); if ( empty( $usernames ) ) { return array(); } $usernames = str_replace( PHP_EOL, ' ', $this->username_blacklist ); $usernames = explode( ' ', $usernames ); $usernames = array_map( 'trim', $usernames ); return $usernames; } /** * Define labels for settings key. * * @param string|null $key * * @return string|array|null */ public function labels( $key = null ) { $labels = array( // New key: enabled. 'login_protection' => __( 'Login Protection', 'wpdef' ), // New key: attempt. 'login_protection_login_attempt' => __( 'Login Protection - Threshold', 'wpdef' ), // New key: timeframe. 'login_protection_lockout_timeframe' => __( 'Login Protection - Timeframe', 'wpdef' ), // New key: lockout_type. 'login_protection_lockout_ban' => __( 'Login Protection - Duration Type', 'wpdef' ), // New key: duration. 'login_protection_lockout_duration' => __( 'Login Protection - Duration', 'wpdef' ), // New key: duration_unit. 'login_protection_lockout_duration_unit' => __( 'Login Protection - Duration units', 'wpdef' ), // New key: lockout_message. 'login_protection_lockout_message' => __( 'Login Protection - Lockout Message', 'wpdef' ), 'username_blacklist' => __( 'Login Protection - Banned Usernames', 'wpdef' ), ); if ( ! is_null( $key ) ) { return $labels[ $key ] ?? null; } return $labels; } }