You are here

function ip_geoloc_pretty_print in IP Geolocation Views & Maps 8

Same name and namespace in other branches
  1. 7 ip_geoloc.module \ip_geoloc_pretty_print()

Print the location array nicely.

Parameters

array $location: Array of location components.

Return value

string The location array formatted as string.

5 calls to ip_geoloc_pretty_print()
IpGeoLocAPI::storeLocation in src/Services/IpGeoLocAPI.php
Store the supplied IP geolocation info on the database. This will overwrite any existing info for the IP address in question.
IpGeoLocGlobal::useGeoipApiIfEnabled in src/Services/IpGeoLocGlobal.php
Module GeoIP API does not expose a hook, but it does expose an API.
ip_geoloc_smart_ip_get_location_alter in ./ip_geoloc.module
Implements hook_smart_ip_get_location_alter().
ip_geoloc_store_location in ./ip_geoloc_api.inc
Store the supplied IP geolocation info on the database.
ip_geoloc_use_geoip_api_if_enabled in ./ip_geoloc.module
Module GeoIP API does not expose a hook, but it does expose an API.

File

./ip_geoloc.module, line 544
IPGV&M is a mapping engine for Views that contain locations of entities and/or visitors. Google Maps, Leaflet and OpenLayers2 maps are all supported and available through this module. Using a number of optional sources IPGV&M also retrieves…

Code

function ip_geoloc_pretty_print(array $location) {
  $t = '';
  foreach ($location as $label => $value) {
    if (!empty($value)) {
      $t .= SafeMarkup::checkPlain($label) . ':&nbsp;<strong>' . SafeMarkup::checkPlain($value) . '</strong>&nbsp; ';
    }
  }
  return empty($t) ? t('nothing') : $t;
}