Ticket #19570: 19570.2.diff
File 19570.2.diff, 8.8 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/post.php
193 193 194 194 // Post Formats 195 195 if ( isset( $post_data['post_format'] ) ) { 196 if ( current_theme_supports( 'post-formats', $post_data['post_format'] ) ) 197 set_post_format( $post_ID, $post_data['post_format'] ); 198 elseif ( '0' == $post_data['post_format'] ) 199 set_post_format( $post_ID, false ); 196 set_post_format( $post_ID, $post_data['post_format'] ); 200 197 } 201 198 199 if ( isset( $post_data[ '_wp_format_quote' ] ) ) { 200 update_post_meta( $post_ID, '_wp_format_quote', addslashes( wp_kses_post( stripslashes( $post_data['_wp_format_quote'] ) ) ) ); 201 } 202 203 if ( isset( $post_data[ '_wp_format_quote_source' ] ) ) { 204 update_post_meta( $post_ID, '_wp_format_quote_source', addslashes( wp_kses_post( stripslashes( $post_data['_wp_format_quote_source'] ) ) ) ); 205 } 206 207 if ( isset( $post_data[ '_wp_format_url' ] ) ) { 208 update_post_meta( $post_ID, '_wp_format_url', addslashes( esc_url_raw( stripslashes( $post_data['_wp_format_url'] ) ) ) ); 209 } 210 211 if ( isset( $post_data[ '_wp_format_image' ] ) ) { 212 update_post_meta( $post_ID, '_wp_format_image', addslashes( wp_kses_post( stripslashes( $post_data['_wp_format_image'] ) ) ) ); 213 } 214 215 if ( isset( $post_data[ '_wp_format_gallery' ] ) ) { 216 update_post_meta( $post_ID, '_wp_format_gallery', addslashes( wp_kses_post( stripslashes( $post_data['_wp_format_gallery'] ) ) ) ); 217 } 218 219 if ( isset( $post_data[ '_wp_format_media' ] ) ) { 220 update_post_meta( $post_ID, '_wp_format_media', addslashes( wp_kses_post( stripslashes( $post_data['_wp_format_media'] ) ) ) ); 221 } 222 202 223 // Meta Stuff 203 224 if ( isset($post_data['meta']) && $post_data['meta'] ) { 204 225 foreach ( $post_data['meta'] as $key => $value ) { -
wp-admin/js/post.js
791 791 }); 792 792 }); 793 793 } 794 795 // Post formats selection 796 $('.post-format-select a').on( 'click', function(e){ 797 e.preventDefault(); 798 var $this = $(this), 799 format = $this.data('wpFormat'); 800 $('.post-format-select a.nav-tab-active').removeClass('nav-tab-active'); 801 $this.addClass('nav-tab-active').blur(); 802 $('#post_format').val(format); 803 $('#post-body-content').attr('class', 'wp-format-' + format ); 804 }); 794 805 }); -
wp-admin/edit-form-advanced.php
112 112 add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' ); 113 113 } 114 114 115 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )116 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' );117 118 115 // all taxonomies 119 116 foreach ( get_object_taxonomies( $post ) as $tax_name ) { 120 117 $taxonomy = get_taxonomy($tax_name); … … 129 126 add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name )); 130 127 } 131 128 129 // post format 130 $post_format = get_post_format(); 131 $format_class = ''; 132 if ( ! $post_format && post_type_supports( $post_type, 'post-formats' ) ) 133 $post_format = 'standard'; 134 if ( $post_format ) 135 $format_class = " class='wp-format-{$post_format}'"; 136 132 137 if ( post_type_supports($post_type, 'page-attributes') ) 133 138 add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); 134 139 … … 322 327 <div id="poststuff"> 323 328 324 329 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 325 <div id="post-body-content"> 330 <div id="post-body-content"<?php echo $format_class; ?>> 331 332 <?php 333 if ( post_type_supports( $post_type, 'post-formats' ) ) { 334 $all_post_formats = get_post_format_strings(); 335 336 echo '<h2 class="nav-tab-wrapper post-format-select">'; 337 338 foreach ( $all_post_formats as $slug => $label ) { 339 if ( $post_format == $slug ) 340 $class = 'nav-tab nav-tab-active'; 341 else 342 $class = 'nav-tab'; 343 344 echo '<a class="' . $class . '" href="?format=' . $slug . '" data-wp-format="' . $slug . '">' . $label . '</a>'; 345 } 346 347 echo '</h2>'; 348 } 349 ?> 350 326 351 <?php if ( post_type_supports($post_type, 'title') ) { ?> 327 352 <div id="titlediv"> 328 353 <div id="titlewrap"> … … 356 381 357 382 do_action( 'edit_form_after_title' ); 358 383 384 // post format fields 385 if ( post_type_supports( $post_type, 'post-formats' ) ) { 386 $format_quote = get_post_meta( $post_ID, '_wp_format_quote', true ); 387 $format_quote_source = get_post_meta( $post_ID, '_wp_format_quote_source', true ); 388 $format_url = get_post_meta( $post_ID, '_wp_format_url', true ); 389 $format_image = get_post_meta( $post_ID, '_wp_format_image', true ); 390 $format_gallery = get_post_meta( $post_ID, '_wp_format_gallery', true ); 391 $format_media = get_post_meta( $post_ID, '_wp_format_media', true ); 392 ?> 393 <div class="post-formats-fields"> 394 395 <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" /> 396 397 <div class="wp_format_quote"> 398 <label for="_wp_format_quote"><?php _e( 'Quote' ); ?>:</label> 399 <textarea name="_wp_format_quote" class="widefat"><?php echo esc_textarea( $format_quote ); ?></textarea> 400 </div> 401 402 <div class="wp_format_quote_source"> 403 <label for="_wp_format_quote_source"><?php _e( 'Source' ); ?>:</label> 404 <input type="text" name="_wp_format_quote_source" value="<?php echo esc_attr( $format_quote_source ); ?>" class="widefat" /> 405 </div> 406 407 <div class="wp_format_url"> 408 <label for="_wp_format_url"><?php _e( 'URL' ); ?>:</label> 409 <input type="text" name="_wp_format_url" value="<?php echo esc_url( $format_url ); ?>" class="widefat" /> 410 </div> 411 412 <div class="wp_format_image"> 413 <label for="_wp_format_image"><?php _e( 'Image' ); ?>:</label> 414 <input type="text" name="_wp_format_image" value="<?php echo esc_attr( $format_image ); ?>" class="widefat" /> 415 </div> 416 417 <div class="wp_format_gallery"> 418 <label for="_wp_format_gallery"><?php _e( 'Gallery' ); ?>:</label> 419 <input type="text" name="_wp_format_gallery" value="<?php echo esc_attr( $format_gallery ); ?>" class="widefat" /> 420 </div> 421 422 <div class="wp_format_media"> 423 <label for="_wp_format_media"><?php _e( 'Media' ); ?>:</label> 424 <textarea name="_wp_format_media" class="widefat"><?php echo esc_textarea( $format_media ); ?></textarea> 425 </div> 426 427 </div> 428 <?php 429 } 430 359 431 if ( post_type_supports($post_type, 'editor') ) { 360 432 ?> 361 433 <div id="postdivrich" class="postarea"> -
wp-admin/css/wp-admin.css
3089 3089 margin: 2px 0 2px -2px; 3090 3090 } 3091 3091 3092 #post-status-select , #post-format{3092 #post-status-select { 3093 3093 line-height: 2.5em; 3094 3094 margin-top: 3px; 3095 3095 } 3096 3096 3097 /* Post formats form */ 3098 #post-body-content.wp-format-standard .post-formats-fields, 3099 #post-body-content.wp-format-aside .post-formats-fields, 3100 #post-body-content.wp-format-status .post-formats-fields, 3101 #post-body-content.wp-format-chat .post-formats-fields, 3102 #post-body-content.wp-format-link .wp_format_quote, 3103 #post-body-content.wp-format-gallery .wp_format_quote, 3104 #post-body-content.wp-format-image .wp_format_quote, 3105 #post-body-content.wp-format-video .wp_format_quote, 3106 #post-body-content.wp-format-audio .wp_format_quote, 3107 #post-body-content.wp-format-link .wp_format_quote_source, 3108 #post-body-content.wp-format-gallery .wp_format_quote_source, 3109 #post-body-content.wp-format-image .wp_format_quote_source, 3110 #post-body-content.wp-format-video .wp_format_quote_source, 3111 #post-body-content.wp-format-audio .wp_format_quote_source, 3112 #post-body-content.wp-format-gallery .wp_format_url, 3113 #post-body-content.wp-format-video .wp_format_url, 3114 #post-body-content.wp-format-audio .wp_format_url, 3115 #post-body-content.wp-format-link .wp_format_image, 3116 #post-body-content.wp-format-gallery .wp_format_image, 3117 #post-body-content.wp-format-quote .wp_format_image, 3118 #post-body-content.wp-format-video .wp_format_image, 3119 #post-body-content.wp-format-audio .wp_format_image, 3120 #post-body-content.wp-format-link .wp_format_gallery, 3121 #post-body-content.wp-format-image .wp_format_gallery, 3122 #post-body-content.wp-format-quote .wp_format_gallery, 3123 #post-body-content.wp-format-video .wp_format_gallery, 3124 #post-body-content.wp-format-audio .wp_format_gallery, 3125 #post-body-content.wp-format-link .wp_format_media, 3126 #post-body-content.wp-format-gallery .wp_format_media, 3127 #post-body-content.wp-format-image .wp_format_media, 3128 #post-body-content.wp-format-quote .wp_format_media { 3129 display: none; 3130 } 3131 3097 3132 /* Post Screen */ 3098 3133 #post-body #normal-sortables { 3099 3134 min-height: 50px;