Make WordPress Core

Ticket #19570: 19570.diff

File 19570.diff, 5.9 KB (added by helen, 12 years ago)
  • wp-admin/includes/post.php

     
    193193
    194194        // Post Formats
    195195        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'] );
    200197        }
    201198
     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
    202223        // Meta Stuff
    203224        if ( isset($post_data['meta']) && $post_data['meta'] ) {
    204225                foreach ( $post_data['meta'] as $key => $value ) {
  • wp-admin/js/post.js

     
    791791                        });
    792792                });
    793793        }
     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        });
    794803});
  • wp-admin/edit-form-advanced.php

     
    112112        add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' );
    113113}
    114114
    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 
    118115// all taxonomies
    119116foreach ( get_object_taxonomies( $post ) as $tax_name ) {
    120117        $taxonomy = get_taxonomy($tax_name);
     
    323320
    324321<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    325322<div id="post-body-content">
     323
     324<?php
     325if ( 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
    326347<?php if ( post_type_supports($post_type, 'title') ) { ?>
    327348<div id="titlediv">
    328349<div id="titlewrap">
     
    356377
    357378do_action( 'edit_form_after_title' );
    358379
     380// post format fields
     381if ( 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
    359423if ( post_type_supports($post_type, 'editor') ) {
    360424?>
    361425<div id="postdivrich" class="postarea">