protected function cleanHTMLPurify($string, $allowedTags = null)
    {
        if(strlen($string)==0)
            return '';

        if($allowedTags === null)
            $allowedTags = $this->defaultAllowedTags;

        if($allowedTags == '*')
            return $string;

        if(is_null($this->purifier))
        {
            require_once PATH_SYSTEM . '/vendors/HTMLPurifier.php';

            $this->purifier = HTMLPurifier::instance();

            FileSystemUtils::recursiveMkdir($this->vendorCacheDirectory.'/purifier/');
        }


        $string = $this->purifier->purify($string, array(
                'Core.Encoding'            => $this->charset,
                'HTML.TidyLevel'           =>'none',
                'HTML.Allowed'             => $allowedTags,
                'AutoFormat.AutoParagraph' => false,
                //'HTML.Doctype'           => 'XHTML 1.0 Transitional',
                'Cache.SerializerPath'     => $this->vendorCacheDirectory.'/purifier/'
                ));

//        $string = html_entity_decode($string, ENT_COMPAT, $this->charset);

        return $string;
    }
protected function cleanHTMLPurify($string, $allowedTags = null)
    {
        if(strlen($string)==0)
            return '';

        if($allowedTags === null)
            $allowedTags = $this->defaultAllowedTags;

        if($allowedTags == '*')
            return $string;

        if(is_null($this->purifier))
        {
            require_once PATH_SYSTEM . '/vendors/HTMLPurifier.php';

            $this->purifier = HTMLPurifier::instance();

            FileSystemUtils::recursiveMkdir($this->vendorCacheDirectory.'/purifier/');
        }


        $string = $this->purifier->purify($string, array(
                'Core.Encoding'            => $this->charset,
                'HTML.TidyLevel'           =>'none',
                'HTML.Allowed'             => $allowedTags,
                'AutoFormat.AutoParagraph' => false,
                //'HTML.Doctype'           => 'XHTML 1.0 Transitional',
                'Cache.SerializerPath'     => $this->vendorCacheDirectory.'/purifier/'
                ));

//        $string = html_entity_decode($string, ENT_COMPAT, $this->charset);

        return $string;
    }
protected function cleanHTMLPurify ( $ string , $ allowedTags = null ) { if ( strlen ( $ string ) == 0 ) return '' ; if ( $ allowedTags === null ) $ allowedTags = $ this -> defaultAllowedTags ; if ( $ allowedTags == '*' ) return $ string ; if ( is_null ( $ this -> purifier ) ) { require_once PATH_SYSTEM . '/vendors/HTMLPurifier.php' ; $ this -> purifier = HTMLPurifier :: instance ( ) ; FileSystemUtils :: recursiveMkdir ( $ this -> vendorCacheDirectory . '/purifier/' ) ; } $ string = $ this -> purifier -> purify ( $ string , array ( 'Core.Encoding' => $ this -> charset , 'HTML.TidyLevel' => 'none' , 'HTML.Allowed' => $ allowedTags , 'AutoFormat.AutoParagraph' => false , //'HTML.Doctype'           => 'XHTML 1.0 Transitional', 'Cache.SerializerPath' => $ this -> vendorCacheDirectory . '/purifier/' ) ) ; //        $string = html_entity_decode($string, ENT_COMPAT, $this->charset); return $ string ; }
Produces a nicely-formatted HTML string with all non-matching tags stripped.

@param string $string      The HTML string to format
@param string $allowedTags A comma separated list of tags to allow in the result

@return string A nicely-formatted version of the input text, containing only the tags specified.
Produces a nicely - formatted HTML string with all non - matching tags stripped .