Ticket #34196: moderate-size.diff
File moderate-size.diff, 16.9 KB (added by , 9 years ago) |
---|
-
src/wp-admin/custom-background.php
diff --git a/src/wp-admin/custom-background.php b/src/wp-admin/custom-background.php index dba32c6..71f43a0 100644
a b if ( current_theme_supports( 'custom-background', 'default-color' ) ) 467 467 if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; 468 468 $attachment_id = absint($_POST['attachment_id']); 469 469 /** This filter is documented in wp-admin/includes/media.php */ 470 $sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), ' large' => __('Large'), 'full' => __('Full Size')) ));470 $sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'moderate' => __('Moderate'), 'large' => __('Large'), 'full' => __('Full Size')) )); 471 471 $size = 'thumbnail'; 472 472 if ( in_array( $_POST['size'], $sizes ) ) 473 473 $size = esc_attr( $_POST['size'] ); -
src/wp-admin/includes/media.php
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index c1f7f5f..387f691 100644
a b function the_media_upload_tabs() { 112 112 * @param string $align image css alignment property 113 113 * @param string $url image src url 114 114 * @param string $rel image rel attribute 115 * @param string $size image size (thumbnail, medium, large, full or addedwith add_image_size() )115 * @param string $size image size (thumbnail, medium, moderate, large, full or added with add_image_size() ) 116 116 * @return string the html to insert into editor 117 117 */ 118 118 function get_image_send_to_editor( $id, $caption, $title, $align, $url='', $rel = '', $size='medium', $alt = '' ) { … … function get_image_send_to_editor( $id, $caption, $title, $align, $url='', $rel 159 159 * @param string $title image title attribute 160 160 * @param string $align image css alignment property 161 161 * @param string $url image src url 162 * @param string $size image size (thumbnail, medium, large, full or added with add_image_size() )162 * @param string $size image size (thumbnail, medium, moderate, large, full or added with add_image_size() ) 163 163 * @return string 164 164 */ 165 165 function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) { … … function image_size_input_fields( $post, $check = '' ) { 972 972 * @since 3.3.0 973 973 * 974 974 * @param array $size_names Array of image sizes and their names. Default values 975 * include 'Thumbnail', 'Medium', ' Large', 'Full Size'.975 * include 'Thumbnail', 'Medium', 'Moderate', 'Large', 'Full Size'. 976 976 */ 977 977 $size_names = apply_filters( 'image_size_names_choose', array( 978 978 'thumbnail' => __( 'Thumbnail' ), 979 979 'medium' => __( 'Medium' ), 980 'moderate' => __( 'Moderate' ), 980 981 'large' => __( 'Large' ), 981 982 'full' => __( 'Full Size' ) 982 983 ) ); -
src/wp-admin/includes/schema.php
diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index 1d67e76..12babd4 100644
a b function populate_options() { 506 506 507 507 // 4.3.0 508 508 'finished_splitting_shared_terms' => 1, 509 510 // 4.4.0 511 'moderate_size_w' => 768, 512 'moderate_size_h' => 768, 509 513 ); 510 514 511 515 // 3.3 -
src/wp-admin/options-media.php
diff --git a/src/wp-admin/options-media.php b/src/wp-admin/options-media.php index d4d4318..a45c28e 100644
a b include( ABSPATH . 'wp-admin/admin-header.php' ); 72 72 </tr> 73 73 74 74 <tr> 75 <th scope="row"><?php _e('Moderate size') ?></th> 76 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Moderate size'); ?></span></legend> 77 <label for="moderate_size_w"><?php _e('Max Width'); ?></label> 78 <input name="moderate_size_w" type="number" step="1" min="0" id="moderate_size_w" value="<?php form_option('moderate_size_w'); ?>" class="small-text" /> 79 <label for="moderate_size_h"><?php _e('Max Height'); ?></label> 80 <input name="moderate_size_h" type="number" step="1" min="0" id="moderate_size_h" value="<?php form_option('moderate_size_h'); ?>" class="small-text" /> 81 </fieldset></td> 82 </tr> 83 84 <tr> 75 85 <th scope="row"><?php _e('Large size') ?></th> 76 86 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend> 77 87 <label for="large_size_w"><?php _e('Max Width'); ?></label> -
src/wp-admin/options.php
diff --git a/src/wp-admin/options.php b/src/wp-admin/options.php index 017725d..3e00b28 100644
a b if ( is_multisite() && ! is_super_admin() && 'update' != $action ) { 84 84 $whitelist_options = array( 85 85 'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ), 86 86 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 87 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', ' large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),87 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'moderate_size_w', 'moderate_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 88 88 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ), 89 89 'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' ) 90 90 ); -
src/wp-includes/class-wp-image-editor-gd.php
diff --git a/src/wp-includes/class-wp-image-editor-gd.php b/src/wp-includes/class-wp-image-editor-gd.php index 53f0837..a37d437 100644
a b class WP_Image_Editor_GD extends WP_Image_Editor { 212 212 * @access public 213 213 * 214 214 * @param array $sizes { 215 * An array of image size arrays. Default sizes are 'small', 'medium', ' large'.215 * An array of image size arrays. Default sizes are 'small', 'medium', 'moderate', 'large'. 216 216 * 217 217 * Either a height or width must be provided. 218 218 * If one of the two is set to null, the resize will -
src/wp-includes/class-wp-image-editor-imagick.php
diff --git a/src/wp-includes/class-wp-image-editor-imagick.php b/src/wp-includes/class-wp-image-editor-imagick.php index f4d8f3b..a629a01 100644
a b class WP_Image_Editor_Imagick extends WP_Image_Editor { 270 270 * @access public 271 271 * 272 272 * @param array $sizes { 273 * An array of image size arrays. Default sizes are 'small', 'medium', ' large'.273 * An array of image size arrays. Default sizes are 'small', 'medium', 'moderate', 'large'. 274 274 * 275 275 * Either a height or width must be provided. 276 276 * If one of the two is set to null, the resize will -
src/wp-includes/class-wp-xmlrpc-server.php
diff --git a/src/wp-includes/class-wp-xmlrpc-server.php b/src/wp-includes/class-wp-xmlrpc-server.php index 380a28d..9c1d2c8 100644
a b class wp_xmlrpc_server extends IXR_Server { 498 498 'readonly' => false, 499 499 'option' => 'medium_size_h' 500 500 ), 501 'moderate_size_w' => array( 502 'desc' => __( 'Moderate size image width' ), 503 'readonly' => false, 504 'option' => 'moderate_size_w' 505 ), 506 'moderate_size_h' => array( 507 'desc' => __( 'Moderate size image height' ), 508 'readonly' => false, 509 'option' => 'moderate_size_h' 510 ), 501 511 'large_size_w' => array( 502 512 'desc' => __( 'Large size image width' ), 503 513 'readonly' => false, -
src/wp-includes/formatting.php
diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index b3f18ee..0fc662a 100644
a b function get_html_split_regex() { 611 611 . ')*+' // Loop possessively. 612 612 . '(?:]]>)?'; // End of comment. If not found, match all input. 613 613 614 $escaped = 614 $escaped = 615 615 '(?=' // Is the element escaped? 616 616 . '!--' 617 617 . '|' … … function sanitize_option( $option, $value ) { 3647 3647 case 'thumbnail_size_h': 3648 3648 case 'medium_size_w': 3649 3649 case 'medium_size_h': 3650 case 'moderate_size_w': 3651 case 'moderate_size_h': 3650 3652 case 'large_size_w': 3651 3653 case 'large_size_h': 3652 3654 case 'mailserver_port': -
src/wp-includes/js/media-views.js
diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index c932f21..de141ec 100644
a b Attachment = View.extend({ 2996 2996 matched = sizes[ size ]; 2997 2997 } else if ( sizes.large ) { 2998 2998 matched = sizes.large; 2999 } else if ( sizes.moderate ) { 3000 matched = sizes.moderate; 2999 3001 } else if ( sizes.thumbnail ) { 3000 3002 matched = sizes.thumbnail; 3001 3003 } else if ( sizes.full ) { -
src/wp-includes/js/media/views/attachment.js
diff --git a/src/wp-includes/js/media/views/attachment.js b/src/wp-includes/js/media/views/attachment.js index 17266a5..dcfc65f 100644
a b Attachment = View.extend({ 361 361 matched = sizes[ size ]; 362 362 } else if ( sizes.large ) { 363 363 matched = sizes.large; 364 } else if ( sizes.moderate ) { 365 matched = sizes.moderate; 364 366 } else if ( sizes.thumbnail ) { 365 367 matched = sizes.thumbnail; 366 368 } else if ( sizes.full ) { -
src/wp-includes/js/tinymce/langs/wp-langs-en.js
diff --git a/src/wp-includes/js/tinymce/langs/wp-langs-en.js b/src/wp-includes/js/tinymce/langs/wp-langs-en.js index 65d9669..93a9134 100644
a b 489 489 size: "Size", 490 490 thumbnail: "Thumbnail", 491 491 medium: "Medium", 492 moderate: "Moderate", 492 493 full_size: "Full Size", 493 494 current_link: "Current Link", 494 495 link_to_img: "Link to Image", -
src/wp-includes/media-template.php
diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php index ae39d57..aa8efc8 100644
a b function wp_print_media_templates() { 687 687 $sizes = apply_filters( 'image_size_names_choose', array( 688 688 'thumbnail' => __('Thumbnail'), 689 689 'medium' => __('Medium'), 690 'moderate' => __('Moderate'), 690 691 'large' => __('Large'), 691 692 'full' => __('Full Size'), 692 693 ) ); -
src/wp-includes/media.php
diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index e0ed8f4..16bd2fe 100644
a b 14 14 * The `$size` parameter accepts either an array or a string. The supported string 15 15 * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at 16 16 * 128 width and 96 height in pixels. Also supported for the string value is 17 * 'm edium' and 'full'. The 'full' isn't actually supported, but any value other17 * 'moderate', 'medium' and 'full'. The 'full' isn't actually supported, but any value other 18 18 * than the supported will result in the content_width size or 500 if that is 19 19 * not set. 20 20 * … … function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co 61 61 $max_height = intval(get_option('medium_size_h')); 62 62 // if no width is set, default to the theme content width if available 63 63 } 64 elseif ( $size == 'moderate' ) { 65 /* 66 * We're inserting a moderately sized image into the editor. If it's a really 67 * big image we'll scale it down to fit reasonably within the editor 68 * itself, and within the theme's content width if it's known. The user 69 * can resize it in the editor if they wish. 70 */ 71 $max_width = intval(get_option('moderate_size_w')); 72 $max_height = intval(get_option('moderate_size_h')); 73 if ( intval($content_width) > 0 ) 74 $max_width = min( intval($content_width), $max_width ); 75 } 64 76 elseif ( $size == 'large' ) { 65 77 /* 66 78 * We're inserting a large size image into the editor. If it's a really … … function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) { 672 684 */ 673 685 function get_intermediate_image_sizes() { 674 686 global $_wp_additional_image_sizes; 675 $image_sizes = array('thumbnail', 'medium', ' large'); // Standard sizes687 $image_sizes = array('thumbnail', 'medium', 'moderate', 'large'); // Standard sizes 676 688 if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) 677 689 $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) ); 678 690 … … function get_intermediate_image_sizes() { 682 694 * @since 2.5.0 683 695 * 684 696 * @param array $image_sizes An array of intermediate image sizes. Defaults 685 * are 'thumbnail', 'medium', ' large'.697 * are 'thumbnail', 'medium', 'moderate', 'large'. 686 698 */ 687 699 return apply_filters( 'intermediate_image_sizes', $image_sizes ); 688 700 } … … function wp_prepare_attachment_for_js( $attachment ) { 2901 2913 $possible_sizes = apply_filters( 'image_size_names_choose', array( 2902 2914 'thumbnail' => __('Thumbnail'), 2903 2915 'medium' => __('Medium'), 2916 'moderate' => __('Moderate'), 2904 2917 'large' => __('Large'), 2905 2918 'full' => __('Full Size'), 2906 2919 ) ); … … function wp_prepare_attachment_for_js( $attachment ) { 2930 2943 $size_meta = $meta['sizes'][ $size ]; 2931 2944 2932 2945 // We have the actual image size, but might need to further constrain it if content_width is narrower. 2933 // Thumbnail, medium, and full sizes are also checked against the site's height/width options.2946 // Thumbnail, medium, moderate, and full sizes are also checked against the site's height/width options. 2934 2947 list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' ); 2935 2948 2936 2949 $sizes[ $size ] = array( -
src/wp-includes/version.php
diff --git a/src/wp-includes/version.php b/src/wp-includes/version.php index 7c88c6c..c27abed 100644
a b $wp_version = '4.4-alpha-33636-src'; 11 11 * 12 12 * @global int $wp_db_version 13 13 */ 14 $wp_db_version = 3452 8;14 $wp_db_version = 34529; 15 15 16 16 /** 17 17 * Holds the TinyMCE version -
tests/phpunit/tests/media.php
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index f4888af..902584d 100644
a b EOF; 762 762 'descriptor' => 'w', 763 763 'value' => $image['sizes']['medium']['width'], 764 764 ), 765 array( 766 'url' => 'http://example.org/wp-content/uploads/' . $year_month . '/' . $image['sizes']['moderate']['file'], 767 'descriptor' => 'w', 768 'value' => $image['sizes']['moderate']['width'], 769 ), 765 770 array( 766 771 'url' => 'http://example.org/wp-content/uploads/' . $year_month . '/' . $image['sizes']['large']['file'], 767 772 'descriptor' => 'w', … … EOF; 805 810 'value' => $image['sizes']['medium']['width'], 806 811 ), 807 812 array( 813 'url' => 'http://example.org/wp-content/uploads/' . $image['sizes']['moderate']['file'], 814 'descriptor' => 'w', 815 'value' => $image['sizes']['moderate']['width'], 816 ), 817 array( 808 818 'url' => 'http://example.org/wp-content/uploads/' . $image['sizes']['large']['file'], 809 819 'descriptor' => 'w', 810 820 'value' => $image['sizes']['large']['width'], … … EOF; 817 827 ); 818 828 819 829 // Set up test cases for all expected size names and a random one. 820 $sizes = array( 'medium', 'large', ' full', 'yoav' );830 $sizes = array( 'medium', 'large', 'moderate', 'full', 'yoav' ); 821 831 822 832 foreach ( $sizes as $size ) { 823 833 $this->assertSame( $expected, wp_get_attachment_image_srcset_array( $id, $size ) ); … … EOF; 917 927 $expected = 'http://example.org/wp-content/uploads/' . $year_month = date('Y/m') . '/' 918 928 . $image['sizes']['medium']['file'] . ' ' . $image['sizes']['medium']['width'] . 'w, '; 919 929 $expected .= 'http://example.org/wp-content/uploads/' . $year_month = date('Y/m') . '/' 930 . $image['sizes']['moderate']['file'] . ' ' . $image['sizes']['moderate']['width'] . 'w, '; 931 $expected .= 'http://example.org/wp-content/uploads/' . $year_month = date('Y/m') . '/' 920 932 . $image['sizes']['large']['file'] . ' ' . $image['sizes']['large']['width'] . 'w, '; 921 933 $expected .= 'http://example.org/wp-content/uploads/' . $image['file'] . ' ' . $image['width'] .'w'; 922 934 … … EOF; 951 963 global $content_width; 952 964 953 965 // Test sizes against the default WP sizes. 954 $intermediates = array('thumbnail', 'medium', ' large');966 $intermediates = array('thumbnail', 'medium', 'moderate', 'large'); 955 967 956 968 foreach( $intermediates as $int ) { 957 969 $width = get_option( $int . '_size_w' );