Make WordPress Core

Ticket #21152: 21152.2.diff

File 21152.2.diff, 29.2 KB (added by SergeyBiryukov, 13 years ago)

Refreshed after [21688]

  • wp-admin/includes/class-wp-comments-list-table.php

     
    288288        </tr>
    289289        </tfoot>
    290290
    291         <tbody id="the-comment-list" class="list:comment">
     291        <tbody id="the-comment-list" class="list" data-list="comment">
    292292                <?php $this->display_rows_or_placeholder(); ?>
    293293        </tbody>
    294294
    295         <tbody id="the-extra-comment-list" class="list:comment" style="display: none;">
     295        <tbody id="the-extra-comment-list" class="list" data-list="comment" style="display: none;">
    296296                <?php $this->items = $this->extra_items; $this->display_rows(); ?>
    297297        </tbody>
    298298</table>
    299299<?php
    300 
    301300                $this->display_tablenav( 'bottom' );
    302301        }
    303302
     
    391390                        );
    392391
    393392                        if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
    394                                 if ( 'approved' == $the_comment_status )
    395                                         $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
    396                                 else if ( 'unapproved' == $the_comment_status )
    397                                         $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
     393                               
     394                                if ( 'approved' == $the_comment_status ) {
     395                                        $actions['unapprove'] = sprintf( '<a href="%s" class="vim-u vim-destructive" data-context="delete" data-what="the-comment-list" data-item="comment" data-id="%d" data-dim-class="dim-comment" data-del-color"e7e7d3" data-new="unapproved" title="%s">%s</a>',
     396                                                $unapprove_url,
     397                                                $comment->comment_ID,
     398                                                esc_attr__( 'Unapprove this comment' ),
     399                                                __( 'Unapprove' )       
     400                                        );
     401                                } else if ( 'unapproved' == $the_comment_status ) {
     402                                        $actions['approve'] = sprintf( '<a href="%s" class="vim-a vim-destructive" data-context="delete" data-what="the-comment-list" data-item="dim-comment" data-id="%d" data-dim-class="approved" data-del-color"e7e7d3" data-new="approved" title="%s">%s</a>',
     403                                                $approve_url,
     404                                                $comment->comment_ID,
     405                                                esc_attr__( 'Approve this comment' ),   
     406                                                __( 'Approve' )
     407                                        );
     408                                }       
     409                               
    398410                        } else {
    399                                 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    400                                 $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
     411                                $actions['approve'] = sprintf( '<a href="%s" class="vim-a" data-context="dim" data-what="the-comment-list" data-item="comment" data-id="%d" data-dim-class="unapproved" data-color"e7e7d3" data-del-color="e7e7d3" data-new="approved" title="%s">%s</a>',
     412                                        $approve_url,
     413                                        $comment->comment_ID,
     414                                        esc_attr__( 'Approve this comment' ),   
     415                                        __( 'Approve' )
     416                                );
     417
     418                                $actions['unapprove'] = sprintf( '<a href="%s" class="vim-u" data-context="dim" data-what="the-comment-list" data-item="comment" data-id="%d" data-dim-class="unapproved" data-color"e7e7d3" data-del-color="e7e7d3" data-new="unapproved" title="%s">%s</a>',
     419                                        $unapprove_url,
     420                                        $comment->comment_ID,
     421                                        esc_attr__( 'Unapprove this comment' ),
     422                                        __( 'Unapprove' )       
     423                                );
    401424                        }
    402425
    403426                        if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
    404                                 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
     427                                $actions['spam'] = sprintf( '<a href="%s" class="vim-s vim-destructive" data-context="delete" data-what="the-comment-list" data-item="comment" data-id="%d" data-action="spam" title="%s">%s</a>',
     428                                        $spam_url,
     429                                        $comment->comment_ID,
     430                                        esc_attr__( 'Mark this comment as spam' ),
     431                                        /* translators: mark as spam link */
     432                                        _x( 'Spam', 'verb' )
     433                                );
    405434                        } elseif ( 'spam' == $the_comment_status ) {
    406                                 $actions['unspam'] = "<a href='$unspam_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1 vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
     435                                $actions['unspam'] = sprintf( '<a href="%s" class="vim-z vim-destructive" data-context="delete" data-what="the-comment-list" data-item="comment" data-id="%d" data-action="unspam" data-del-color="66cc66">%s</a>',
     436                                        $unspam_url,
     437                                        $comment->comment_ID,
     438                                        _x( 'Not Spam', 'comment' )
     439                                );
    407440                        } elseif ( 'trash' == $the_comment_status ) {
    408                                 $actions['untrash'] = "<a href='$untrash_url' class='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1 vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
     441                                $actions['untrash'] = sprintf( '<a href="%s" class="vim-z vim-destructive" data-context="delete" data-what="the-comment-list" data-item="comment" data-id="%d" data-action="untrash" data-del-color="66cc66">%s</a>',
     442                                        $untrash_url,
     443                                        $comment->comment_ID,
     444                                        __( 'Restore' )
     445                                );
    409446                        }
    410447
    411                         if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
    412                                 $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';
     448                        if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || ! EMPTY_TRASH_DAYS ) {
     449                                $actions['delete'] = sprintf(
     450                                        '<a href="%s" class="vim-d vim-destructive" data-context="delete" data-what="the-comment-list" data-item="comment" data-id="%d" data-action="delete">%s</a>',
     451                                        $delete_url,
     452                                        $comment->comment_ID,
     453                                        __( 'Delete Permanently' )
     454                                );
    413455                        } else {
    414                                 $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
     456                                $actions['trash'] = sprintf( '<a href="%s" class="vim-d vim-destructive" data-context="delete" data-what="the-comment-list" data-item="comment" data-id="%d" data-action="trash" title="%s">%s</a>',
     457                                        $trash_url,
     458                                        $comment->comment_ID,
     459                                        esc_attr__( 'Move this comment to the trash' ),
     460                                        _x( 'Trash', 'verb' )
     461                                );
    415462                        }
    416463
    417464                        if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
     
    548595                wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
    549596?>
    550597<table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;">
    551         <tbody id="the-comment-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
     598        <tbody id="the-comment-list"<?php if ( $singular ) printf( ' class="list" data-list="%s"', $singular ) ?>>
    552599                <?php if ( ! $output_empty ) $this->display_rows_or_placeholder(); ?>
    553600        </tbody>
    554601</table>
  • wp-admin/includes/class-wp-list-table.php

     
    735735        </tr>
    736736        </tfoot>
    737737
    738         <tbody id="the-list"<?php if ( $singular ) echo " class='list:$singular'"; ?>>
     738        <tbody id="the-list"<?php if ( $singular ) printf( ' class="list" data-list="%s"', $singular ) ?>>
    739739                <?php $this->display_rows_or_placeholder(); ?>
    740740        </tbody>
    741741</table>
  • wp-admin/includes/dashboard.php

     
    614614        }
    615615
    616616        if ( $comments ) {
    617                 echo '<div id="the-comment-list" class="list:comment">';
     617                echo '<div id="the-comment-list" class="list" data-list="comment">';
    618618                foreach ( $comments as $comment )
    619619                        _wp_dashboard_recent_comments_row( $comment );
    620620                echo '</div>';
     
    657657                $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
    658658                $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
    659659
    660                 $actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
    661                 $actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
     660                $actions['approve'] = sprintf( '<a href="%s" class="vim-a" data-context="dim" data-what="the-comment-list" data-item="comment" data-id="%d" data-dim-class="unapproved" data-color"e7e7d3" data-del-color"e7e7d3" data-new="approved" title="%s">%s</a>',
     661                        $approve_url,
     662                        $comment->comment_ID,
     663                        esc_attr__( 'Approve this comment' ),   
     664                        __( 'Approve' )
     665                );                     
     666               
     667                $actions['unapprove'] = sprintf( '<a href="%s" class="vim-u" data-context="dim" data-what="the-comment-list" data-item="comment" data-id="%d" data-dim-class="unapproved" data-color"e7e7d3" data-del-color"e7e7d3" data-new="unapproved" title="%s">%s</a>',
     668                        $unapprove_url,
     669                        $comment->comment_ID,
     670                        esc_attr__( 'Unapprove this comment' ),
     671                        __( 'Unapprove' )       
     672                );
     673
    662674                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
    663675                $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
    664                 $actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1 vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
    665                 if ( !EMPTY_TRASH_DAYS )
    666                         $actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
    667                 else
    668                         $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
     676               
     677                $actions['spam'] = sprintf( '<a href="%s" class="vim-s vim-destructive" data-context="delete" data-what="the-comment-list" data-id="%s" data-action="spam" title="%s">%s</a>',
     678                        $spam_url,
     679                        $comment->comment_ID,
     680                        esc_attr__( 'Mark this comment as spam' ),
     681                        /* translators: mark as spam link */
     682                        _x( 'Spam', 'verb' )
     683                );
     684               
     685                if ( ! EMPTY_TRASH_DAYS ) {
     686                        $actions['delete'] = sprintf( '<a href="%s" class="delete vim-d vim-destructive" data-context="delete" data-what="the-comment-list" data-id="%s" data-action="trash">%s</a>',
     687                                $delete_url,
     688                                $comment->comment_ID,
     689                                __( 'Delete Permanently' )
     690                        );             
     691                } else {
     692                        $actions['trash'] = sprintf( '<a href="%s" class="delete vim-d vim-destructive" data-context="delete" data-what="the-comment-list" data-id="%s" data-action="trash" title="%s">%s</a>',
     693                                $trash_url,
     694                                $comment->comment_ID,
     695                                esc_attr__( 'Move this comment to the trash' ),
     696                                _x( 'Trash', 'verb' )
     697                        );             
     698                }
    669699
    670700                $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
    671701
  • wp-admin/includes/meta-boxes.php

     
    333333            $name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';
    334334            echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
    335335            ?>
    336                         <ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear">
     336                        <ul id="<?php echo $taxonomy; ?>checklist" class="list categorychecklist form-no-clear" data-list="<?php echo $taxonomy ?>">
    337337                                <?php wp_terms_checklist($post->ID, array( 'taxonomy' => $taxonomy, 'popular_cats' => $popular_ids ) ) ?>
    338338                        </ul>
    339339                </div>
     
    354354                                                <?php echo $tax->labels->parent_item_colon; ?>
    355355                                        </label>
    356356                                        <?php wp_dropdown_categories( array( 'taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new'.$taxonomy.'_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;' ) ); ?>
    357                                         <input type="button" id="<?php echo $taxonomy; ?>-add-submit" class="add:<?php echo $taxonomy ?>checklist:<?php echo $taxonomy ?>-add button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
     357                                        <input type="button" id="<?php echo $taxonomy; ?>-add-submit" data-context="add" data-what="<?php echo $taxonomy ?>checklist" data-action="add-<?php echo $taxonomy ?>" data-id="<?php echo $taxonomy ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
    358358                                        <?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce-add-'.$taxonomy, false ); ?>
    359359                                        <span id="<?php echo $taxonomy; ?>-ajax-response"></span>
    360360                                </p>
     
    665665        </ul>
    666666
    667667        <div id="categories-all" class="tabs-panel">
    668                 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
     668                <ul id="categorychecklist" class="list categorychecklist form-no-clear" data-list="category">
    669669                        <?php
    670670                        if ( isset($link->link_id) )
    671671                                wp_link_category_checklist($link->link_id);
     
    686686                <p id="link-category-add" class="wp-hidden-child">
    687687                        <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
    688688                        <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
    689                         <input type="button" id="link-category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" />
     689                        <input type="button" id="link-category-add-submit" data-context="add" data-what="categorychecklist" data-action="add-link-category" data-id="linkcategorydiv" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
    690690                        <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
    691691                        <span id="category-ajax-response"></span>
    692692                </p>
  • wp-admin/includes/nav-menu.php

     
    696696                                <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
    697697                        </p>
    698698
    699                         <ul id="<?php echo $post_type_name; ?>-search-checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">
     699                        <ul id="<?php echo $post_type_name; ?>-search-checklist" class="categorychecklist form-no-clear" data-list="<?php echo $post_type_name ?>">
    700700                        <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
    701701                                <?php
    702702                                $args['walker'] = $walker;
     
    718718                                        <?php echo $page_links; ?>
    719719                                </div>
    720720                        <?php endif; ?>
    721                         <ul id="<?php echo $post_type_name; ?>checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">
     721                        <ul id="<?php echo $post_type_name; ?>checklist" class="categorychecklist form-no-clear" data-list="<?php echo $post_type_name ?>">
    722722                                <?php
    723723                                $args['walker'] = $walker;
    724724
     
    896896                                        <?php echo $page_links; ?>
    897897                                </div>
    898898                        <?php endif; ?>
    899                         <ul id="<?php echo $taxonomy_name; ?>checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
     899                        <ul id="<?php echo $taxonomy_name; ?>checklist" class="categorychecklist form-no-clear" data-list="<?php echo $taxonomy_name ?>">
    900900                                <?php
    901901                                $args['walker'] = $walker;
    902902                                echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
     
    927927                                <?php submit_button( __( 'Search' ), 'quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
    928928                        </p>
    929929
    930                         <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">
     930                        <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="categorychecklist form-no-clear" data-list="<?php echo $taxonomy_name ?>">
    931931                        <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
    932932                                <?php
    933933                                $args['walker'] = $walker;
  • wp-admin/js/cat.js

     
    11jQuery(document).ready( function($) {
    22        var myConfirm = function() { return '' !== $('#newcat').val(); };
    3         $('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>');
     3        $('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" data-context="add" data-what="categorychecklist" data-id="jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>');
    44        $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response', confirm: myConfirm } );
    55} );
  • wp-admin/js/edit-comments.js

     
    3535
    3636        // Send current total, page, per_page and url
    3737        delBefore = function( settings, list ) {
    38                 var cl = $(settings.target).attr('class'), id, el, n, h, a, author, action = false;
     38                var target = $(settings.target), id, el, n, h, a, author, action = false;
     39               
     40                if ( 'spam' == target.data('action') || 'trash' == target.data('action') )
     41                        action = target.data('action');
    3942
    4043                settings.data._total = totalInput.val() || 0;
    4144                settings.data._per_page = perPageInput.val() || 0;
     
    4346                settings.data._url = document.location.href;
    4447                settings.data.comment_status = $('input[name="comment_status"]', '#comments-form').val();
    4548
    46                 if ( cl.indexOf(':trash=1') != -1 )
    47                         action = 'trash';
    48                 else if ( cl.indexOf(':spam=1') != -1 )
    49                         action = 'spam';
    50 
    5149                if ( action ) {
    52                         id = cl.replace(/.*?comment-([0-9]+).*/, '$1');
     50                        id = target.data('id');
    5351                        el = $('#comment-' + id);
     52
    5453                        note = $('#' + action + '-undo-holder').html();
    5554
    5655                        el.find('.check-column :checkbox').prop('checked', false); // Uncheck the row so as not to be affected by Bulk Edits.
     
    7170
    7271                        $('strong', '#undo-' + id).text(author);
    7372                        a = $('.undo a', '#undo-' + id);
    74                         a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
    75                         a.attr('class', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1 vim-z vim-destructive');
     73                        a.attr({
     74                                'href' : 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce,
     75                                'class' : 'vim-z vim-destructive',
     76                                'data-context' : 'delete',
     77                                'data-what' : 'the-comment-list',
     78                                'data-item' : 'comment',
     79                                'data-id' : id,
     80                                'data-action' : 'un' + action
     81                        });
     82                       
    7683                        $('.avatar', el).clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
    7784
    7885                        a.click(function(){
     
    279286        theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
    280287        theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
    281288                .bind('wpListDelEnd', function(e, s){
    282                         var id = s.element.replace(/[^0-9]+/g, '');
     289                        var id = s.element.replace(/[^0-9]+/g, ''), target = $(s.target);
    283290
    284                         if ( s.target.className.indexOf(':trash=1') != -1 || s.target.className.indexOf(':spam=1') != -1 )
     291                        if ( 'trash' == target.data('action') || 'spam' == target.data('action') )
    285292                                $('#undo-' + id).fadeIn(300, function(){ $(this).show() });
    286293                });
    287294};
  • wp-admin/press-this.php

     
    506506                                        </div>
    507507
    508508                                        <div id="category-all" class="tabs-panel">
    509                                                 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
     509                                                <ul id="categorychecklist" class="list categorychecklist form-no-clear" data-list="category">
    510510                                                        <?php wp_terms_checklist($post_ID, array( 'taxonomy' => 'category', 'popular_cats' => $popular_ids ) ) ?>
    511511                                                </ul>
    512512                                        </div>
     
    528528                                                                        <?php echo $tax->labels->parent_item_colon; ?>
    529529                                                                </label>
    530530                                                                <?php wp_dropdown_categories( array( 'taxonomy' => 'category', 'hide_empty' => 0, 'name' => 'newcategory_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '&mdash; ' . $tax->labels->parent_item . ' &mdash;' ) ); ?>
    531                                                                 <input type="button" id="category-add-submit" class="add:categorychecklist:category-add button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
     531                                                                <input type="button" id="category-add-submit" data-context="add" data-what="categorychecklist" data-id="category-add" class="button category-add-submit" value="<?php echo esc_attr( $tax->labels->add_new_item ); ?>" />
    532532                                                                <?php wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false ); ?>
    533533                                                                <span id="category-ajax-response"></span>
    534534                                                        </p>
  • wp-admin/user-new.php

     
    267267                $label = __('E-mail or Username');
    268268        }
    269269?>
    270 <form action="" method="post" name="adduser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
     270<form action="" method="post" name="adduser" id="adduser" class="validate"<?php do_action('user_new_form_tag');?>>
    271271<input name="action" type="hidden" value="adduser" />
    272272<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
    273273
     
    300300                echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>';
    301301?>
    302302<p><?php _e('Create a brand new user and add it to this site.'); ?></p>
    303 <form action="" method="post" name="createuser" id="createuser" class="add:users: validate"<?php do_action('user_new_form_tag');?>>
     303<form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action('user_new_form_tag');?>>
    304304<input name="action" type="hidden" value="createuser" />
    305305<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ) ?>
    306306<?php
  • wp-includes/js/wp-lists.js

     
    2121                return s.nonce || url._ajax_nonce || $('#' + s.element + ' input[name="_ajax_nonce"]').val() || url._wpnonce || $('#' + s.element + ' input[name="_wpnonce"]').val() || 0;
    2222        },
    2323
    24         parseClass: function(e,t) {
    25                 var c = [], cl;
    26 
    27                 try {
    28                         cl = $(e).attr('class') || '';
    29                         cl = cl.match(new RegExp(t+':[\\S]+'));
    30 
    31                         if ( cl )
    32                                 c = cl[0].split(':');
    33                 } catch(r) {}
    34 
    35                 return c;
    36         },
    37 
    3824        pre: function(e,s,a) {
    3925                var bg, r;
    4026
     
    6450        ajaxAdd: function( e, s ) {
    6551                e = $(e);
    6652                s = s || {};
    67                 var list = this, cls = wpList.parseClass(e,'add'), es, valid, formData, res, rres;
     53                var list = this, es, valid, formData, res, rres;
    6854
    6955                s = wpList.pre.call( list, e, s, 'add' );
     56               
     57                s.element = $(e).data('id') || s.element || null;
     58                s.addColor = s.addColor || '#FFFF33';
    7059
    71                 s.element = cls[2] || e.attr( 'id' ) || s.element || null;
    72 
    73                 if ( cls[3] )
    74                         s.addColor = '#' + cls[3];
    75                 else
    76                         s.addColor = s.addColor || '#FFFF33';
    77 
    7860                if ( !s )
    7961                        return false;
    8062
     
    9476                if ( !valid )
    9577                        return false;
    9678
    97                 s.data = $.param( $.extend( { _ajax_nonce: s.nonce, action: s.action }, wpAjax.unserialize( cls[4] || '' ) ) );
     79                s.data = $.param( { _ajax_nonce: s.nonce, action: s.action } );
    9880                formData = $.isFunction(es.fieldSerialize) ? es.fieldSerialize() : es.serialize();
    9981
    10082                if ( formData )
    10183                        s.data += '&' + formData;
    102 
     84       
    10385                if ( $.isFunction(s.addBefore) ) {
    10486                        s = s.addBefore( s );
    10587                        if ( !s )
     
    147129        ajaxDel: function( e, s ) {
    148130                e = $(e);
    149131                s = s || {};
    150                 var list = this, cls = wpList.parseClass(e,'delete'), element, res, rres;
     132                var list = this, element, res, rres;
    151133
    152134                s = wpList.pre.call( list, e, s, 'delete' );
    153135
    154                 s.element = cls[2] || s.element || null;
    155 
    156                 if ( cls[3] )
    157                         s.delColor = '#' + cls[3];
     136                s.element = ( e.data('item') + '-' + e.data('id') ) || s.element || null;
     137               
     138                if ( e.data('del-color') )
     139                        s.delColor = '#' + e.data('del-color');
    158140                else
    159141                        s.delColor = s.delColor || '#faa';
    160142
     
    165147
    166148                s.nonce = wpList.nonce(e,s);
    167149
    168                 s.data = $.extend(
    169                         { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce },
    170                         wpAjax.unserialize( cls[4] || '' )
    171                 );
     150                s.data = { action: s.action, id: s.element.split('-').pop(), _ajax_nonce: s.nonce };
     151                       
     152                if ( e.data('action') )
     153                        s.data[e.data('action')] = 1;
    172154
    173155                if ( $.isFunction(s.delBefore) ) {
    174156                        s = s.delBefore( s, list );
     
    190172                        list.wpList.recolor();
    191173                        $(list).trigger( 'wpListDelEnd', [ s, list.wpList ] );
    192174                }
    193 
     175               
    194176                s.success = function(r) {
    195177                        res = wpAjax.parseAjaxResponse(r, s.response, s.element);
    196178                        rres = r;
     
    221203                e = $(e);
    222204                s = s || {};
    223205
    224                 var list = this, cls = wpList.parseClass(e,'dim'), element, isClass, color, dimColor, res, rres;
     206                var list = this, element, isClass, color, dimColor, res, rres;
    225207
    226208                s = wpList.pre.call( list, e, s, 'dim' );
    227209
    228                 s.element = cls[2] || s.element || null;
    229                 s.dimClass =  cls[3] || s.dimClass || null;
     210                s.element = ( e.data('item') + '-' + e.data('id') ) || s.element || null;
     211                s.dimClass = e.data('dim-class') || s.dimClass || null;
    230212
    231                 if ( cls[4] )
    232                         s.dimAddColor = '#' + cls[4];
     213                if ( e.data('color') )
     214                        s.dimAddColor = '#' + e.data('color');
    233215                else
    234216                        s.dimAddColor = s.dimAddColor || '#FFFF33';
    235217
    236                 if ( cls[5] )
    237                         s.dimDelColor = '#' + cls[5];
     218                if ( e.data('del-color') )
     219                        s.dimDelColor = '#' + e.data('del-color');
    238220                else
    239221                        s.dimDelColor = s.dimDelColor || '#FF3333';
    240222
     
    245227
    246228                s.nonce = wpList.nonce(e,s);
    247229
    248                 s.data = $.extend(
    249                         { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce },
    250                         wpAjax.unserialize( cls[6] || '' )
    251                 );
     230                s.data = { action: s.action, id: s.element.split('-').pop(), dimClass: s.dimClass, _ajax_nonce : s.nonce };
    252231
     232                if ( e.data('new') )
     233                        s.data['new'] = e.data('new');
     234
    253235                if ( $.isFunction(s.dimBefore) ) {
    254236                        s = s.dimBefore( s );
    255237                        if ( !s )
     
    393375                var list = this,
    394376                        $el = $(el || document);
    395377
    396                 $el.delegate( 'form[class^="add:' + list.id + ':"]', 'submit', function(){
     378                $el.delegate( 'form[data-context="add"][data-what="' + list.id + '"]', 'submit', function(){
    397379                        return list.wpList.add(this);
    398380                });
    399381
    400                 $el.delegate( '[class^="add:' + list.id + ':"]:not(form)', 'click', function(){
     382                $el.delegate( '[data-context="add"][data-what="' + list.id + '"]:not(form)', 'click', function(){
    401383                        return list.wpList.add(this);
    402384                });
    403385
    404                 $el.delegate( '[class^="delete:' + list.id + ':"]', 'click', function(){
     386                $el.delegate( '[data-context="delete"][data-what="' + list.id + '"]', 'click', function(){
    405387                        return list.wpList.del(this);
    406388                });
    407389
    408                 $el.delegate( '[class^="dim:' + list.id + ':"]', 'click', function(){
     390                $el.delegate( '[data-context="dim"][data-what="' + list.id + '"]', 'click', function(){
    409391                        return list.wpList.dim(this);
    410392                });
    411393        },
     
    449431$.fn.wpList = function( settings ) {
    450432        this.each( function() {
    451433                var _this = this;
    452 
    453                 this.wpList = { settings: $.extend( {}, wpList.settings, { what: wpList.parseClass(this,'list')[1] || '' }, settings ) };
     434                this.wpList = { settings: $.extend( {}, wpList.settings, { what: $(this).data('list') || '' }, settings ) };
    454435                $.each( fs, function(i,f) { _this.wpList[i] = function( e, s ) { return wpList[f].call( _this, e, s ); }; } );
    455436        } );
    456437