Closed vuvanhieu143 closed 2 years ago
1) Moodle code should not use htmlspecialchars. It should use Moodle's equivalent, which is s(). However, should we even be doing this?
Hi @timhunt
We have an edge case where the text contains an escaped HTML entity:
Example: "Test shortened text with html enity<br>"
After we run through the html_to_text, it will change the "<br>" to
so I need to s() to escape it again.
"Why are we not doing the escaping when the text is put into the HTML?"
The shortened text should only contain the plain text version of our full text. I don't think we need to escape this, but I found we didn't use format_text when we output to the template, so I add it to the code. Is that ok?
2) I just add more comments to the docs.Is it make more sense now?
3) I have removed it. Sorry for the stupid question, but is there any setting I need to add to my PHPStorm? My PHPStorm did show the hint or warning at all.
You clearly did not understand my comment about it was best to do escaping, but I am not going to debate it any more now. The code probably works without missing or double-excaping, so let's merge an move on.
Hi Tim, I have removed the custom shorten text in SQ and using the core function.
Could you please help me to peer-review again?