Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo a view->escape() in zend framework

Is there a way to undo the effect of an escape after it's been done. I'm using $this->view->escape() on multiple values, but there's one value I don't actually want to escape. Is there a way to literally reverse the effect on an escape after it's been done?

like image 489
sameold Avatar asked Jan 31 '26 02:01

sameold


1 Answers

̶̶s̶t̶r̶i̶p̶s̶l̶a̶s̶h̶e̶s̶̶̶]̶[̶1̶]̶ ̶w̶i̶l̶l̶ ̶u̶n̶e̶s̶c̶a̶p̶e̶ ̶t̶h̶e̶ ̶s̶t̶r̶i̶n̶g̶ ̶c̶o̶r̶r̶e̶c̶t̶l̶y̶.̶ ̶ ̶ ̶ T̶h̶i̶n̶k̶ ̶a̶b̶o̶u̶t̶ ̶c̶r̶e̶a̶t̶i̶n̶g̶ ̶a̶ ̶f̶i̶l̶t̶e̶r̶ ̶a̶n̶d̶ ̶p̶a̶s̶s̶i̶n̶g̶ ̶o̶n̶l̶y̶ ̶t̶h̶o̶s̶e̶ ̶v̶a̶l̶u̶e̶s̶ ̶t̶h̶a̶t̶ ̶y̶o̶u̶ ̶w̶a̶n̶t̶ ̶t̶o̶ ̶e̶s̶c̶a̶p̶e̶ ̶h̶t̶t̶p̶:̶/̶/̶f̶r̶a̶m̶e̶w̶o̶r̶k̶.̶z̶e̶n̶d̶.̶c̶o̶m̶/̶m̶a̶n̶u̶a̶l̶/̶e̶n̶/̶z̶e̶n̶d̶.̶f̶i̶l̶t̶e̶r̶.̶w̶r̶i̶t̶i̶n̶g̶_̶f̶i̶l̶t̶e̶r̶s̶.̶h̶t̶m̶l̶


Edit: I think this is correct now.

By default, the escape() method uses the PHP htmlspecialchars() function for escaping.

from http://framework.zend.com/manual/en/zend.view.scripts.html

htmlspecialchars_decode

to convert special HTML entities back to characters: http://php.net/manual/en/function.htmlspecialchars-decode.php

like image 95
UpCat Avatar answered Feb 01 '26 17:02

UpCat