Ticket #42937: 42937.2.patch
File 42937.2.patch, 2.2 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
1023 1023 ob_start(); 1024 1024 $wp_list_table->single_row( $tag ); 1025 1025 $parents = ob_get_clean(); 1026 1026 $message = sprintf( __( 'New %s created. <a href="%s"> View %s </a>' ), $tax->labels->singular_name, get_term_link( $tag ), $tax->labels->singular_name ); 1027 1027 $x->add( 1028 1028 array( 1029 1029 'what' => 'taxonomy', 1030 'data' => $message, 1030 1031 'supplemental' => compact( 'parents', 'noparents' ), 1031 1032 ) 1032 1033 ); -
src/wp-includes/js/wp-ajax-response.js
12 12 return r; 13 13 }, 14 14 parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission 15 var parsed = {}, re = jQuery('#' + r).empty(), err = '' ;15 var parsed = {}, re = jQuery('#' + r).empty(), err = '', successmsg = ''; 16 16 17 17 if ( x && typeof x == 'object' && x.getElementsByTagName('wp_ajax') ) { 18 18 parsed.responses = []; … … 21 21 var th = jQuery(this), child = jQuery(this.firstChild), response; 22 22 response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; 23 23 response.data = jQuery( 'response_data', child ).text(); 24 successmsg += response.data; 24 25 response.supplemental = {}; 25 26 if ( !jQuery( 'supplemental', child ).children().each( function() { 26 27 response.supplemental[this.nodeName] = jQuery(this).text(); … … 40 41 } ).length ) { response.errors = false; } 41 42 parsed.responses.push( response ); 42 43 } ); 43 if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); } 44 if ( err.length ) { 45 re.html( '<div class="error">' + err + '</div>' ); 46 } else { 47 re.html( '<div class="updated"><p>' + successmsg + '</p></div>' ); 48 } 44 49 return parsed; 45 50 } 46 51 if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); }