Ticket #19570: 19570.diff
File 19570.diff, 5.9 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 $('.post-format-select a.nav-tab-active').removeClass('nav-tab-active'); 800 $this.addClass('nav-tab-active').blur(); 801 $('#post_format').val($this.data('format')); 802 }); 794 803 }); -
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); … … 323 320 324 321 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 325 322 <div id="post-body-content"> 323 324 <?php 325 if ( post_type_supports( $post_type, 'post-formats' ) ) { 326 $post_format = get_post_format(); 327 if ( ! $post_format ) 328 $post_format = 'standard'; 329 330 $all_post_formats = get_post_format_strings(); 331 332 echo '<h2 class="nav-tab-wrapper post-format-select">'; 333 334 foreach ( $all_post_formats as $slug => $label ) { 335 if ( $post_format == $slug ) 336 $class = 'nav-tab nav-tab-active'; 337 else 338 $class = 'nav-tab'; 339 340 echo '<a class="' . $class . '" href="?format=' . $slug . '" data-format="' . $slug . '">' . $label . '</a>'; 341 } 342 343 echo '</h2>'; 344 } 345 ?> 346 326 347 <?php if ( post_type_supports($post_type, 'title') ) { ?> 327 348 <div id="titlediv"> 328 349 <div id="titlewrap"> … … 356 377 357 378 do_action( 'edit_form_after_title' ); 358 379 380 // post format fields 381 if ( post_type_supports( $post_type, 'post-formats' ) ) { 382 $format_quote = get_post_meta( $post_ID, '_wp_format_quote', true ); 383 $format_quote_source = get_post_meta( $post_ID, '_wp_format_quote_source', true ); 384 $format_url = get_post_meta( $post_ID, '_wp_format_url', true ); 385 $format_image = get_post_meta( $post_ID, '_wp_format_image', true ); 386 $format_gallery = get_post_meta( $post_ID, '_wp_format_gallery', true ); 387 $format_media = get_post_meta( $post_ID, '_wp_format_media', true ); 388 ?> 389 <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" /> 390 391 <div class="wp_format_quote"> 392 <label for="_wp_format_quote"><?php _e( 'Quote' ); ?>:</label> 393 <textarea name="_wp_format_quote" class="widefat"><?php echo esc_textarea( $format_quote ); ?></textarea> 394 </div> 395 396 <div class="wp_format_quote_source"> 397 <label for="_wp_format_quote_source"><?php _e( 'Source' ); ?>:</label> 398 <input type="text" name="_wp_format_quote_source" value="<?php echo esc_attr( $format_quote_source ); ?>" class="widefat" /> 399 </div> 400 401 <div class="wp_format_url"> 402 <label for="_wp_format_url"><?php _e( 'URL' ); ?>:</label> 403 <input type="text" name="_wp_format_url" value="<?php echo esc_url( $format_url ); ?>" class="widefat" /> 404 </div> 405 406 <div class="wp_format_image"> 407 <label for="_wp_format_image"><?php _e( 'Image' ); ?>:</label> 408 <input type="text" name="_wp_format_image" value="<?php echo esc_attr( $format_image ); ?>" class="widefat" /> 409 </div> 410 411 <div class="wp_format_gallery"> 412 <label for="_wp_format_gallery"><?php _e( 'Gallery' ); ?>:</label> 413 <input type="text" name="_wp_format_gallery" value="<?php echo esc_attr( $format_gallery ); ?>" class="widefat" /> 414 </div> 415 416 <div class="wp_format_media"> 417 <label for="_wp_format_media"><?php _e( 'Media' ); ?>:</label> 418 <textarea name="_wp_format_media" class="widefat"><?php echo esc_textarea( $format_media ); ?></textarea> 419 </div> 420 <?php 421 } 422 359 423 if ( post_type_supports($post_type, 'editor') ) { 360 424 ?> 361 425 <div id="postdivrich" class="postarea">