Make WordPress Core

Ticket #19292: 19292.2.diff

File 19292.2.diff, 2.0 KB (added by markjaquith, 12 years ago)
  • wp-admin/js/post.dev.js

    jQuery(document).ready( function($) { 
    547547                        b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
    548548                        b.children('.save').click(function() {
    549549                                var new_slug = e.children('input').val();
     550                                if ( new_slug == $('#editable-post-name-full').text() ) {
     551                                        return $('.cancel', '#edit-slug-buttons').click();
     552                                }
    550553                                $.post(ajaxurl, {
    551554                                        action: 'sample-permalink',
    552555                                        post_id: post_id,
  • wp-includes/post.php

    function wp_insert_post($postarr, $wp_error = false) { 
    24902490                else
    24912491                        $post_name = '';
    24922492        } else {
    2493                 $post_name = sanitize_title($post_name);
     2493                // On updates, we need to check to see if it's using an old sanitization context, or the newer Save context
     2494                $check_name = sanitize_title( $post_name, '', 'query'); // sanitize_title_for_query(), but spelt out here for readability
     2495                if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $ID ) == $check_name )
     2496                        $post_name = $check_name;
     2497                else // slug has changed or uses newer (default) sanitization
     2498                        $post_name = sanitize_title($post_name);
    24942499        }
    24952500
    24962501        // If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now
    function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') { 
    31533158        $page_path = str_replace('%20', ' ', $page_path);
    31543159        $parts = explode( '/', trim( $page_path, '/' ) );
    31553160        $parts = array_map( 'esc_sql', $parts );
    3156         $parts = array_map( 'sanitize_title', $parts );
     3161        $parts = array_map( 'sanitize_title_for_query', $parts );
    31573162
    31583163        $in_string = "'". implode( "','", $parts ) . "'";
    31593164        $post_type_sql = $post_type;