From a8f888a13b4e9967bbd9ed7ca5f232aed5c23df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Sat, 2 Jun 2012 09:10:54 +0200 Subject: [PATCH] Ad script / images / css versionning to allow aggressive cache --- base.php | 8 +++++++- index.php | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/base.php b/base.php index 0c02fd7..76a3ab1 100644 --- a/base.php +++ b/base.php @@ -6,6 +6,8 @@ * @author Sébastien Lucas */ +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; } } diff --git a/index.php b/index.php index e9a7d75..01dea7e 100644 --- a/index.php +++ b/index.php @@ -31,8 +31,8 @@ <?php echo $currentPage->title ?> - - + + " media="screen" />