ip_detector = $ip_detector; $this->api_manager = new ApiProviderManager(); } /** * Check if the given IP address is a VPN or proxy * * @return bool True if the IP is a VPN or proxy, false otherwise */ public function is_vpn_or_proxy(): bool { $ip = $this->ip_detector->get_client_ip(); if ( empty( $ip ) || $this->ip_detector->is_private_ip( $ip ) ) { return false; } $result = $this->api_manager->is_vpn_proxy( $ip ); return $result; } /** * Get country information for the current IP * * @return array Country information (code, name) * @since 1.1.0 */ public function get_country_info(): array { $ip = $this->ip_detector->get_client_ip(); if ( empty( $ip ) || $this->ip_detector->is_private_ip( $ip ) ) { return array( 'code' => '', 'name' => '', ); } return $this->api_manager->get_country_info( $ip ); } /** * Get full IP information for the current IP * * @return array|false Full IP information or false on failure * @since 1.1.0 */ public function get_ip_info() { $ip = $this->ip_detector->get_client_ip(); if ( empty( $ip ) || $this->ip_detector->is_private_ip( $ip ) ) { return false; } return $this->api_manager->get_ip_info( $ip ); } /** * Get API provider manager instance * * @return ApiProviderManager API provider manager * @since 1.1.0 */ public function get_api_manager(): ApiProviderManager { return $this->api_manager; } }