pgintro.net

WordPressプラグイン - 「Comment Attachment」

作成日時:2019/04/25

更新日時:2019/04/25

スポンサーリンク

この記事の確認環境

WordPress 5.0.4

Comment Attachment バージョン 1.5.8.1

プラグイン概要

コメントにファイル添付機能を付与できます。


公式サイト : https://ja.wordpress.org/plugins/comment-attachment/

アクションフック一覧

add_action関数を使用して既存の関数呼び出しにフックを追加します。

フック種類関数
plugins_loadedwpCommentAttachment::loaded
initwpCommentAttachment::init
admin_initwpCommentAttachment::adminInit
admin_notices無名関数
comment_form_topwpCommentAttachment::displayBeforeForm
comment_form_before_fieldswpCommentAttachment::displayFormAttBefore
comment_form_after_fieldswpCommentAttachment::displayFormAttAfter
comment_form_logged_in_afterwpCommentAttachment::displayFormAtt
comment_postwpCommentAttachment::saveAttachment
delete_commentwpCommentAttachment::deleteAttachment
admin_noticeswpCommentAttachment::displayFunctionMissingNotice

関連リンク

https://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded

https://codex.wordpress.org/Plugin_API/Action_Reference/init

https://codex.wordpress.org/Plugin_API/Action_Reference/admin_init

https://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices

https://developer.wordpress.org/reference/hooks/comment_form_top/

https://developer.wordpress.org/reference/hooks/comment_form_before_fields/

https://developer.wordpress.org/reference/hooks/comment_form_after_fields/

https://developer.wordpress.org/reference/hooks/comment_form_logged_in_after/

https://codex.wordpress.org/Plugin_API/Action_Reference/comment_post

https://developer.wordpress.org/reference/hooks/delete_comment/

https://codex.wordpress.org/Plugin_API/Action_Reference/admin_notices

フィルターフック一覧

add_filter関数を使用して既存の関数呼び出しにフックを追加します。

フック種類関数
preprocess_commentwpCommentAttachment::checkAttachment
comment_textwpCommentAttachment::displayAttachment
upload_mimeswpCommentAttachment::getAllowedUploadMimes
comment_notification_textwpCommentAttachment::notificationText
plugin_action_linkswpCommentAttachment::displayPluginActionLink
comment_row_actionswpCommentAttachment::addCommentActionLinks

関連リンク

https://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment

https://codex.wordpress.org/Function_Reference/comment_text

https://codex.wordpress.org/Plugin_API/Filter_Reference/upload_mimes

https://developer.wordpress.org/reference/hooks/comment_notification_text/

https://developer.wordpress.org/reference/hooks/plugin_action_links/

https://developer.wordpress.org/reference/hooks/comment_row_actions/

設定方法

WordPress管理画面の「設定」>「ディスカッション」メニュー画面に「Comment Attachment」の見出しで設定項目が追加されています。

作成テーブル一覧

テーブル名概要
--

使用テーブル一覧

テーブル名概要
wp_options-

オプション一覧

「update_option()」,「get_option()」を使用して「wp_options」テーブルに設定値を格納、参照しています。

キー説明
commentAttachment-

キー「commentAttachment」の値の例

a:44:{
  s:25:"commentAttachmentPosition";
  s:0:"";
  s:22:"commentAttachmentTitle";
  s:17:"Upload attachment";
  s:24:"commentAttachmentMaxSize";
  i:256;
  s:25:"commentAttachmentRequired";
  i:0;
  s:21:"commentAttachmentBind";
  i:1;
  s:27:"commentAttachmentThumbTitle";
  s:10:"Attachment";
  s:26:"commentAttachmentAPosition";
  s:0:"";
  s:21:"commentAttachmentLink";
  i:0;
  s:22:"commentAttachmentThumb";
  i:1;
  s:26:"commentAttachmentThumbSize";
  s:0:"";
  s:23:"commentAttachmentPlayer";
  i:1;
  s:23:"commentAttachmentDelete";
  i:1;
  s:20:"commentAttachmentJPG";
  i:1;
  s:20:"commentAttachmentGIF";
  i:1;
  s:20:"commentAttachmentPNG";
  i:1;
  s:20:"commentAttachmentPDF";
  i:0;
  s:20:"commentAttachmentDOC";
  i:0;
  s:21:"commentAttachmentDOCX";
  i:0;
  s:20:"commentAttachmentPPT";
  i:0;
  s:21:"commentAttachmentPPTX";
  i:0;
  s:20:"commentAttachmentPPS";
  i:0;
  s:21:"commentAttachmentPPSX";
  i:0;
  s:20:"commentAttachmentODT";
  i:0;
  s:20:"commentAttachmentXLS";
  i:0;
  s:21:"commentAttachmentXLSX";
  i:0;
  s:20:"commentAttachmentRAR";
  i:0;
  s:20:"commentAttachmentZIP";
  i:0;
  s:20:"commentAttachmentMP3";
  i:0;
  s:20:"commentAttachmentM4A";
  i:0;
  s:20:"commentAttachmentOGG";
  i:0;
  s:20:"commentAttachmentWAV";
  i:0;
  s:20:"commentAttachmentWMA";
  i:0;
  s:20:"commentAttachmentMP4";
  i:0;
  s:20:"commentAttachmentM4V";
  i:0;
  s:20:"commentAttachmentMOV";
  i:0;
  s:20:"commentAttachmentWMV";
  i:0;
  s:20:"commentAttachmentAVI";
  i:0;
  s:20:"commentAttachmentMPG";
  i:0;
  s:20:"commentAttachmentOGV";
  i:0;
  s:20:"commentAttachment3GP";
  i:0;
  s:20:"commentAttachment3G2";
  i:0;
  s:20:"commentAttachmentFLV";
  i:0;
  s:21:"commentAttachmentWEBM";
  i:0;
  s:20:"commentAttachmentAPK";
  i:0;
}