protected function _render($bAdminMode = false) { $sContent = $this->content; if ($bAdminMode) { $oTMPDocument = new DOMDocument(); $oTMPDocument->loadXML('<root>' . str_replace('&', '&', $sContent) . '</root>'); if ($oTMPDocument->firstChild->childNodes->length == 1 && $oTMPDocument->firstChild->childNodes->item(0)->nodeType == XML_TEXT_NODE) { $oTMPDocument->loadXML('<root><p>' . $sContent . '</p></root>'); } foreach ($oTMPDocument->firstChild->childNodes as $oChildNode) { if ($oChildNode->nodeType == XML_TEXT_NODE) { continue; } if ($oChildNode->nodeName == 'div') { $oChildNode->parentNode->removeChild($oChildNode); continue; } foreach ($this->_oNode->attributes as $oOriginalNodeAttribute) { $oChildNode->setAttribute($oOriginalNodeAttribute->name, $oOriginalNodeAttribute->value); } // $oChildNode->setAttribute( 'data-brick', $this->ref ); $oChildNode->setAttribute('data-brick-parsed', 'yes'); DOMParser::addClassTo('posib-editable', $oChildNode); } $sContent = null; DOMParser::getNodeContent($oTMPDocument->firstChild, $sContent); } DOMParser::replaceNodeWithContent(str_replace('& ', '& ', $this->_cleanContent($sContent)), $this->_oNode); }
public function render($bAdminMode = false, $sLang = null) { if ($bAdminMode && $this->_oNode->hasAttribute('data-brick-parsed')) { return false; } $this->_render($bAdminMode); if ($bAdminMode) { if (!$this->_oNode->hasAttribute('data-brick-parsed')) { $this->_oNode->setAttribute('data-brick-parsed', 'yes'); } DOMParser::addClassTo('posib-editable', $this->_oNode); } else { $this->_clean(); } return true; }