__( 'All', 'videopress-hq' ), 'mine' => __( 'Mine', 'videopress-hq' ), 'hold' => __( 'Pending', 'videopress-hq' ), 'approve' => __( 'Approved', 'videopress-hq' ), 'spam' => __( 'Spam', 'videopress-hq' ), 'trash' => __( 'Trash', 'videopress-hq' ), ); $available_comment_actions = array( 'approve' => __( 'Approve', 'videopress-hq' ), 'unapprove' => __( 'Unapprove', 'videopress-hq' ), 'reply' => __( 'Reply', 'videopress-hq' ), 'edit' => __( 'Edit', 'videopress-hq' ), 'spam' => __( 'Spam', 'videopress-hq' ), 'unspam' => __( 'Not Spam', 'videopress-hq' ), 'trash' => __( 'Trash', 'videopress-hq' ), 'untrash' => __( 'Restore', 'videopress-hq' ), 'delete' => __( 'Delete Permanently', 'videopress-hq' ), ); $current_status_filter = 'all'; $req_filter = filter_input( INPUT_GET, 'filter' ); if ( $req_filter && isset( $available_type_filter[ $req_filter ] ) ) { $current_status_filter = $req_filter; } $post = null; $req_post_id = filter_input( INPUT_GET, 'post_id', FILTER_VALIDATE_INT ); if ( $req_post_id && is_numeric( $req_post_id ) && $req_post_id > 0 ) { $post = get_post( (int) $req_post_id ); if ( $post && 'vp_video' !== $post->post_type ) { $post = null; } } $page = filter_input( INPUT_GET, 'paged', FILTER_VALIDATE_INT ); if ( ! is_numeric( $page ) || $page <= 0 ) { $page = 1; } // Helper function as lambda so we can use local vars (not in global context). $vphq_get_self_link = function ( $args = array() ) use ( $current_status_filter, $post ) { $default_args = array( 'filter' => $current_status_filter, ); if ( $post ) { $default_args['post_id'] = $post->ID; } $args = wp_parse_args( $args, $default_args ); return add_query_arg( $args, vphq_admin_page_link( 'comments' ) ); }; $query = new WP_Comment_Query( array( 'include_unapproved' => in_array( $current_status_filter, array( 'all', 'mine', 'hold' ) ), 'number' => 10, 'paged' => $page, 'orderby' => 'comment_date', 'order' => 'DESC', 'post_type' => 'vp_video', 'type' => 'comment', 'post_id' => $post ? $post->ID : 0, 'status' => $current_status_filter, 'no_found_rows' => false, ) ); $comments_count = $query->found_comments; $title = sprintf( /* translators: %s: Comments count. */ __( 'Comments (%s)', 'videopress-hq' ), number_format_i18n( $comments_count ) ); if ( $post ) { $post_title = get_the_title( $post ); if ( empty( $post_title ) ) { $post_title = __( '(no title)', 'videopress-hq' ); } $post_title = wp_html_excerpt( $post_title, 50, '…' ); $title = sprintf( /* translators: 1: Comments count, 2: Post title. */ __( 'Comments (%1$s) on “%2$s”', 'videopress-hq' ), number_format_i18n( $comments_count ), $post_title ); } ?>

ID ) ); if ( $post_type_object ) { printf( '%2$s', get_permalink( $post->ID ), $post_type_object->labels->view_item ); } } ?>
$label ) : $classname = 'comments-filter-' . $filter; if ( $current_status_filter === $filter ) { $classname .= ' current'; } $link = $vphq_get_self_link( array( 'filter' => $filter ) ); ?>
comments ) ) : ?>

comments as $comment ) : $comment_status = wp_get_comment_status( $comment->comment_ID ); $comment_classname = 'status-' . $comment_status; $comment_actions = array(); switch ( $comment_status ) { case 'approved': $comment_actions = array( 'unapprove', 'edit', 'spam', 'trash' ); break; case 'unapproved': $comment_actions = array( 'approve', 'edit', 'spam', 'trash' ); break; case 'spam': $comment_actions = array( 'unspam', 'delete' ); break; case 'trash': $comment_actions = array( 'spam', 'untrash', 'delete' ); break; } ?>
comment_author ); ?> comment_author_url ) ) : ?> comment_author_url ); ?> comment_author_email ) ) : ?> comment_author_email ); ?> comment_author_IP ) ) : ?> comment_author_IP ); ?>
comment_content ); ?> comment_ID ), 'videopress_hq_update_comment_status-' . $comment->comment_ID ); if ( 'edit' === $comment_action ) { $link = admin_url( 'comment.php?action=editcomment&c=' . $comment->comment_ID ); } ?>
comment_post_ID ) ); ?> comment_date_gmt ); ?>