name() == 'li') {
if (!$options['show_submenus'] && $node->level() == 1) {
if ($ul = $node->getElementByPath('ul'))
$node->removeChild($ul);
}
$liChildren = & $node->_children;
if (count($liChildren) > 0) {
// element ( $img?, $span ( $text ) ) )
// ?
//
?
$element = & $liChildren[0];
if ($element->_children[0]->name() == 'img') {
$img = & $element->_children[0];
$span = & $element->_children[1];
$element->removeChild($img);
} else {
$img = null;
$span = & $element->_children[0];
}
$element->removeChild($span);
// convert separator to anchor
if ($element->name() == 'span' && $element->attributes('class') == 'separator') {
$element->_name = 'a';
$element->addAttribute('href', '#');
$element->addAttribute('onclick', 'return false;');
}
// add extra spans for top level items, required for design
if ($element->level() == 2) {
$lspan = & $element->addChild('span', array('class' => 'l'));
$lspan->setData(' ');
$rspan = & $element->addChild('span', array('class' => 'r'));
$rspan->setData(' ');
$tspan = & $element->addChild('span', array('class' => 't'));
$container = & $tspan;
} else {
$container = & $element;
}
// container is always ... here
$text = $span->data();
if ($img != null) {
$align = $img->attributes('align');
if ($align == 'left' || $align == '') {
$container->addChild('img', array('class' => 'art-metadata-icon',
'src' => $img->attributes('src'),
'style' => 'margin-right: 5px; vertical-align: middle;',
'alt' => $img->attributes('alt')));
$extraArtxSpan = & $container->addChild('artx-extra-span');
$extraArtxSpan->setData($text);
} else if ($align == 'right') {
$extraArtxSpan = & $container->addChild('artx-extra-span');
$extraArtxSpan->setData($text);
$container->addChild('img', array('class' => 'art-metadata-icon',
'src' => $img->attributes('src'),
'style' => 'margin-left: 5px; vertical-align: middle;',
'alt' => $img->attributes('alt')));
}
} else {
$container->setData($text);
}
}
modMainMenuXMLCallback($node, $args);
// this should be after modMainMenuXMLCallback, because the callback sets class='active' and id='current'
if ($options['vmenu'] !== null && !$options['vmenu']['simple']) {
$class = $node->attributes('class');
$isActive = $class && false !== strpos(' ' . $class, ' active');
if ($node->attributes('id') != 'current' && !$isActive) {
if ($ul = $node->getElementByPath('ul'))
$node->removeChild($ul);
}
}
$class = $node->attributes('class');
if ($class && false !== strpos(' ' . $class, ' active')) {
$element->addAttribute('class', 'active');
}
} else {
modMainMenuXMLCallback($node, $args);
}
}
function artxMenuDecorator($content)
{
$result = '';
ob_start();
?>