/** * Converts a 2 letter country code to long name (ie AU -> Australia) * */ function yourls_geo_countrycode_to_countryname($code) { // Allow plugins to short-circuit the Geo IP API $country = yourls_apply_filter('shunt_geo_countrycode_to_countryname', false, $code); if (false !== $country) { return $country; } // Load the Geo class if not already done if (!class_exists('GeoIP', false)) { $temp = yourls_geo_ip_to_countrycode('127.0.0.1'); } if (class_exists('GeoIP', false)) { $geo = new GeoIP(); $id = $geo->GEOIP_COUNTRY_CODE_TO_NUMBER[$code]; $long = $geo->GEOIP_COUNTRY_NAMES[$id]; return $long; } else { return false; } }
function yourls_geo_get_flag($code) { // Load the Geo class if not already done if (!class_exists('GeoIP')) { $temp = yourls_geo_ip_to_countrycode('127.0.0.1'); } if (class_exists('GeoIP')) { return YOURLS_SITE . '/includes/geo/flags/flag_' . strtolower($code) . '.gif'; } else { return false; } }