76 * if they are for zip packages for interrupted or failed updates. |
76 * if they are for zip packages for interrupted or failed updates. |
77 * See File_Upload_Upgrader class. |
77 * See File_Upload_Upgrader class. |
78 */ |
78 */ |
79 $not_in = array(); |
79 $not_in = array(); |
80 |
80 |
81 foreach ( _get_cron_array() as $cron ) { |
81 $crons = _get_cron_array(); |
82 if ( isset( $cron['upgrader_scheduled_cleanup'] ) ) { |
82 |
83 $details = reset( $cron['upgrader_scheduled_cleanup'] ); |
83 if ( is_array( $crons ) ) { |
84 |
84 foreach ( $crons as $cron ) { |
85 if ( ! empty( $details['args'][0] ) ) { |
85 if ( isset( $cron['upgrader_scheduled_cleanup'] ) ) { |
86 $not_in[] = (int) $details['args'][0]; |
86 $details = reset( $cron['upgrader_scheduled_cleanup'] ); |
|
87 |
|
88 if ( ! empty( $details['args'][0] ) ) { |
|
89 $not_in[] = (int) $details['args'][0]; |
|
90 } |
87 } |
91 } |
88 } |
92 } |
89 } |
93 } |
90 |
94 |
91 if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) { |
95 if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) { |
145 $selected, |
149 $selected, |
146 $label[0] |
150 $label[0] |
147 ); |
151 ); |
148 } |
152 } |
149 |
153 |
150 $type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . __( 'Unattached' ) . '</option>'; |
154 $type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . _x( 'Unattached', 'media items' ) . '</option>'; |
151 |
155 |
152 $type_links['mine'] = sprintf( |
156 $type_links['mine'] = sprintf( |
153 '<option value="mine"%s>%s</option>', |
157 '<option value="mine"%s>%s</option>', |
154 selected( 'mine' === $filter, true, false ), |
158 selected( 'mine' === $filter, true, false ), |
155 _x( 'Mine', 'media items' ) |
159 _x( 'Mine', 'media items' ) |
381 |
385 |
382 /** |
386 /** |
383 * Handles the checkbox column output. |
387 * Handles the checkbox column output. |
384 * |
388 * |
385 * @since 4.3.0 |
389 * @since 4.3.0 |
386 * |
390 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. |
387 * @param WP_Post $post The current WP_Post object. |
391 * |
388 */ |
392 * @param WP_Post $item The current WP_Post object. |
389 public function column_cb( $post ) { |
393 */ |
|
394 public function column_cb( $item ) { |
|
395 // Restores the more descriptive, specific name for use within this method. |
|
396 $post = $item; |
|
397 |
390 if ( current_user_can( 'edit_post', $post->ID ) ) { |
398 if ( current_user_can( 'edit_post', $post->ID ) ) { |
391 ?> |
399 ?> |
392 <label class="screen-reader-text" for="cb-select-<?php echo $post->ID; ?>"> |
400 <label class="screen-reader-text" for="cb-select-<?php echo $post->ID; ?>"> |
393 <?php |
401 <?php |
394 /* translators: %s: Attachment title. */ |
402 /* translators: %s: Attachment title. */ |
498 } else { |
506 } else { |
499 $h_time = get_the_time( __( 'Y/m/d' ), $post ); |
507 $h_time = get_the_time( __( 'Y/m/d' ), $post ); |
500 } |
508 } |
501 } |
509 } |
502 |
510 |
503 echo $h_time; |
511 /** |
|
512 * Filters the published time of an attachment displayed in the Media list table. |
|
513 * |
|
514 * @since 6.0.0 |
|
515 * |
|
516 * @param string $h_time The published time. |
|
517 * @param WP_Post $post Attachment object. |
|
518 * @param string $column_name The column name. |
|
519 */ |
|
520 echo apply_filters( 'media_date_column_time', $h_time, $post, 'date' ); |
504 } |
521 } |
505 |
522 |
506 /** |
523 /** |
507 * Handles the parent column output. |
524 * Handles the parent column output. |
508 * |
525 * |
588 |
605 |
589 /** |
606 /** |
590 * Handles output for the default column. |
607 * Handles output for the default column. |
591 * |
608 * |
592 * @since 4.3.0 |
609 * @since 4.3.0 |
593 * |
610 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. |
594 * @param WP_Post $post The current WP_Post object. |
611 * |
|
612 * @param WP_Post $item The current WP_Post object. |
595 * @param string $column_name Current column name. |
613 * @param string $column_name Current column name. |
596 */ |
614 */ |
597 public function column_default( $post, $column_name ) { |
615 public function column_default( $item, $column_name ) { |
|
616 // Restores the more descriptive, specific name for use within this method. |
|
617 $post = $item; |
|
618 |
598 if ( 'categories' === $column_name ) { |
619 if ( 'categories' === $column_name ) { |
599 $taxonomy = 'category'; |
620 $taxonomy = 'category'; |
600 } elseif ( 'tags' === $column_name ) { |
621 } elseif ( 'tags' === $column_name ) { |
601 $taxonomy = 'post_tag'; |
622 $taxonomy = 'post_tag'; |
602 } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { |
623 } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { |
619 '<a href="%s">%s</a>', |
640 '<a href="%s">%s</a>', |
620 esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), |
641 esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), |
621 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) |
642 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) |
622 ); |
643 ); |
623 } |
644 } |
624 /* translators: Used between list items, there is a space after the comma. */ |
645 echo implode( wp_get_list_item_separator(), $out ); |
625 echo implode( __( ', ' ), $out ); |
|
626 } else { |
646 } else { |
627 echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>'; |
647 echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>'; |
628 } |
648 } |
629 |
649 |
630 return; |
650 return; |
792 get_permalink( $post->ID ), |
812 get_permalink( $post->ID ), |
793 /* translators: %s: Attachment title. */ |
813 /* translators: %s: Attachment title. */ |
794 esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), |
814 esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), |
795 __( 'View' ) |
815 __( 'View' ) |
796 ); |
816 ); |
|
817 |
|
818 $actions['copy'] = sprintf( |
|
819 '<span class="copy-to-clipboard-container"><button type="button" class="button-link copy-attachment-url media-library" data-clipboard-text="%s" aria-label="%s">%s</button><span class="success hidden" aria-hidden="true">%s</span></span>', |
|
820 esc_url( wp_get_attachment_url( $post->ID ) ), |
|
821 /* translators: %s: Attachment title. */ |
|
822 esc_attr( sprintf( __( 'Copy “%s” URL to clipboard' ), $att_title ) ), |
|
823 __( 'Copy URL to clipboard' ), |
|
824 __( 'Copied!' ) |
|
825 ); |
797 } |
826 } |
798 } |
827 } |
799 |
828 |
800 /** |
829 /** |
801 * Filters the action links for each attachment in the Media list table. |
830 * Filters the action links for each attachment in the Media list table. |
813 |
842 |
814 /** |
843 /** |
815 * Generates and displays row action links. |
844 * Generates and displays row action links. |
816 * |
845 * |
817 * @since 4.3.0 |
846 * @since 4.3.0 |
818 * |
847 * @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. |
819 * @param WP_Post $post Attachment being acted upon. |
848 * |
|
849 * @param WP_Post $item Attachment being acted upon. |
820 * @param string $column_name Current column name. |
850 * @param string $column_name Current column name. |
821 * @param string $primary Primary column name. |
851 * @param string $primary Primary column name. |
822 * @return string Row actions output for media attachments, or an empty string |
852 * @return string Row actions output for media attachments, or an empty string |
823 * if the current column is not the primary column. |
853 * if the current column is not the primary column. |
824 */ |
854 */ |
825 protected function handle_row_actions( $post, $column_name, $primary ) { |
855 protected function handle_row_actions( $item, $column_name, $primary ) { |
826 if ( $primary !== $column_name ) { |
856 if ( $primary !== $column_name ) { |
827 return ''; |
857 return ''; |
828 } |
858 } |
829 |
859 |
830 $att_title = _draft_or_post_title(); |
860 $att_title = _draft_or_post_title(); |
831 |
861 $actions = $this->_get_row_actions( |
832 return $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); |
862 $item, // WP_Post object for an attachment. |
|
863 $att_title |
|
864 ); |
|
865 |
|
866 return $this->row_actions( $actions ); |
833 } |
867 } |
834 } |
868 } |