forked from verdnatura/hedera-web
40 lines
753 B
PHP
40 lines
753 B
PHP
|
<?php
|
||
|
|
||
|
function getUrl ($fileName)
|
||
|
{
|
||
|
if (file_exists ($fileName))
|
||
|
{
|
||
|
$hashes = apc_fetch ("$appName.hashes", $success);
|
||
|
|
||
|
if (!$success)
|
||
|
{
|
||
|
apc_store ("$appName.version", $version);
|
||
|
$hashes = [];
|
||
|
}
|
||
|
|
||
|
if (!isset ($hashes[$fileName]))
|
||
|
{
|
||
|
$hash = md5_file($fileName);
|
||
|
$hashes[$fileName] = $hash;
|
||
|
}
|
||
|
else
|
||
|
$hash = $hashes[$fileName];
|
||
|
|
||
|
$mTime = "?$hash";
|
||
|
}
|
||
|
else
|
||
|
$mTime = '';
|
||
|
|
||
|
return $fileName.$mTime;
|
||
|
}
|
||
|
|
||
|
function js ($fileName)
|
||
|
{
|
||
|
return '<script type="text/javascript" src="'. getUrl ($fileName) .'"></script>'."\n";
|
||
|
}
|
||
|
|
||
|
function css ($fileName)
|
||
|
{
|
||
|
return '<link rel="stylesheet" type="text/css" href="'. getUrl ($fileName) .'"/>'."\n";
|
||
|
}
|