Created
February 6, 2012 21:14
-
-
Save tigrang/1754929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php | |
index f198f82..fb2952d 100644 | |
--- a/lib/Cake/View/Helper.php | |
+++ b/lib/Cake/View/Helper.php | |
@@ -267,15 +267,29 @@ class Helper extends Object { | |
* @param array $options Options array. Possible keys: | |
* `fullBase` Return full url with domain name | |
* `pathPrefix` Path prefix for relative urls | |
+ * `ext` Asset extension to append | |
* @return string Generated url | |
*/ | |
public function assetUrl($path, array $options) { | |
if (is_array($path)) { | |
$path = $this->url($path); | |
} elseif (strpos($path, '://') === false) { | |
+ list($plugin, $path) = $this->_View->pluginSplit($path, false); | |
+ | |
if (!empty($options['pathPrefix']) && $path[0] !== '/') { | |
$path = $options['pathPrefix'] . $path; | |
} | |
+ if ( | |
+ !empty($options['ext']) && | |
+ strpos($path, '?') === false && | |
+ substr($path, -strlen($options['ext'])) !== $options['ext'] | |
+ ) { | |
+ $path .= $options['ext']; | |
+ } | |
+ if ($plugin) { | |
+ $path = Inflector::underscore($plugin) . DS . $path; | |
+ } | |
+ | |
$path = $this->assetTimestamp($this->webroot($path)); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment