Cache internal linking nonce jQuery object. props mitchoyoshitaka. Update this nonce through autosave. fixes #18403.

git-svn-id: http://svn.automattic.com/wordpress/trunk@18820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-09-29 21:39:55 +00:00
parent 2a38f122ab
commit f186494c9a
4 changed files with 5 additions and 3 deletions

View File

@ -998,6 +998,7 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
$supplemental['replace-getpermalinknonce'] = wp_create_nonce('getpermalink');
$supplemental['replace-samplepermalinknonce'] = wp_create_nonce('samplepermalink');
$supplemental['replace-closedpostboxesnonce'] = wp_create_nonce('closedpostboxes');
$supplemental['replace-_ajax_linking_nonce'] = wp_create_nonce( 'internal-linking' );
if ( $id ) {
if ( $_POST['post_type'] == 'post' )
$supplemental['replace-_wpnonce'] = wp_create_nonce('update-post_' . $id);

View File

@ -16,6 +16,7 @@ var wpLink;
inputs.submit = $('#wp-link-submit');
// URL
inputs.url = $('#url-field');
inputs.nonce = $('#_ajax_linking_nonce');
// Secondary options
inputs.title = $('#link-title-field');
// Advanced Options
@ -569,7 +570,7 @@ var wpLink;
query = {
action : 'wp-link-ajax',
page : this.page,
'_ajax_linking_nonce' : $('#_ajax_linking_nonce').val()
'_ajax_linking_nonce' : inputs.nonce.val()
};
if ( this.search )

File diff suppressed because one or more lines are too long

View File

@ -261,7 +261,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", false, '20110925' );
$scripts->add_data( 'admin-bar', 'group', 1 );
$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), '20110802', 1 );
$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), '20110929', 1 );
$scripts->add_script_data( 'wplink', 'wpLinkL10n', array(
'title' => __('Insert/edit link'),
'update' => __('Update'),