Will Fris's WordPress Weblog











{20150724}   php’s nl2br is evil

Line-breaks <br /> are something for poetry and stuff.
Use paragraphs <p />.
They make up a <section /> or <article />.


if ( !function_exists( 'nl2p' ) ) {
    function nl2p ( $text ) {
        $peed = ''
            . '<p>'
            . str_replace(
                  array( "\r\n" , "\r" , "\n" )
                , '</p><p>'
                , $text
            )
            . '</p>'
        ;
        return $peed;
    }
}
Advertisements


et cetera