Permalink
Browse files

Restored ability to link PHP files for CSS and JS from view helpers.

  • Loading branch information...
1 parent f56e24c commit 7e277e8239fc643f65c333a8076434a946ce5bbf @predominant predominant committed Mar 31, 2010
@@ -343,7 +343,7 @@ function css($path, $rel = null, $htmlAttributes = array(), $inline = true) {
}
if (strpos($path, '?') === false) {
- if (substr($path, -4) !== '.css') {
+ if (!preg_match('/.*\.(css|php)$/i', $path)) {
$path .= '.css';
}
}
@@ -248,7 +248,7 @@ function link($url, $inline = true) {
$url = JS_URL . $url;
}
if (strpos($url, '?') === false) {
- if (substr($url, -3) !== '.js') {
+ if (!preg_match('/.*\.(js|php)$/i', $url)) {
$url .= '.js';
}
}
@@ -365,6 +365,10 @@ function testCssLink() {
$expected['link']['href'] = 'preg:/.*css\/my\.css\.library\.css/';
$this->assertTags($result, $expected);
+ $result = $this->Html->css('my.css.php');
+ $expected['link']['href'] = 'preg:/.*css\/my\.css\.php/';
+ $this->assertTags($result, $expected);
+
$result = $this->Html->css('screen.css?1234');
$expected['link']['href'] = 'preg:/.*css\/screen\.css\?1234/';
$this->assertTags($result, $expected);
@@ -173,8 +173,8 @@ function testLink() {
$expected = '<script type="text/javascript" src="js/jquery-1.1.2.js"></script>';
$this->assertEqual($result, $expected);
- $result = $this->Javascript->link('jquery-1.1.2');
- $expected = '<script type="text/javascript" src="js/jquery-1.1.2.js"></script>';
+ $result = $this->Javascript->link('jquery-1.1.2.php');
+ $expected = '<script type="text/javascript" src="js/jquery-1.1.2.php"></script>';
$this->assertEqual($result, $expected);
$result = $this->Javascript->link('/plugin/js/jquery-1.1.2');

0 comments on commit 7e277e8

Please sign in to comment.