Make WordPress Core

Ticket #31449: 31449.patch

File 31449.patch, 9.1 KB (added by afercia, 10 years ago)
  • src/wp-admin/css/press-this.css

     
    217217}
    218218
    219219fieldset {
    220         border: 1px solid #c0c0c0;
    221         margin: 0 2px;
    222         padding: 0.35em 0.625em 0.75em;
     220        border: 0;
     221        margin: 0;
     222        padding: 0;
    223223}
    224224
    225225legend {
  • src/wp-admin/includes/class-wp-press-this.php

     
    133133                if ( empty( $_POST['post_ID'] ) || ! $post_id = (int) $_POST['post_ID'] ) {
    134134                        wp_send_json_error( array( 'errorMessage' => __( 'Missing post ID.' ) ) );
    135135                }
    136        
     136
    137137                if ( ! current_user_can( 'edit_post', $post_id ) ) {
    138138                        wp_send_json_error( array( 'errorMessage' => __( 'Cheatin’ uh?' ) ) );
    139139                }
    140        
     140
    141141                $post = array(
    142142                        'ID'            => $post_id,
    143143                        'post_title'    => ( ! empty( $_POST['title'] ) ) ? sanitize_text_field( trim( $_POST['title'] ) ) : '',
     
    148148                        'tax_input'     => ( ! empty( $_POST['tax_input'] ) ) ? $_POST['tax_input'] : array(),
    149149                        'post_category' => ( ! empty( $_POST['post_category'] ) ) ? $_POST['post_category'] : array(),
    150150                );
    151        
     151
    152152                if ( ! empty( $_POST['post_status'] ) && 'publish' === $_POST['post_status'] ) {
    153153                        if ( current_user_can( 'publish_posts' ) ) {
    154154                                $post['post_status'] = 'publish';
     
    164164                }
    165165
    166166                $updated = wp_update_post( $post, true );
    167        
     167
    168168                if ( is_wp_error( $updated ) || intval( $updated ) < 1 ) {
    169169                        wp_send_json_error( array( 'errorMessage' => __( 'Error while saving the post. Please try again later.' ) ) );
    170170                } else {
     
    192192                                /** This filter is documented in wp-admin/includes/class-wp-press-this.php */
    193193                                $redirect = apply_filters( 'press_this_save_redirect', get_edit_post_link( $post_id, 'raw' ), $post_id, $post['post_status'] );
    194194                        }
    195        
     195
    196196                        wp_send_json_success( array( 'redirect' => $redirect ) );
    197197                }
    198198        }
     
    537537
    538538                                ?>
    539539                                <div id="post-formats-select">
     540                                <fieldset><legend class="screen-reader-text"><?php _e( 'Post formats' ); ?></legend>
    540541                                        <input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> />
    541542                                        <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
    542543                                        <?php
     
    550551                                                <?php
    551552                                         }
    552553                                         ?>
     554                                </fieldset>
    553555                                </div>
    554556                                <?php
    555557                        }
     
    569571
    570572                if ( current_user_can( $taxonomy->cap->edit_terms ) ) {
    571573                        ?>
    572                         <button type="button" class="add-cat-toggle button-subtle">
    573                                 <span class="dashicons dashicons-plus"></span>
     574                        <button type="button" class="add-cat-toggle button-subtle" aria-expanded="false">
     575                                <span class="dashicons dashicons-plus"></span><span class="screen-reader-text"><?php _e( 'Toggle add category' ); ?></span>
    574576                        </button>
    575577                        <div class="add-category is-hidden">
    576578                                <label class="screen-reader-text" for="new-category"><?php echo $taxonomy->labels->add_new_item; ?></label>
     
    592594                        </div>
    593595                <?php } ?>
    594596                <div class="categories-search-wrapper">
    595                         <input id="categories-search" type="search" class="categories-search" placeholder="<?php esc_attr_e( 'Search categories' ) ?>">
     597                        <input id="categories-search" type="search" class="categories-search" placeholder="<?php esc_attr_e( 'Search categories by name' ) ?>">
    596598                        <label for="categories-search">
    597                                 <span class="dashicons dashicons-search"></span>
     599                                <span class="dashicons dashicons-search"></span><span class="screen-reader-text"><?php _e( 'Search categories' ); ?></span>
    598600                        </label>
    599601                </div>
    600                 <ul class="categories-select">
     602                <ul class="categories-select" aria-label="<?php esc_attr_e( 'Categories' ); ?>">
    601603                        <?php wp_terms_checklist( $post->ID, array( 'taxonomy' => 'category' ) ); ?>
    602604                </ul>
    603605                <?php
     
    645647                <?php
    646648                if ( $user_can_assign_terms ) {
    647649                        ?>
    648                         <p>
    649                                 <a href="#titlediv" class="tagcloud-link" id="link-post_tag"><?php echo $taxonomy->labels->choose_from_most_used; ?></a>
    650                         </p>
     650                        <button type="button" class="button-reset button-link tagcloud-link" id="link-post_tag"><?php echo $taxonomy->labels->choose_from_most_used; ?></button>
    651651                        <?php
    652652                }
    653653        }
     
    756756
    757757        <div id="scanbar" class="scan">
    758758                <form method="GET">
     759                        <label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
    759760                        <input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
    760761                        <input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
    761762                </form>
     
    841842
    842843                        <?php if ( $supports_formats ) : ?>
    843844                                <div class="setting-modal is-off-screen is-hidden">
    844                                         <button type="button" class="button-reset modal-close">
    845                                                 <span class="dashicons dashicons-arrow-left-alt2"></span><span class="setting-title"><?php _e( 'Post format' ); ?></span>
    846                                         </button>
     845                                        <button type="button" class="button-reset modal-close"><span class="dashicons dashicons-arrow-left-alt2"></span><span class="setting-title" aria-hidden="true"><?php _e( 'Post format' ); ?></span><span class="screen-reader-text"><?php _e( 'Back to post options' ) ?></span></button>
    847846                                        <?php $this->post_formats_html( $post ); ?>
    848847                                </div>
    849848                        <?php endif; ?>
    850849
    851850                        <div class="setting-modal is-off-screen is-hidden">
    852                                 <button type="button" class="button-reset modal-close"><span class="dashicons dashicons-arrow-left-alt2"></span><span class="setting-title"><?php _e( 'Categories' ); ?></span></button>
     851                                <button type="button" class="button-reset modal-close"><span class="dashicons dashicons-arrow-left-alt2"></span><span class="setting-title" aria-hidden="true"><?php _e( 'Categories' ); ?></span><span class="screen-reader-text"><?php _e( 'Back to post options' ) ?></span></button>
    853852                                <?php $this->categories_html( $post ); ?>
    854853                        </div>
    855854
    856855                        <div class="setting-modal tags is-off-screen is-hidden">
    857                                 <button type="button" class="button-reset modal-close"><span class="dashicons dashicons-arrow-left-alt2"></span><span class="setting-title"><?php _e( 'Tags' ); ?></span></button>
     856                                <button type="button" class="button-reset modal-close"><span class="dashicons dashicons-arrow-left-alt2"></span><span class="setting-title" aria-hidden="true"><?php _e( 'Tags' ); ?></span><span class="screen-reader-text"><?php _e( 'Back to post options' ) ?></span></button>
    858857                                <?php $this->tags_html( $post ); ?>
    859858                        </div>
    860859                </div><!-- .options-panel -->
  • src/wp-admin/js/press-this.js

     
    810810                                $targetSettingModal
    811811                                        .removeClass( isOffScreen + ' ' + isHidden )
    812812                                        .one( transitionEndEvent, function() {
    813                                                 $( this ).find( $modalClose ).focus();
     813                                                $( this ).find( '.modal-close' ).focus();
    814814                                        } );
    815815                        } );
    816816
     
    827827                                        .addClass( isOffScreen )
    828828                                        .one( transitionEndEvent, function() {
    829829                                                $( this ).addClass( isHidden );
     830                                                $postOption.eq( index - 1 ).focus();
    830831                                        } );
    831832
    832833                                // For browser that don't support transitionend.
     
    833834                                if ( ! transitionEndEvent ) {
    834835                                        setTimeout( function() {
    835836                                                $targetSettingModal.addClass( isHidden );
     837                                                $postOption.eq( index - 1 ).focus();
    836838                                        }, 350 );
    837839                                }
    838 
    839                                 $postOption.eq( index - 1 ).focus();
    840840                        } );
    841841                }
    842842
     
    964964
    965965                        $( 'button.add-cat-toggle' ).on( 'click.press-this', function() {
    966966                                $( this ).toggleClass( 'is-toggled' );
     967                                $( this ).attr( 'aria-expanded', $( this ).attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
    967968                                $( '.setting-modal .add-category' ).toggleClass( 'is-hidden' );
    968969                                $( '.categories-search-wrapper' ).toggleClass( 'is-hidden' );
    969970                        } );
  • src/wp-admin/js/tags-box.js

     
    1818
    1919                return out;
    2020        };
    21        
     21
    2222        tagBox = {
    2323                clean : function(tags) {
    2424                        var comma = window.tagsBoxL10n.tagDelimiter;
     
    193193                        });
    194194
    195195                        // tag cloud
    196                         $('a.tagcloud-link').click(function(){
     196                        $('.tagcloud-link').click(function(){
    197197                                tagBox.get( $(this).attr('id') );
    198198                                $(this).unbind().click(function(){
    199199                                        $(this).siblings('.the-tagcloud').toggle();
  • src/wp-admin/tools.php

     
    5757                        </button>
    5858                </p>
    5959
    60                 <div class="hidden js-pressthis-code-wrap">
     60                <div class="hidden js-pressthis-code-wrap" id="pressthis-code-wrap">
    6161                        <p id="pressthis-code-desc">
    6262                                <?php _e( 'If you can\'t drag it to your bookmarks, copy the following code and create new bookmark. Paste the code into the new bookmark\'s URL field.' ) ?>
    6363                        </p>