-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathutils.php
More file actions
44 lines (38 loc) · 1007 Bytes
/
utils.php
File metadata and controls
44 lines (38 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* @file
* Gets the WSDL file.
*/
/**
* Convert array to xml.
*/
function array_to_xml($array, &$xml) {
foreach ($array as $key => $value) {
if (is_array($value)) {
if (!is_numeric($key)) {
$subnode = $xml->addChild("$key");
array_to_xml($value, $subnode);
}
else {
$subnode = $xml->addChild("item$key");
array_to_xml($value, $subnode);
}
}
else {
$xml->addChild("$key", htmlspecialchars("$value"));
}
}
}
function send_cache_headers($seconds = 0) {
if ($seconds == 0) {
// No caching
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
return;
}
// Allow upstream caching $seconds from now
$timestamp = time();
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time() ) ) ;
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', (time() + $seconds) ) ) ;
}