| @@ -49,25 +49,26 @@ | ||
| 49 | 49 | * @param bool $enable True to enable whitelisting, false otherwise. |
| 50 | 50 | * |
| 51 | 51 | * @since 5.0.2 |
| 52 | 52 | */ |
| 53 | - return (bool) apply_filters( 'wpdef_firewall_whitelist_mainwp_dashboard_public_ip_enabled', true ); | |
| 53 | + $enabled = apply_filters( 'wpdef_firewall_whitelist_mainwp_dashboard_public_ip_enabled', true ); | |
| 54 | + return is_bool( $enabled ) ? $enabled : (bool) $enabled; | |
| 54 | 55 | } |
| 55 | 56 | |
| 56 | 57 | /** |
| 57 | 58 | * Whitelist MainWP dashboard site's public IP. |
| 58 | 59 | * |
| 59 | - * @return bool | |
| 60 | + * @return void | |
| 60 | 61 | */ |
| 61 | - public function set_whitelist_dashboard_public_ip(): bool { | |
| 62 | + public function set_whitelist_dashboard_public_ip(): void { | |
| 62 | 63 | if ( ! $this->is_whitelist_dashboard_public_ip_enabled() ) { |
| 63 | - return false; | |
| 64 | + return; | |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | $ips = $this->get_user_ip(); |
| 67 | 68 | |
| 68 | 69 | if ( array() === $ips ) { |
| 69 | - return false; | |
| 70 | + return; | |
| 70 | 71 | } |
| 71 | 72 | |
| 72 | 73 | $stored_ips = $this->get_whitelist_dashboard_public_ip(); |
| 73 | 74 | $stored_ips = array_unique( $stored_ips ); |
| @@ -78,10 +79,8 @@ | ||
| 78 | 79 | |
| 79 | 80 | if ( $stored_ips !== $ips ) { |
| 80 | 81 | update_site_option( self::WHITELIST_DASHBOARD_PUBLIC_IP_OPTION, $ips ); |
| 81 | 82 | } |
| 82 | - | |
| 83 | - return true; | |
| 84 | 83 | } |
| 85 | 84 | |
| 86 | 85 | /** |
| 87 | 86 | * Get the whitelisted MainWP dashboard site's public IP. |