@@ -15,7 +15,7 @@ class JsUtils extends \Ajax\JsUtils {
1515 */
1616 protected function _open_script ($ src = '' ) {
1717 $ str = '<script ' ;
18- if (($ this ->params ['csp ' ]?? false )==='nonce ' && ContentSecurityManager::isStarted ()) {
18+ if (($ this ->params ['csp ' ] ?? false ) === 'nonce ' && ContentSecurityManager::isStarted ()) {
1919 $ nonce = ContentSecurityManager::getNonce ('jsUtils ' );
2020 $ str .= ' nonce=" ' . $ nonce . '" ' ;
2121 }
@@ -24,14 +24,13 @@ protected function _open_script($src = '') {
2424 }
2525
2626 public function inline ($ script , $ cdata = true ) {
27- if (($ this ->params ['csp ' ]?? false )==='hash ' && ContentSecurityManager::isStarted ()) {
28- $ script = ($ cdata ) ? "\n// <![CDATA[ \n{$ script }\n// ]]> \n" : "\n{$ script }\n" ;
29- ContentSecurityManager::getHash ('jsUtils ' ,$ script );
27+ if (($ this ->params ['csp ' ] ?? false ) === 'hash ' && ContentSecurityManager::isStarted ()) {
28+ $ script = ($ cdata ) ? "\n// <![CDATA[ \n{$ script }\n// ]]> \n" : "\n{$ script }\n" ;
29+ ContentSecurityManager::getHash ('jsUtils ' , $ script );
3030 }
31- return $ this ->_open_script (). $ script. $ this ->_close_script ();
31+ return $ this ->_open_script () . $ script . $ this ->_close_script ();
3232 }
3333
34-
3534 public function getUrl ($ url ) {
3635 return URequest::getUrl ($ url );
3736 }
@@ -75,9 +74,7 @@ public function renderView($viewName, $parameters = [], $asString = false) {
7574 if (isset ($ this ->injected )) {
7675 $ view = $ this ->injected ->getView ();
7776 $ this ->compile ($ view );
78- if (isset ($ parameters ))
79- $ view ->setVars ($ parameters );
80- return $ view ->render ($ viewName , $ asString );
77+ return $ this ->injected ->loadView ($ viewName , $ parameters , $ asString );
8178 }
8279 throw new \Exception (get_class () . " instance is not properly instancied : you omitted the second parameter \$controller! " );
8380 }
0 commit comments