WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/17/2014 08:18:38 PM (7 years ago)
Author:
wonderboymusic
Message:

Fix abbreviations mixed with quotes, example: '99% of people'.
Add/alter unit tests.

Props miqrogroove.
Fixes #26850.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r28764 r28765  
    112112        }
    113113
    114         // '99 '99s '99's (apostrophe)  But never '9 or '999 or '99.0.
     114        // '99 '99s '99's (apostrophe)  But never '9 or '99% or '999 or '99.0.
    115115        if ( "'" !== $apos ) {
    116             $dynamic[ '/\'(?=\d\d(?:\Z|(?!\d|[.,]\d)))/' ] = $apos;
     116            $dynamic[ '/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/' ] = $apos;
    117117        }
    118118
    119119        // Quoted Numbers like "42" or '42.00'
    120120        if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
    121             $dynamic[ '/(?<=\A|' . $spaces . ')"(\d[\d\.\,]*)"/' ] = $opening_quote . '$1' . $closing_quote;
     121            $dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $opening_quote . '$1' . $closing_quote;
    122122        }
    123123        if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
    124             $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
     124            $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
    125125        }
    126126
Note: See TracChangeset for help on using the changeset viewer.