function anno_popup_images_iframe_html() { $errors = array(); if (isset($_POST['html-upload']) && !empty($_FILES)) { check_admin_referer('media-form'); // Upload File button was clicked $id = media_handle_upload('async-upload', $_REQUEST['post_id']); unset($_FILES); if (is_wp_error($id)) { $errors['upload_error'] = $id; $id = false; } } global $tab; $post_id = anno_get_post_id(); $attachments = get_posts(array('post_type' => 'attachment', 'posts_per_page' => -1, 'post_parent' => $post_id, 'post_mime_type' => 'image', 'order' => 'ASC')); ?> <body id="anno-popup-images"> <div id="anno-popup-images-inside" class="anno-mce-popup"> <div class="anno-mce-popup-fields"> <?php if (!empty($id)) { if (is_wp_error($id)) { echo '<div id="media-upload-error">' . esc_html($id->get_error_message()) . '</div>'; exit; } } ?> <table class="anno-images"> <thead> <tr> <th scope="col" class="img-list-img"></th> <th scope="col" class="img-list-title"></th> <th scope="col" class="img-list-actions"></th> </tr> </thead> <tbody id="media-items"> <?php foreach ($attachments as $attachment_key => $attachment) { anno_popup_images_row_display($attachment); anno_popup_images_row_edit($attachment); } ?> </tbody> </table> <?php anno_upload_form(); ?> </div> </body> <?php }
function anno_get_media_item($attachment_id, $args = null) { global $redir_tab; $post = get_post($attachment_id); $default_args = array('errors' => null, 'send' => $post->post_parent ? post_type_supports(get_post_type($post->post_parent), 'editor') : true, 'delete' => true, 'toggle' => true, 'show_title' => true); $args = wp_parse_args($args, $default_args); extract($args, EXTR_SKIP); $filename = esc_html(basename($post->guid)); $title = esc_attr($post->post_title); ob_start(); anno_popup_images_row_display($post); anno_popup_images_row_edit($post); $display = ob_get_contents(); ob_end_clean(); return $display; }