Switch to sanitize_title_for_query() for Query sanitization (allows for pre-3.3 page slugs to be viewable), Don't update page slugs to new slug-types when the slug is not being changed, Don't issue a XHR if the page slug hasn't changed. Group effort props xknown, markjaquith, nacin. See #19292
git-svn-id: http://svn.automattic.com/wordpress/trunk@19444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1611327f11
commit
c85525aece
|
@ -547,6 +547,9 @@ jQuery(document).ready( function($) {
|
|||
b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
|
||||
b.children('.save').click(function() {
|
||||
var new_slug = e.children('input').val();
|
||||
if ( new_slug == $('#editable-post-name-full').text() ) {
|
||||
return $('.cancel', '#edit-slug-buttons').click();
|
||||
}
|
||||
$.post(ajaxurl, {
|
||||
action: 'sample-permalink',
|
||||
post_id: post_id,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2490,6 +2490,11 @@ function wp_insert_post($postarr, $wp_error = false) {
|
|||
else
|
||||
$post_name = '';
|
||||
} else {
|
||||
// On updates, we need to check to see if it's using the old, fixed sanitization context.
|
||||
$check_name = sanitize_title( $post_name, '', 'old-save' );
|
||||
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $ID ) == $check_name )
|
||||
$post_name = $check_name;
|
||||
else // new post, or slug has changed.
|
||||
$post_name = sanitize_title($post_name);
|
||||
}
|
||||
|
||||
|
@ -3153,7 +3158,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
|
|||
$page_path = str_replace('%20', ' ', $page_path);
|
||||
$parts = explode( '/', trim( $page_path, '/' ) );
|
||||
$parts = array_map( 'esc_sql', $parts );
|
||||
$parts = array_map( 'sanitize_title', $parts );
|
||||
$parts = array_map( 'sanitize_title_for_query', $parts );
|
||||
|
||||
$in_string = "'". implode( "','", $parts ) . "'";
|
||||
$post_type_sql = $post_type;
|
||||
|
|
|
@ -1838,7 +1838,7 @@ class WP_Query {
|
|||
}
|
||||
|
||||
if ( !empty($q['tag_slug__in']) ) {
|
||||
$q['tag_slug__in'] = array_map('sanitize_title', array_unique( (array) $q['tag_slug__in'] ) );
|
||||
$q['tag_slug__in'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) );
|
||||
$tax_query[] = array(
|
||||
'taxonomy' => 'post_tag',
|
||||
'terms' => $q['tag_slug__in'],
|
||||
|
@ -1847,7 +1847,7 @@ class WP_Query {
|
|||
}
|
||||
|
||||
if ( !empty($q['tag_slug__and']) ) {
|
||||
$q['tag_slug__and'] = array_map('sanitize_title', array_unique( (array) $q['tag_slug__and'] ) );
|
||||
$q['tag_slug__and'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) );
|
||||
$tax_query[] = array(
|
||||
'taxonomy' => 'post_tag',
|
||||
'terms' => $q['tag_slug__and'],
|
||||
|
|
|
@ -311,7 +311,7 @@ function wp_default_scripts( &$scripts ) {
|
|||
|
||||
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20111009a', 1 );
|
||||
|
||||
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20110524', 1 );
|
||||
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), '20111124', 1 );
|
||||
$scripts->localize( 'post', 'postL10n', array(
|
||||
'ok' => __('OK'),
|
||||
'cancel' => __('Cancel'),
|
||||
|
|
Loading…
Reference in New Issue