OSDN Git Service

Added define MENU_SUBMENUBAR
[pukiwiki/pukiwiki.git] / plugin / menu.inc.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: menu.inc.php,v 1.5 2004/08/06 13:11:27 henoheno Exp $
6 //
7
8 // ¥µ¥Ö¥á¥Ë¥å¡¼¤ò»ÈÍѤ¹¤ë
9 define('MENU_ENABLE_SUBMENU', FALSE);
10
11 // ¥µ¥Ö¥á¥Ë¥å¡¼¤Î̾¾Î
12 define('MENU_SUBMENUBAR', 'MenuBar');
13
14 function plugin_menu_convert()
15 {
16         global $vars, $menubar;
17         static $menu = NULL;
18
19         if (func_num_args()) {
20                 $args = func_get_args();
21                 if (is_page($args[0])) $menu = $args[0];
22                 return '';
23         }
24
25         $page = ($menu === NULL) ? $menubar : $menu;
26
27         if (MENU_ENABLE_SUBMENU) {
28                 $path = explode('/', strip_bracket($vars['page']));
29                 while(count($path)) {
30                         $_page = join('/', $path) . '/' . MENU_SUBMENUBAR;
31                         if (is_page($_page)) {
32                                 $page = $_page;
33                                 break;
34                         }
35                         array_pop($path);
36                 }
37         }
38
39         if (! is_page($page)) {
40                 return '';
41         } else {
42                 return preg_replace('/<ul[^>]*>/', '<ul>', convert_html(get_source($page)));
43         }
44 }
45 ?>