From f8b03aa52875e70f3d04787516f595d0754583ed Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 10 Jun 2014 02:43:14 +0000 Subject: [PATCH] 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 --- wp-includes/formatting.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index be2292502b..94000b3995 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -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;