Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 0.59 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Zend sanitizing input
  2. public function init(){
  3.  
  4.  $this->view->setEscape('html_entity_decode');
  5.  $this->view->setEscape('stripslashes');
  6.  
  7. }
  8.        
  9. <?php
  10. #Tools.php
  11.  
  12. class My_Tools {
  13.  
  14.     /**
  15.      * My custom escape function
  16.      *
  17.      * @param string $str String to be escaped
  18.      * @return string Escaped string
  19.      */
  20.     static function myEscape($str) {
  21.         $str = html_entity_decode($str);
  22.         return stripslashes($str);
  23.     }
  24.  
  25. }
  26.  
  27. ?>
  28.        
  29. public function init() {
  30.  
  31.     require_once(APPLICATION_PATH . '/../library/My/Tools.php');
  32.     $this->view->setEscape(array('My_Tools', 'myEscape'));
  33.  
  34. }