Code-Formatierungen und Anpassungen an neue Editoren

This commit is contained in:
2016-09-12 22:24:04 +00:00
parent 5ca973cb00
commit 73c64c5f65
46 changed files with 5167 additions and 5374 deletions

View File

@@ -1,60 +1,58 @@
<?php
class renderSpecialContentClass extends renderClass_abstract
class renderSpecialContentClass extends renderClass_abstract
{
public function createSpecialContent($id, $popupData, $type)
{
$html = file_get_contents($this->_pathTpl . $this->_layout . '/tpl_' . $this->_template . '_' . $id . '.php');
$html = str_replace($this->_renderSearch, $this->_renderReplace, $html);
$subTpl = new DOMDocument ();
$subTpl->preserveWhitespace = false;
$subTpl->formatOutput = true;
$subTpl->loadHTML($html);
$xpath = new DOMXpath ($subTpl);
$subCont = $xpath->query(".//*[contains(concat(' ', @class, ' '), ' " . $id . " ')]")->item(0);
foreach ($popupData as $singleData)
{
public function createSpecialContent ( $id , $popupData , $type )
$tmp_node = $subCont->firstChild->cloneNode(true);
if (isset ($singleData['id']))
{
$subCont->setAttributeNode(new DOMAttr ('id', $type . '_' . $singleData['id']));
}
foreach ($singleData as $key => $data)
{
$nodeList = $xpath->query(".//*[contains(concat(' ', @class, ' '), ' " . $key . " ')]", $tmp_node);
if ($nodeList->length !== 0)
{
$html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_' . $this -> _template . '_' . $id . '.php' );
$html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html );
$subTpl = new DOMDocument ( );
$subTpl -> preserveWhitespace = false;
$subTpl -> formatOutput = true;
$subTpl -> loadHTML ( $html );
$xpath = new DOMXpath ( $subTpl );
$subCont = $xpath -> query ( ".//*[contains(concat(' ', @class, ' '), ' " . $id . " ')]" ) -> item( 0 );
foreach ( $popupData as $singleData )
foreach ($nodeList as $node)
{
switch ($key)
{
$tmp_node = $subCont -> firstChild -> cloneNode ( true );
if ( isset ( $singleData[ 'id' ] ) )
{
$subCont -> setAttributeNode ( new DOMAttr ( 'id' , $type . '_' . $singleData[ 'id' ] ) );
}
foreach ( $singleData as $key => $data )
{
$nodeList = $xpath -> query ( ".//*[contains(concat(' ', @class, ' '), ' " . $key . " ')]" , $tmp_node );
if ( $nodeList -> length !== 0 )
{
foreach ( $nodeList as $node )
{
switch ( $key )
{
case 'link' :
$node -> setAttributeNode ( new DOMAttr ( 'href' , $data ) );
break;
default :
$node -> appendChild ( new DOMCdataSection ( $data ) );
break;
}
}
}
}
$subCont -> appendChild ( $tmp_node );
case 'link' :
$node->setAttributeNode(new DOMAttr ('href', $data));
break;
default :
$node->appendChild(new DOMCdataSection ($data));
break;
}
$subCont -> removeChild ( $subCont -> firstChild );
$new_node = $this -> _tpl -> importNode ( $subCont , true );
return $new_node;
}
}
}
$subCont->appendChild($tmp_node);
}
?>
$subCont->removeChild($subCont->firstChild);
$new_node = $this->_tpl->importNode($subCont, true);
return $new_node;
}
}