| @@ -243,34 +243,26 @@ | ||
| 243 | 243 | * |
| 244 | 244 | * @return void |
| 245 | 245 | */ |
| 246 | 246 | protected function after_validate(): void { |
| 247 | - if ( true === $this->sh_xframe | |
| 248 | - && ( empty( $this->sh_xframe_mode ) | |
| 249 | - || ! in_array( $this->sh_xframe_mode, array( 'sameorigin', 'deny' ), true ) ) | |
| 250 | - ) { | |
| 247 | + if ( true === $this->sh_xframe && ! in_array( $this->sh_xframe_mode, array( 'sameorigin', 'deny' ), true ) ) { | |
| 251 | 248 | $this->errors[] = esc_html__( 'X-Frame-Options mode is invalid', 'defender-security' ); |
| 252 | - } elseif ( true === $this->sh_xss_protection | |
| 253 | - && ( empty( $this->sh_xss_protection_mode ) | |
| 254 | - || ! in_array( $this->sh_xss_protection_mode, array( 'sanitize', 'block', 'none' ), true ) ) | |
| 255 | - ) { | |
| 249 | + } elseif ( true === $this->sh_xss_protection && ! in_array( $this->sh_xss_protection_mode, array( 'sanitize', 'block', 'none' ), true ) ) { | |
| 256 | 250 | $this->errors[] = esc_html__( 'X-XSS-Protection mode is invalid', 'defender-security' ); |
| 257 | 251 | } elseif ( true === $this->sh_referrer_policy |
| 258 | - && ( empty( $this->sh_referrer_policy_mode ) | |
| 259 | - || ! in_array( | |
| 260 | - $this->sh_referrer_policy_mode, | |
| 261 | - array( | |
| 262 | - 'no-referrer', | |
| 263 | - 'no-referrer-when-downgrade', | |
| 264 | - 'origin', | |
| 265 | - 'origin-when-cross-origin', | |
| 266 | - 'same-origin', | |
| 267 | - 'strict-origin', | |
| 268 | - 'strict-origin-when-cross-origin', | |
| 269 | - 'unsafe-url', | |
| 270 | - ), | |
| 271 | - true | |
| 272 | - ) | |
| 252 | + && ! in_array( | |
| 253 | + $this->sh_referrer_policy_mode, | |
| 254 | + array( | |
| 255 | + 'no-referrer', | |
| 256 | + 'no-referrer-when-downgrade', | |
| 257 | + 'origin', | |
| 258 | + 'origin-when-cross-origin', | |
| 259 | + 'same-origin', | |
| 260 | + 'strict-origin', | |
| 261 | + 'strict-origin-when-cross-origin', | |
| 262 | + 'unsafe-url', | |
| 263 | + ), | |
| 264 | + true | |
| 273 | 265 | ) |
| 274 | 266 | ) { |
| 275 | 267 | $this->errors[] = esc_html__( 'Referrer Policy mode is invalid', 'defender-security' ); |
| 276 | 268 | } |
| @@ -365,7 +357,7 @@ | ||
| 365 | 357 | * |
| 366 | 358 | * @return string |
| 367 | 359 | */ |
| 368 | 360 | public static function get_module_name(): string { |
| 369 | - return esc_html__( 'Security Headers', 'defender-security' ); | |
| 361 | + return esc_html__( 'Security Policy', 'defender-security' ); | |
| 370 | 362 | } |
| 371 | 363 | } |