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,34 +1,32 @@
<?php
class renderWidgetClass extends renderClass_abstract
class renderWidgetClass extends renderClass_abstract
{
public function createWidget($widgetData)
{
$html = file_get_contents($this->_pathTpl . $this->_layout . '/tpl_' . $this->_template . '_widget_' . $widgetData['tpl'] . '.php');
$html = str_replace($this->_renderSearch, $this->_renderReplace, $html);
foreach ($widgetData as $key => $value)
{
public function createWidget ( $widgetData )
{
$html = file_get_contents ( $this -> _pathTpl . $this -> _layout . '/tpl_' . $this -> _template . '_widget_' . $widgetData[ 'tpl' ] . '.php' );
$html = str_replace ( $this -> _renderSearch , $this -> _renderReplace , $html );
foreach ( $widgetData as $key => $value )
{
$html = str_replace ( '%%' . $key . '%%' , $value , $html );
}
$subTpl = new DOMDocument ( );
$subTpl -> preserveWhitespace = false;
$subTpl -> formatOutput = true;
$subTpl -> loadHTML ( $html );
$xpath = new DOMXpath ( $subTpl );
$subCont = $xpath -> query ( ".//*[contains(concat(' ', @class, ' '), ' " . $widgetData[ 'tpl' ] . " ')]" ) -> item( 0 );
if ( isset ( $widgetData[ 'id' ] ) )
{
$subCont -> setAttributeNode ( new DOMAttr ( 'id' , 'widget_' . $widgetData[ 'id' ] ) );
}
$new_node = $this -> _tpl -> importNode ( $subCont , true );
return $new_node;
}
$html = str_replace('%%' . $key . '%%', $value, $html);
}
?>
$subTpl = new DOMDocument ();
$subTpl->preserveWhitespace = false;
$subTpl->formatOutput = true;
$subTpl->loadHTML($html);
$xpath = new DOMXpath ($subTpl);
$subCont = $xpath->query(".//*[contains(concat(' ', @class, ' '), ' " . $widgetData['tpl'] . " ')]")->item(0);
if (isset ($widgetData['id']))
{
$subCont->setAttributeNode(new DOMAttr ('id', 'widget_' . $widgetData['id']));
}
$new_node = $this->_tpl->importNode($subCont, true);
return $new_node;
}
}