Permalink
Browse files

Updating HtmlHelper and JavascriptHelper to use Helper::assetTimestamp

  • Loading branch information...
markstory committed Sep 24, 2009
1 parent ee514f3 commit 7f49f7f455f1f818f92b11ff40bba8f817185177
Showing with 6 additions and 38 deletions.
  1. +5 −28 cake/libs/view/helpers/html.php
  2. +1 −10 cake/libs/view/helpers/javascript.php
@@ -373,14 +373,7 @@ function css($path, $rel = null, $htmlAttributes = array(), $inline = true) {
$path .= '.css';
}
}
- $timestampEnabled = (
- (Configure::read('Asset.timestamp') === true && Configure::read() > 0) ||
- Configure::read('Asset.timestamp') === 'force'
- );
- $url = $this->webroot($path);
- if (strpos($path, '?') === false && $timestampEnabled) {
- $url .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path));
- }
+ $url = $this->webroot($this->assetTimestamp($path));
if (Configure::read('Asset.filter.css')) {
$url = str_replace(CSS_URL, 'ccss/', $url);
@@ -449,21 +442,10 @@ function script($url, $options = array()) {
if ($url[0] !== '/') {
$url = JS_URL . $url;
}
- $url = $this->webroot($url);
- if (strpos($url, '?') === false) {
- if (strpos($url, '.js') === false) {
- $url .= '.js';
- }
- }
-
- $timestampEnabled = (
- (Configure::read('Asset.timestamp') === true && Configure::read('debug') > 0) ||
- Configure::read('Asset.timestamp') === 'force'
- );
-
- if (strpos($url, '?') === false && $timestampEnabled) {
- $url .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $url));
+ if (strpos($url, '?') === false && strpos($url, '.js') === false) {
+ $url .= '.js';
}
+ $url = $this->webroot($this->assetTimestamp($url));
if (Configure::read('Asset.filter.js')) {
$url = str_replace(JS_URL, 'cjs/', $url);
@@ -608,12 +590,7 @@ function image($path, $options = array()) {
if ($path[0] !== '/') {
$path = IMAGES_URL . $path;
}
-
- if ((Configure::read('Asset.timestamp') == true && Configure::read() > 0) || Configure::read('Asset.timestamp') === 'force') {
- $path = $this->webroot($path) . '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path));
- } else {
- $path = $this->webroot($path);
- }
+ $path = $this->webroot($this->assetTimestamp($path));
}
if (!isset($options['alt'])) {
@@ -270,16 +270,7 @@ function link($url, $inline = true) {
$url .= '.js';
}
}
- $timestampEnabled = (
- (Configure::read('Asset.timestamp') === true && Configure::read() > 0) ||
- Configure::read('Asset.timestamp') === 'force'
- );
-
- if (strpos($url, '?') === false && $timestampEnabled) {
- $url = $this->webroot($url) . '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $url));
- } else {
- $url = $this->webroot($url);
- }
+ $url = $this->webroot($this->assetTimestamp($url));
if (Configure::read('Asset.filter.js')) {
$url = str_replace(JS_URL, 'cjs/', $url);

0 comments on commit 7f49f7f

Please sign in to comment.