2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
5 // $Id: topicpath.inc.php,v 1.4 2004/08/12 13:02:26 henoheno Exp $
6 // topicpath plugin for PukiWiki
7 // available under the GPL
9 // $defaultpage¤Ø¤Î¥ê¥ó¥¯¤âɽ¼¨¤¹¤ë¤«¤É¤¦¤«
10 // TRUE:ɽ¼¨¤¹¤ë FALSE:ɽ¼¨¤·¤Ê¤¤.
11 define('PLUGIN_TOPICPATH_TOP_DISPLAY', TRUE);
12 // $defaultpage¤ËÂФ¹¤ë¥é¥Ù¥ë
13 define('PLUGIN_TOPICPATH_TOP_LABEL', 'Top');
15 // ³¬Áؤò¶èÀڤ륻¥Ñ¥ì¡¼¥¿
16 define('PLUGIN_TOPICPATH_TOP_SEPARATOR', ' / ');
18 // ¤½¤Î¥Ú¡¼¥¸¼«¿È¤òɽ¼¨¤¹¤ë¤«
19 define('PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY', TRUE);
20 // ɽ¼¨¤¹¤ë¾ì¹ç¡¢¼«Ê¬¼«¿È¤ò»Ø¤¹¥ê¥ó¥¯¤òɽ¼¨¤¹¤ë¤«
21 define('PLUGIN_TOPICPATH_THIS_PAGE_LINK', FALSE);
23 function plugin_topicpath_convert()
25 return '<div>' . plugin_topicpath_inline() . '</div>';
28 function plugin_topicpath_inline()
30 global $script, $vars, $defaultpage;
32 // $args = func_get_args();
34 $page = isset($vars['page']) ? $vars['page'] : '';
35 if ($page == '' || $page == $defaultpage) return '';
37 $parts = explode('/', $page);
39 if (PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY) {
40 $b_link = PLUGIN_TOPICPATH_THIS_PAGE_LINK;
42 array_pop($parts); // Remove itself
43 $b_link = TRUE; // Link to the parent
46 $topic_path = array();
47 while (! empty($parts)) {
48 $landing = rawurlencode(join('/', $parts));
49 $element = htmlspecialchars(array_pop($parts));
51 $topic_path[] = "<a href=\"$script?$landing\">$element</a>";
53 $topic_path[] = $element;
54 $b_link = TRUE; // Maybe reacheable once at a time
58 if (PLUGIN_TOPICPATH_TOP_DISPLAY) {
59 $topic_path[] = make_pagelink($defaultpage, PLUGIN_TOPICPATH_TOP_LABEL);
62 return join(PLUGIN_TOPICPATH_TOP_SEPARATOR, array_reverse($topic_path));