Changeset 36331
- Timestamp:
- 01/17/2016 02:45:26 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-media-list-table.php
r35901 r36331 371 371 372 372 if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { 373 $link_start = '<a href="' . get_edit_post_link( $post->ID ) . '">'; 373 $link_start = sprintf( 374 '<a href="%s" aria-label="%s">', 375 get_edit_post_link( $post->ID ), 376 /* translators: %s: attachment title */ 377 esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ) 378 ); 374 379 $link_end = '</a>'; 375 380 } 376 381 377 382 $class = $thumb ? ' class="has-media-icon"' : ''; 378 379 383 ?> 380 384 <strong<?php echo $class; ?>> 381 <?php echo $link_start; ?> 382 <?php if ( $thumb ) : ?> 385 <?php 386 echo $link_start; 387 if ( $thumb ) : ?> 383 388 <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span> 384 <?php endif; ?> 385 386 <span aria-hidden="true"><?php echo $title; ?></span> 387 <span class="screen-reader-text"><?php printf( __( 'Edit “%s”' ), $title ); ?></span> 388 <?php echo $link_end; ?> 389 <?php _media_states( $post ); ?> 389 <?php endif; 390 echo $title . $link_end; 391 _media_states( $post ); 392 ?> 390 393 </strong> 391 394 <p class="filename"> … … 489 492 'media[]' => $post->ID, 490 493 '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ) 491 ), 'upload.php' ); ?> 492 <a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a> 493 <?php endif; 494 ), 'upload.php' ); 495 printf( 496 '<a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>', 497 $detach_url, 498 /* translators: %s: title of the post the attachment is attached to */ 499 esc_attr( sprintf( __( 'Detach from “%s”' ), $title ) ), 500 __( 'Detach' ) 501 ); 502 endif; 494 503 } else { 495 504 _e( '(Unattached)' ); ?><br /> 496 <?php if ( $user_can_edit ) { ?> 497 <a class="hide-if-no-js" 498 onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;" 499 href="#the-list"> 500 <?php _e( 'Attach' ); ?></a> 501 <?php } 505 <?php if ( $user_can_edit ) { 506 $title = _draft_or_post_title( $post->post_parent ); 507 printf( 508 '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>', 509 $post->ID, 510 /* translators: %s: attachment title */ 511 esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $title ) ), 512 __( 'Attach' ) 513 ); 514 } 502 515 } 503 516 } … … 633 646 634 647 if ( $this->detached ) { 635 if ( current_user_can( 'edit_post', $post->ID ) ) 636 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>'; 637 if ( current_user_can( 'delete_post', $post->ID ) ) 648 if ( current_user_can( 'edit_post', $post->ID ) ) { 649 $actions['edit'] = sprintf( 650 '<a href="%s" aria-label="%s">%s</a>', 651 get_edit_post_link( $post->ID ), 652 /* translators: %s: attachment title */ 653 esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), 654 __( 'Edit' ) 655 ); 656 } 657 if ( current_user_can( 'delete_post', $post->ID ) ) { 638 658 if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { 639 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>"; 659 $actions['trash'] = sprintf( 660 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', 661 wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), 662 /* translators: %s: attachment title */ 663 esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), 664 _x( 'Trash', 'verb' ) 665 ); 640 666 } else { 641 $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; 642 $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 667 $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; 668 $actions['delete'] = sprintf( 669 '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>', 670 wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), 671 $delete_ays, 672 /* translators: %s: attachment title */ 673 esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), 674 __( 'Delete Permanently' ) 675 ); 643 676 } 644 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 645 if ( current_user_can( 'edit_post', $post->ID ) ) 646 $actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>'; 677 } 678 $actions['view'] = sprintf( 679 '<a href="%s" aria-label="%s" rel="permalink">%s</a>', 680 get_permalink( $post->ID ), 681 /* translators: %s: attachment title */ 682 esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), 683 __( 'View' ) 684 ); 685 686 if ( current_user_can( 'edit_post', $post->ID ) ) { 687 $actions['attach'] = sprintf( 688 '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>', 689 $post->ID, 690 /* translators: %s: attachment title */ 691 esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $att_title ) ), 692 __( 'Attach' ) 693 ); 694 } 647 695 } 648 696 else { 649 if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) 650 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>'; 697 if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) { 698 $actions['edit'] = sprintf( 699 '<a href="%s" aria-label="%s">%s</a>', 700 get_edit_post_link( $post->ID ), 701 /* translators: %s: attachment title */ 702 esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), 703 __( 'Edit' ) 704 ); 705 } 651 706 if ( current_user_can( 'delete_post', $post->ID ) ) { 652 if ( $this->is_trash ) 653 $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 654 elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) 655 $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>"; 656 if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { 707 if ( $this->is_trash ) { 708 $actions['untrash'] = sprintf( 709 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', 710 wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ), 711 /* translators: %s: attachment title */ 712 esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $att_title ) ), 713 __( 'Restore' ) 714 ); 715 } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { 716 $actions['trash'] = sprintf( 717 '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', 718 wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), 719 /* translators: %s: attachment title */ 720 esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), 721 _x( 'Trash', 'verb' ) 722 ); 723 } 724 if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) { 657 725 $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; 658 $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 726 $actions['delete'] = sprintf( 727 '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>', 728 wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), 729 $delete_ays, 730 /* translators: %s: attachment title */ 731 esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), 732 __( 'Delete Permanently' ) 733 ); 659 734 } 660 735 } 661 if ( !$this->is_trash ) { 662 $title =_draft_or_post_title( $post->post_parent ); 663 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 736 if ( ! $this->is_trash ) { 737 $actions['view'] = sprintf( 738 '<a href="%s" aria-label="%s" rel="permalink">%s</a>', 739 get_permalink( $post->ID ), 740 /* translators: %s: attachment title */ 741 esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), 742 __( 'View' ) 743 ); 664 744 } 665 745 }
Note: See TracChangeset
for help on using the changeset viewer.