Formatting: In `sanitize_title_with_dashes()`, convert ` `, `&ndash`, and `&mdash` HTML entities to hyphens on save.
Props polevaultweb for initial patch. Fixes #31790. Built from https://develop.svn.wordpress.org/trunk@36775 git-svn-id: http://core.svn.wordpress.org/trunk@36742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2099e388bb
commit
d115144857
|
@ -1584,12 +1584,12 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = strtolower($title);
|
$title = strtolower($title);
|
||||||
$title = preg_replace('/&.+?;/', '', $title); // kill entities
|
|
||||||
$title = str_replace('.', '-', $title);
|
|
||||||
|
|
||||||
if ( 'save' == $context ) {
|
if ( 'save' == $context ) {
|
||||||
// Convert nbsp, ndash and mdash to hyphens
|
// Convert nbsp, ndash and mdash to hyphens
|
||||||
$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
|
$title = str_replace( array( '%c2%a0', '%e2%80%93', '%e2%80%94' ), '-', $title );
|
||||||
|
// Convert nbsp, ndash and mdash HTML entities to hyphens
|
||||||
|
$title = str_replace( array( ' ', ' ', '–', '–', '—', '—' ), '-', $title );
|
||||||
|
|
||||||
// Strip these characters entirely
|
// Strip these characters entirely
|
||||||
$title = str_replace( array(
|
$title = str_replace( array(
|
||||||
|
@ -1612,6 +1612,9 @@ function sanitize_title_with_dashes( $title, $raw_title = '', $context = 'displa
|
||||||
$title = str_replace( '%c3%97', 'x', $title );
|
$title = str_replace( '%c3%97', 'x', $title );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$title = preg_replace('/&.+?;/', '', $title); // kill entities
|
||||||
|
$title = str_replace('.', '-', $title);
|
||||||
|
|
||||||
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
|
$title = preg_replace('/[^%a-z0-9 _-]/', '', $title);
|
||||||
$title = preg_replace('/\s+/', '-', $title);
|
$title = preg_replace('/\s+/', '-', $title);
|
||||||
$title = preg_replace('|-+|', '-', $title);
|
$title = preg_replace('|-+|', '-', $title);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-beta1-36774';
|
$wp_version = '4.5-beta1-36775';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue