Frontend\Core\Engine\TemplateModifiers::cleanupPlainText PHP Метод

cleanupPlainText() публичный статический Метод

Formats plain text as HTML, links will be detected, paragraphs will be inserted syntax: {{ $string|cleanupPlainText }}.
public static cleanupPlainText ( string $string ) : string
$string string The text to cleanup.
Результат string
    public static function cleanupPlainText($string)
    {
        // redefine
        $string = (string) $string;
        // detect links
        $string = \SpoonFilter::replaceURLsWithAnchors($string, FrontendModel::get('fork.settings')->get('Core', 'seo_nofollow_in_comments', false));
        // replace newlines
        $string = str_replace("\r", '', $string);
        $string = preg_replace('/(?<!.)(\\r\\n|\\r|\\n){3,}$/m', '', $string);
        // replace br's into p's
        $string = '<p>' . str_replace("\n", '</p><p>', $string) . '</p>';
        // cleanup
        $string = str_replace("\n", '', $string);
        $string = str_replace('<p></p>', '', $string);
        // return
        return $string;
    }