Issues

ZF-3928: Zend_View_Helper_HeadScript: no way to disable encoding of attributes passed to appendFile and related methods

Description

There is currently no way (at least that I could dissect) to disable encoding of values passed into Zend_View_Helper_HeadScript::appendFile which causes some 3rd-party javascript API's to break.

For example, if I need to link to a javasript API that requires that I pass in more then one parameter in order to remotely load the file. I am currently unable to do this as the '&' separating the parameters will be automatically encoded to '&'

For example. $this->view->HeadScript()->appendFile('http://server/script.js?v=1.2&id=123'); will generate the following code:

which causes the remote server to not see the 'id' variable b/c it doesn't see the '&' delimiter and thus refuses to let me access the javascript api.

In the Zend_View_Helper_HeadScript::itemToString method there should be a way to disable calling htmlspecialchars.

Comments

This issue also affects HeadLink Helper.

Attached is the proposed patch file.

With this file you can call your string like this:


$this->headScript()->setAutoEscape(true)->appendFile('test.js?id=123&foo=bar');

and 

$this->headStyle()->setAutoEscape(true)->appendStylesheet('/css/rules.css?id=123&foo=bar');

the proper one for the style sheet is


$this->headLink()->setAutoEscape(true)->appendStylesheet('/css/rules.css?id=123&foo=bar');

Fixed in r12106.

Changing issues in preparation for the 1.7.0 release.