- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2017-12-18T00:37:35+00:00","","")
#topicpath
* plugin tips [#w2f88651]
** paraedit.inc.php 0.6[#z51de1ad]
*** pukiwiki 1.4.7 への組み込み方 [#w5a25274]
** paraedit.inc.php 0.8[#z51de1ad]
*** pukiwiki 1.5.1 への組み込み方 [#w5a25274]
+ DL
-- http://taru.s223.xrea.com/index.php?PukiWiki%2Fvanish より
-- plugin/ 配下にコピーする。
+ lib/pukiwiki.php の編集
++ メイン処理(// Main)の直前に次の二行を追加。(paraedit 0.6以降)
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) の書換え
++ skin/pukiwiki.skin.php内の二箇所を書き換え
+++ 1ヵ所目
-- skin/pukiwiki.skin.php内の二箇所を書き換え
++ 1ヵ所目
--- 変更前
<?php echo $body ?>
--- 変更後
<?php include_once 'plugin/paraedit.inc.php'; echo _plugin_paraedit_mkeditlink($body); ?>
--- (注意) InputHelper と ParaEdit を併用する場合は下記の様にして下さい。
php include_once 'plugin/input_helper.inc.php'; include_once 'plugin/input_helper.inc.php';
echo plugin_input_helper_echo( _plugin_paraedit_mkeditlink($body) );
+++ 2ヵ所目
++ 2ヵ所目
pkwk_common_headers();
の直前あたりに
// ParaEdit
if(exist_plugin('paraedit')) {
$body = _plugin_paraedit_mkeditlink($body);
}
を追加。↑のもinclude_onceよりexist_pluginの方がスマートな気が。
+ lib/convert_html.php の編集。
class Heading extends Element 内にある、
function toString()
{
return $this->msg_top . $this->wrap(parent::toString(),
'h' . $this->level, ' id="' . $this->id . '"');
}
を、次のように書き変える。
function toString()
{
//////////////////////////////////////////////////////////////////////////////
// paraedit.inc.php 用の変更
/*
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\"");
}
function toString()
{
// paraedit.inc.php 用の変更
// for enable paraedit.inc.php on pukiwiki 1.5.0 or later
$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 . '"');
/*
return $this->msg_top . $this->wrap(parent::toString(),
'h' . $this->level, ' id="' . $this->id . '"');
*/
}
-- ちょっと補足:改変3行目の後ろの方にあるid=の一文字前は半角の空白が一つあります。空白を入れ忘れると、通常ページのh2やh3等のタグが機能しなくなってしまいます・・ (T-T
+ paraedit.inc.php 自体への変更
-- pukiwiki1.5.1, PHP7 以降では、以下の変更が必要
++ 2箇所ある split() を explode() に変更
+++ 1箇所目
// $vars[msg] を分割
$msg_before; $msg_now; $msg_after; // 編集行とその前後
$part = $vars['parnum'];
$index_num = 0;
$is_first_line = 1;
// for pukiwiki 1.5.0 or later
// foreach (split ("\n", $postdata) as $line) {
foreach (explode ("\n", $postdata) as $line) {
+++ 2箇所目
function _plugin_paraedit_mkeditlink($body)
{
// [edit]リンクの作成
global $script, $get, $post, $vars;
// for pukiwiki 1.5.0 or later
// $lines = split("\n", $body);
$lines = explode("\n", $body);