From 0beec68355a414656dd14a4557b81164287ba407 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 11 Aug 2011 22:05:41 -0500 Subject: [PATCH] refactoring asset version handling. --- system/asset.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/asset.php b/system/asset.php index 0bfecdf7..cb704547 100644 --- a/system/asset.php +++ b/system/asset.php @@ -122,9 +122,11 @@ public function __construct($name) */ public function add($name, $source, $dependencies = array(), $attributes = array()) { - $_source = explode('?', $source); + // Since assets may contain timestamps to force a refresh, we will strip them + // off to get the "real" filename of the asset. + $segments = explode('?', $source); - $type = (File::extension($_source[0]) == 'css') ? 'style' : 'script'; + $type = (File::extension($segments[0]) == 'css') ? 'style' : 'script'; return call_user_func(array($this, $type), $name, $source, $dependencies, $attributes); }