703 |
707 |
704 $the_comment_status = wp_get_comment_status( $comment ); |
708 $the_comment_status = wp_get_comment_status( $comment ); |
705 |
709 |
706 $output = ''; |
710 $output = ''; |
707 |
711 |
708 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
712 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'approve-comment_' . $comment->comment_ID ) ); |
709 $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
713 $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'delete-comment_' . $comment->comment_ID ) ); |
710 |
714 |
711 $url = "comment.php?c=$comment->comment_ID"; |
715 $action_string = 'comment.php?action=%s&c=' . $comment->comment_ID . '&%s'; |
712 |
716 |
713 $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" ); |
717 $approve_url = sprintf( $action_string, 'approvecomment', $approve_nonce ); |
714 $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" ); |
718 $unapprove_url = sprintf( $action_string, 'unapprovecomment', $approve_nonce ); |
715 $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" ); |
719 $spam_url = sprintf( $action_string, 'spamcomment', $del_nonce ); |
716 $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" ); |
720 $unspam_url = sprintf( $action_string, 'unspamcomment', $del_nonce ); |
717 $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); |
721 $trash_url = sprintf( $action_string, 'trashcomment', $del_nonce ); |
718 $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); |
722 $untrash_url = sprintf( $action_string, 'untrashcomment', $del_nonce ); |
719 $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); |
723 $delete_url = sprintf( $action_string, 'deletecomment', $del_nonce ); |
720 |
724 |
721 // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash. |
725 // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash. |
722 $actions = array( |
726 $actions = array( |
723 'approve' => '', |
727 'approve' => '', |
724 'unapprove' => '', |
728 'unapprove' => '', |
735 // Not looking at all comments. |
739 // Not looking at all comments. |
736 if ( $comment_status && 'all' !== $comment_status ) { |
740 if ( $comment_status && 'all' !== $comment_status ) { |
737 if ( 'approved' === $the_comment_status ) { |
741 if ( 'approved' === $the_comment_status ) { |
738 $actions['unapprove'] = sprintf( |
742 $actions['unapprove'] = sprintf( |
739 '<a href="%s" data-wp-lists="%s" class="vim-u vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
743 '<a href="%s" data-wp-lists="%s" class="vim-u vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
740 $unapprove_url, |
744 esc_url( $unapprove_url ), |
741 "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=unapproved", |
745 "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=unapproved", |
742 esc_attr__( 'Unapprove this comment' ), |
746 esc_attr__( 'Unapprove this comment' ), |
743 __( 'Unapprove' ) |
747 __( 'Unapprove' ) |
744 ); |
748 ); |
745 } elseif ( 'unapproved' === $the_comment_status ) { |
749 } elseif ( 'unapproved' === $the_comment_status ) { |
746 $actions['approve'] = sprintf( |
750 $actions['approve'] = sprintf( |
747 '<a href="%s" data-wp-lists="%s" class="vim-a vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
751 '<a href="%s" data-wp-lists="%s" class="vim-a vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
748 $approve_url, |
752 esc_url( $approve_url ), |
749 "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=approved", |
753 "delete:the-comment-list:comment-{$comment->comment_ID}:e7e7d3:action=dim-comment&new=approved", |
750 esc_attr__( 'Approve this comment' ), |
754 esc_attr__( 'Approve this comment' ), |
751 __( 'Approve' ) |
755 __( 'Approve' ) |
752 ); |
756 ); |
753 } |
757 } |
754 } else { |
758 } else { |
755 $actions['approve'] = sprintf( |
759 $actions['approve'] = sprintf( |
756 '<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>', |
760 '<a href="%s" data-wp-lists="%s" class="vim-a aria-button-if-js" aria-label="%s">%s</a>', |
757 $approve_url, |
761 esc_url( $approve_url ), |
758 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", |
762 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=approved", |
759 esc_attr__( 'Approve this comment' ), |
763 esc_attr__( 'Approve this comment' ), |
760 __( 'Approve' ) |
764 __( 'Approve' ) |
761 ); |
765 ); |
762 |
766 |
763 $actions['unapprove'] = sprintf( |
767 $actions['unapprove'] = sprintf( |
764 '<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>', |
768 '<a href="%s" data-wp-lists="%s" class="vim-u aria-button-if-js" aria-label="%s">%s</a>', |
765 $unapprove_url, |
769 esc_url( $unapprove_url ), |
766 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", |
770 "dim:the-comment-list:comment-{$comment->comment_ID}:unapproved:e7e7d3:e7e7d3:new=unapproved", |
767 esc_attr__( 'Unapprove this comment' ), |
771 esc_attr__( 'Unapprove this comment' ), |
768 __( 'Unapprove' ) |
772 __( 'Unapprove' ) |
769 ); |
773 ); |
770 } |
774 } |
771 |
775 |
772 if ( 'spam' !== $the_comment_status ) { |
776 if ( 'spam' !== $the_comment_status ) { |
773 $actions['spam'] = sprintf( |
777 $actions['spam'] = sprintf( |
774 '<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
778 '<a href="%s" data-wp-lists="%s" class="vim-s vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
775 $spam_url, |
779 esc_url( $spam_url ), |
776 "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", |
780 "delete:the-comment-list:comment-{$comment->comment_ID}::spam=1", |
777 esc_attr__( 'Mark this comment as spam' ), |
781 esc_attr__( 'Mark this comment as spam' ), |
778 /* translators: "Mark as spam" link. */ |
782 /* translators: "Mark as spam" link. */ |
779 _x( 'Spam', 'verb' ) |
783 _x( 'Spam', 'verb' ) |
780 ); |
784 ); |
781 } elseif ( 'spam' === $the_comment_status ) { |
785 } elseif ( 'spam' === $the_comment_status ) { |
782 $actions['unspam'] = sprintf( |
786 $actions['unspam'] = sprintf( |
783 '<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
787 '<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
784 $unspam_url, |
788 esc_url( $unspam_url ), |
785 "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:unspam=1", |
789 "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:unspam=1", |
786 esc_attr__( 'Restore this comment from the spam' ), |
790 esc_attr__( 'Restore this comment from the spam' ), |
787 _x( 'Not Spam', 'comment' ) |
791 _x( 'Not Spam', 'comment' ) |
788 ); |
792 ); |
789 } |
793 } |
790 |
794 |
791 if ( 'trash' === $the_comment_status ) { |
795 if ( 'trash' === $the_comment_status ) { |
792 $actions['untrash'] = sprintf( |
796 $actions['untrash'] = sprintf( |
793 '<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
797 '<a href="%s" data-wp-lists="%s" class="vim-z vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
794 $untrash_url, |
798 esc_url( $untrash_url ), |
795 "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:untrash=1", |
799 "delete:the-comment-list:comment-{$comment->comment_ID}:66cc66:untrash=1", |
796 esc_attr__( 'Restore this comment from the Trash' ), |
800 esc_attr__( 'Restore this comment from the Trash' ), |
797 __( 'Restore' ) |
801 __( 'Restore' ) |
798 ); |
802 ); |
799 } |
803 } |
800 |
804 |
801 if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS ) { |
805 if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS ) { |
802 $actions['delete'] = sprintf( |
806 $actions['delete'] = sprintf( |
803 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
807 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
804 $delete_url, |
808 esc_url( $delete_url ), |
805 "delete:the-comment-list:comment-{$comment->comment_ID}::delete=1", |
809 "delete:the-comment-list:comment-{$comment->comment_ID}::delete=1", |
806 esc_attr__( 'Delete this comment permanently' ), |
810 esc_attr__( 'Delete this comment permanently' ), |
807 __( 'Delete Permanently' ) |
811 __( 'Delete Permanently' ) |
808 ); |
812 ); |
809 } else { |
813 } else { |
810 $actions['trash'] = sprintf( |
814 $actions['trash'] = sprintf( |
811 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
815 '<a href="%s" data-wp-lists="%s" class="delete vim-d vim-destructive aria-button-if-js" aria-label="%s">%s</a>', |
812 $trash_url, |
816 esc_url( $trash_url ), |
813 "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", |
817 "delete:the-comment-list:comment-{$comment->comment_ID}::trash=1", |
814 esc_attr__( 'Move this comment to the Trash' ), |
818 esc_attr__( 'Move this comment to the Trash' ), |
815 _x( 'Trash', 'verb' ) |
819 _x( 'Trash', 'verb' ) |
816 ); |
820 ); |
817 } |
821 } |