~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-admin/includes/class-wp-media-list-table.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:49:28 UTC
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: barry.price@canonical.com-20160817044928-viijiwb4tl8jwzmp
new upstream release 4.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
282
282
                $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
283
283
 
284
284
                /**
285
 
                 * Filter the taxonomy columns for attachments in the Media list table.
 
285
                 * Filters the taxonomy columns for attachments in the Media list table.
286
286
                 *
287
287
                 * @since 3.5.0
288
288
                 *
312
312
                /* translators: column name */
313
313
                $posts_columns['date'] = _x( 'Date', 'column name' );
314
314
                /**
315
 
                 * Filter the Media list table columns.
 
315
                 * Filters the Media list table columns.
316
316
                 *
317
317
                 * @since 2.5.0
318
318
                 *
476
476
                if ( $parent ) {
477
477
                        $title = _draft_or_post_title( $post->post_parent );
478
478
                        $parent_type = get_post_type_object( $parent->post_type );
479
 
?>
480
 
                        <strong>
481
 
                        <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
482
 
                                <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
483
 
                                        <?php echo $title ?></a><?php
 
479
 
 
480
                        if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
 
481
?>
 
482
                                <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
 
483
                                        <?php echo $title ?></a></strong><?php
 
484
                        } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) {
 
485
?>
 
486
                                <strong><?php echo $title ?></strong><?php
484
487
                        } else {
485
 
                                echo $title;
486
 
                        } ?></strong>
487
 
                        <br />
488
 
                        <?php
 
488
                                _e( '(Private post)' );
 
489
                        }
 
490
 
489
491
                        if ( $user_can_edit ):
490
492
                                $detach_url = add_query_arg( array(
491
493
                                        'parent_post_id' => $post->post_parent,
493
495
                                        '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
494
496
                                ), 'upload.php' );
495
497
                                printf(
496
 
                                        '<a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>',
 
498
                                        '<br /><a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>',
497
499
                                        $detach_url,
498
500
                                        /* translators: %s: title of the post the attachment is attached to */
499
501
                                        esc_attr( sprintf( __( 'Detach from &#8220;%s&#8221;' ), $title ) ),
501
503
                                );
502
504
                        endif;
503
505
                } else {
504
 
                        _e( '(Unattached)' ); ?><br />
 
506
                        _e( '(Unattached)' ); ?>
505
507
                        <?php if ( $user_can_edit ) {
506
508
                                $title = _draft_or_post_title( $post->post_parent );
507
509
                                printf(
508
 
                                        '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>',
 
510
                                        '<br /><a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>',
509
511
                                        $post->ID,
510
512
                                        /* translators: %s: attachment title */
511
513
                                        esc_attr( sprintf( __( 'Attach &#8220;%s&#8221; to existing content' ), $title ) ),
657
659
                        if ( current_user_can( 'delete_post', $post->ID ) ) {
658
660
                                if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
659
661
                                        $actions['trash'] = sprintf(
660
 
                                                '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
 
662
                                                '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
661
663
                                                wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ),
662
664
                                                /* translators: %s: attachment title */
663
665
                                                esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $att_title ) ),
666
668
                                } else {
667
669
                                        $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
668
670
                                        $actions['delete'] = sprintf(
669
 
                                                '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>',
 
671
                                                '<a href="%s" class="submitdelete aria-button-if-js"%s aria-label="%s">%s</a>',
670
672
                                                wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ),
671
673
                                                $delete_ays,
672
674
                                                /* translators: %s: attachment title */
685
687
 
686
688
                        if ( current_user_can( 'edit_post', $post->ID ) ) {
687
689
                                $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>',
 
690
                                        '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js aria-button-if-js" aria-label="%s">%s</a>',
689
691
                                        $post->ID,
690
692
                                        /* translators: %s: attachment title */
691
693
                                        esc_attr( sprintf( __( 'Attach &#8220;%s&#8221; to existing content' ), $att_title ) ),
706
708
                        if ( current_user_can( 'delete_post', $post->ID ) ) {
707
709
                                if ( $this->is_trash ) {
708
710
                                        $actions['untrash'] = sprintf(
709
 
                                                '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
 
711
                                                '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
710
712
                                                wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ),
711
713
                                                /* translators: %s: attachment title */
712
714
                                                esc_attr( sprintf( __( 'Restore &#8220;%s&#8221; from the Trash' ), $att_title ) ),
714
716
                                        );
715
717
                                } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
716
718
                                        $actions['trash'] = sprintf(
717
 
                                                '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
 
719
                                                '<a href="%s" class="submitdelete aria-button-if-js" aria-label="%s">%s</a>',
718
720
                                                wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ),
719
721
                                                /* translators: %s: attachment title */
720
722
                                                esc_attr( sprintf( __( 'Move &#8220;%s&#8221; to the Trash' ), $att_title ) ),
724
726
                                if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) {
725
727
                                        $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
726
728
                                        $actions['delete'] = sprintf(
727
 
                                                '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>',
 
729
                                                '<a href="%s" class="submitdelete aria-button-if-js"%s aria-label="%s">%s</a>',
728
730
                                                wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ),
729
731
                                                $delete_ays,
730
732
                                                /* translators: %s: attachment title */
745
747
                }
746
748
 
747
749
                /**
748
 
                 * Filter the action links for each attachment in the Media list table.
 
750
                 * Filters the action links for each attachment in the Media list table.
749
751
                 *
750
752
                 * @since 2.8.0
751
753
                 *