Exemplo n.º 1
0
 /**
  * structHandlerParagraph (Structure handler, pass 2 after childre tags)
  * Structure handler for paragraph tag.
  *
  * @param DOMElement $element
  * @param DOMElement $newParent node that are going to become new parent.
  * @return array changes structure if it contains 'result' key
  */
 function structHandlerParagraph($element, $newParent)
 {
     $ret = array();
     if ($element->getAttribute('ezparser-new-element') === 'true' && !$element->hasChildren()) {
         $element = $element->parentNode->removeChild($element);
         return $ret;
     }
     // Removes single line tag
     $line = $element->lastChild;
     if ($element->childNodes->length == 1 && $line->nodeName === 'line') {
         $lineChildren = array();
         $lineChildNodes = $line->childNodes;
         foreach ($lineChildNodes as $lineChildNode) {
             $lineChildren[] = $lineChildNode;
         }
         $line = $element->removeChild($line);
         foreach ($lineChildren as $lineChild) {
             $element->appendChild($lineChild);
         }
     }
     return $ret;
 }