diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index db0f5e0c4a..6481ee4ee2 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -520,10 +520,27 @@ function media_upload_library() {
return wp_iframe( 'media_upload_library_form', $errors );
}
+// produce HTML for the image alignment radio buttons with the specified one checked
+function image_align_input_fields($post, $checked='') {
+
+ $alignments = array('none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right');
+ if ( !array_key_exists($checked, $alignments) )
+ $checked = 'none';
+
+ $out = array();
+ foreach ($alignments as $name => $label) {
+
+ $out[] = "";
+ }
+ return join("\n", $out);
+}
+
+// produce HTML for the size radio buttons with the specified one checked
function image_size_input_fields($post, $checked='') {
// get a list of the actual pixel dimensions of each possible intermediate version of this image
- $sizes = array();
$size_names = array('thumbnail' => 'Thumbnail', 'medium' => 'Medium', 'large' => 'Large', 'full' => 'Full size');
foreach ( $size_names as $size => $name) {
@@ -555,6 +572,27 @@ function image_size_input_fields($post, $checked='') {
);
}
+// produce HTML for the Link URL buttons with the default link type as specified
+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 "
+
+
+
+ \n";
+}
+
function image_attachment_fields_to_edit($form_fields, $post) {
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
$form_fields['post_title']['required'] = true;
@@ -567,17 +605,10 @@ function image_attachment_fields_to_edit($form_fields, $post) {
$form_fields['align'] = array(
'label' => __('Alignment'),
'input' => 'html',
- 'html' => "
-
-
-
-
-
-
-
- \n",
+ 'html' => image_align_input_fields($post, get_option('image_default_align')),
);
- $form_fields['image-size'] = image_size_input_fields($post);
+
+ $form_fields['image-size'] = image_size_input_fields($post, get_option('image_default_size'));
}
return $form_fields;
}
@@ -654,14 +685,7 @@ function get_attachment_fields_to_edit($post, $errors = null) {
'url' => array(
'label' => __('Link URL'),
'input' => 'html',
- 'html' => "
-
-
-
-
- \n",
+ 'html' => image_link_input_fields($post, get_option('image_default_link_type')),
'helps' => __('Enter a link URL or click above for presets.'),
),
'menu_order' => array(
@@ -1312,6 +1336,10 @@ function type_form_image() {
$alt_help = __('Also used as alternate text for the image');
}
+ $default_align = get_option('image_default_align');
+ if ( empty($default_align) )
+ $default_align = 'none';
+
return '
| - + - + - + - + | |
| + | + |
| + | + |
| + | + |
- +
diff --git a/wp-includes/version.php b/wp-includes/version.php index 71d3f62791..c95fa9f889 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -15,6 +15,6 @@ $wp_version = '2.7-bleeding'; * * @global int $wp_db_version */ -$wp_db_version = 8586; +$wp_db_version = 8645; ?>