mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Fixing JavascriptHelper::link() for script files outside of webroot/js (i.e. plugins), fixes #3799
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6313 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
181aa97ca1
commit
93f034b9bd
2 changed files with 8 additions and 1 deletions
|
@ -162,7 +162,10 @@ class JavascriptHelper extends AppHelper {
|
|||
}
|
||||
|
||||
if (strpos($url, '://') === false) {
|
||||
$url = $this->webroot(JS_URL . $url);
|
||||
if ($url{0} !== '/') {
|
||||
$url = JS_URL . $url;
|
||||
}
|
||||
$url = $this->webroot($url);
|
||||
|
||||
if (Configure::read('Asset.filter.js')) {
|
||||
$url = str_replace(JS_URL, 'cjs/', $url);
|
||||
|
|
|
@ -80,6 +80,10 @@ class JavascriptTest extends UnitTestCase {
|
|||
$result = $this->Javascript->link('jquery-1.1.2');
|
||||
$this->assertPattern('/^<script[^<>]+src=".*cjs\/jquery-1\.1\.2\.js"[^<>]*>/', $result);
|
||||
Configure::write('Asset.filter.js', false);
|
||||
|
||||
$result = $this->Javascript->link('/plugin/js/jquery-1.1.2');
|
||||
$expected = '<script type="text/javascript" src="/plugin/js/jquery-1.1.2.js"></script>';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testObjectGeneration() {
|
||||
|
|
Loading…
Add table
Reference in a new issue