~canonical-sysadmins/wordpress/4.8.3

« back to all changes in this revision

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

  • Committer: Ryan Finnie
  • Date: 2015-08-31 16:09:47 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: ryan.finnie@canonical.com-20150831160947-1h6rfxby9z1ec62u
Merge WP4.3 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
                ) );
38
38
        }
39
39
 
 
40
        /**
 
41
         *
 
42
         * @return bool
 
43
         */
40
44
        public function ajax_user_can() {
41
45
                return current_user_can('upload_files');
42
46
        }
43
47
 
 
48
        /**
 
49
         *
 
50
         * @global WP_Query $wp_query
 
51
         * @global array    $post_mime_types
 
52
         * @global array    $avail_post_mime_types
 
53
         * @global string   $mode
 
54
         */
44
55
        public function prepare_items() {
45
56
                global $wp_query, $post_mime_types, $avail_post_mime_types, $mode;
46
57
 
57
68
                ) );
58
69
        }
59
70
 
 
71
        /**
 
72
         *
 
73
         * @global wpdb  $wpdb
 
74
         * @global array $post_mime_types
 
75
         * @global array $avail_post_mime_types
 
76
         * @return array
 
77
         */
60
78
        protected function get_views() {
61
79
                global $wpdb, $post_mime_types, $avail_post_mime_types;
62
80
 
65
83
                $_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
66
84
                $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
67
85
                $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
68
 
                foreach ( $matches as $type => $reals )
69
 
                        foreach ( $reals as $real )
 
86
                $num_posts = array();
 
87
                foreach ( $matches as $type => $reals ) {
 
88
                        foreach ( $reals as $real ) {
70
89
                                $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
71
 
 
 
90
                        }
 
91
                }
72
92
                $selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : '';
73
93
                $type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>';
74
94
                foreach ( $post_mime_types as $mime_type => $label ) {
89
109
                return $type_links;
90
110
        }
91
111
 
 
112
        /**
 
113
         *
 
114
         * @return array
 
115
         */
92
116
        protected function get_bulk_actions() {
93
117
                $actions = array();
94
118
                if ( MEDIA_TRASH ) {
135
159
<?php
136
160
        }
137
161
 
 
162
        /**
 
163
         *
 
164
         * @return string
 
165
         */
138
166
        public function current_action() {
139
167
                if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) )
140
168
                        return 'attach';
148
176
                return parent::current_action();
149
177
        }
150
178
 
 
179
        /**
 
180
         *
 
181
         * @return bool
 
182
         */
151
183
        public function has_items() {
152
184
                return have_posts();
153
185
        }
154
186
 
 
187
        /**
 
188
         * @access public
 
189
         */
155
190
        public function no_items() {
156
191
                _e( 'No media attachments found.' );
157
192
        }
158
193
 
159
194
        /**
160
195
         * Override parent views so we can use the filter bar display.
 
196
         *
 
197
         * @global string $mode
161
198
         */
162
199
        public function views() {
163
200
                global $mode;
203
240
        <?php
204
241
        }
205
242
 
 
243
        /**
 
244
         *
 
245
         * @return array
 
246
         */
206
247
        public function get_columns() {
207
248
                $posts_columns = array();
208
249
                $posts_columns['cb'] = '<input type="checkbox" />';
209
 
                $posts_columns['icon'] = '';
210
250
                /* translators: column name */
211
251
                $posts_columns['title'] = _x( 'File', 'column name' );
212
252
                $posts_columns['author'] = __( 'Author' );
240
280
                if ( !$this->detached ) {
241
281
                        $posts_columns['parent'] = _x( 'Uploaded to', 'column name' );
242
282
                        if ( post_type_supports( 'attachment', 'comments' ) )
243
 
                                $posts_columns['comments'] = '<span class="vers"><span title="' . esc_attr__( 'Comments' ) . '" class="comment-grey-bubble"></span></span>';
 
283
                                $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
244
284
                }
245
285
                /* translators: column name */
246
286
                $posts_columns['date'] = _x( 'Date', 'column name' );
253
293
                 * @param bool  $detached      Whether the list table contains media not attached
254
294
                 *                             to any posts. Default true.
255
295
                 */
256
 
                $posts_columns = apply_filters( 'manage_media_columns', $posts_columns, $this->detached );
257
 
 
258
 
                return $posts_columns;
 
296
                return apply_filters( 'manage_media_columns', $posts_columns, $this->detached );
259
297
        }
