• R/O
  • SSH
  • HTTPS

y2pukiwiki: Commit


Commit MetaInfo

Revision121 (tree)
Time2010-04-18 21:58:00
Authory2katayama

Log Message

wikinoteプラグインを追加

Change Summary

Incremental Difference

--- pukiwiki-1.4.7_notb_utf8/plugin/wikinote.inc.php (nonexistent)
+++ pukiwiki-1.4.7_notb_utf8/plugin/wikinote.inc.php (revision 121)
@@ -0,0 +1,77 @@
1+<?php
2+/**
3+ *
4+ * Wikipedia 風のノート
5+ *
6+ * @package org.pukiwiki.plugin.wikinote
7+ * @author tetsuo morikawa <momonga at user dot sourceforge dot jp>
8+ * @version $Id$
9+ */
10+
11+// ノートページ名のSuffix
12+define('PLUGIN_WIKINOTE_PREFIX',':Note/'); // last slash would be added
13+// ノートへのリンク名
14+define('PLUGIN_WIKINOTE_LABEL_GO','ウィキノート');
15+// 元ページへのリンク名
16+define('PLUGIN_WIKINOTE_LABEL_BACK','元ページへ');
17+
18+
19+
20+
21+function plugin_wikinote_convert(){
22+ $args = func_get_args();
23+ return call_user_func_array('plugin_wikinote_inline',$args);
24+} // func
25+
26+function plugin_wikinote_inline() {
27+ global $script,$vars;
28+
29+ $str = '';
30+ $page = '';
31+ $_PLUGIN_WIKINOTE_PREFIX = PLUGIN_WIKINOTE_PREFIX;
32+ $_PLUGIN_WIKINOTE_LABEL_GO = PLUGIN_WIKINOTE_LABEL_GO;
33+ $_PLUGIN_WIKINOTE_LABEL_BACK = PLUGIN_WIKINOTE_LABEL_BACK;
34+
35+ // args check
36+ $args = func_get_args();
37+ $size = sizeof($args);
38+ if ( ($size > 1) && strlen($args[1]) > 0 ) {
39+ $_PLUGIN_WIKINOTE_LABEL_GO = $args[0];
40+ $_PLUGIN_WIKINOTE_LABEL_BACK = $args[1];
41+ if ( ($size > 2) && (strlen($args[2]) > 0) )
42+ $_PLUGIN_WIKINOTE_PREFIX = $args[2];
43+ } //
44+
45+ // slash check
46+ if ( (strlen($_PLUGIN_WIKINOTE_PREFIX) > 0) && (substr($_PLUGIN_WIKINOTE_PREFIX,-1,1) != '/') )
47+ $_PLUGIN_WIKINOTE_PREFIX .= '/';
48+
49+ // page
50+ $page = strip_bracket($vars['page']);
51+ // PLUGIN_WIKINOTE_PREFIX ページであれば、元のページへ
52+ if (strpos($page, $_PLUGIN_WIKINOTE_PREFIX) === 0 ) {
53+ $str = $_PLUGIN_WIKINOTE_LABEL_BACK;
54+ $crypted = crypt($_PLUGIN_WIKINOTE_PREFIX);
55+ $page = str_replace($crypted.$_PLUGIN_WIKINOTE_PREFIX, '', $crypted.$page);
56+ } else {
57+ $str = $_PLUGIN_WIKINOTE_LABEL_GO;
58+ $page = $_PLUGIN_WIKINOTE_PREFIX.$page;
59+ } //
60+ $r_page = rawurlencode($page);
61+ // $s_page = htmlspecialchars($page); // no use
62+
63+
64+ // $str = '<a href="'.$script.'?'.$r_page.'">'.$str.'</a>';
65+ $str = make_pagelink($page,$str);
66+ return $str;
67+} // func
68+
69+
70+/** ------------------------------------------------------------
71+ChangeLog
72+- 2003-11-11
73+-- slash would be added automatically.
74+-- args are able to be specified.
75+
76+---------------------------------------------------------------- **/
77+?>
\ No newline at end of file
Show on old repository browser