開始行: *minicalendar_viewer.inc.phpの改造 [#vdd75700] |SIZE(12):RIGHT:100|LEFT:360|c |~目的|minicalendar_viewer.inc.phpをブログ風にコメントを... |~対応バージョン|1.4.7plus-i18n| |~改造者|taru| |~公開日|&new{2006-8-31 (木) 19:05:43};| &include_in(diary/2006-08-18,comment); #contentsx *使用するプラグイン [#sec07885] |plugin名|改造|h |minicalendar.inc.php|無し| |minicalendar_viewer.inc.php|有り| |wikinote.inc.php|有り| |diary_opt.inc.php|新規| *minicalendar_viewer.inc.phpの改造部分 [#v6f98232] ***define部 [#q9f2a071] #expand(470){{{ #code(diff){{ define('PLUGIN_MINICALENDAR_VIEWER_USAGE', '#calendar_viewer(pagename,this|yyyy-mm|n|x*y[,mode[,sep... define('PLUGIN_MINICALENDAR_MAX_VIEWS', 6); define('PLUGIN_MINICALENDAR_VIEWER_HOLIDAYVIEW',TRUE); define('PLUGIN_MINICALENDAR_VIEWER_COMMENT',TRUE); +define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_COUNT_CHANGE'... +define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_PAGE_NAME','N... define('PLUGIN_MINICALENDAR_VIEWER_TRACKBACK',TRUE); +define('PLUGIN_MINICALENDAR_VIEWER_CUT',TRUE); //ソ... +define('PLUGIN_MINICALENDAR_VIEWER_WIKINOTE_OPTION','noa... }} }}} -define('PLUGIN_MINICALENDAR_VIEWER_COMMENT',TRUE); >コメントページの作成を有効にします。minicalendar_viewer... ※初期値がFALSEになっています。TRUEに変更しなければコメン... -define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_COUNT_CHANGE'... >コメントのカウント方法変更。TRUE=ページソースを読込んで... -define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_PAGE_NAME','N... >コメントを作成するページ名。この場合''Note''の下層にコメ... -define('PLUGIN_MINICALENDAR_VIEWER_TRACKBACK',TRUE); >Trackbackを有効にします。minicalendar_viewerの表示でTrac... -define('PLUGIN_MINICALENDAR_VIEWER_CUT',TRUE); >日記の中に//cutの記述があれば、minicalendar_viewerの表示... -define('PLUGIN_MINICALENDAR_VIEWER_WIKINOTE_OPTION','noa... >wikinote.inc.phpに引き渡すオプションです。 '' とすると... ***任意の位置で「…続きを見る」を表示させる。 [#mb0e2a18] -ソースを一行づつチェックして//cutの文字が見つかればソー... #expand(470){{{ #code(diff){{ // 現状で閲覧許可がある場合だけ表示する if (check_readable($page, FALSE, FALSE)) { + $source_in = get_source($page); //taru 06.08.19 + $source = ''; //taru 06.08.19 + $source_cut_find = FALSE; + if (PLUGIN_MINICALENDAR_VIEWER_CUT === TRUE) { //taru... + foreach ($source_in as $line_s) { + if (preg_match('/^(\/\/)(cut)/', $line_s)){ + $source_cut_find = TRUE; + break; + } + $source .=$line_s; + } + } if (function_exists('convert_filter')) { - $body = convert_html(convert_filter(get_source($page... + $body = convert_html(convert_filter($source)); } else { - $body = convert_html(get_source($page)); + $body = convert_html($source); } }} }}} ***270行目付近 [#b689b147] -comment,Trackbackを別functionに移動(関数化)。 -上の追加コードでソースに//cutが見つかれば「…続きを見る」... #region(←クリックして頂ければ、コードを展開します。) #code(diff){{ - if (PLUGIN_MINICALENDAR_VIEWER_COMMENT === TRUE) { - if (is_page(':config/plugin/addline/comment') && exis... - $comm = convert_html(array('&addline(comment,above){... - $comm = preg_replace(array("'<p>'si","'</p>'si"), ar... - $tail .= str_replace('>comment','><img src="'.IMAGE_... - } - } - if (PLUGIN_MINICALENDAR_VIEWER_TRACKBACK === TRUE) { - if ($trackback) { - $tb_id = tb_get_id($page); - $tail .= '<a href="' . $script . '?plugin=tb&a... - . '<img src="' . IMAGE_URI . 'plus/trac... - . '</a>' . "\n"; - } - } + $tail = comment_and_trackback($page,$trackback); //tar... + if ($source_cut_find === TRUE) { //taru 06.08.19 + $tail = '<font size="-1"><a href="' . $script . '?' ... + } if ($tail != '') { $tail = '<div class="trackback">'... $return_body .= $head . '<div class="minicalendar_vi... ++$tmp; } }} #endregion ***最終行''}''の後ろに下記コードを追加する。 [#h7367dcd] -注意''?>''は必ず一番最後になるようにして下さい。(''?>''... -commentとtrackbackを表示するための処理です。 #region(←クリックして頂ければ、コードを展開します。) #geshi{{{ function comment_and_trackback($page,$trackback,$br_on_of... { if (PLUGIN_MINICALENDAR_VIEWER_COMMENT === TRUE) { if (exist_plugin_inline('wikinote')) { //taru 06.08.18... $wikinotepage = PLUGIN_MINICALENDAR_VIEWER_COMMENT_PAG... $r_wikinotepage = rawurlencode($wikinotepage); $comment_count = 0; if(is_page($wikinotepage,$reload=FALSE)){ //taru 06.0... if(PLUGIN_MINICALENDAR_VIEWER_COMMENT_COUNT_CHANGE ==... $note_source = get_source($wikinotepage); foreach ($note_source as $line_chk) { if (preg_match('/\&new\{.*?\}\;$/', $line_chk)) $co... } } else { $comment_count = log_count('update',$wikinotepage); } } $search_r = array ('@<ul[^>]*?>(.+?)</ul>@si', // ul ... '@<li[^>]*?>(.+?)</li>@si', // li タグを削除 '@<a href="[^>]*?>Article</a>@si', // Article リン... '@>Comment@si'); // Comment文字の前に画像、後... $replace_r = array ('$1', '$1', '', '><img src="'.IMAGE_URI.'plus/comment.png" width="15"... ); if (PLUGIN_MINICALENDAR_VIEWER_WIKINOTE_OPTION === 'no... if(is_page($wikinotepage)){ $tail = '<a href="' . $script . '?' . $r_wikinotepag... } else { $r_page = rawurlencode($page); $tail = '<a href="' . $script . '?cmd=diary_opt&... } } else { $comm = call_user_func(array(new PluginWikinote(array... $comm = preg_replace(array("'<p>'si","'</p>'si"), arr... $tail .= preg_replace($search_r, $replace_r, $comm); } } } if ($br_on_off) $tail .= '<br />'; if (PLUGIN_MINICALENDAR_VIEWER_TRACKBACK === TRUE) { if ($trackback) { $tb_id = tb_get_id($page); $tail .= '<a href="' . $script . '?plugin=tb&... . '<img src="' . IMAGE_URI . 'plus/trackb... . '</a>' . "\n"; } } return $tail; } }}} #endregion *wikinote.inc.phpの改造部分 [#h801fb60] -大幅な改良が行われたようなので、旧バージョンRevision 96... -作成元ページへのリンクを作れるようにする ***options['templink']を追加する [#w50fa2a7] #code(diff){{ // Modify here for default values $this->options['prefix'] = 'Note/'; $this->options['mainlabel'] = 'Article'; $this->options['notelabel'] = 'Comment'; $this->options['except'] = '^$'; $this->options['noauto'] = FALSE; + $this->options['templink'] = FALSE; //taru 06.0... }} ***ページ情報を付加する [#q5627a7c] #expand(470){{{ #code(diff){{ // do not touch, users global $vars; $this->parse_options($args); list($page, $notepage) = $this->parse_current($va... $is_none = $this->is_none($page); if ($is_none) { $this->inline = '1'; $this->convert = ''; } else { - $this->autocreate_wikinote($notepage); + $this->autocreate_wikinote($notepage,$page); ... if ($this->error != '') { return "<p>#$this->... $this->inline = '0'; $this->convert = $this->make_switchlink($page... } }} }}} ***templateにリンクを追加 [#x22beede] #expand(470){{{ #code(diff){{ - function autocreate_wikinote($notepage) + function autocreate_wikinote($notepage,$page) { if ($this->options['noauto']) return; if ($this->is_page($notepage)) return; $contents = auto_template($notepage); if ($contents == '') { + if ($this->options['templink']){ //taru 06.08... + $contents = $this->default_template_conte... + } else { $contents = $this->default_template_conte... + } } }} }}} *diary_opt.inc.phpのダウンロード [#qc94613f] #table_edit2(textarea){{{ |SIZE(12):|SIZE(12):|SIZE(12):|SIZE(12):|c |~ファイル|~バージョン|~日付|~コメント| |&ref(diary_opt.inc.php.0.6);|0.6|07/01/30|コメントページ... |&ref(diary_opt.inc.php);|0.5|06/08/30|minicalendar_viewe... }}} >minicalendar_viewer.inc.phpでページを見ている時はcomment... **使用方法 [#xe4f78b3] #diary_opt(カレンダー作成ページ名) このサイトの様に作っている場合は#diary_opt(diary)と指定す... **define部 [#ta9725fc] define('PLUGIN_DIARY_OPT_COMMENT_PAGE_NAME','Note/'); >コメントページの名前。wikinote,minicalendar_viewerと統一... define('PLUGIN_DIARY_OPT_JOIN_FORM_CHECK','-'); >日記名XXXX-XX-XXの「-」なんとなくdefineにしただけ。変え... define('PLUGIN_DIARY_OPT_DATE_LIMIT',2); //month >minicalendar_viewer.inc.phpでnoautoに設定した時に、この... *コメント [#y487ea8e] #block(wholewidth:95%,width:50%,border:solid 1px #D3D3FF,... - ページの修正と補助プラグインバージョンアップをしました... #comment #block(end) 終了行: *minicalendar_viewer.inc.phpの改造 [#vdd75700] |SIZE(12):RIGHT:100|LEFT:360|c |~目的|minicalendar_viewer.inc.phpをブログ風にコメントを... |~対応バージョン|1.4.7plus-i18n| |~改造者|taru| |~公開日|&new{2006-8-31 (木) 19:05:43};| &include_in(diary/2006-08-18,comment); #contentsx *使用するプラグイン [#sec07885] |plugin名|改造|h |minicalendar.inc.php|無し| |minicalendar_viewer.inc.php|有り| |wikinote.inc.php|有り| |diary_opt.inc.php|新規| *minicalendar_viewer.inc.phpの改造部分 [#v6f98232] ***define部 [#q9f2a071] #expand(470){{{ #code(diff){{ define('PLUGIN_MINICALENDAR_VIEWER_USAGE', '#calendar_viewer(pagename,this|yyyy-mm|n|x*y[,mode[,sep... define('PLUGIN_MINICALENDAR_MAX_VIEWS', 6); define('PLUGIN_MINICALENDAR_VIEWER_HOLIDAYVIEW',TRUE); define('PLUGIN_MINICALENDAR_VIEWER_COMMENT',TRUE); +define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_COUNT_CHANGE'... +define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_PAGE_NAME','N... define('PLUGIN_MINICALENDAR_VIEWER_TRACKBACK',TRUE); +define('PLUGIN_MINICALENDAR_VIEWER_CUT',TRUE); //ソ... +define('PLUGIN_MINICALENDAR_VIEWER_WIKINOTE_OPTION','noa... }} }}} -define('PLUGIN_MINICALENDAR_VIEWER_COMMENT',TRUE); >コメントページの作成を有効にします。minicalendar_viewer... ※初期値がFALSEになっています。TRUEに変更しなければコメン... -define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_COUNT_CHANGE'... >コメントのカウント方法変更。TRUE=ページソースを読込んで... -define('PLUGIN_MINICALENDAR_VIEWER_COMMENT_PAGE_NAME','N... >コメントを作成するページ名。この場合''Note''の下層にコメ... -define('PLUGIN_MINICALENDAR_VIEWER_TRACKBACK',TRUE); >Trackbackを有効にします。minicalendar_viewerの表示でTrac... -define('PLUGIN_MINICALENDAR_VIEWER_CUT',TRUE); >日記の中に//cutの記述があれば、minicalendar_viewerの表示... -define('PLUGIN_MINICALENDAR_VIEWER_WIKINOTE_OPTION','noa... >wikinote.inc.phpに引き渡すオプションです。 '' とすると... ***任意の位置で「…続きを見る」を表示させる。 [#mb0e2a18] -ソースを一行づつチェックして//cutの文字が見つかればソー... #expand(470){{{ #code(diff){{ // 現状で閲覧許可がある場合だけ表示する if (check_readable($page, FALSE, FALSE)) { + $source_in = get_source($page); //taru 06.08.19 + $source = ''; //taru 06.08.19 + $source_cut_find = FALSE; + if (PLUGIN_MINICALENDAR_VIEWER_CUT === TRUE) { //taru... + foreach ($source_in as $line_s) { + if (preg_match('/^(\/\/)(cut)/', $line_s)){ + $source_cut_find = TRUE; + break; + } + $source .=$line_s; + } + } if (function_exists('convert_filter')) { - $body = convert_html(convert_filter(get_source($page... + $body = convert_html(convert_filter($source)); } else { - $body = convert_html(get_source($page)); + $body = convert_html($source); } }} }}} ***270行目付近 [#b689b147] -comment,Trackbackを別functionに移動(関数化)。 -上の追加コードでソースに//cutが見つかれば「…続きを見る」... #region(←クリックして頂ければ、コードを展開します。) #code(diff){{ - if (PLUGIN_MINICALENDAR_VIEWER_COMMENT === TRUE) { - if (is_page(':config/plugin/addline/comment') && exis... - $comm = convert_html(array('&addline(comment,above){... - $comm = preg_replace(array("'<p>'si","'</p>'si"), ar... - $tail .= str_replace('>comment','><img src="'.IMAGE_... - } - } - if (PLUGIN_MINICALENDAR_VIEWER_TRACKBACK === TRUE) { - if ($trackback) { - $tb_id = tb_get_id($page); - $tail .= '<a href="' . $script . '?plugin=tb&a... - . '<img src="' . IMAGE_URI . 'plus/trac... - . '</a>' . "\n"; - } - } + $tail = comment_and_trackback($page,$trackback); //tar... + if ($source_cut_find === TRUE) { //taru 06.08.19 + $tail = '<font size="-1"><a href="' . $script . '?' ... + } if ($tail != '') { $tail = '<div class="trackback">'... $return_body .= $head . '<div class="minicalendar_vi... ++$tmp; } }} #endregion ***最終行''}''の後ろに下記コードを追加する。 [#h7367dcd] -注意''?>''は必ず一番最後になるようにして下さい。(''?>''... -commentとtrackbackを表示するための処理です。 #region(←クリックして頂ければ、コードを展開します。) #geshi{{{ function comment_and_trackback($page,$trackback,$br_on_of... { if (PLUGIN_MINICALENDAR_VIEWER_COMMENT === TRUE) { if (exist_plugin_inline('wikinote')) { //taru 06.08.18... $wikinotepage = PLUGIN_MINICALENDAR_VIEWER_COMMENT_PAG... $r_wikinotepage = rawurlencode($wikinotepage); $comment_count = 0; if(is_page($wikinotepage,$reload=FALSE)){ //taru 06.0... if(PLUGIN_MINICALENDAR_VIEWER_COMMENT_COUNT_CHANGE ==... $note_source = get_source($wikinotepage); foreach ($note_source as $line_chk) { if (preg_match('/\&new\{.*?\}\;$/', $line_chk)) $co... } } else { $comment_count = log_count('update',$wikinotepage); } } $search_r = array ('@<ul[^>]*?>(.+?)</ul>@si', // ul ... '@<li[^>]*?>(.+?)</li>@si', // li タグを削除 '@<a href="[^>]*?>Article</a>@si', // Article リン... '@>Comment@si'); // Comment文字の前に画像、後... $replace_r = array ('$1', '$1', '', '><img src="'.IMAGE_URI.'plus/comment.png" width="15"... ); if (PLUGIN_MINICALENDAR_VIEWER_WIKINOTE_OPTION === 'no... if(is_page($wikinotepage)){ $tail = '<a href="' . $script . '?' . $r_wikinotepag... } else { $r_page = rawurlencode($page); $tail = '<a href="' . $script . '?cmd=diary_opt&... } } else { $comm = call_user_func(array(new PluginWikinote(array... $comm = preg_replace(array("'<p>'si","'</p>'si"), arr... $tail .= preg_replace($search_r, $replace_r, $comm); } } } if ($br_on_off) $tail .= '<br />'; if (PLUGIN_MINICALENDAR_VIEWER_TRACKBACK === TRUE) { if ($trackback) { $tb_id = tb_get_id($page); $tail .= '<a href="' . $script . '?plugin=tb&... . '<img src="' . IMAGE_URI . 'plus/trackb... . '</a>' . "\n"; } } return $tail; } }}} #endregion *wikinote.inc.phpの改造部分 [#h801fb60] -大幅な改良が行われたようなので、旧バージョンRevision 96... -作成元ページへのリンクを作れるようにする ***options['templink']を追加する [#w50fa2a7] #code(diff){{ // Modify here for default values $this->options['prefix'] = 'Note/'; $this->options['mainlabel'] = 'Article'; $this->options['notelabel'] = 'Comment'; $this->options['except'] = '^$'; $this->options['noauto'] = FALSE; + $this->options['templink'] = FALSE; //taru 06.0... }} ***ページ情報を付加する [#q5627a7c] #expand(470){{{ #code(diff){{ // do not touch, users global $vars; $this->parse_options($args); list($page, $notepage) = $this->parse_current($va... $is_none = $this->is_none($page); if ($is_none) { $this->inline = '1'; $this->convert = ''; } else { - $this->autocreate_wikinote($notepage); + $this->autocreate_wikinote($notepage,$page); ... if ($this->error != '') { return "<p>#$this->... $this->inline = '0'; $this->convert = $this->make_switchlink($page... } }} }}} ***templateにリンクを追加 [#x22beede] #expand(470){{{ #code(diff){{ - function autocreate_wikinote($notepage) + function autocreate_wikinote($notepage,$page) { if ($this->options['noauto']) return; if ($this->is_page($notepage)) return; $contents = auto_template($notepage); if ($contents == '') { + if ($this->options['templink']){ //taru 06.08... + $contents = $this->default_template_conte... + } else { $contents = $this->default_template_conte... + } } }} }}} *diary_opt.inc.phpのダウンロード [#qc94613f] #table_edit2(textarea){{{ |SIZE(12):|SIZE(12):|SIZE(12):|SIZE(12):|c |~ファイル|~バージョン|~日付|~コメント| |&ref(diary_opt.inc.php.0.6);|0.6|07/01/30|コメントページ... |&ref(diary_opt.inc.php);|0.5|06/08/30|minicalendar_viewe... }}} >minicalendar_viewer.inc.phpでページを見ている時はcomment... **使用方法 [#xe4f78b3] #diary_opt(カレンダー作成ページ名) このサイトの様に作っている場合は#diary_opt(diary)と指定す... **define部 [#ta9725fc] define('PLUGIN_DIARY_OPT_COMMENT_PAGE_NAME','Note/'); >コメントページの名前。wikinote,minicalendar_viewerと統一... define('PLUGIN_DIARY_OPT_JOIN_FORM_CHECK','-'); >日記名XXXX-XX-XXの「-」なんとなくdefineにしただけ。変え... define('PLUGIN_DIARY_OPT_DATE_LIMIT',2); //month >minicalendar_viewer.inc.phpでnoautoに設定した時に、この... *コメント [#y487ea8e] #block(wholewidth:95%,width:50%,border:solid 1px #D3D3FF,... - ページの修正と補助プラグインバージョンアップをしました... #comment #block(end) ページ名: