Make WordPress Core

Ticket #4539: 4539.diff

File 4539.diff, 2.9 KB (added by SergeyBiryukov, 11 years ago)
  • src/wp-includes/formatting.php

     
    124124                        $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
    125125                }
    126126
     127                // Quoted string ending with a number
     128                if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
     129                        $dynamic[ '/(?<!\d)"(.*?\d[.,\d]*)"/' ] = $opening_quote . '$1' . $closing_quote;
     130                }
     131                if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
     132                        $dynamic[ "/(?<!\d)'(.*?\d[.,\d]*)'/" ] = $opening_single_quote . '$1' . $closing_single_quote;
     133                }
     134
    127135                // Single quote at start, or preceded by (, {, <, [, ", -, or spaces.
    128136                if ( "'" !== $opening_single_quote ) {
    129137                        $dynamic[ '/(?<=\A|[([{<"\-]|' . $spaces . ')\'/' ] = $opening_single_quote;
  • tests/phpunit/tests/formatting/WPTexturize.php

     
    9191                //$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;&#8230; and ellipses.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"... and ellipses.'));
    9292                //$this->assertEquals('Here is &#8220;a test <a href="http://example.com">with a link</a>&#8221;.', wptexturize('Here is "a test <a href="http://example.com">with a link</a>".'));
    9393                //$this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;and a work stuck to the end.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"and a work stuck to the end.'));
    94                 //$this->assertEquals('A test with a finishing number, &#8220;like 23&#8221;.', wptexturize('A test with a finishing number, "like 23".'));
    95                 //$this->assertEquals('A test with a number, &#8220;like 62&#8221;, is nice to have.', wptexturize('A test with a number, "like 62", is nice to have.'));
     94                $this->assertEquals('A test with a finishing number, &#8220;like 23&#8221;.', wptexturize('A test with a finishing number, "like 23".'));
     95                $this->assertEquals('A test with a number, &#8220;like 62&#8221;, is nice to have.', wptexturize('A test with a number, "like 62", is nice to have.'));
    9696        }
    9797
    9898        /**
     
    119119                $this->assertEquals('&#8220;Class of &#8217;99&#8221;', wptexturize("\"Class of '99\""));
    120120        }
    121121
     122        /**
     123         * @ticket 4539
     124         */
    122125        function test_quotes_after_numbers() {
    123                 $this->assertEquals('Class of &#8217;99', wptexturize("Class of '99"));
     126                $this->assertEquals('Class of 99&#8242;', wptexturize("Class of 99'"));
     127                $this->assertEquals('&#8216;Class of 99&#8217;', wptexturize("'Class of 99'"));
     128                $this->assertEquals('&#8220;Class of 99&#8221;', wptexturize('"Class of 99"'));
    124129        }
    125130
    126131        /**