PukiWiki/1.3/自作プラグイン/ParaEditで作者のサイトが消失して落とせないと困っているらしい。
別サイトで利用するときに落としたものがあったので、とりあえずここに置きます。
このプラグインを設置すると、見出し単位の編集が可能になります。(通常はページ単位)
ダウンロード | Ver | 備考 |
paraedit.inc.php | 0.6 | 作者サイトから保存していたものを公開 |
paraedit_7a.inc.zip.tgz | 0.7a | PHP5.2.0以上の環境では php.iniの制限値範囲でしかページに文字を追加できない問題を修正 「テキストの整形ルール」のリンク定義を変更 |
paraedit_8.inc.zip.tgz | 0.8 | UTF-8Nで保存しました。 (EUC-JPの環境で利用する方は文字コードを変更して使う必要があります。) pukiWiki1.4.7では利用できない参照定義があったので修正してみました。 但し、この部分は消しても良いかもしれません。 |
設置方法
lib/pukiwiki.php に次のコードを追加
include_once('plugin/paraedit.inc.php'); $post["msg"] = _plugin_paraedit_parse_postmsg($post["msg_before"], $post["msg"], $post["msg_after"]);バージョンによっては(1.4.7等、PLUGIN_DIRが定義されたバージョンでは)
include_once(PLUGIN_DIR . 'paraedit.inc.php'); $post["msg"] = _plugin_paraedit_parse_postmsg($post["msg_before"], $post["msg"], $post["msg_after"]);
skin (skin/pukiwiki.skin.ja.php) の書換え
変更前
<?php echo $body ?>
変更後
<?php include_once 'plugin/paraedit.inc.php'; echo _plugin_paraedit_mkeditlink($body); ?>
php include_once 'plugin/input_helper.inc.php'; include_once 'plugin/input_helper.inc.php'; echo plugin_input_helper_echo( _plugin_paraedit_mkeditlink($body) );
- 1.4.7の場合(他でも同じ方法でいけるのかも)
- skin/pukiwiki.skin.php
pkwk_common_headers();の直前あたりに// ParaEdit if(exist_plugin('paraedit')) { $body = _plugin_paraedit_mkeditlink($body); }を追加。↑のもinclude_onceよりexist_pluginの方がスマートな気が。
convert_html() の書換え
return $this->msg_top. $this->wrap(parent::toString(),'h'.$this->level," id=\"{$this->id}\"");
$paraedit_flag = (preg_match("/^content_1_/", $this->id)) ? ' paraedit_flag=on' : ''; return $this->msg_top. $this->wrap(parent::toString(),'h'.$this->level," id=\"{$this->id}\"$paraedit_flag");
paraedit.inc.php をplugin ディレクトリ (./plugin) に コピー
paraedit.inc.phpの書換え
// 編集リンクの挿入箇所を指定 // <h2>header</h2> の時、$1:<h2>, $2:header, $3:</h2> となるので $link を // 好きな場所に移動 // (例) define(_PARAEDIT_LINK_POS, '$1$2$link$3'); // </h2>の前 // define(_PARAEDIT_LINK_POS, '$link$1$2$3'); // <h2>の前 // define(_PARAEDIT_LINK_POS, '$1$2$3$link'); // </h2>の後ろ
(paraedit.inc.phpの編集)
// ヘルプ表示 : リンク書き換え $body = preg_replace("/(cmd=edit&help=true)/", "plugin=paraedit&parnum=$vars[parnum]&$1&refer=" . rawurlencode($vars[page]), $body);
を
// ヘルプ表示 : リンク書き換え $body = preg_replace("/cmd=edit(&help=true)/", "plugin=paraedit&parnum=$vars[parnum]$1&refer=" . rawurlencode($vars[page]), $body);
に修正すると良いみたいです。
php include_once 'plugin/input_helper.inc.php'; include_once 'plugin/input_helper.inc.php';は
php include_once PLUGIN_DIR . 'input_helper.inc.php'; include_once PLUGIN_DIR . 'input_helper.inc.php';としておくと、index.phpを別の階層等に移動した場合にも動作してくれそうです。 -- ぃぉぃぉ? 2007-06-29 (金) 02:45:43
// 編集リンクの文字列・スタイルを指定 // %s に URL が入る define(_EDIT_LINK, '<a href="%s"><img src="./image/paraedit.png" width="9" height="9" alt="Edit" title="Edit" /></a>');見出しの中、上、下と場所が簡単に変えられるよう3種類のコードが書かれているので見出しのの中に入れるように最初の「</h2>の前」の先頭にある//を削除して「<h2>の前」の先頭に//を加える。
// 編集リンクの挿入箇所を指定 // <h2>header</h2> の時、$1:<h2>, $2:header, $3:</h2> となるので $link を // 好きな場所に移動 // (例) define(_PARAEDIT_LINK_POS, '$1$2$link$3'); // </h2>の前 // define(_PARAEDIT_LINK_POS, '$link$1$2$3'); // <h2>の前 // define(_PARAEDIT_LINK_POS, '$1$2$3$link'); // </h2>の後ろ
- pcre.backtrack_limit integer
PCRE のバックトラック処理の制限値です。- pcre.recursion_limit integer
PCRE の再帰処理の制限値です。この値を大きくすると、 使用可能なプロセススタックを使い切ってしまい、 (OS のスタックサイズの制限値に達して) PHP をクラッシュさせてしまうことに注意しましょう。
&ref(): File not found: "paraedit.inc.zip.tgz" at page "経済学/行動経済学"; | PHP5.2.5 PukiWiki-1.4.7動作確認済み |
Warning: include_once() [function.include-once]: URL file-access is disabled in the server configuration in /usr/local/apache/htdocs/userad/gdat/ad_f_utf8.p on line 17 Warning: include_once(http://ad.land.to/banner_text.p?en=UTF-8) [function.include-once]: failed to open stream: no suitable wrapper could be found in /usr/local/apache/htdocs/userad/gdat/ad_f_utf8.p on line 17 Warning: include_once() [function.include]: Failed opening 'http://ad.land.to/banner_text.p?en=UTF-8' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/apache/htdocs/userad/gdat/ad_f_utf8.p on line 17
Error message : Variable(s) not found: (Maybe the old *.ini.php?) $rss_maxとエラーになってしまいます。
$load_template_func = 0;
$body = edit_form($get['page'], $textdata, FALSE, FALSE); // v 1.4
#pre{{
/* 132行目のpreg_match関数の処理を以下のように修正し、
preg_match("/^(.*?)(<textarea .*?>)(___paraedit_taxtarea___)(<\/textarea>.*)$/is", $body, $textareas);
//////////////////////// $hit_flag = 0; $textareas[1] = ""; foreach (explode("\n", $body) as $line) { if( $hit_flag != 0 ) { // キーワード以降の行は[4]に入れる $textareas[4] .= "\n".$line; continue; } unset( $sep_line ); if( preg_match("/^(.*?)(<textarea .*?>)(___paraedit_taxtarea___)(<\/textarea>.*)$/is", $line, $sep_line ) != 0 ) { // キーワードがあったら分割する $textareas[1] .= $sep_line[1]; $textareas[2] = $sep_line[2]; $textareas[3] = $sep_line[3]; $textareas[4] = $sep_line[4]; $hit_flag = 1; continue; } $textareas[1] .= $line."\n"; } $textareas[0] = $body; unset( $sep_line ); unset( $line ); unset( $hit_flag ); ////////////////////////
}}