260
298
 
 
299
        /**
 
300
         *
 
301
         * @return array
 
302
         */
261
303
        protected function get_sortable_columns() {
262
304
                return array(
263
305
                        'title'    => 'title',
268
310
                );
269
311
        }
270
312
 
271
 
        public function display_rows() {
272
 
                global $post;
273
 
 
274
 
                add_filter( 'the_title','esc_html' );
275
 
 
276
 
                while ( have_posts() ) : the_post();
277
 
                        $user_can_edit = current_user_can( 'edit_post', $post->ID );
278
 
 
279
 
                        if ( $this->is_trash && $post->post_status != 'trash'
280
 
                        ||  !$this->is_trash && $post->post_status == 'trash' )
281
 
                                continue;
282
 
 
283
 
                        $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';
284
 
                        $att_title = _draft_or_post_title();
285
 
?>
286
 
        <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
287
 
<?php
288
 
 
289
 
list( $columns, $hidden ) = $this->get_column_info();
290
 
foreach ( $columns as $column_name => $column_display_name ) {
291
 
        $class = "class='$column_name column-$column_name'";
292
 
 
293
 
        $style = '';
294
 
        if ( in_array( $column_name, $hidden ) )
295
 
                $style = ' style="display:none;"';
296
 
 
297
 
        $attributes = $class . $style;
298
 
 
299
 
        switch ( $column_name ) {
300
 
 
301
 
        case 'cb':
302
 
?>
303
 
                <th scope="row" class="check-column">
304
 
                        <?php if ( $user_can_edit ) { ?>
305
 
                                <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php echo sprintf( __( 'Select %s' ), $att_title );?></label>
306
 
                                <input type="checkbox" name="media[]" id="cb-select-<?php the_ID(); ?>" value="<?php the_ID(); ?>" />
307
 
                        <?php } ?>
308
 
                </th>
309
 
<?php
310
 
                break;
311
 
 
312
 
        case 'icon':
 
313
        /**
 
314
         * Handles the checkbox column output.
 
315
         *
 
316
         * @since 4.3.0
 
317
         * @access public
 
318
         *
 
319
         * @param WP_Post $post The current WP_Post object.
 
320
         */
 
321
        public function column_cb( $post ) {
 
322
                if ( current_user_can( 'edit_post', $post->ID ) ) { ?>
 
323
                        <label class="screen-reader-text" for="cb-select-<?php echo $post->ID; ?>"><?php
 
324
                                echo sprintf( __( 'Select %s' ), _draft_or_post_title() );
 
325
                        ?></label>
 
326
                        <input type="checkbox" name="media[]" id="cb-select-<?php echo $post->ID; ?>" value="<?php echo $post->ID; ?>" />
 
327
                <?php }
 
328
        }
 
329
 
 
330
        /**
 
331
         * Handles the title column output.
 
332
         *
 
333
         * @since 4.3.0
 
334
         * @access public
 
335
         *
 
336
         * @param WP_Post $post The current WP_Post object.
 
337
         */
 
338
        public function column_title( $post ) {
313
339
                list( $mime ) = explode( '/', $post->post_mime_type );
314
 
                $attributes = 'class="column-icon media-icon ' . $mime . '-icon"' . $style;
315
 
?>
316
 
                <td <?php echo $attributes ?>><?php
317
 
                        if ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) {
318
 
                                if ( $this->is_trash || ! $user_can_edit ) {
319
 
                                        echo $thumb;
320
 
                                } else {
321
 
?>
322
 
                                <a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $att_title ) ); ?>">
323
 
                                        <?php echo $thumb; ?>
324
 
                                </a>
325
 
 
326
 
<?php                   }
327
 
                        }
328
 
?>
329
 
                </td>
330
 
<?php
331
 
                break;
332
 
 
333
 
        case 'title':
334
 
?>
335
 
                <td <?php echo $attributes ?>><strong>
336
 
                        <?php if ( $this->is_trash || ! $user_can_edit ) {
337
 
                                echo $att_title;
338
 
                        } else { ?>
339
 
                        <a href="<?php echo get_edit_post_link( $post->ID ); ?>"
340
 
                                title="<?php echo esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $att_title ) ); ?>">
341
 
                                <?php echo $att_title; ?></a>
342
 
                        <?php };
343
 
                        _media_states( $post ); ?></strong>
344
 
                        <p class="filename"><?php echo wp_basename( $post->guid ); ?></p>
345
 
<?php
346
 
                echo $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
347
 
?>
348
 
                </td>
349
 
<?php
350
 
                break;
351
 
 
352
 
        case 'author':
353
 
?>
354
 
                <td <?php echo $attributes ?>><?php
355
 
                        printf( '<a href="%s">%s</a>',
356
 
                                esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
357
 
                                get_the_author()
358
 
                        );
359
 
                ?></td>
360
 
<?php
361
 
                break;
362
 
 
363
 
        case 'desc':
364
 
?>
365
 
                <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
366
 
<?php
367
 
                break;
368
 
 
369
 
        case 'date':
 
340
 
 
341
                $title = _draft_or_post_title();
 
342
                $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) );
 
