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 | } |
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 ) ) { |
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 | ); |
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 | ); |
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 | } |
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 | } |
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 ) { |
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 | ); |
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 | ); |