Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F1821580
fetch_windows_zones.php
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Subscribers
None
fetch_windows_zones.php
View Options
#!/usr/bin/env php
<?php
$windowsZonesUrl
=
'http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml'
;
$outputFile
=
__DIR__
.
'/../lib/timezonedata/windowszones.php'
;
echo
"Fetching timezone map from: "
.
$windowsZonesUrl
,
"
\n
"
;
$data
=
file_get_contents
(
$windowsZonesUrl
);
$xml
=
simplexml_load_string
(
$data
);
$map
=
array
();
foreach
(
$xml
->
xpath
(
'//mapZone'
)
as
$mapZone
)
{
$from
=
(
string
)
$mapZone
[
'other'
];
$to
=
(
string
)
$mapZone
[
'type'
];
list
(
$to
)
=
explode
(
' '
,
$to
,
2
);
if
(!
isset
(
$map
[
$from
]))
{
$map
[
$from
]
=
$to
;
}
}
ksort
(
$map
);
echo
"Writing to: $outputFile
\n
"
;
$f
=
fopen
(
$outputFile
,
'w'
);
fwrite
(
$f
,
"<?php
\n\n
"
);
fwrite
(
$f
,
"/**
\n
"
);
fwrite
(
$f
,
" * Automatically generated timezone file
\n
"
);
fwrite
(
$f
,
" *
\n
"
);
fwrite
(
$f
,
" * Last update: "
.
date
(
DATE_W3C
)
.
"
\n
"
);
fwrite
(
$f
,
" * Source: "
.
$windowsZonesUrl
.
"
\n
"
);
fwrite
(
$f
,
" *
\n
"
);
fwrite
(
$f
,
" * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
\n
"
);
fwrite
(
$f
,
" * @license http://sabre.io/license/ Modified BSD License
\n
"
);
fwrite
(
$f
,
" */
\n
"
);
fwrite
(
$f
,
"
\n
"
);
fwrite
(
$f
,
"return "
);
fwrite
(
$f
,
var_export
(
$map
,
true
)
.
';'
);
fclose
(
$f
);
echo
"Done
\n
"
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 4:57 AM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
915299
Default Alt Text
fetch_windows_zones.php (1 KB)
Attached To
rDAVCAL DokuWiki DAVCal PlugIn
Event Timeline
Log In to Comment