+/**
+ * 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 = '' ) {
+
+ if ( empty($checked) )
+ $checked = get_user_setting('align', 'none');
+
+ $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, $check = '' ) {
+
+ // 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'));
+
+ if ( empty($check) )
+ $check = get_user_setting('imgsize', 'medium');
+
+ foreach ( $size_names as $size => $label ) {
+ $downsize = image_downsize($post->ID, $size);
+ $checked = '';
+
+ // 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 ( $size == $check ) {
+ if ( $enabled )
+ $checked = " checked='checked'";
+ else
+ $check = '';
+ } elseif ( !$check && $enabled && 'thumbnail' != $size ) {
+ // if $check is not enabled, default to the first available size that's bigger than a thumbnail
+ $check = $size;
+ $checked = " checked='checked'";
+ }
+
+ $html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
+
+ $html .= "<label for='{$css_id}'>$label</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);
+
+ if ( empty($url_type) )
+ $url_type = get_user_setting('urlbutton', 'post');
+
+ $url = '';
+ if ( $url_type == 'file' )
+ $url = $file;
+ elseif ( $url_type == 'post' )
+ $url = $link;
+
+ return "
+ <input type='text' class='text 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
+ */