__( "You have been locked out due to too many attempts to access a file that doesn't exist.", 'wpdef' ), 'whitelist' => ".css\n.js\n.map", ); } protected function before_load() { $default_values = $this->get_default_values(); $this->lockout_message = $default_values['message']; $this->whitelist = $default_values['whitelist']; } /** * Get list of blocklisted or allowlisted data. * * @param string $type blocklist|allowlist * * @return array */ public function get_lockout_list( $type = 'blocklist' ) { $data = ( 'blocklist' === $type ) ? $this->blacklist : $this->whitelist; $arr = is_array( $data ) ? $data : array_filter( explode( PHP_EOL, $data ) ); $arr = array_map( 'trim', $arr ); $arr = array_map( 'strtolower', $arr ); return $arr; } /** * Define labels for settings key. * * @param string|null $key * * @return string|array|null */ public function labels( $key = null ) { $labels = array( //Todo new key: enabled 'detect_404' => __( '404 Detection', 'wpdef' ), //Todo new key: attempt 'detect_404_threshold' => __( '404 Detection - Threshold', 'wpdef' ), //Todo new key: timeframe 'detect_404_timeframe' => __( '404 Protection - Timeframe', 'wpdef' ), //Todo new key: lockout_type 'detect_404_lockout_ban' => __( '404 Protection - Duration Type', 'wpdef' ), //Todo new key: duration 'detect_404_lockout_duration' => __( '404 Detection - Duration', 'wpdef' ), //Todo new key: duration_unit 'detect_404_lockout_duration_unit' => __( '404 Protection - Duration units', 'wpdef' ), //Todo new key: lockout_message 'detect_404_lockout_message' => __( '404 Detection - Lockout Message', 'wpdef' ), //Todo new key: blacklist 'detect_404_blacklist' => __( '404 Detection - Files & Folders Blocklist', 'wpdef' ), //Todo new key: whitelist 'detect_404_whitelist' => __( '404 Detection - Files & Folders Allowlist', 'wpdef' ), //Todo new key: detect_logged 'detect_404_logged' => __( '404 Detection - Monitor logged in users', 'wpdef' ), ); if ( ! is_null( $key ) ) { return $labels[ $key ] ?? null; } return $labels; } }