+/**
+ * Retrieve HTML for the image alignment radio buttons with the specified one checked.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $checked
+ * @return unknown
+ */
+function image_align_input_fields( $post, $checked = '' ) {
+
+ $alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right'));
+ if ( !array_key_exists( (string) $checked, $alignments ) )
+ $checked = 'none';
+
+ $out = array();
+ foreach ($alignments as $name => $label) {
+ $name = esc_attr($name);
+ $out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".
+ ( $checked == $name ? " checked='checked'" : "" ) .
+ " /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>" . $label . "</label>";
+ }
+ return join("\n", $out);
+}
+
+/**
+ * Retrieve HTML for the size radio buttons with the specified one checked.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $checked
+ * @return unknown
+ */
+function image_size_input_fields( $post, $checked = '' ) {
+
+ // get a list of the actual pixel dimensions of each possible intermediate version of this image
+ $size_names = array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full size'));
+
+ foreach ( $size_names as $size => $name ) {
+ $downsize = image_downsize($post->ID, $size);
+
+ // is this size selectable?
+ $enabled = ( $downsize[3] || 'full' == $size );
+ $css_id = "image-size-{$size}-{$post->ID}";
+ // if this size is the default but that's not available, don't select it
+ if ( $checked && !$enabled )
+ $checked = '';
+ // if $checked was not specified, default to the first available size that's bigger than a thumbnail
+ if ( !$checked && $enabled && 'thumbnail' != $size )
+ $checked = $size;
+
+ $html = "<div class='image-size-item'><input type='radio' ".( $enabled ? '' : "disabled='disabled'")."name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'".( $checked == $size ? " checked='checked'" : '') ." />";
+
+ $html .= "<label for='{$css_id}'>" . __($name). "</label>";
+ // only show the dimensions if that choice is available
+ if ( $enabled )
+ $html .= " <label for='{$css_id}' class='help'>" . sprintf( __("(%d × %d)"), $downsize[1], $downsize[2] ). "</label>";
+
+ $html .= '</div>';
+
+ $out[] = $html;
+ }
+
+ return array(
+ 'label' => __('Size'),
+ 'input' => 'html',
+ 'html' => join("\n", $out),
+ );
+}
+
+/**
+ * Retrieve HTML for the Link URL buttons with the default link type as specified.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $url_type
+ * @return unknown
+ */
+function image_link_input_fields($post, $url_type='') {
+
+ $file = wp_get_attachment_url($post->ID);
+ $link = get_attachment_link($post->ID);
+
+ $url = '';
+ if ( $url_type == 'file' )
+ $url = $file;
+ elseif ( $url_type == 'post' )
+ $url = $link;
+
+ return "<input type='text' class='urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />
+ <button type='button' class='button urlnone' title=''>" . __('None') . "</button>
+ <button type='button' class='button urlfile' title='" . esc_attr($file) . "'>" . __('File URL') . "</button>
+ <button type='button' class='button urlpost' title='" . esc_attr($link) . "'>" . __('Post URL') . "</button>
+";
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $form_fields
+ * @param unknown_type $post
+ * @return unknown
+ */