Mercurial > hg > isophonics-drupal-site
view core/modules/system/src/Controller/TimezoneController.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 7a779792577d |
children |
line wrap: on
line source
<?php namespace Drupal\system\Controller; use Symfony\Component\HttpFoundation\JsonResponse; /** * Provides a callback for finding out a timezone name. */ class TimezoneController { /** * Retrieve a JSON object containing a time zone name given a timezone * abbreviation. * * @param string $abbreviation * Time zone abbreviation. * @param int $offset * Offset from GMT in seconds. Defaults to -1 which means that first found * time zone corresponding to abbr is returned. Otherwise exact offset is * searched and only if not found then the first time zone with any offset * is returned. * @param null|bool $is_daylight_saving_time * Daylight saving time indicator. If abbr does not exist then the time * zone is searched solely by offset and isdst. * * @return \Symfony\Component\HttpFoundation\JsonResponse * The timezone name in JsonResponse object. */ public function getTimezone($abbreviation = '', $offset = -1, $is_daylight_saving_time = NULL) { // An abbreviation of "0" passed in the callback arguments should be // interpreted as the empty string. $abbreviation = $abbreviation ? $abbreviation : ''; $timezone = timezone_name_from_abbr($abbreviation, intval($offset), $is_daylight_saving_time); return new JsonResponse($timezone); } }