if (!defined('_PS_VERSION_')) exit; class Tools extends ToolsCore { //credit: http://particletree.com/notebook/automatically-version-your-css-and-javascript-files/ public static function autoVer($url){ $path = pathinfo($url); if(file_exists($_SERVER['DOCUMENT_ROOT'].$url)) $ver = filemtime($_SERVER['DOCUMENT_ROOT'].$url); else $ver = '1'; return $path['dirname'].'/'.$path['basename'].'?v='.$ver; } public static function addCSS($css_uri, $css_media_type = 'all') { global $css_files; if (is_array($css_uri)) { foreach ($css_uri as $file => $media_type) self::addCSS($file, $media_type); return true; } //overriding of modules css files $different = 0; $override_path = str_replace(__PS_BASE_URI__.'modules/', _PS_ROOT_DIR_.'/themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different); if ($different && file_exists($override_path)) $css_uri = str_replace(__PS_BASE_URI__.'modules/', __PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/modules/', $css_uri, $different); else { // remove PS_BASE_URI on _PS_ROOT_DIR_ for the following $url_data = parse_url($css_uri); $file_uri = _PS_ROOT_DIR_.self::str_replace_once(__PS_BASE_URI__, DIRECTORY_SEPARATOR, $url_data['path']); // check if css files exists if (!file_exists($file_uri)) return true; } // detect mass add $css_uri = array(Tools::autoVer($css_uri) => $css_media_type);//This is the only line that has been changed to add in the call to the new autoVer function we created above. // adding file to the big array... if (is_array($css_files)) $css_files = array_merge($css_files, $css_uri); else $css_files = $css_uri; return true; } }