/**
 * Convert HTML entities to plaintext
 * Rewritten in CB to use CB's own version of html_entity_decode where innexistant or buggy in < joomla 1.5
 *
 * @access	protected
 * @param	string	$source
 * @return	string	Plaintext string
 */
function cb_html_entity_decode_all($source)
{
    global $_CB_framework;
    $charset = $_CB_framework->outputCharset();
    // entity decode : use own version of html_entity_decode :
    $source = CBTxt::_unhtmlentities($source, ENT_QUOTES, $charset);
    if ($charset == 'UTF-8') {
        // convert decimal
        $source = preg_replace('/&#(\\d+);/me', "utf8_encode(chr(\\1))", $source);
        // decimal notation
        // convert hex
        $source = preg_replace('/&#x([a-f0-9]+);/mei', "utf8_encode(chr(0x\\1))", $source);
        // hex notation
    } else {
        // convert decimal
        $source = preg_replace('/&#(\\d+);/me', "chr(\\1)", $source);
        // decimal notation
        // convert hex
        $source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source);
        // hex notation
    }
    return $source;
}
Пример #2
0
	/**
	 * Equivalent of html_entity_decode( $string ) using ENT_COMPAT and the charset of the system
	 * @since 1.2.2
	 *
	 * @param  string  $string
	 * @return string
	 */
	static function html_entity_decode( $string ) {
		global $_CB_TxtIntStore;
		return CBTxt::_unhtmlentities( $string, ENT_COMPAT, $_CB_TxtIntStore->_iso );
	}