Changeset 2390880
- Timestamp:
- 09/30/2020 11:13:52 AM (6 years ago)
- Location:
- admin-edit-comment/trunk
- Files:
-
- 6 edited
-
admin-edit-comment.php (modified) (6 diffs)
-
admin/admin.php (modified) (2 diffs)
-
assets/js/edit.js (modified) (1 diff)
-
languages/admin-edit-comment-ja.mo (modified) (previous)
-
languages/admin-edit-comment-ja.po (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admin-edit-comment/trunk/admin-edit-comment.php
r2390682 r2390880 139 139 $screen = get_current_screen(); 140 140 $active_post_types = apply_filters( 'aec_activate_post_types', get_option( self::ADMIN_EDIT_COMMENT_OPTIONS, self::DEFAULT_ACTIVE_POST_TYPE ) ); 141 if ( $screen->base !== 'post'|| ! in_array( $screen->post_type, $active_post_types ) ) {141 if ( 'post' !== $screen->base || ! in_array( $screen->post_type, $active_post_types ) ) { 142 142 return; 143 143 } … … 169 169 public function add_meta_box( WP_Post $post ) { 170 170 $post_type = get_post_type( $post->ID ); 171 $has_revisions = post_type_supports( $post_type, 'revisions' );172 171 ?> 173 172 <div id='aec_checkbox_wrap'> … … 177 176 </label> 178 177 <?php 179 if ( $has_revisions) :178 if ( $this->is_revision_supported( $post_type ) ) : 180 179 ?> 181 180 <label> … … 409 408 * @since 2.0 410 409 * 411 * @param $post_ ID410 * @param $post_id 412 411 * @param $post 413 412 * @param $updated 414 413 */ 415 public function revision_transitions( $post_ ID, $post, $updated ) {416 417 if ( $post->post_type == 'revision'&& $post->post_parent ) {418 419 $parent = get_post( $post->post_parent);414 public function revision_transitions( $post_id, $post, $updated ) { 415 416 if ( 'revision' === $post->post_type && $post->post_parent ) { 417 418 $parent = get_post( $post->post_parent ); 420 419 $active_post_types = apply_filters( 'aec_activate_post_types', get_option( self::ADMIN_EDIT_COMMENT_OPTIONS, self::DEFAULT_ACTIVE_POST_TYPE ) ); 421 420 if ( ! in_array( $parent->post_type, $active_post_types ) ) { 422 421 return; 423 422 } 423 if ( ! $this->is_revision_supported( $parent->post_type ) ) { 424 return; 425 } 424 426 425 427 $user = wp_get_current_user(); … … 427 429 $insert_post_id = wp_insert_post( apply_filters( 'aec_insert_post_revision_args', array( 428 430 'post_author' => $user->ID, 429 'post_content' => $post_ ID,431 'post_content' => $post_id, 430 432 'post_excerpt' => self::TYPE_NAME_REVISION, 431 433 'post_status' => 'publish', … … 545 547 $args['posts_per_page'] = apply_filters( 'aec_posts_per_page_for_column', self::POSTS_PER_PAGE_FOR_COLUMN ); 546 548 return $args; 549 } 550 551 /** 552 * Determines whether the posttype is support the revision. 553 * @param post_type $post_type 554 * @return boolean 555 */ 556 public function is_revision_supported( $post_type ) { 557 return post_type_supports( $post_type, 'revisions' ); 547 558 } 548 559 } -
admin-edit-comment/trunk/admin/admin.php
r2103684 r2390880 30 30 ?> 31 31 <span style="font-weight: bold;"><?php esc_html_e( 'Customization: ', 'admin-edit-comment' ); ?></span> 32 <span><?php esc_html_e( 'You can override the setting above by using a filter hook named \'aec_activ e_post_types\'.', 'admin-edit-comment' ); ?></span>32 <span><?php esc_html_e( 'You can override the setting above by using a filter hook named \'aec_activate_post_types\'.', 'admin-edit-comment' ); ?></span> 33 33 <?php 34 34 submit_button(); … … 45 45 $fields = [ 46 46 [ 47 'label' => __( 'Enable for these post types', 'admin-edit-comment' ),47 'label' => __( 'Enable the function for these post types', 'admin-edit-comment' ), 48 48 'id' => Admin_Edit_Comment::ADMIN_EDIT_COMMENT_OPTIONS, 49 49 'type' => 'checkbox', -
admin-edit-comment/trunk/assets/js/edit.js
r2390682 r2390880 132 132 } 133 133 134 wp.data.subscribe(function () { 135 var isSavingPost = wp.data.select('core/editor').isSavingPost(); 136 var isAutosavingPost = wp.data.select('core/editor').isAutosavingPost(); 134 if ( window.wp && wp.data && wp.data.select && wp.data.select( 'core/editor' ) ) { 135 wp.data.subscribe(function () { 136 var isSavingPost = wp.data.select('core/editor').isSavingPost(); 137 var isAutosavingPost = wp.data.select('core/editor').isAutosavingPost(); 137 138 138 if (isSavingPost && !isAutosavingPost) {139 var $text= $('[name="aec_comment_text_area"]'),140 $message = $('#admin_edit_comment div.aec-msg'),141 post_id= $('input[name="post_ID"]').val(),142 $comment = $("#aec_comment_wrap");139 if (isSavingPost && !isAutosavingPost) { 140 var $text = $('[name="aec_comment_text_area"]'), 141 $message = $('#admin_edit_comment div.aec-msg'), 142 post_id = $('input[name="post_ID"]').val(), 143 $comment = $("#aec_comment_wrap"); 143 144 144 $message.remove(); 145 146 $.ajax({ 147 type: 'POST', 148 url: ajax_url, 149 data: { 150 action: 'aec_refresh_comment', 151 post_id: post_id 152 }, 153 dataType: 'json' 154 }).done(function (res) { 155 if (res.success) { 156 $comment.empty(); 157 $comment.append(res.data.comments); 158 $text.val(''); 159 } else { 160 notice(res.data.message, 'error'); 161 } 162 }).fail(function () { 163 notice(localize.update_failed_msg, 'error'); 164 }); 165 } 166 }) 145 $message.remove(); 146 147 $.ajax({ 148 type: 'POST', 149 url: ajax_url, 150 data: { 151 action: 'aec_refresh_comment', 152 post_id: post_id 153 }, 154 dataType: 'json' 155 }).done(function (res) { 156 if (res.success) { 157 $comment.empty(); 158 $comment.append(res.data.comments); 159 $text.val(''); 160 } else { 161 notice(res.data.message, 'error'); 162 } 163 }).fail(function () { 164 notice(localize.update_failed_msg, 'error'); 165 }); 166 } 167 }); 168 } 167 169 }); -
admin-edit-comment/trunk/languages/admin-edit-comment-ja.po
r2390682 r2390880 3 3 msgid "" 4 4 msgstr "" 5 "PO-Revision-Date: 2020-09- 29 19:36+0900\n"5 "PO-Revision-Date: 2020-09-30 20:04+0900\n" 6 6 "MIME-Version: 1.0\n" 7 7 "Content-Type: text/plain; charset=UTF-8\n" … … 33 33 msgid "Admin Edit Comment" 34 34 msgstr "" 35 36 #. admin-edit-comment.php:35 37 msgid "Recent Edit Comments" 38 msgstr "直近の編集コメント" 35 39 36 40 #. admin-edit-comment.php:146 … … 101 105 msgid "Failed to delete comment." 102 106 msgstr "コメントの削除に失敗しました。" 107 108 #. admin-edit-comment.php:352 109 msgid "Enable the function for these post types" 110 msgstr "機能を有効にする投稿タイプ" 111 112 #. admin/admin.php:31 113 msgid "Customization: " 114 msgstr "カスタマイズ: " 115 116 #. admin/admin.php:32 117 msgid "You can override the setting above by using a filter hook named 'aec_activate_post_types'." 118 msgstr "'aec_activate_post_types'というフィルターフック'を使って上記の設定を上書きすることができます。" -
admin-edit-comment/trunk/readme.txt
r2390682 r2390880 5 5 Tested up to: 5.5.1 6 6 Requires PHP: 5.4.0 7 Stable tag: 2.0. 07 Stable tag: 2.0.1 8 8 License: GNU GPL v2 or higher 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 18 18 19 19 == Changelog == 20 = 2.0.1 = 21 A minor bug fix. 22 20 23 = 2.0.0 = 21 24 Add revision & changed status in comment timeline with filtering function.
Note: See TracChangeset
for help on using the changeset viewer.