WP_Media_List_Table::prepare_items
Prepares the list of items for displaying.
Метод класса: WP_Media_List_Table{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WP_Media_List_Table = new WP_Media_List_Table(); $WP_Media_List_Table->prepare_items();
Заметки
Global. Строка. $mode List table view mode. |
Global. WP_Query. $wp_query WordPress Query object. |
Global. Массив. $post_mime_types An array of post mime types. |
Global. Массив. $avail_post_mime_types An array of available post mime types. |
Список изменений
| С версии 3.1.0 | Введена. |
Код WP_Media_List_Table::prepare_items() WP Media List Table::prepare items WP 7.1.2
public function prepare_items() {
global $mode, $wp_query, $post_mime_types, $avail_post_mime_types;
$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
/*
* Exclude attachments scheduled for deletion in the next two hours
* if they are for zip packages for interrupted or failed updates.
* See File_Upload_Upgrader class.
*/
$not_in = array();
$crons = _get_cron_array();
if ( is_array( $crons ) ) {
foreach ( $crons as $cron ) {
if ( isset( $cron['upgrader_scheduled_cleanup'] ) ) {
$details = reset( $cron['upgrader_scheduled_cleanup'] );
if ( ! empty( $details['args'][0] ) ) {
$not_in[] = (int) $details['args'][0];
}
}
}
}
if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) {
$not_in = array_merge( array_values( $_REQUEST['post__not_in'] ), $not_in );
}
if ( ! empty( $not_in ) ) {
$_REQUEST['post__not_in'] = $not_in;
}
list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST );
$this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter'];
$this->set_pagination_args(
array(
'total_items' => $wp_query->found_posts,
'total_pages' => $wp_query->max_num_pages,
'per_page' => $wp_query->query_vars['posts_per_page'],
)
);
if ( $wp_query->posts ) {
update_post_thumbnail_cache( $wp_query );
update_post_parent_caches( $wp_query->posts );
}
}