Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do $this->escape() in zend framework actually do?

I need help in understanding the actual actions of a helper function in Zend Framework.

I need someone to explain to me what $this->escape($string) actually does to the string passed to it before printing the string into the template.

like image 255
IndexController Avatar asked Dec 18 '09 00:12

IndexController


2 Answers

$this->escape() escapes a string according to settings you can provide with $this->setEscape('functionname'), by default it is PHP's htmlspecialchars function.

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

like image 113
sakabako Avatar answered Sep 29 '22 23:09

sakabako


It calls the htmlspecialchars PHP function.

The translations performed are:

  • '&' (ampersand) becomes '&'
  • '"' (double quote) becomes '"'
  • '<' (less than) becomes '&lt;'
  • '>' (greater than) becomes '&gt;'
like image 28
Derek Illchuk Avatar answered Sep 29 '22 23:09

Derek Illchuk