2 defined('_JEXEC') or die('Restricted access'); // no direct access
5 require_once realpath(dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../../../../modules/mod_mainmenu/tmpl/default.php'));
8 if (!defined('modMainMenuArtXMLCallbackDefined'))
10 function modMainMenuArtXMLCallback(&$node, $args)
12 if (!$GLOBALS['menu_showSubmenus'] && $node->name() == 'li' && $node->level() == 1) {
13 if ($ul = $node->getElementByPath('ul'))
14 $node->removeChild($ul);
17 if ($node->name() == 'li') {
18 $liChildren = & $node->_children;
19 if (count($liChildren) > 0) {
20 $liFirstChild = & $liChildren[0];
21 $linkChildren = & $liFirstChild->_children;
22 $span = & $linkChildren[0];
23 $text = $span->data();
24 if ($liFirstChild->name() == 'span' && $liFirstChild->attributes('class') == 'separator') {
25 $liFirstChild->_name = 'a';
26 $liFirstChild->addAttribute('href', '#');
27 $liFirstChild->addAttribute('onclick', 'return false;');
29 if ($liFirstChild->name() == 'a') {
30 if ($liFirstChild->level() == 2) {
31 $liFirstChild->removeChild($span);
32 $lspan = & $liFirstChild->addChild('span', array('class' => 'l'));
34 $rspan = & $liFirstChild->addChild('span', array('class' => 'r'));
36 $tspan = & $liFirstChild->addChild('span', array('class' => 't'));
37 $tspan->setData($text);
39 $liFirstChild->removeAttribute('class');
40 $liFirstChild->setData($text);
41 $liFirstChild->removeChild($span);
46 modMainMenuXMLCallback($node, $args);
47 if ($node->name() == 'li') {
48 $class = $node->attributes('class');
49 if ($class && false !== strpos(' ' . $class, ' active')) {
50 $itemChildren = & $node->_children;
51 $itemChildren[0]->addAttribute('class', 'active');
56 define('modMainMenuArtXMLCallbackDefined', true);
59 if (!defined('artxMenuDecorator'))
62 function artxMenuDecorator($content)
71 $result .= ob_get_clean() . $content;
76 $result .= ob_get_clean();
80 define('artxMenuDecorator', true);
83 if ($attribs['name'] == 'user3') {
84 $GLOBALS['menu_showSubmenus'] = false && 1 == $params->get('showAllChildren');
85 $xml = modMainMenuHelper::getXML($params->get('menutype'), $params, 'modMainMenuArtXMLCallback');
87 $xml->addAttribute('class', 'art-menu');
88 if ($tagId = $params->get('tag_id')) {
89 $xml->addAttribute('id', $tagId);
91 $result = JFilterOutput::ampReplace($xml->toString((bool)$params->get('show_whitespace')));
92 $result = str_replace(array('<ul/>', '<ul />'), '', $result);
93 echo artxMenuDecorator($result);
96 modMainMenuHelper::render($params, 'modMainMenuXMLCallback');