Changeset 24226
- Timestamp:
- 05/09/2013 10:45:14 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-header.php
r23879 r24226 86 86 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); 87 87 88 if ( false !== $post_format = get_post_format() ) { 89 if ( ! $post_format ) { 90 $post_format = 'standard'; 91 92 if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) 93 $post_format = $_REQUEST['format']; 94 } 95 96 $admin_body_class .= ' wp-format-' . $post_format; 97 } 98 88 99 if ( wp_is_mobile() ) 89 100 $admin_body_class .= ' mobile'; … … 99 110 100 111 <?php 101 // Make sure the customize body classes are correct as early as possible. 112 // Make sure the customize body classes are correct as early as possible. 102 113 if ( current_user_can( 'edit_theme_options' ) ) 103 114 wp_customize_support_script(); -
trunk/wp-admin/css/wp-admin.css
r24219 r24226 4005 4005 } 4006 4006 4007 .wp-format-gallery .post-formats-fields,4008 .wp-format-image .post-formats-fields,4009 .wp-format-link .post-formats-fields,4010 .wp-format-quote .post-formats-fields,4011 .wp-format-video .post-formats-fields,4012 .wp-format-audio .post-formats-fields,4013 .wp-format-gallery .field.wp-format-gallery,4014 .wp-format-image .field.wp-format-image,4015 .wp-format-chat .field.wp-format-chat,4016 .wp-format-link .field.wp-format-link,4017 .wp-format-quote .field.wp-format-quote,4018 .wp-format-video .field.wp-format-video,4019 .wp-format-audio .field.wp-format-audio {4007 #post-body-content.wp-format-gallery .post-formats-fields, 4008 #post-body-content.wp-format-image .post-formats-fields, 4009 #post-body-content.wp-format-link .post-formats-fields, 4010 #post-body-content.wp-format-quote .post-formats-fields, 4011 #post-body-content.wp-format-video .post-formats-fields, 4012 #post-body-content.wp-format-audio .post-formats-fields, 4013 #post-body-content.wp-format-gallery .field.wp-format-gallery, 4014 #post-body-content.wp-format-image .field.wp-format-image, 4015 #post-body-content.wp-format-chat .field.wp-format-chat, 4016 #post-body-content.wp-format-link .field.wp-format-link, 4017 #post-body-content.wp-format-quote .field.wp-format-quote, 4018 #post-body-content.wp-format-video .field.wp-format-video, 4019 #post-body-content.wp-format-audio .field.wp-format-audio { 4020 4020 display: block; 4021 4021 } … … 4033 4033 } 4034 4034 4035 .wp-format-image label,4036 .wp-format-video label,4037 .wp-format-audio label {4035 #post-body-content.wp-format-image label, 4036 #post-body-content.wp-format-video label, 4037 #post-body-content.wp-format-audio label { 4038 4038 float: left; 4039 4039 } … … 4044 4044 width: 40%; 4045 4045 height: auto; 4046 padding: 55px 0 20px;4047 4046 border: 1px dashed #dfdfdf; 4048 4047 background: #f5f5f5 url(../images/media-button-2x.png) no-repeat 50% 25%; 4048 box-sizing: border-box; 4049 position:relative; 4049 4050 } 4050 4051 … … 4053 4054 } 4054 4055 4056 .wp-format-media-holder.drag-over { 4057 background: rgba( 0, 86, 132, 0.9 ); 4058 border-color:transparent; 4059 } 4060 4061 .wp-format-media-holder div { 4062 display: none; 4063 } 4064 .wp-format-media-holder.drag-over div { 4065 position: absolute; 4066 top: 10px; 4067 left: 10px; 4068 right: 10px; 4069 bottom: 10px; 4070 border: 1px dashed #fff; 4071 display:block; 4072 } 4073 4074 #poststuff .wp-format-media-holder.drag-over div h3 { 4075 4076 position: absolute; 4077 top: 50%; 4078 left: 0; 4079 right: 0; 4080 -webkit-transform: translateY( -50% ); 4081 -moz-transform: translateY( -50% ); 4082 -ms-transform: translateY( -50% ); 4083 -o-transform: translateY( -50% ); 4084 transform: translateY( -50% ); 4085 4086 font-size: 20px; 4087 font-weight: 200; 4088 color: #fff; 4089 padding: 0; 4090 text-align:center; 4091 font-family: sans-serif; 4092 } 4093 4094 #post-body-content.wp-format-image .wp-format-media-holder { 4095 margin-top: 17px; 4096 } 4097 4055 4098 .wp-format-media-preview { 4056 margin-bottom: 20px; 4057 } 4058 4059 .wp-format-status #titlewrap, 4060 .wp-format-image .wp-media-buttons .insert-media, 4061 .wp-format-audio .wp-media-buttons .insert-media, 4062 .wp-format-video .wp-media-buttons .insert-media, 4063 .wp-format-aside .wp-media-buttons .insert-media, 4064 .wp-format-status .wp-media-buttons .insert-media { 4099 margin: 20px 0; 4100 } 4101 4102 #image-preview img { 4103 width: auto; 4104 max-height: 300px; 4105 } 4106 4107 #post-body-content .wp-format-image p.use-url-or-html { 4108 padding-top: 10px; 4109 clear: both; 4110 width: 40%; 4111 text-align: center; 4112 } 4113 4114 body.wp-format-image .attachment-display-settings { 4115 display: none; 4116 } 4117 4118 body.wp-format-status #titlewrap, 4119 body.wp-format-image .wp-media-buttons .insert-media, 4120 body.wp-format-audio .wp-media-buttons .insert-media, 4121 body.wp-format-video .wp-media-buttons .insert-media, 4122 body.wp-format-aside .wp-media-buttons .insert-media, 4123 body.wp-format-status .wp-media-buttons .insert-media { 4065 4124 display: none; 4066 4125 } … … 4073 4132 .wp-format-media-select { 4074 4133 display: block; 4075 height: 200px; 4134 height: 20px; 4135 padding: 55px 0 20px; 4076 4136 text-align: center; 4077 4137 } … … 4080 4140 max-width: 100%; 4081 4141 max-height: 100%; 4082 }4083 4084 .wp-format-media-select {4085 height: 20px;4086 4142 } 4087 4143 … … 4102 4158 float: left; 4103 4159 margin-right: 23px; 4104 max-width: 50%;4160 max-width: 40%; 4105 4161 min-height: 97px; 4106 4162 } 4107 4163 4108 #icon-edit.wp-format-standard,4164 body.wp-format-standard #icon-edit, 4109 4165 .post-format-options .standard { 4110 4166 background: url(../images/post-formats32.png) no-repeat -3px -4px; 4111 4167 } 4112 4168 4113 #icon-edit.wp-format-image,4169 body.wp-format-image #icon-edit, 4114 4170 .post-format-options .image { 4115 4171 background: url(../images/post-formats32.png) no-repeat -43px -4px; 4116 4172 } 4117 4173 4118 #icon-edit.wp-format-gallery,4174 body.wp-format-gallery #icon-edit, 4119 4175 .post-format-options .gallery { 4120 4176 background: url(../images/post-formats32.png) no-repeat -83px -4px; 4121 4177 } 4122 4178 4123 #icon-edit.wp-format-audio,4179 body.wp-format-audio #icon-edit, 4124 4180 .post-format-options .audio { 4125 4181 background: url(../images/post-formats32.png) no-repeat -123px -4px; 4126 4182 } 4127 4183 4128 #icon-edit.wp-format-video,4184 body.wp-format-video #icon-edit, 4129 4185 .post-format-options .video { 4130 4186 background: url(../images/post-formats32.png) no-repeat -163px -4px; 4131 4187 } 4132 4188 4133 #icon-edit.wp-format-chat,4189 body.wp-format-chat #icon-edit, 4134 4190 .post-format-options .chat { 4135 4191 background: url(../images/post-formats32.png) no-repeat -202px -4px; 4136 4192 } 4137 4193 4138 #icon-edit.wp-format-status,4194 body.wp-format-status #icon-edit, 4139 4195 .post-format-options .status { 4140 4196 background: url(../images/post-formats32.png) no-repeat -242px -4px; 4141 4197 } 4142 4198 4143 #icon-edit.wp-format-aside,4199 body.wp-format-aside #icon-edit, 4144 4200 .post-format-options .aside { 4145 4201 background: url(../images/post-formats32.png) no-repeat -282px -4px; 4146 4202 } 4147 4203 4148 #icon-edit.wp-format-quote,4204 body.wp-format-quote #icon-edit, 4149 4205 .post-format-options .quote { 4150 4206 background: url(../images/post-formats32.png) no-repeat -322px -4px; 4151 4207 } 4152 4208 4153 #icon-edit.wp-format-link,4209 body.wp-format-link #icon-edit, 4154 4210 .post-format-options .link { 4155 4211 background: url(../images/post-formats32.png) no-repeat -362px -4px; -
trunk/wp-admin/includes/post-formats.php
r24184 r24226 39 39 </div> 40 40 <?php endif ?> 41 <label for="wp_format_image"><?php42 if ( current_user_can( 'unfiltered_html' ) )43 _e( 'Image HTML or URL' );44 else45 _e( 'Image URL' );46 ?></label>47 <textarea id="wp_format_image" type="text" name="_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea>48 41 <div data-format="image" class="wp-format-media-holder hide-if-no-js"> 42 <div><h3><?php _e( 'Drop image file to upload' ); ?></h3></div> 49 43 <a href="#" class="wp-format-media-select" 50 44 data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>" … … 53 47 </a> 54 48 </div> 49 <div class="wp-format-image-textarea hide-if-js"> 50 <label for="wp_format_image"><?php 51 if ( current_user_can( 'unfiltered_html' ) ) 52 _e( 'Image HTML or URL' ); 53 else 54 _e( 'Image URL' ); 55 ?></label> 56 <textarea id="wp_format_image" type="text" name="_format_image" class="widefat"><?php esc_html_e( $format_meta['image'] ); ?></textarea> 57 </div> 58 <p class="use-url-or-html hide-if-no-js"><span><?php printf( __( '(or %suse an image URL or HTML%s)' ), '<a href="#">', '</a>' ); ?></span> 59 <span style="display: none"><?php printf( __( '(or %sselect/upload an image%s)' ), '<a href="#">', '</a>' ); ?></span></p> 55 60 </div> 56 61 -
trunk/wp-admin/js/post-formats.js
r24141 r24226 7 7 8 8 var mediaFrame, insertMediaButton, container, icon, formatField, 9 body, 9 10 lastMimeType, 10 11 classRegex = /\s?\bwp-format-[^ ]+/g, … … 18 19 noUIFormats = ['standard', 'chat', 'status', 'aside', 'gallery']; 19 20 21 function imageFormatUploadProgress( uploader, file ) { 22 var $bar = $( '#' + uploader.settings.drop_element + ' .media-progress-bar div' ); 23 $bar.width( file.percent + '%' ); 24 } 25 26 function imageFormatUploadStart( uploader ) { 27 $( '#' + uploader.settings.drop_element + ' .wp-format-media-select' ).append('<div class="media-progress-bar"><div></div></div>'); 28 } 29 30 function imageFormatUploadError() { 31 $( '.media-progress-bar', $('.wp-format-media-holder[data-format=image]') ).remove(); 32 } 33 34 function imageFormatUploadSuccess( attachment ) { 35 var $holder, $field, html = wp.media.string.image({ 36 size : 'full', 37 align : false, 38 link : getUserSetting( 'urlbutton' ) 39 }, attachment.attributes ); 40 41 $holder = $('.wp-format-media-holder[data-format=image]'); 42 $( '.media-progress-bar', $holder ).remove(); 43 44 if ( 'image' !== attachment.attributes.type ) 45 return; 46 47 $field = $( '#wp_format_' + $holder.data( 'format' ) ); 48 49 // set the hidden input's value 50 $field.val( html ); 51 52 $( '#image-preview' ).remove(); 53 54 $holder.parent().prepend( ['<div id="image-preview" class="wp-format-media-preview">', 55 '<img src="', attachment.get('url'), '"', 56 attachment.get('width') ? ' width="' + attachment.get('width') + '"' : '', 57 attachment.get('height') ? ' height="' + attachment.get('height') + '"' : '', 58 ' />', 59 '</div>'].join( '' ) ); 60 } 61 62 var uploader = { 63 dropzone: $('.wp-format-media-holder[data-format=image]'), 64 success: imageFormatUploadSuccess, 65 error: imageFormatUploadError, 66 plupload: {}, 67 params: {} 68 }; 69 uploader = new wp.Uploader( uploader ); 70 uploader.uploader.bind( 'BeforeUpload', imageFormatUploadStart ); 71 uploader.uploader.bind( 'UploadProgress', imageFormatUploadProgress ); 72 20 73 function switchFormatClass( format ) { 21 74 formatField.val( format ); 22 75 23 container24 .prop( 'className', container.prop( 'className' ).replace( classRegex, '' ) )76 $.each( [ container, icon, body ], function(i, thing) { 77 thing.prop( 'className', thing.prop( 'className' ).replace( classRegex, '' ) ) 25 78 .addClass( 'wp-format-' + format ); 26 27 icon 28 .prop( 'className', icon.prop( 'className' ).replace( classRegex, '' ) ) 29 .addClass( 'wp-format-' + format ); 79 }); 30 80 } 31 81 … … 138 188 139 189 $(function () { 190 body = $( 'body' ); 140 191 container = $( '#post-body-content' ); 141 192 icon = $( '.icon32' ); … … 163 214 switchFormat( $( e.currentTarget ) ); 164 215 } ); 216 217 // Toggle select/upload and URL/HTML for images 218 $( '.use-url-or-html' ).on( 'click', 'a', function(e) { 219 e.preventDefault(); 220 $( '.wp-format-media-holder, .wp-format-image-textarea' ).toggle(); 221 $(this).closest( 'p' ).find( 'span' ).toggle(); 222 }); 165 223 166 224 // Media selection … … 243 301 } else { 244 302 html = wp.media.string.image({ 245 align : getUserSetting( 'align' ),246 size : getUserSetting( 'imgsize' ),303 size: 'full', 304 align : false, 247 305 link : getUserSetting( 'urlbutton' ) 248 306 }, attachment); -
trunk/wp-includes/post-formats.php
r24207 r24226 25 25 26 26 if ( empty( $_format ) ) 27 return false;27 return ''; 28 28 29 29 $format = array_shift( $_format ); -
trunk/wp-includes/script-loader.php
r24204 r24226 408 408 ) ); 409 409 410 $scripts->add( 'post-formats', "/wp-admin/js/post-formats$suffix.js", array( 'media-models' ), false, 1 );410 $scripts->add( 'post-formats', "/wp-admin/js/post-formats$suffix.js", array( 'media-models', 'wp-plupload' ), false, 1 ); 411 411 412 412 $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.