Make WordPress Core

Ticket #23930: 23930.diff

File 23930.diff, 6.8 KB (added by nacin, 12 years ago)
  • wp-includes/user.php

     
    276276        if ( !$global )
    277277                $option_name = $wpdb->prefix . $option_name;
    278278
    279         // For backward compatibility. See differences between update_user_meta() and deprecated update_usermeta().
    280         // http://core.trac.wordpress.org/ticket/13088
    281         if ( is_null( $newvalue ) || is_scalar( $newvalue ) && empty( $newvalue ) )
    282                 return delete_user_meta( $user_id, $option_name );
    283 
    284279        return update_user_meta( $user_id, $option_name, $newvalue );
    285280}
    286281
  • wp-content/themes/twentythirteen/functions.php

     
    8484         * Structured post formats are formats where Twenty Thirteen handles the
    8585         * output instead of the default core HTML output.
    8686         */
    87         add_theme_support( 'structured-post-formats', array(
    88                 'link', 'video'
    89         ) );
    90         add_theme_support( 'post-formats', array(
    91                 'aside', 'audio', 'chat', 'gallery', 'image', 'quote', 'status'
    92         ) );
     87        //add_theme_support( 'structured-post-formats', array(
     88        //      'link', 'video'
     89        //) );
     90        //add_theme_support( 'post-formats', array(
     91        //      'aside', 'audio', 'chat', 'gallery', 'image', 'quote', 'status'
     92        //) );
    9393
    9494        // This theme uses wp_nav_menu() in one location.
    9595        register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) );
  • wp-admin/admin-ajax.php

     
    5656        'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',
    5757        'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',
    5858        'query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',
    59         'send-attachment-to-editor', 'save-attachment-order', 'heartbeat'
     59        'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'show-post-format-ui',
    6060);
    6161
    6262// Register core Ajax calls.
  • wp-admin/includes/ajax-actions.php

     
    11351135        wp_die( 1 );
    11361136}
    11371137
     1138function wp_ajax_show_post_format_ui() {
     1139        error_log( serialize( $_REQUEST ) );
     1140
     1141        if ( empty( $_POST['post_type'] ) )
     1142                wp_die( 0 );
     1143
     1144        check_ajax_referer( 'show-post-format-ui_' . $_POST['post_type'], 'nonce' );
     1145
     1146        if ( ! $post_type_object = get_post_type_object( $_POST['post_type'] ) )
     1147                wp_die( 0 );
     1148
     1149        if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
     1150                wp_die( -1 );
     1151
     1152        error_log( 'Update post_formats_' . $post_type_object->name . ' option for ' . get_current_user_id() . ' to ' . ( empty( $_POST['show'] ) ? 0 : 1 ) );
     1153
     1154        update_user_option( get_current_user_id(), 'post_formats_' . $post_type_object->name, empty( $_POST['show'] ) ? 0 : 1 );
     1155
     1156        wp_die( 1 );
     1157}
     1158
    11381159function wp_ajax_hidden_columns() {
    11391160        check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
    11401161        $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
  • wp-admin/includes/post-formats.php

     
    11<?php
     2
     3defined( 'ABSPATH' ) or die;
     4
    25global $wp_embed;
    36
    47$format_meta = get_post_format_meta( $post_ID );
    58
     9wp_nonce_field( 'show-post-format-ui_' . $post_type, 'show_post_format_ui_nonce', false );
     10
    611?>
    712<div class="post-format-change"><span class="icon <?php echo esc_attr( $post_format ); ?>"></span> <span class="post-format-description"><?php echo $all_post_formats[$post_format]['description']; ?></span> <a href="#"><?php _e('Change format'); ?></a></div>
    813<div class="post-formats-fields">
  • wp-admin/includes/screen.php

     
    960960                                                echo '<label for="wp_welcome_panel-hide">';
    961961                                                echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
    962962                                                echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
     963                                        } elseif ( 'post' == $this->base && post_type_supports( $this->post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $GLOBALS['post'] ) ) {
     964                                                $user_wants = get_user_option( 'post_formats_' . $this->post_type );
     965                                                if ( false !== $user_wants ) {
     966                                                        // User wants what user gets.
     967                                                        $show_post_format_ui = (bool) $user_wants;
     968                                                } else {
     969                                                        // UI is shown when the theme supports formats, or if the site has formats assigned to posts.
     970                                                        $show_post_format_ui = current_theme_supports( 'post-formats' ) || get_terms( 'post_format', array( 'number' => 1 ) );
     971                                                }
     972                                                echo '<label for="show_post_format_ui">';
     973                                                echo '<input type="checkbox" id="show_post_format_ui"' . checked( $show_post_format_ui, true, false ) . ' />';
     974                                                echo __( 'Post Formats' ) . "</label>\n";
    963975                                        }
    964976                                ?>
    965977                                <br class="clear" />
  • wp-admin/js/post-formats.js

     
    6464
    6565        $(function(){
    6666
     67                $('#show_post_format_ui').on('change', function() {
     68                        $('.some-element').toggleClass('.no-ui', ! this.checked );
     69                        $.post( ajaxurl, {
     70                                action: 'show-post-format-ui',
     71                                post_type: $('#post_type').val(),
     72                                show: this.checked ? 1 : 0,
     73                                nonce: $('#show_post_format_ui_nonce').val()
     74                        });
     75                });
     76
    6777                $('.post-format-change a').click(function() {
    6878                        $('.post-formats-fields, .post-format-change').slideUp();
    6979                        $('.post-format-options').slideDown();
  • wp-admin/edit-form-advanced.php

     
    143143                        $post_format_set_class = '';
    144144        }
    145145
     146        $user_wants = get_user_option( 'post_formats_' . $post_type );
     147        if ( false !== $user_wants ) {
     148                // User wants what user gets.
     149                $show_post_format_ui = (bool) $user_wants;
     150        } else {
     151                // UI is shown when the theme supports formats, or if the site has formats assigned to posts.
     152                $show_post_format_ui = current_theme_supports( 'post-formats' ) || get_terms( 'post_format', array( 'number' => 1 ) );
     153        }
     154
     155        // Use $show_post_format_ui to set a class.
     156
    146157        $format_class = " class='wp-format-{$post_format}'";
    147158
    148159