src/ORM/FieldType/DBHTMLText.php
public function Plain()
    {
        // Preserve line breaks
        $text = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $this->RAW());

        // Convert paragraph breaks to multi-lines
        $text = preg_replace('/\<\/p\>/i', "\n\n", $text);

        // Strip out HTML tags
        $text = strip_tags($text);

        // Implode >3 consecutive linebreaks into 2
        $text = preg_replace('~(\R){2,}~', "\n\n", $text);

        // Decode HTML entities back to plain text
        return trim(Convert::xml2raw($text));
    }
public function Plain()
    {
        // Preserve line breaks
        $text = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $this->RAW());

        // Convert paragraph breaks to multi-lines
        $text = preg_replace('/\<\/p\>/i', "\n\n", $text);

        // Strip out HTML tags
        $text = strip_tags($text);

        // Implode >3 consecutive linebreaks into 2
        $text = preg_replace('~(\R){2,}~', "\n\n", $text);

        // Decode HTML entities back to plain text
        return trim(Convert::xml2raw($text));
    }
public function Plain ( ) { // Preserve line breaks $ text = preg_replace ( '/\<br(\s*)?\/?\>/i' , "\n" , $ this -> RAW ( ) ) ; // Convert paragraph breaks to multi-lines $ text = preg_replace ( '/\<\/p\>/i' , "\n\n" , $ text ) ; // Strip out HTML tags $ text = strip_tags ( $ text ) ; // Implode >3 consecutive linebreaks into 2 $ text = preg_replace ( '~(\R){2,}~' , "\n\n" , $ text ) ; // Decode HTML entities back to plain text return trim ( Convert :: xml2raw ( $ text ) ) ; }
Get plain-text version

@return string
Get plain - text version