src/wcmf/lib/util/DOMUtils.php
public static function removeEmptyLines($html) {
    // merge multiple linebreaks to one
    $html = preg_replace("/(<br>\s*)+/", "<br>", $html);
    // remove linebreaks at the beginning of a paragraph
    $html = preg_replace("/<p>(\s|<br>)*/", "<p>", $html);
    // remove linebreaks at the end of a paragraph
    $html = preg_replace("/(\s|<br>)*<\/p>/", "</p>", $html);
    // remove empty paragraphs
    $html = preg_replace("/<p><\/p>/", "", $html);
    return $html;
  }
public static function removeEmptyLines($html) {
    // merge multiple linebreaks to one
    $html = preg_replace("/(<br>\s*)+/", "<br>", $html);
    // remove linebreaks at the beginning of a paragraph
    $html = preg_replace("/<p>(\s|<br>)*/", "<p>", $html);
    // remove linebreaks at the end of a paragraph
    $html = preg_replace("/(\s|<br>)*<\/p>/", "</p>", $html);
    // remove empty paragraphs
    $html = preg_replace("/<p><\/p>/", "", $html);
    return $html;
  }
public static function removeEmptyLines ( $ html ) { // merge multiple linebreaks to one $ html = preg_replace ( "/(<br>\s*)+/" , "<br>" , $ html ) ; // remove linebreaks at the beginning of a paragraph $ html = preg_replace ( "/<p>(\s|<br>)*/" , "<p>" , $ html ) ; // remove linebreaks at the end of a paragraph $ html = preg_replace ( "/(\s|<br>)*<\/p>/" , "</p>" , $ html ) ; // remove empty paragraphs $ html = preg_replace ( "/<p><\/p>/" , "" , $ html ) ; return $ html ; }
Remove double linebreaks and empty paragraphs
@param $content
@return String
Remove double linebreaks and empty paragraphs