OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / templates / moyoo_blue_dog / html / mod_mainmenu / default.php
1 <?php
2 defined('_JEXEC') or die('Restricted access'); // no direct access
3
4 ob_start();
5 require_once realpath(dirname(__FILE__) . str_replace('/', DIRECTORY_SEPARATOR, '/../../../../modules/mod_mainmenu/tmpl/default.php'));
6 ob_clean();
7
8 if (!defined('modMainMenuArtXMLCallbackDefined'))
9 {
10 function modMainMenuArtXMLCallback(&$node, $args)
11 {
12                 if (!$GLOBALS['menu_showSubmenus'] && $node->name() == 'li' && $node->level() == 1) {
13                         if ($ul = $node->getElementByPath('ul'))
14                                 $node->removeChild($ul);
15                 }
16                 
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;');
28                                 }
29                                 if ($liFirstChild->name() == 'a') {
30                                         if ($liFirstChild->level() == 2) {
31                                                 $liFirstChild->removeChild($span);
32                                                 $lspan = & $liFirstChild->addChild('span', array('class' => 'l'));
33                                                 $lspan->setData(' ');
34                                                 $rspan = & $liFirstChild->addChild('span', array('class' => 'r'));
35                                                 $rspan->setData(' ');
36                                                 $tspan = & $liFirstChild->addChild('span', array('class' => 't'));
37                                                 $tspan->setData($text);
38                                         } else {
39                                                 $liFirstChild->removeAttribute('class');
40                                                 $liFirstChild->setData($text);
41                                                 $liFirstChild->removeChild($span);
42                                         }
43                                 }
44                         }
45                 }
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');
52                         }
53                 }
54         }
55
56         define('modMainMenuArtXMLCallbackDefined', true);
57 }
58
59 if (!defined('artxMenuDecorator'))
60 {
61
62         function artxMenuDecorator($content)
63         {
64                 $result = '';
65                 ob_start();
66 ?>
67 <div class="art-nav">
68         <div class="l"></div>
69         <div class="r"></div>
70 <?php
71                 $result .= ob_get_clean() . $content;
72                 ob_start();
73 ?>
74 </div>
75 <?php
76                 $result .= ob_get_clean();
77                 return $result;
78         }
79
80         define('artxMenuDecorator', true);
81 }
82
83 if ($attribs['name'] == 'user3') {
84         $GLOBALS['menu_showSubmenus'] = false && 1 == $params->get('showAllChildren');
85         $xml = modMainMenuHelper::getXML($params->get('menutype'), $params, 'modMainMenuArtXMLCallback');
86         if ($xml) {
87                 $xml->addAttribute('class', 'art-menu');
88                 if ($tagId = $params->get('tag_id')) {
89                         $xml->addAttribute('id', $tagId);
90                 }
91                 $result = JFilterOutput::ampReplace($xml->toString((bool)$params->get('show_whitespace')));
92                 $result = str_replace(array('<ul/>', '<ul />'), '', $result);
93                 echo artxMenuDecorator($result);
94         }
95 } else {
96         modMainMenuHelper::render($params, 'modMainMenuXMLCallback');
97 }