/**
* Defined by Zend_Filter_Interface
*
* Returns the string $value, converting characters to their corresponding HTML entity
* equivalents where they exist
*
* @param string $value
* @return string
*/
public function filter($value) { $filtered =
htmlentities((string) $value,
$this->
getQuoteStyle(),
$this->
getEncoding(),
$this->
getDoubleQuote());
if (strlen((string) $value) && !
strlen($filtered)) { if (!
function_exists('iconv'
)) { throw new Zend_Filter_Exception('Encoding mismatch has resulted in htmlentities errors'
);
} $enc =
$this->
getEncoding();
$value =
iconv('',
$enc . '//IGNORE',
(string) $value);
$filtered =
htmlentities($value,
$this->
getQuoteStyle(),
$enc,
$this->
getDoubleQuote());
if (!
strlen($filtered)) { throw new Zend_Filter_Exception('Encoding mismatch has resulted in htmlentities errors'
);
} }