wp/wp-admin/edit-comments.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    29 		$delete_time    = wp_unslash( $_REQUEST['pagegen_timestamp'] );
    29 		$delete_time    = wp_unslash( $_REQUEST['pagegen_timestamp'] );
    30 		$comment_ids    = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) );
    30 		$comment_ids    = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) );
    31 		$doaction       = 'delete';
    31 		$doaction       = 'delete';
    32 	} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
    32 	} elseif ( isset( $_REQUEST['delete_comments'] ) ) {
    33 		$comment_ids = $_REQUEST['delete_comments'];
    33 		$comment_ids = $_REQUEST['delete_comments'];
    34 		$doaction    = ( '-1' !== $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
    34 		$doaction    = $_REQUEST['action'];
    35 	} elseif ( isset( $_REQUEST['ids'] ) ) {
    35 	} elseif ( isset( $_REQUEST['ids'] ) ) {
    36 		$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
    36 		$comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) );
    37 	} elseif ( wp_get_referer() ) {
    37 	} elseif ( wp_get_referer() ) {
    38 		wp_safe_redirect( wp_get_referer() );
    38 		wp_safe_redirect( wp_get_referer() );
    39 		exit;
    39 		exit;
   118 	}
   118 	}
   119 	if ( $deleted ) {
   119 	if ( $deleted ) {
   120 		$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
   120 		$redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
   121 	}
   121 	}
   122 	if ( $trashed || $spammed ) {
   122 	if ( $trashed || $spammed ) {
   123 		$redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
   123 		$redirect_to = add_query_arg( 'ids', implode( ',', $comment_ids ), $redirect_to );
   124 	}
   124 	}
   125 
   125 
   126 	wp_safe_redirect( $redirect_to );
   126 	wp_safe_redirect( $redirect_to );
   127 	exit;
   127 	exit;
   128 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
   128 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
   226 }
   226 }
   227 ?>
   227 ?>
   228 </h1>
   228 </h1>
   229 
   229 
   230 <?php
   230 <?php
       
   231 if ( $post_id ) {
       
   232 	$post_type_object = get_post_type_object( get_post_type( $post_id ) );
       
   233 
       
   234 	if ( $post_type_object ) {
       
   235 		printf(
       
   236 			'<a href="%1$s" class="comments-view-item-link">%2$s</a>',
       
   237 			get_permalink( $post_id ),
       
   238 			$post_type_object->labels->view_item
       
   239 		);
       
   240 	}
       
   241 }
       
   242 
   231 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
   243 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
   232 	echo '<span class="subtitle">';
   244 	echo '<span class="subtitle">';
   233 	printf(
   245 	printf(
   234 		/* translators: %s: Search query. */
   246 		/* translators: %s: Search query. */
   235 		__( 'Search results for &#8220;%s&#8221;' ),
   247 		__( 'Search results for: %s' ),
   236 		wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' )
   248 		'<strong>' . wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '&hellip;' ) . '</strong>'
   237 	);
   249 	);
   238 	echo '</span>';
   250 	echo '</span>';
   239 }
   251 }
   240 ?>
   252 ?>
   241 
   253 
   327 <form id="comments-form" method="get">
   339 <form id="comments-form" method="get">
   328 
   340 
   329 <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
   341 <?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?>
   330 
   342 
   331 <?php if ( $post_id ) : ?>
   343 <?php if ( $post_id ) : ?>
   332 <input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
   344 <input type="hidden" name="p" value="<?php echo esc_attr( (int) $post_id ); ?>" />
   333 <?php endif; ?>
   345 <?php endif; ?>
   334 <input type="hidden" name="comment_status" value="<?php echo esc_attr( $comment_status ); ?>" />
   346 <input type="hidden" name="comment_status" value="<?php echo esc_attr( $comment_status ); ?>" />
   335 <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr( current_time( 'mysql', 1 ) ); ?>" />
   347 <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr( current_time( 'mysql', 1 ) ); ?>" />
   336 
   348 
   337 <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'total_items' ) ); ?>" />
   349 <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg( 'total_items' ) ); ?>" />