Plugin Directory

Changeset 2390880


Ignore:
Timestamp:
09/30/2020 11:13:52 AM (6 years ago)
Author:
pressmaninc
Message:

Update to ver 2.0.1

Location:
admin-edit-comment/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • admin-edit-comment/trunk/admin-edit-comment.php

    r2390682 r2390880  
    139139        $screen            = get_current_screen();
    140140        $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 ) ) {
    142142            return;
    143143        }
     
    169169    public function add_meta_box( WP_Post $post ) {
    170170        $post_type = get_post_type( $post->ID );
    171         $has_revisions = post_type_supports( $post_type, 'revisions' );
    172171        ?>
    173172        <div id='aec_checkbox_wrap'>
     
    177176            </label>
    178177        <?php
    179             if ($has_revisions) :
     178            if ( $this->is_revision_supported( $post_type ) ) :
    180179        ?>
    181180            <label>
     
    409408     * @since 2.0
    410409     *
    411      * @param $post_ID
     410     * @param $post_id
    412411     * @param $post
    413412     * @param $updated
    414413     */
    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 );
    420419            $active_post_types = apply_filters( 'aec_activate_post_types', get_option( self::ADMIN_EDIT_COMMENT_OPTIONS, self::DEFAULT_ACTIVE_POST_TYPE ) );
    421420            if ( ! in_array( $parent->post_type, $active_post_types ) ) {
    422421                return;
    423422            }
     423            if ( ! $this->is_revision_supported( $parent->post_type ) ) {
     424                return;
     425            }
    424426
    425427            $user = wp_get_current_user();
     
    427429            $insert_post_id = wp_insert_post( apply_filters( 'aec_insert_post_revision_args', array(
    428430                'post_author'  => $user->ID,
    429                 'post_content' => $post_ID,
     431                'post_content' => $post_id,
    430432                'post_excerpt' => self::TYPE_NAME_REVISION,
    431433                'post_status'  => 'publish',
     
    545547        $args['posts_per_page'] = apply_filters( 'aec_posts_per_page_for_column', self::POSTS_PER_PAGE_FOR_COLUMN );
    546548        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' );
    547558    }
    548559}
  • admin-edit-comment/trunk/admin/admin.php

    r2103684 r2390880  
    3030                ?>
    3131                <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_active_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>
    3333                <?php
    3434                submit_button();
     
    4545        $fields = [
    4646            [
    47                 'label'   => __( 'Enable for these post types', 'admin-edit-comment' ),
     47                'label'   => __( 'Enable the function for these post types', 'admin-edit-comment' ),
    4848                'id'      => Admin_Edit_Comment::ADMIN_EDIT_COMMENT_OPTIONS,
    4949                'type'    => 'checkbox',
  • admin-edit-comment/trunk/assets/js/edit.js

    r2390682 r2390880  
    132132    }
    133133
    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();
    137138
    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");
    143144
    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    }
    167169});
  • admin-edit-comment/trunk/languages/admin-edit-comment-ja.po

    r2390682 r2390880  
    33msgid ""
    44msgstr ""
    5 "PO-Revision-Date: 2020-09-29 19:36+0900\n"
     5"PO-Revision-Date: 2020-09-30 20:04+0900\n"
    66"MIME-Version: 1.0\n"
    77"Content-Type: text/plain; charset=UTF-8\n"
     
    3333msgid "Admin Edit Comment"
    3434msgstr ""
     35
     36#. admin-edit-comment.php:35
     37msgid "Recent Edit Comments"
     38msgstr "直近の編集コメント"
    3539
    3640#. admin-edit-comment.php:146
     
    101105msgid "Failed to delete comment."
    102106msgstr "コメントの削除に失敗しました。"
     107
     108#. admin-edit-comment.php:352
     109msgid "Enable the function for these post types"
     110msgstr "機能を有効にする投稿タイプ"
     111
     112#. admin/admin.php:31
     113msgid "Customization: "
     114msgstr "カスタマイズ: "
     115
     116#. admin/admin.php:32
     117msgid "You can override the setting above by using a filter hook named 'aec_activate_post_types'."
     118msgstr "'aec_activate_post_types'というフィルターフック'を使って上記の設定を上書きすることができます。"
  • admin-edit-comment/trunk/readme.txt

    r2390682 r2390880  
    55Tested up to: 5.5.1
    66Requires PHP: 5.4.0
    7 Stable tag: 2.0.0
     7Stable tag: 2.0.1
    88License: GNU GPL v2 or higher
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1818
    1919== Changelog ==
     20= 2.0.1 =
     21A minor bug fix.
     22
    2023= 2.0.0 =
    2124Add revision & changed status in comment timeline with filtering function.
Note: See TracChangeset for help on using the changeset viewer.