343
                $link_start = $link_end = '';
 
344
 
 
345
                if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) {
 
346
                        $link_start = '<a href="' . get_edit_post_link( $post->ID ) . '">';
 
347
                        $link_end = '</a>';
 
348
                }
 
349
 
 
350
                $class = $thumb ? ' class="has-media-icon"' : '';
 
351
 
 
352
                ?>
 
353
                <strong<?php echo $class; ?>>
 
354
                        <?php echo $link_start; ?>
 
355
                                <?php if ( $thumb ) : ?>
 
356
                                <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span>
 
357
                                <?php endif; ?>
 
358
 
 
359
                                <span aria-hidden="true"><?php echo $title; ?></span>
 
360
                                <span class="screen-reader-text"><?php printf( __( 'Edit &#8220;%s&#8221;' ), $title ); ?></span>
 
361
                        <?php echo $link_end; ?>
 
362
                        <?php _media_states( $post ); ?>
 
363
                </strong>
 
364
                <p class="filename"><span class="screen-reader-text"><?php _e( 'File name:' ); ?> </span><?php echo wp_basename( $post->guid ); ?></p>
 
365
                <?php
 
366
        }
 
367
 
 
368
        /**
 
369
         * Handles the author column output.
 
370
         *
 
371
         * @since 4.3.0
 
372
         * @access public
 
373
         *
 
374
         * @param WP_Post $post The current WP_Post object.
 
375
         */
 
376
        public function column_author( $post ) {
 
377
                printf( '<a href="%s">%s</a>',
 
378
                        esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
 
379
                        get_the_author()
 
380
                );
 
381
        }
 
382
 
 
383
        /**
 
384
         * Handles the description column output.
 
385
         *
 
386
         * @since 4.3.0
 
387
         * @access public
 
388
         *
 
389
         * @param WP_Post $post The current WP_Post object.
 
390
         */
 
391
        public function column_desc( $post ) {
 
392
                echo has_excerpt() ? $post->post_excerpt : '';
 
393
        }
 
394
 
 
395
        /**
 
396
         * Handles the date column output.
 
397
         *
 
398
         * @since 4.3.0
 
399
         * @access public
 
400
         *
 
401
         * @param WP_Post $post The current WP_Post object.
 
402
         */
 
403
        public function column_date( $post ) {
370
404
                if ( '0000-00-00 00:00:00' == $post->post_date ) {
371
405
                        $h_time = __( 'Unpublished' );
372
406
                } else {
373
407
                        $m_time = $post->post_date;
374
408
                        $time = get_post_time( 'G', true, $post, false );
375
409
                        if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
376
 
                                if ( $t_diff < 0 )
 
410
                                if ( $t_diff < 0 ) {
377
411
                                        $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
378
 
                                else
 
412
                                } else {
379
413
                                        $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
 
414
                                }
380
415
                        } else {
381
416
                                $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
382
417
                        }
383
418
                }
384
 
?>
385
 
                <td <?php echo $attributes ?>><?php echo $h_time ?></td>
386
 
<?php
387
 
                break;
388
 
 
389
 
        case 'parent':
390
 
                if ( $post->post_parent > 0 )
 
419
 
 
420
                echo $h_time;
 
421
        }
 
422
 
 
423
        /**
 
424
         * Handles the parent column output.
 
425
         *
 
426
         * @since 4.3.0
 
427
         * @access public
 
428
         *
 
429
         * @param WP_Post $post The current WP_Post object.
 
430
         */
 
