[TYPO3-core] RFC: Bug 1030, 277, 1472 possibly 1270
Bernhard Kraft
kraftb at kraftb.at
Fri Feb 24 20:36:20 CET 2006
Martin Kutschker wrote:
> René Fritz <rene at typo3.org> writes on
> Fri, 24 Feb 2006 19:23:18 +0100 (MET):
>
>
>>Still I would like to change the function. But nobody cares and
>>that's not my task.
>
>
>
> I simply forgot what this was all about.
>
> Bernhard presented a patch, ok. You complaind about one function argument, fine. Did Bernhard's patch go into the CVS or not?
The code is already in CVS ... others tought it would be ok with how the argument is.
altough internaly a negate is used on the $inScriptTags variable I would REALLY suggest
not to change this:
function quoteJSvalue($value, $inScriptTags = false)
Is the line I have to read when I want to use the method. I clearly see that it has the
value I want to quote as first argument and the seconds one has to get set ONLY if I will
use the script value in <script> tags in which case htmlspecialchars is not required
(MUST NOT be used, to be true).
If I will rename the flag to "$hsc = true" nobody would know when to set it.
Of course I could name it "$inTagAttribute = true" but that does rather not conform to the
DTD. It specifies that "every" occurence of a special character has to be htmlspecialchared.
And makes an exception for CDATA which the content of a <script> tag is ... AFAIK this is
the only exception except if you explicitly define <![CDATA[ tags - in which case you would
also have to set the "inScriptTags" flag :)
So I could name it "$inCDATASection = false" ... but that would also not help in understanding :(
I think the way it currently is is the best. It reflects the DTD somehow but still is understandable
for everyone who wants to use the method.
And after all I don't know what's the problem with this "!" ? Is it somehow deprecated to do negatoins ? :)
greets,
Bernhard
More information about the TYPO3-team-core
mailing list