Ejemplo n.º 1
0
 /**
  * @param string $content
  *
  * @return string
  */
 protected function fixHtmlOutput($content)
 {
     // INFO: DOMDocument will encapsulate plaintext into a paragraph tag (<p>),
     //          so we try to remove it here again ...
     if ($this->isDOMDocumentCreatedWithoutHtmlWrapper === true) {
         $content = str_replace(array("\n", "\r\n", "\r", '<simpleHtmlDomP>', '</simpleHtmlDomP>', '<body>', '</body>', '<html>', '</html>'), '', $content);
     }
     if ($this->isDOMDocumentCreatedWithoutHtml === true) {
         $content = str_replace(array('<p>', '</p>', '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">'), '', $content);
     }
     $content = UTF8::html_entity_decode($content);
     $content = trim($content);
     $content = UTF8::rawurldecode($content);
     $content = self::putReplacedBackToPreserveHtmlEntities($content);
     return $content;
 }