Code-Formatierungen und Anpassungen an neue Editoren
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user