1 install.core.inc _install_get_timezone_country($timezone)

Get a country code for the provided timezone.

File

core/includes/install.core.inc, line 2010
API functions for installing Backdrop.

Code

function _install_get_timezone_country($timezone) {
  // Get timezone countries list
  include_once BACKDROP_ROOT . '/core/includes/locale.inc';
  $timezone_countries = timezone_country_get_list();

  // Replace spaces in provided timezone with underscores
  $timezone = str_replace(' ', '_', $timezone);

  // Return timezone's country code or empty string
  if (isset($timezone_countries[$timezone])) {
    return $timezone_countries[$timezone];
  }
  else {
    return '';
  }
}