OSDN Git Service

topicpathプラグイン
authorarino <arino>
Sat, 3 Apr 2004 15:26:07 +0000 (00:26 +0900)
committerarino <arino>
Sat, 3 Apr 2004 15:26:07 +0000 (00:26 +0900)
plugin/topicpath.inc.php [new file with mode: 0644]

diff --git a/plugin/topicpath.inc.php b/plugin/topicpath.inc.php
new file mode 100644 (file)
index 0000000..83c5a1f
--- /dev/null
@@ -0,0 +1,55 @@
+<?php\r
+/////////////////////////////////////////////////\r
+// PukiWiki - Yet another WikiWikiWeb clone.\r
+//\r
+// $Id: topicpath.inc.php,v 1.1 2004/04/03 15:26:07 arino Exp $\r
+//\r
+// topicpath plugin for PukiWiki\r
+//   available under the GPL\r
+\r
+\r
+//     defaultpage¤ò°ìÈֺǽé¤Ëɽ¼¨¤¹¤ë¤«¤É¤¦¤«¡£TRUE:ɽ¼¨¤¹¤ë FALSE:ɽ¼¨¤·¤Ê¤¤.\r
+define('PLUGIN_TOPICPATH_TOP_DISPLAY',TRUE);\r
+//     $defaultpage¤ËÂФ¹¤ë¥é¥Ù¥ë\r
+define('PLUGIN_TOPICPATH_TOP_LABEL','Top');\r
+//     ³¬Áؤò¶èÀڤ륻¥Ñ¥ì¡¼¥¿\r
+define('PLUGIN_TOPICPATH_TOP_SEPARATOR',' / ');\r
+//     ¼«Ê¬¤Î¥Ú¡¼¥¸¤ËÂФ¹¤ë¥ê¥ó¥¯¤òɽ¼¨¤¹¤ë¤«¤É¤¦¤«\r
+define('PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY',TRUE);\r
+//     ¼«Ê¬¤Î¥Ú¡¼¥¸¤ËÂФ·¤Æ¥ê¥ó¥¯¤¹¤ë¤«¤É¤¦¤«\r
+define('PLUGIN_TOPICPATH_THIS_PAGE_LINK',TRUE);\r
+\r
+function plugin_topicpath_convert()\r
+{\r
+       return '<div>'.plugin_topicpath_inline().'</div>';\r
+}\r
+\r
+function plugin_topicpath_inline()\r
+{\r
+       global $script,$vars,$defaultpage;\r
+       \r
+       $args = func_get_args();\r
+       \r
+       $page = $vars['page'];\r
+       \r
+       if ($page == $defaultpage) { return ''; }\r
+       \r
+       $topic_path = array();\r
+       $parts = explode('/', $page);\r
+\r
+       if (!PLUGIN_TOPICPATH_THIS_PAGE_DISPLAY) { array_pop($parts); }\r
+\r
+       $b_link = PLUGIN_TOPICPATH_THIS_PAGE_LINK;\r
+       while (count($parts)) {\r
+               $landing = join('/', $parts);\r
+               $element = array_pop($parts);\r
+               $topic_path[] = $b_link ? "<a href=\"$script?".rawurlencode($landing)."\">$element</a>" : htmlspecialchars($element);\r
+               $b_link = TRUE;\r
+       }\r
+       if (PLUGIN_TOPICPATH_TOP_DISPLAY)\r
+       {\r
+               $topic_path[] = make_pagelink($defaultpage,PLUGIN_TOPICPATH_TOP_LABEL);\r
+       }\r
+       return join(PLUGIN_TOPICPATH_TOP_SEPARATOR, array_reverse($topic_path));\r
+}\r
+?>\r