/** * Reload attachment container */ function ajax_reload_attachment_boxes() { check_ajax_referer('wpshop_reload_product_attachment_part', 'wpshop_ajax_nonce'); $bool = false; $current_post_id = isset($_POST['current_post_id']) ? intval(wpshop_tools::varSanitizer($_POST['current_post_id'])) : null; $attachement_type_list = array('reload_box_document' => 'application/pdf', 'reload_box_picture' => 'image/'); $part_to_reload = isset($_POST['part_to_reload']) ? wpshop_tools::varSanitizer($_POST['part_to_reload']) : null; $attachement_type = $attachement_type_list[$part_to_reload]; echo json_encode(array(wpshop_products::product_attachement_by_type($current_post_id, $attachement_type, 'media-upload.php?post_id=' . $current_post_id . '&tab=library&type=image&TB_iframe=1&width=640&height=566'), $part_to_reload)); die; }