Make WordPress Core

Ticket #24327: 24327.diff

File 24327.diff, 5.6 KB (added by kovshenin, 13 years ago)
  • wp-admin/css/wp-admin.css

     
    39953995        padding-bottom: 0;
    39963996}
    39973997
    3998 .no-ui {
     3998.wp-post-format-ui {
    39993999        display: none;
    40004000}
    40014001
     4002.wp-post-format-show-ui .wp-post-format-ui {
     4003        display: block;
     4004}
     4005
    40024006.post-formats-fields {
    40034007        display: none;
    40044008        margin-bottom: 15px;
     
    41114115        text-align: center;
    41124116}
    41134117
    4114 body.wp-format-image .attachment-display-settings,
    4115 body.wp-format-status #titlewrap,
    4116 body.wp-format-image .wp-media-buttons .insert-media,
    4117 body.wp-format-audio .wp-media-buttons .insert-media,
    4118 body.wp-format-video .wp-media-buttons .insert-media,
    4119 body.wp-format-aside .wp-media-buttons .insert-media,
    4120 body.wp-format-status .wp-media-buttons .insert-media {
     4118.wp-post-format-show-ui.wp-format-image .attachment-display-settings,
     4119.wp-post-format-show-ui.wp-format-status #titlewrap,
     4120.wp-post-format-show-ui.wp-format-image #insert-media-button,
     4121.wp-post-format-show-ui.wp-format-audio #insert-media-button,
     4122.wp-post-format-show-ui.wp-format-video #insert-media-button,
     4123.wp-post-format-show-ui.wp-format-aside #insert-media-button,
     4124.wp-post-format-show-ui.wp-format-status #insert-media-button {
    41214125        display: none;
    41224126}
    41234127
  • wp-admin/admin-header.php

     
    9595        }
    9696
    9797        $admin_body_class .= ' wp-format-' . $post_format;
     98
     99        $show_post_format_ui = false;
     100
     101        if ( apply_filters( 'enable_post_format_ui', true, $post ) ) {
     102
     103                // If the user has explicitly set a screen option, use it, otherwise the UI is shown
     104                // when the theme supports formats, or if the site has formats assigned to posts.
     105                $post_format_user_option = get_user_option( 'post_formats_' . $post->post_type );
     106                if ( false !== $post_format_user_option )
     107                        $show_post_format_ui = (bool) $post_format_user_option;
     108                else
     109                        $show_post_format_ui = current_theme_supports( 'post-formats' ) || (bool) get_terms( 'post_format', array( 'number' => 1 ) );
     110        }
     111
     112        if ( $show_post_format_ui )
     113                $admin_body_class .= ' wp-post-format-show-ui';
    98114}
    99115
    100116if ( wp_is_mobile() )
  • wp-admin/js/post-formats.js

     
    210210                }
    211211
    212212                $( '#show_post_format_ui' ).on( 'change', function () {
    213                         $( '.wp-post-format-ui' ).toggleClass( 'no-ui', ! this.checked );
     213                        body.toggleClass( 'wp-post-format-show-ui', this.checked );
     214
     215                        // Reset the display properties of possibly hidden items.
     216                        insertMediaButton.css( 'display', '' );
     217                        $( '#titlewrap' ).css( 'display', '' );
     218
    214219                        $.post( ajaxurl, {
    215220                                action: 'show-post-format-ui',
    216221                                post_type: $( '#post_type' ).val(),
  • wp-admin/edit-form-advanced.php

     
    130130$format_class = '';
    131131$post_format = '';
    132132$post_format_options = '';
    133 $show_post_format_ui = false;
    134133if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) {
    135134        wp_enqueue_script( 'post-formats' );
    136135        wp_enqueue_script( 'wp-mediaelement' );
     
    144143                        $post_format = $_REQUEST['format'];
    145144        }
    146145
    147         $user_wants = get_user_option( 'post_formats_' . $post_type );
    148         if ( false !== $user_wants ) {
    149                 // User wants what user gets.
    150                 $show_post_format_ui = (bool) $user_wants;
    151         } else {
    152                 // UI is shown when the theme supports formats, or if the site has formats assigned to posts.
    153                 $show_post_format_ui = current_theme_supports( 'post-formats' ) || get_terms( 'post_format', array( 'number' => 1 ) );
    154         }
    155 
    156146        $format_class = " class='wp-format-{$post_format}'";
    157147
    158148        $all_post_formats = array(
     
    389379        <p><?php _e("You have lost your connection with the server, and saving has been disabled. This message will vanish once you've reconnected."); ?></p>
    390380</div>
    391381<?php if ( ! empty( $post_format_options ) ) : ?>
    392 <div class="wp-post-format-ui<?php if ( ! $show_post_format_ui ) echo ' no-ui' ?>">
     382<div class="wp-post-format-ui">
    393383        <div class="post-format-options">
    394384                <?php echo $post_format_options; ?>
    395385        </div>
     
    422412<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    423413<div id="post-body-content"<?php echo $format_class; ?>>
    424414<?php if ( ! empty( $all_post_formats ) ) : ?>
    425 <div class="wp-post-format-ui<?php if ( ! $show_post_format_ui ) echo ' no-ui' ?>">
     415<div class="wp-post-format-ui">
    426416        <div class="post-format-change"><span class="icon <?php echo esc_attr( 'wp-format-' . $post_format ); ?>"></span> <span class="post-format-description"><?php echo $all_post_formats[$post_format]['description']; ?></span></div>
    427417</div>
    428418<?php endif; ?>
  • wp-admin/includes/post-formats.php

     
    99wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce', false );
    1010
    1111?>
    12 <div class="wp-post-format-ui<?php if ( ! $show_post_format_ui ) echo ' no-ui' ?>">
     12<div class="wp-post-format-ui">
    1313        <div class="post-formats-fields">
    1414
    1515                <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />