diff options
author | robocoder <anthon.pang@gmail.com> | 2010-09-05 05:34:14 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2010-09-05 05:34:14 +0400 |
commit | f463f20906b38a330c53022a11c7573cca5c5396 (patch) | |
tree | 159eb5d80ddd5fa7ba8b0843d29fdf80aa2369b9 | |
parent | 2a132e1ad810b4e2b1f8b29f390f91d1c9aab712 (diff) |
fix broken cachebuster; fix broken ajaxcdn; use piwik_version in cachebuster for consistency
git-svn-id: http://dev.piwik.org/svn/trunk@3056 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r-- | core/AssetManager.php | 6 | ||||
-rw-r--r-- | core/SmartyPlugins/outputfilter.ajaxcdn.php | 10 | ||||
-rw-r--r-- | core/SmartyPlugins/outputfilter.cachebuster.php | 9 | ||||
-rw-r--r-- | core/View.php | 12 | ||||
-rw-r--r-- | js/index.php | 8 | ||||
-rw-r--r-- | plugins/CoreHome/templates/graph.tpl | 2 | ||||
-rw-r--r-- | plugins/CoreUpdater/templates/header.tpl | 2 | ||||
-rw-r--r-- | plugins/Login/templates/header.tpl | 2 | ||||
-rw-r--r-- | plugins/UserCountryMap/UserCountryMap.php | 1 | ||||
-rw-r--r-- | plugins/UserCountryMap/templates/worldmap.tpl | 4 |
10 files changed, 30 insertions, 26 deletions
diff --git a/core/AssetManager.php b/core/AssetManager.php index aa9951d13d..d32a23ff12 100644 --- a/core/AssetManager.php +++ b/core/AssetManager.php @@ -45,8 +45,8 @@ class Piwik_AssetManager const CSS_IMPORT_EVENT = "AssetManager.getCssFiles"; const JS_IMPORT_EVENT = "AssetManager.getJsFiles"; const MERGED_FILE_DIR = "tmp/assets/"; - const CSS_IMPORT_DIRECTIVE = "<link rel='stylesheet' type='text/css' href='%s' /> \n"; - const JS_IMPORT_DIRECTIVE = "<script type='text/javascript' src='%s'> </script> \n"; + const CSS_IMPORT_DIRECTIVE = "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\" />\n"; + const JS_IMPORT_DIRECTIVE = "<script type=\"text/javascript\" src=\"%s\"></script>\n"; const GET_CSS_MODULE_ACTION = "index.php?module=CoreHome&action=getCss"; const GET_JS_MODULE_ACTION = "index.php?module=CoreHome&action=getJs"; const MINIFIED_JS_RATIO = 100; @@ -493,4 +493,4 @@ class Piwik_AssetManager } return array_keys(array_flip($newFiles)); } -}
\ No newline at end of file +} diff --git a/core/SmartyPlugins/outputfilter.ajaxcdn.php b/core/SmartyPlugins/outputfilter.ajaxcdn.php index 118ddd3010..e91f397fe9 100644 --- a/core/SmartyPlugins/outputfilter.ajaxcdn.php +++ b/core/SmartyPlugins/outputfilter.ajaxcdn.php @@ -28,18 +28,12 @@ */ function smarty_outputfilter_ajaxcdn($source, &$smarty) { - $use_ajax_cdn = Zend_Registry::get('config')->General->use_ajax_cdn; - if(!$use_ajax_cdn) - { - return $source; - } - $jquery_version = Zend_Registry::get('config')->General->jquery_version; $jqueryui_version = Zend_Registry::get('config')->General->jqueryui_version; $swfobject_version = Zend_Registry::get('config')->General->swfobject_version; $pattern = array( - '~<link rel="stylesheet" type="text/css" href="libs/jquery/themes/([^"]*)" class="ui-theme" />~', + '~<link rel="stylesheet" type="text/css" href="libs/jquery/themes/([^"]*)" />~', '~<script type="text/javascript" src="libs/jquery/jquery\.js([^"]*)">~', '~<script type="text/javascript" src="libs/jquery/jquery-ui\.js([^"]*)">~', '~<script type="text/javascript" src="libs/jquery/jquery-ui-18n\.js([^"]*)">~', @@ -47,7 +41,7 @@ function smarty_outputfilter_ajaxcdn($source, &$smarty) ); $replace = array( - '<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/'.$jqueryui_version.'/themes/\\1" class="ui-theme" />', + '<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/'.$jqueryui_version.'/themes/\\1" />', '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/'.$jquery_version.'/jquery.min.js">', '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/'.$jqueryui_version.'/jquery-ui.min.js">', '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/'.$jqueryui_version.'/i18n/jquery-ui-18n.min.js">', diff --git a/core/SmartyPlugins/outputfilter.cachebuster.php b/core/SmartyPlugins/outputfilter.cachebuster.php index 292c1af296..671f6531ce 100644 --- a/core/SmartyPlugins/outputfilter.cachebuster.php +++ b/core/SmartyPlugins/outputfilter.cachebuster.php @@ -31,12 +31,13 @@ */ function smarty_outputfilter_cachebuster($source, &$smarty) { - $tag = $smarty->get_template_vars('tag'); + $version = $smarty->get_template_vars('piwik_version'); + $tag = 'piwik=' . $version; $pattern = array( - '~<script type="text/javascript" src="([^"]+)">~', - '~<script src="([^"]+)" type="text/javascript">~', - '~<link rel="stylesheet" type="text/css" href="([^"]+)" ?/?>~', + '~<script type=[\'"]text/javascript[\'"] src=[\'"]([^\'"]+)[\'"]>~', + '~<script src=[\'"]([^\'"]+)[\'"] type=[\'"]text/javascript[\'"]>~', + '~<link rel=[\'"]stylesheet[\'"] type=[\'"]text/css[\'"] href=[\'"]([^\'"]+)[\'"] ?/?>~', ); $replace = array( diff --git a/core/View.php b/core/View.php index 50597f3a08..3a990fed58 100644 --- a/core/View.php +++ b/core/View.php @@ -69,16 +69,23 @@ class Piwik_View implements Piwik_iView } $this->smarty->error_reporting = $error_reporting; - $this->smarty->assign('tag', 'piwik=' . Piwik_Version::VERSION); if($filter) { $this->smarty->load_filter('output', 'cachebuster'); - $this->smarty->load_filter('output', 'ajaxcdn'); + + $use_ajax_cdn = Zend_Registry::get('config')->General->use_ajax_cdn; + if($use_ajax_cdn) + { + $this->smarty->load_filter('output', 'ajaxcdn'); + } + $this->smarty->load_filter('output', 'trimwhitespace'); } // global value accessible to all templates: the piwik base URL for the current request $this->piwikUrl = Piwik_Url::getCurrentUrlWithoutFileName(); + + $this->piwik_version = Piwik_Version::VERSION; } /** @@ -123,7 +130,6 @@ class Piwik_View implements Piwik_iView $this->token_auth = Piwik::getCurrentUserTokenAuth(); $this->userHasSomeAdminAccess = Piwik::isUserHasSomeAdminAccess(); $this->userIsSuperUser = Piwik::isUserIsSuperUser(); - $this->piwik_version = Piwik_Version::VERSION; $this->latest_version_available = Piwik_UpdateCheck::isNewestVersionAvailable(); if(Zend_Registry::get('config')->General->autocomplete_min_sites <= count($sites)) { diff --git a/js/index.php b/js/index.php index cdda22c6b4..ade36fdbd4 100644 --- a/js/index.php +++ b/js/index.php @@ -7,15 +7,19 @@ * @version $Id$ */ +/** + * Tracker proxy + */ if(!empty($_SERVER['QUERY_STRING'])) { include '../piwik.php'; exit; } /** + * piwik.js proxy + * * @see core/Piwik.php */ - define('PIWIK_INCLUDE_PATH', '..'); define('PIWIK_DOCUMENT_ROOT', '..'); @@ -25,4 +29,4 @@ $file = 'piwik.js'; Piwik::serveStaticFile($file, "application/javascript; charset=UTF-8"); -exit;
\ No newline at end of file +exit; diff --git a/plugins/CoreHome/templates/graph.tpl b/plugins/CoreHome/templates/graph.tpl index e445b5411a..164dc2016f 100644 --- a/plugins/CoreHome/templates/graph.tpl +++ b/plugins/CoreHome/templates/graph.tpl @@ -11,7 +11,7 @@ piwikHelper.OFC.set("{$chartDivId}", '{$flashParameters.data}'); {/if} swfobject.embedSWF( - "{$flashParameters.ofcLibraryPath}open-flash-chart.swf?{$tag}", + "{$flashParameters.ofcLibraryPath}open-flash-chart.swf?piwik={$piwik_version}", "{$chartDivId}", "{$flashParameters.width}", "{$flashParameters.height}", "{$flashParameters.requiredFlashVersion}", diff --git a/plugins/CoreUpdater/templates/header.tpl b/plugins/CoreUpdater/templates/header.tpl index 043ab57590..51a6e49f8b 100644 --- a/plugins/CoreUpdater/templates/header.tpl +++ b/plugins/CoreUpdater/templates/header.tpl @@ -7,7 +7,7 @@ <link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico" /> <link rel="stylesheet" type="text/css" href="themes/default/simple_structure.css" /> - <link rel="stylesheet" type="text/css" href="libs/jquery/themes/base/jquery-ui.css" class="ui-theme" /> + <link rel="stylesheet" type="text/css" href="libs/jquery/themes/base/jquery-ui.css" /> <link rel="stylesheet" type="text/css" href="themes/default/styles.css" /> {literal} <style> diff --git a/plugins/Login/templates/header.tpl b/plugins/Login/templates/header.tpl index ff72a23093..5b13ca7fac 100644 --- a/plugins/Login/templates/header.tpl +++ b/plugins/Login/templates/header.tpl @@ -6,7 +6,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="plugins/CoreHome/templates/images/favicon.ico" /> - <link rel="stylesheet" type="text/css" href="plugins/Login/templates/login.css" media="screen" /> + <link rel="stylesheet" type="text/css" href="plugins/Login/templates/login.css" /> {literal} <script type="text/javascript"> diff --git a/plugins/UserCountryMap/UserCountryMap.php b/plugins/UserCountryMap/UserCountryMap.php index df1f4ad566..0260386677 100644 --- a/plugins/UserCountryMap/UserCountryMap.php +++ b/plugins/UserCountryMap/UserCountryMap.php @@ -85,7 +85,6 @@ class Piwik_UserCountryMap_Controller extends Piwik_Controller $view->metrics = $metrics; $view->defaultMetric = 'nb_visits'; - $view->version = Piwik_Version::VERSION; echo $view->render(); } diff --git a/plugins/UserCountryMap/templates/worldmap.tpl b/plugins/UserCountryMap/templates/worldmap.tpl index 94b5ed6f9b..4ec42a0afb 100644 --- a/plugins/UserCountryMap/templates/worldmap.tpl +++ b/plugins/UserCountryMap/templates/worldmap.tpl @@ -41,7 +41,7 @@ $(document).ready(function() { var attr = { id:"UserCountryMap" }; {/literal} - swfobject.embedSWF("plugins/UserCountryMap/PiwikMap.swf?piwik={$version}", "UserCountryMap_map", + swfobject.embedSWF("plugins/UserCountryMap/PiwikMap.swf?piwik={$piwik_version}", "UserCountryMap_map", "100%", Math.round($('#UserCountryMap_content').width() *.55), "9.0.0", "libs/swfobject/expressInstall.swf", fv, params, attr ); @@ -83,4 +83,4 @@ $(document).ready(function() { <option value="{$metric[0]}" {if $metric[0] == $defaultMetric}selected="selected"{/if}>{$metric[1]}</option> {/foreach} </select> -</div>
\ No newline at end of file +</div> |