Ticket #19730: 19730.patch
| File 19730.patch, 4.2 KB (added by , 14 years ago) |
|---|
-
wp-admin/includes/class-wp-media-list-table.php
354 354 function _get_row_actions( $post, $att_title ) { 355 355 $actions = array(); 356 356 357 $referer = urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ); 358 357 359 if ( $this->detached ) { 358 360 if ( current_user_can( 'edit_post', $post->ID ) ) 359 361 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; 360 362 if ( current_user_can( 'delete_post', $post->ID ) ) 361 363 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { 362 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 364 $nonce_url = wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID ); 365 $submit_url = esc_url( admin_url( add_query_arg( '_wp_http_referer', $referer, $nonce_url ) ) ); 366 $actions['trash'] = "<a class='submitdelete' href='$submit_url'>" . __( 'Trash' ) . "</a>"; 363 367 } else { 364 368 $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; 365 $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-attachment_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 369 $nonce_url = wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-attachment_' . $post->ID ); 370 $submit_url = esc_url( admin_url( add_query_arg( '_wp_http_referer', $referer, $nonce_url ) ) ); 371 $actions['delete'] = "<a class='submitdelete'$delete_ays href='$submit_url'>" . __( 'Delete Permanently' ) . "</a>"; 366 372 } 367 373 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 368 374 if ( current_user_can( 'edit_post', $post->ID ) ) … … 372 378 if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) 373 379 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>'; 374 380 if ( current_user_can( 'delete_post', $post->ID ) ) { 375 if ( $this->is_trash ) 376 $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-attachment_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 377 elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) 378 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 381 if ( $this->is_trash ) { 382 $nonce_url = wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-attachment_' . $post->ID ); 383 $submit_url = esc_url( admin_url( add_query_arg( '_wp_http_referer', $referer, $nonce_url ) ) ); 384 $actions['untrash'] = "<a class='submitdelete' href='$submit_url'>" . __( 'Restore' ) . "</a>"; 385 } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { 386 $nonce_url = wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-attachment_' . $post->ID ); 387 $submit_url = esc_url( admin_url( add_query_arg( '_wp_http_referer', $referer, $nonce_url ) ) ); 388 $actions['trash'] = "<a class='submitdelete' href='$submit_url'>" . __( 'Trash' ) . "</a>"; 389 } 379 390 if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { 380 391 $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; 381 $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-attachment_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 392 $nonce_url = wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-attachment_' . $post->ID ); 393 $submit_url = esc_url( admin_url( add_query_arg( '_wp_http_referer', $referer, $nonce_url ) ) ); 394 $actions['delete'] = "<a class='submitdelete'$delete_ays href='$submit_url'>" . __( 'Delete Permanently' ) . "</a>"; 382 395 } 383 396 } 384 397 if ( !$this->is_trash ) {