api = $api; } public function getConfig(): array { return [ 'title' => 'GeoIP Info', 'type' => 'system', ]; } /** * Register admin menu items. */ public function getAdminMenu(): array { return [ ['label' => 'GeoIP Info', 'route' => 'geoip-info', 'icon' => 'bi-globe2'], ]; } /** * Register admin routes this plugin handles. */ public function getAdminRoutes(): array { return ['geoip-info']; } /** * Handle admin route — render the admin page. */ public function handleAdminRoute(string $route): void { $ip = $_SERVER['REMOTE_ADDR'] ?? '127.0.0.1'; $geoip = new GeoIP(); $countryCode = $geoip->lookupCountry($ip); $country = GeoIP::getCountryName($countryCode); $flag = GeoIP::getCountryFlagEmoji($countryCode); echo '

GeoIP Info

'; echo '
'; echo ''; echo ''; echo ''; echo '
IP adres' . htmlspecialchars($ip) . '
Land' . $flag . ' ' . htmlspecialchars($country) . '
'; echo '
'; } }