Ad script / images / css versionning to allow aggressive cache

This commit is contained in:
Sébastien Lucas 2012-06-02 09:10:54 +02:00
parent 6fa0031b9f
commit a8f888a13b
2 changed files with 11 additions and 5 deletions

View file

@ -6,6 +6,8 @@
* @author Sébastien Lucas <sebastien@slucas.fr>
*/
define ("VERSION", "0.0.4");
function getURLParam ($name, $default = NULL) {
if (!empty ($_GET) && isset($_GET[$name])) {
return $_GET[$name];
@ -13,6 +15,10 @@ function getURLParam ($name, $default = NULL) {
return $default;
}
function getUrlWithVersion ($url) {
return $url . "?v=" . VERSION;
}
/**
* This method is a direct copy-paste from
* http://tmont.com/blargh/2010/1/string-format-in-php
@ -138,7 +144,7 @@ class Entry
foreach (self::$icons as $reg => $image)
{
if (preg_match ("/" . $reg . "/", $pid)) {
array_push ($this->linkArray, new Link ($image, "image/png", Link::OPDS_THUMBNAIL_TYPE));
array_push ($this->linkArray, new Link (getUrlWithVersion ($image), "image/png", Link::OPDS_THUMBNAIL_TYPE));
break;
}
}