$detached ? 'upload-detached' : 'upload', 'plural' => 'media' ) ); } function check_permissions() { if ( !current_user_can('upload_files') ) wp_die( __( 'You do not have permission to upload files.' ) ); } function prepare_items() { global $lost, $wpdb, $wp_query, $post_mime_types, $avail_post_mime_types; $q = $_REQUEST; if ( !empty( $lost ) ) $q['post__in'] = implode( ',', $lost ); list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $q ); $this->is_trash = isset( $_REQUEST['status'] ) && 'trash' == $_REQUEST['status']; $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'], ) ); } function get_views() { global $wpdb, $post_mime_types, $detached, $avail_post_mime_types; $type_links = array(); $_num_posts = (array) wp_count_attachments(); $_total_posts = array_sum($_num_posts) - $_num_posts['trash']; if ( !isset( $total_orphans ) ) $total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" ); $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); foreach ( $matches as $type => $reals ) foreach ( $reals as $real ) $num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real]; $class = ( empty($_GET['post_mime_type']) && !$detached && !isset($_GET['status']) ) ? ' class="current"' : ''; $type_links['all'] = "
ID ), $matches ) ) echo esc_html( strtoupper( $matches[1] ) ); else echo strtoupper( str_replace( 'image/', '', get_post_mime_type() ) ); ?>
ID ) && !$this->is_trash ) $actions['edit'] = '' . __( 'Edit' ) . ''; if ( current_user_can( 'delete_post', $post->ID ) ) { if ( $this->is_trash ) $actions['untrash'] = "ID ) . "'>" . __( 'Restore' ) . ""; elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) $actions['trash'] = "ID ) . "'>" . __( 'Trash' ) . ""; if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) { $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; $actions['delete'] = "ID ) . "'>" . __( 'Delete Permanently' ) . ""; } } if ( !$this->is_trash ) { $title =_draft_or_post_title( $post->post_parent ); $actions['view'] = '' . __( 'View' ) . ''; } $actions = apply_filters( 'media_row_actions', $actions, $post ); echo $this->row_actions( $actions ); ?>