431
        public function column_parent( $post ) {
 
432
                $user_can_edit = current_user_can( 'edit_post', $post->ID );
 
433
 
 
434
                if ( $post->post_parent > 0 ) {
391
435
                        $parent = get_post( $post->post_parent );
392
 
                else
 
436
                } else {
393
437
                        $parent = false;
 
438
                }
394
439
 
395
440
                if ( $parent ) {
396
441
                        $title = _draft_or_post_title( $post->post_parent );
397
442
                        $parent_type = get_post_type_object( $parent->post_type );
398
443
?>
399
 
                        <td <?php echo $attributes ?>><strong>
400
 
                                <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
401
 
                                        <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
402
 
                                                <?php echo $title ?></a><?php
403
 
                                } else {
404
 
                                        echo $title;
405
 
                                } ?></strong>,
406
 
                                <?php echo get_the_time( __( 'Y/m/d' ) ); ?><br />
407
 
                                <?php
408
 
                                if ( $user_can_edit ):
409
 
                                        $detach_url = add_query_arg( array(
410
 
                                                'parent_post_id' => $post->post_parent,
411
 
                                                'media[]' => $post->ID,
412
 
                                                '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
413
 
                                        ), 'upload.php' ); ?>
414
 
                                <a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
415
 
                                <?php endif; ?>
416
 
                        </td>
417
 
<?php
 
444
                        <strong>
 
445
                        <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
 
446
                                <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
 
447
                                        <?php echo $title ?></a><?php
 
448
                        } else {
 
449
                                echo $title;
 
450
                        } ?></strong>,
 
451
                        <?php echo get_the_time( __( 'Y/m/d' ) ); ?><br />
 
452
                        <?php
 
453
                        if ( $user_can_edit ):
 
454
                                $detach_url = add_query_arg( array(
 
455
                                        'parent_post_id' => $post->post_parent,
 
456
                                        'media[]' => $post->ID,
 
457
                                        '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
 
458
                                ), 'upload.php' ); ?>
 
459
                        <a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
 
460
                        <?php endif;
418
461
                } else {
419
 
?>
420
 
                        <td <?php echo $attributes ?>><?php _e( '(Unattached)' ); ?><br />
 
462
                        _e( '(Unattached)' ); ?><br />
421
463
                        <?php if ( $user_can_edit ) { ?>
422
464
                                <a class="hide-if-no-js"
423
465
                                        onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
424
466
                                        href="#the-list">
425
467
                                        <?php _e( 'Attach' ); ?></a>
426
 
                        <?php } ?></td>
427
 
<?php
 
468
                        <?php }
428
469
                }
429
 
                break;
430
 
 
431
 
        case 'comments':
432
 
                $attributes = 'class="comments column-comments num"' . $style;
433
 
?>
434
 
                <td <?php echo $attributes ?>>
435
 
                        <div class="post-com-count-wrapper">
436
 
<?php
 
470
        }
 
471
 
 
472
        /**
 
473
         * Handles the comments column output.
 
474
         *
 
475
         * @since 4.3.0
 
476
         * @access public
 
477
         *
 
478
         * @param WP_Post $post The current WP_Post object.
 
479
         */
 
480
        public function column_comments( $post ) {
 
481
                echo '<div class="post-com-count-wrapper">';
 
482
 
437
483
                $pending_comments = get_pending_comments_num( $post->ID );
438
 
 
439
484
                $this->comments_bubble( $post->ID, $pending_comments );
440
 
?>
441
 
                        </div>
442
 
                </td>
443
 
<?php
444
 
                break;
445
 
 
446
 
        default:
447
 
                if ( 'categories' == $column_name )
 
485
 
 
486
                echo '</div>';
 
487
        }
 
488
 
 
489
        /**
 
490
         * Handles output for the default column.
 
491
         *
 
492
         * @since 4.3.0
 
493
         * @access public
 
494
         *
 
495
         * @param WP_Post $post        The current WP_Post object.
 
496
         * @param string  $column_name Current column name.
 
497
         */
 
498
        public function column_default( $post, $column_name ) {
 
499
                if ( 'categories' == $column_name ) {
448
500
                        $taxonomy = 'category';
449
 
                elseif ( 'tags' == $column_name )
 
501
                } elseif ( 'tags' == $column_name ) {
450
502
                        $taxonomy = 'post_tag';
451
 
                elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
 
503
                } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
452
504
                        $taxonomy = substr( $column_name, 9 );
453
 
                else
 
505
                } else {
454
506
                        $taxonomy = false;
 
507
                }
455
508
 
