cakePHP:重载清理
在最近的 cakePHP 1.3.4 版本中,我发现 Sanitize::html 返回双重编码的 html 实体 - 因为新添加的 htmlentities 'double_encode' 的第四个参数。
以下是 cakePHP 上的相应票证: http ://cakephp.lighthouseapp.com/projects/42648/tickets/1152-sanitizehtml-needs-double_encode-parameter-in-htmlentities
由于我需要在 PHP 5.2.14 上使用 cakePHP 1.3.4 我需要更改double_encode 参数。有没有办法重载蛋糕中的 Sanitize::html 方法,这样我就不必摆弄核心了?
In the recent cakePHP 1.3.4 version I discovered that Sanitize::html returns double encoded html entities - because of the newly added fourth parameter of htmlentities 'double_encode'.
Here is a corresponding ticket on cakePHP: http://cakephp.lighthouseapp.com/projects/42648/tickets/1152-sanitizehtml-needs-double_encode-parameter-in-htmlentities
Since I need to use cakePHP 1.3.4 on PHP 5.2.14 I need to change the double_encode parameter. Is there a way to overload the Sanitize::html method in cake so I don't have to fiddle with the core?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
/app/libs
目录中对它进行子类化:您必须切换到使用
MySanitize
而不是Sanitize
,但这应该'这不是一个大问题。如果您已经经常使用文本查找/替换,则可以处理它。You can subclass it in the
/app/libs
directory:You'll have to switch to use
MySanitize
instead ofSanitize
, but that shouldn't be a big problem. A text find/replace can take care of it if you're using it a lot already.