public function make_tags($layout)
{
if ($layout == '') {
return $layout;
}
require_once __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'phpQuery.php';
$pq = \phpQuery::newDocument($layout);
foreach ($pq['.module'] as $elem) {
$name = pq($elem)->attr('module');
$attrs = $elem->attributes;
$module_html = '<module ';
if (!empty($attrs)) {
foreach ($attrs as $attribute_name => $attribute_node) {
$v = $attribute_node->nodeValue;
$module_html .= " {$attribute_name}='{$v}' ";
}
}
$module_html .= ' />';
pq($elem)->replaceWith($module_html);
}
$layout = $pq->htmlOuter();
$layout = str_replace("\\u00a0", ' ', $layout);
$layout = str_replace('<?', '<?', $layout);
$layout = str_replace('?>', '?>', $layout);
return $layout;
}