456
509
                if ( $taxonomy ) {
457
 
                        echo '<td ' . $attributes . '>';
458
 
                        if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
 
510
                        $terms = get_the_terms( $post->ID, $taxonomy );
 
511
                        if ( is_array( $terms ) ) {
459
512
                                $out = array();
460
513
                                foreach ( $terms as $t ) {
461
514
                                        $posts_in_term_qv = array();
470
523
                                /* translators: used between list items, there is a space after the comma */
471
524
                                echo join( __( ', ' ), $out );
472
525
                        } else {
473
 
                                echo '&#8212;';
 
526
                                echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>';
474
527
                        }
475
 
                        echo '</td>';
476
 
                        break;
 
528
 
 
529
                        return;
477
530
                }
478
 
?>
479
 
                <td <?php echo $attributes ?>><?php
480
 
                        /**
481
 
                         * Fires for each custom column in the Media list table.
482
 
                         *
483
 
                         * Custom columns are registered using the 'manage_media_columns' filter.
484
 
                         *
485
 
                         * @since 2.5.0
486
 
                         *
487
 
                         * @param string $column_name Name of the custom column.
488
 
                         * @param int    $post_id     Attachment ID.
489
 
                         */
490
 
                        do_action( 'manage_media_custom_column', $column_name, $post->ID );
491
 
                ?></td>
492
 
<?php
493
 
                break;
494
 
        }
495
 
}
496
 
?>
497
 
        </tr>
498
 
<?php endwhile;
 
531
 
 
532
                /**
 
533
                 * Fires for each custom column in the Media list table.
 
534
                 *
 
535
                 * Custom columns are registered using the {@see 'manage_media_columns'} filter.
 
536
                 *
 
537
                 * @since 2.5.0
 
538
                 *
 
539
                 * @param string $column_name Name of the custom column.
 
540
                 * @param int    $post_id     Attachment ID.
 
541
                 */
 
542
                do_action( 'manage_media_custom_column', $column_name, $post->ID );
 
543
        }
 
544
 
 
545
        /**
 
546
         *
 
547
         * @global WP_Post $post
 
548
         */
 
549
        public function display_rows() {
 
550
                global $post;
 
551
 
 
552
                add_filter( 'the_title','esc_html' );
 
553
 
 
554
                while ( have_posts() ) : the_post();
 
555
                        if (
 
556
                                ( $this->is_trash && $post->post_status != 'trash' )
 
557
                                || ( ! $this->is_trash && $post->post_status == 'trash' )
 
558
                        ) {
 
559
                                continue;
 
560
                        }
 
561
                        $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';
 
562
                ?>
 
563
                        <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
 
564
                                <?php $this->single_row_columns( $post ); ?>
 
565
                        </tr>
 
566
                <?php
 
567
                endwhile;
 
568
        }
 
569
 
 
570
        /**
 
571
         * Gets the name of the default primary column.
 
572
         *
 
573
         * @since 4.3.0
 
574
         * @access protected
 
575
         *
 
576
         * @return string Name of the default primary column, in this case, 'title'.
 
577
         */
 
578
        protected function get_default_primary_column_name() {
 
579
                return 'title';
499
580
        }
500
581
 
501
582
        /**
502
583
         * @param WP_Post $post
503
584
         * @param string  $att_title
 
585
         *
 
586
         * @return array
504
587
         */
505
588
        private function _get_row_actions( $post, $att_title ) {
506
589
                $actions = array();
549
632
                 * @param bool    $detached Whether the list table contains media not attached
550
633
                 *                          to any posts. Default true.
551
634
                 */
552
 
                $actions = apply_filters( 'media_row_actions', $actions, $post, $this->detached );
553
 
 
554
 
                return $actions;
 
635
                return apply_filters( 'media_row_actions', $actions, $post, $this->detached );
 
636
        }
 
637
 
 
638
        /**
 
639
         * Generates and displays row action links.
 
640
         *
 
641
         * @since 4.3.0
 
642
         * @access protected
 
643
         *
 
644
         * @param object $post        Attachment being acted upon.
 
645
         * @param string $column_name Current column name.
 
646
         * @param string $primary     Primary column name.
 
647
         * @return string Row actions output for media attachments.
 
648
         */
 
649
        protected function handle_row_actions( $post, $column_name, $primary ) {
 
650
                if ( $primary !== $column_name ) {
 
651
                        return '';
 
652
                }
 
653
 
 
654
                $att_title = _draft_or_post_title();
 
655
                return $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
555
656
        }
556
657
}