2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
5 // $Id: topicpath.inc.php,v 1.2 2004/08/04 11:21:13 henoheno Exp $
7 // topicpath plugin for PukiWiki
8 // available under the GPL
11 // defaultpage¤ò°ìÈֺǽé¤Ëɽ¼¨¤¹¤ë¤«¤É¤¦¤«¡£TRUE:ɽ¼¨¤¹¤ë FALSE:ɽ¼¨¤·¤Ê¤¤.
12 define('PLUGIN_TOPICPATH_TOP_DISPLAY',TRUE);
13 // $defaultpage¤ËÂФ¹¤ë¥é¥Ù¥ë
14 define('PLUGIN_TOPICPATH_TOP_LABEL','Top');
15 // ³¬Áؤò¶èÀڤ륻¥Ñ¥ì¡¼¥¿
16 define('PLUGIN_TOPICPATH_TOP_SEPARATOR',' / ');
17 // ¼«Ê¬¤Î¥Ú¡¼¥¸¤ËÂФ¹¤ë¥ê¥ó¥¯¤òɽ¼¨¤¹¤ë¤«¤É¤¦¤«
18 define('PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY',TRUE);
19 // ¼«Ê¬¤Î¥Ú¡¼¥¸¤ËÂФ·¤Æ¥ê¥ó¥¯¤¹¤ë¤«¤É¤¦¤«
20 define('PLUGIN_TOPICPATH_THIS_PAGE_LINK',TRUE);
22 function plugin_topicpath_convert()
24 return '<div>'.plugin_topicpath_inline().'</div>';
27 function plugin_topicpath_inline()
29 global $script,$vars,$defaultpage;
31 $args = func_get_args();
33 $page = $vars['page'];
35 if ($page == $defaultpage) { return ''; }
37 $topic_path = array();
38 $parts = explode('/', $page);
40 if (!PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY) { array_pop($parts); }
42 $b_link = PLUGIN_TOPICPATH_THIS_PAGE_LINK;
43 while (count($parts)) {
44 $landing = join('/', $parts);
45 $element = array_pop($parts);
46 $topic_path[] = $b_link ? "<a href=\"$script?".rawurlencode($landing)."\">$element</a>" : htmlspecialchars($element);
49 if (PLUGIN_TOPICPATH_TOP_DISPLAY)
51 $topic_path[] = make_pagelink($defaultpage,PLUGIN_TOPICPATH_TOP_LABEL);
53 return join(PLUGIN_TOPICPATH_TOP_SEPARATOR, array_reverse($topic_path));