mirror of
https://github.com/getgrav/grav.git
synced 2026-02-02 12:50:15 +01:00
timezon and param_sep blueprints
This commit is contained in:
@@ -362,3 +362,26 @@ form:
|
||||
0: No
|
||||
validate:
|
||||
type: bool
|
||||
system:
|
||||
type: section
|
||||
title: System
|
||||
underline: true
|
||||
|
||||
fields:
|
||||
timezone:
|
||||
type: select
|
||||
label: Timezone
|
||||
classes: fancy
|
||||
@data-options: '\Grav\Common\Utils::timezones'
|
||||
default: ''
|
||||
options:
|
||||
'': '- None -'
|
||||
|
||||
param_sep:
|
||||
type: select
|
||||
label: Parameter separator
|
||||
classes: fancy
|
||||
default: ''
|
||||
options:
|
||||
':': ': (default)'
|
||||
';': '; (use this for apache on Windows)'
|
||||
|
||||
@@ -348,4 +348,32 @@ abstract class Utils
|
||||
}
|
||||
return $root . implode('/', $ret);
|
||||
}
|
||||
|
||||
public static function timezones()
|
||||
{
|
||||
$timezones = \DateTimeZone::listIdentifiers(\DateTimeZone::ALL);
|
||||
$offsets = [];
|
||||
$testDate = new \DateTime;
|
||||
|
||||
foreach ($timezones as $zone) {
|
||||
$tz = new \DateTimeZone($zone);
|
||||
$offsets[$zone] = $tz->getOffset($testDate);
|
||||
}
|
||||
|
||||
asort($offsets);
|
||||
|
||||
$timezone_list = array();
|
||||
foreach( $offsets as $timezone => $offset )
|
||||
{
|
||||
$offset_prefix = $offset < 0 ? '-' : '+';
|
||||
$offset_formatted = gmdate( 'H:i', abs($offset) );
|
||||
|
||||
$pretty_offset = "UTC${offset_prefix}${offset_formatted}";
|
||||
|
||||
$timezone_list[$timezone] = "(${pretty_offset}) $timezone";
|
||||
}
|
||||
|
||||
return $timezone_list;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user