public function autoParagraph($string, $allowedTags = null, $linkUrls = true)
    {
        if(is_null($allowedTags))
            $allowedTags = $this->defaultAllowedTags;

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

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

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

        if ($this->injectors == null && $linkUrls)
            $this->injectors = array(new CF_HTMLPurifier_Injector_Linkify());

        $purifierConfig = array(
                'Core.Encoding'            => $this->charset,
                'AutoFormat.AutoParagraph' => true,
                'HTML.TidyLevel'           =>'none',
                'HTML.Allowed'             => $allowedTags,
                'Cache.SerializerPath'     => $this->vendorCacheDirectory
                );

        if(!is_null($this->injectors))
            $purifierConfig['AutoFormat.Custom'] = $this->injectors;

        $string = $this->purifier->purify($string, $purifierConfig);

        $string = str_replace("\n\n", '[DBLBR]', $string);
        $string = str_replace("\n", '<br/>', $string);
        $string = str_replace('[DBLBR]', "\n\n", $string);

        // trim links
        $string = preg_replace_callback("/\<a\s+href\=\"(".URLUtils::URL_MATCH.")\"\>\\1<\/a\>/Uix",
                    array($this, 'trimCallback'), $string);


        // trim all words longer than 60 chars that aren't URLs, ignoring tags
        if (preg_match_all("/\S60/", strip_tags(preg_replace('/(\<(\/?[^\>]+)\>)/', ' $1', $string)), $m)) {
            foreach ($m[0] as $n) {
                if( !preg_match("/".URLUtils::URL_MATCH."/", $n) )
                    $string = str_replace($n, trim(substr($n, 0, (60 - 3)), '.') . '...', $string);
            }
        }


        return $string;
    }