Fix curly quotes around numbers when applicable.

Adds unit tests.

Props filosofo, mrmist, aliso, MikeHansenMe, miqrogroove.
Fixes #8775.

Built from https://develop.svn.wordpress.org/trunk@28721


git-svn-id: http://core.svn.wordpress.org/trunk@28535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-10 02:43:14 +00:00
parent 5219bbbbc9
commit f8b03aa528
1 changed files with 8 additions and 0 deletions

View File

@ -88,6 +88,14 @@ function wptexturize($text) {
// Pattern-based replacements of characters.
$dynamic = array();
// Quoted Numbers like "42" or '42.00'
if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
$dynamic[ '/(?<=\A|' . $spaces . ')"(\d[\d\.\,]*)"/' ] = $opening_quote . '$1' . $closing_quote;
}
if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
$dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
}
// '99 '99s '99's (apostrophe)
if ( "'" !== $apos ) {
$dynamic[ '/\'(?=\d)/' ] = $apos;