@@ -91,10 +91,7 @@ class HtmlHelper extends Helper {
91
91
*
92
92
* @var array
93
93
*/
94
- protected $ _includedAssets = array (
95
- 'css ' => array (),
96
- 'script ' => array ()
97
- );
94
+ protected $ _includedAssets = array ();
98
95
99
96
/**
100
97
* Options for the currently opened script block buffer if any.
@@ -408,19 +405,19 @@ public function css($path, array $options = array()) {
408
405
return ;
409
406
}
410
407
411
- if ($ options ['once ' ] && isset ($ this ->_includedAssets ['css ' ][$ path ])) {
412
- return '' ;
413
- }
414
- unset($ options ['once ' ]);
415
- $ this ->_includedAssets ['css ' ][$ path ] = true ;
416
-
417
408
if (strpos ($ path , '// ' ) !== false ) {
418
409
$ url = $ path ;
419
410
} else {
420
411
$ url = $ this ->assetUrl ($ path , $ options + array ('pathPrefix ' => Configure::read ('App.cssBaseUrl ' ), 'ext ' => '.css ' ));
421
412
$ options = array_diff_key ($ options , array ('fullBase ' => null , 'pathPrefix ' => null ));
422
413
}
423
414
415
+ if ($ options ['once ' ] && isset ($ this ->_includedAssets [$ url ])) {
416
+ return '' ;
417
+ }
418
+ unset($ options ['once ' ]);
419
+ $ this ->_includedAssets [$ url ] = true ;
420
+
424
421
if ($ options ['rel ' ] === 'import ' ) {
425
422
$ out = $ this ->formatTemplate ('style ' , [
426
423
'attrs ' => $ this ->templater ()->formatAttributes ($ options , ['rel ' , 'block ' ]),
@@ -492,15 +489,17 @@ public function script($url, array $options = array()) {
492
489
}
493
490
return null ;
494
491
}
495
- if ($ options ['once ' ] && isset ($ this ->_includedAssets ['script ' ][$ url ])) {
496
- return null ;
497
- }
498
- $ this ->_includedAssets ['script ' ][$ url ] = true ;
499
492
500
493
if (strpos ($ url , '// ' ) === false ) {
501
494
$ url = $ this ->assetUrl ($ url , $ options + array ('pathPrefix ' => Configure::read ('App.jsBaseUrl ' ), 'ext ' => '.js ' ));
502
495
$ options = array_diff_key ($ options , array ('fullBase ' => null , 'pathPrefix ' => null ));
503
496
}
497
+
498
+ if ($ options ['once ' ] && isset ($ this ->_includedAssets [$ url ])) {
499
+ return null ;
500
+ }
501
+ $ this ->_includedAssets [$ url ] = true ;
502
+
504
503
$ out = $ this ->formatTemplate ('javascriptlink ' , [
505
504
'url ' => $ url ,
506
505
'attrs ' => $ this ->templater ()->formatAttributes ($ options , ['block ' , 'once ' ]),
0 commit comments