[[FrontPage]]
* plugin tips [#w2f88651]

** paraedit.inc.php 0.6[#z51de1ad]
*** pukiwiki 1.4.7 への組み込み方 [#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ヵ所目
--- 変更前
 <?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ヵ所目
 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\"");
		
	}
-- ちょっと補足:改変3行目の後ろの方にあるid=の一文字前は半角の空白が一つあります。空白を入れ忘れると、通常ページのh2やh3等のタグが機能しなくなってしまいます・・ (T-T


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS