FrontPage

plugin tips

paraedit.inc.php 0.6

pukiwiki 1.4.7 への組み込み方

  1. DL
  2. lib/pukiwiki.php の編集
    1. メイン処理(// 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"]);
  3. skin (skin/pukiwiki.skin.ja.php) の書換え
    1. skin/pukiwiki.skin.php内の二箇所を書き換え
      1. 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) );
      1. 2ヵ所目
        pkwk_common_headers();
        の直前あたりに
        // ParaEdit
        if(exist_plugin('paraedit')) {
           $body = _plugin_paraedit_mkeditlink($body);
        }
        を追加。↑のもinclude_onceよりexist_pluginの方がスマートな気が。
  4. 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