From 2bac3b660f9b83ec42a5930a1d6adfd2a17c8823 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 17 Jun 2014 20:14:15 +0000 Subject: [PATCH] In `wptexturize()`, adjust for the treatment of abbreviated years at the end of quotations. Silence some unit tests that have never passed and may no longer be applicable. Props miqrogroove. Fixes #18549. Built from https://develop.svn.wordpress.org/trunk@28764 git-svn-id: http://core.svn.wordpress.org/trunk@28577 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index d71924fdd1..cfc1e52130 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -102,11 +102,15 @@ function wptexturize($text, $reset = false) { // Pattern-based replacements of characters. $dynamic = array(); - // '99' is an ambiguous case among other patterns; assume it's an abbreviated year at the end of a quotation. - if ( "'" !== $apos && "'" !== $closing_single_quote ) { + // '99' and '99" are ambiguous among other patterns; assume it's an abbreviated year at the end of a quotation. + if ( "'" !== $apos || "'" !== $closing_single_quote ) { $dynamic[ '/\'(\d\d)\'(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $apos . '$1' . $closing_single_quote; } + if ( "'" !== $apos || '"' !== $closing_quote ) { + $dynamic[ '/\'(\d\d)"(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $apos . '$1' . $closing_quote; + } + // '99 '99s '99's (apostrophe) But never '9 or '999 or '99.0. if ( "'" !== $apos ) { $dynamic[ '/\'(?=\d\d(?:\Z|(?!\d|[.,]\d)))/' ] = $apos; @@ -126,7 +130,7 @@ function wptexturize($text, $reset = false) { } // Apostrophe in a word. No spaces, double apostrophes, or other punctuation. - if ( "'" != $apos ) { + if ( "'" !== $apos ) { $dynamic[ '/(?[\]\-]|' . $spaces . ')/' ] = $apos; } @@ -151,7 +155,7 @@ function wptexturize($text, $reset = false) { } // Single quotes followed by spaces or ending punctuation. - if ( "'" != $closing_single_quote ) { + if ( "'" !== $closing_single_quote ) { $dynamic[ '/\'(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $closing_single_quote; }