OSDN Git Service

Correct CRLF => LF
[pukiwiki/pukiwiki.git] / plugin / topicpath.inc.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: topicpath.inc.php,v 1.2 2004/08/04 11:21:13 henoheno Exp $
6 //
7 // topicpath plugin for PukiWiki
8 //   available under the GPL
9
10
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);
21
22 function plugin_topicpath_convert()
23 {
24         return '<div>'.plugin_topicpath_inline().'</div>';
25 }
26
27 function plugin_topicpath_inline()
28 {
29         global $script,$vars,$defaultpage;
30         
31         $args = func_get_args();
32         
33         $page = $vars['page'];
34         
35         if ($page == $defaultpage) { return ''; }
36         
37         $topic_path = array();
38         $parts = explode('/', $page);
39
40         if (!PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY) { array_pop($parts); }
41
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);
47                 $b_link = TRUE;
48         }
49         if (PLUGIN_TOPICPATH_TOP_DISPLAY)
50         {
51                 $topic_path[] = make_pagelink($defaultpage,PLUGIN_TOPICPATH_TOP_LABEL);
52         }
53         return join(PLUGIN_TOPICPATH_TOP_SEPARATOR, array_reverse($topic_path));
54 }
55 ?>