Make WordPress Core


Ignore:
Timestamp:
06/10/2014 02:42:35 AM (11 years ago)
Author:
wonderboymusic
Message:

Fix curly quotes around numbers when applicable.

Adds unit tests.

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

File:
1 edited

Legend:

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

    r28719 r28721  
    8888        // Pattern-based replacements of characters.
    8989        $dynamic = array();
     90
     91        // Quoted Numbers like "42" or '42.00'
     92        if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
     93            $dynamic[ '/(?<=\A|' . $spaces . ')"(\d[\d\.\,]*)"/' ] = $opening_quote . '$1' . $closing_quote;
     94        }
     95        if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
     96            $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
     97        }
    9098
    9199        // '99 '99s '99's (apostrophe)
Note: See TracChangeset for help on using the changeset viewer.