Make WordPress Core


Ignore:
Timestamp:
06/10/2014 01:54:11 AM (10 years ago)
Author:
wonderboymusic
Message:

Ensure that shortcode_unautop() treats   like whitespace.
shortcode_unautop() and wptexturize() now use wp_spaces_regexp() instead of raw regex.

Adds unit tests.

Props miqrogroove.
See #27588.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/shortcode.php

    r25002 r28716  
    374374    }
    375375
     376    /**
     377     * Check that shortcode_unautop() will always recognize spaces around shortcodes.
     378     *
     379     * @ticket 22692
     380     */
     381    function test_spaces_around_shortcodes() {
     382        $nbsp = "\xC2\xA0";
     383
     384        $input  = array();
     385
     386        $input[] = "<p>[gallery ids=\"37,15,11\"]</p>";
     387        $input[] = "<p> [gallery ids=\"37,15,11\"] </p>";
     388        $input[] = "<p> {$nbsp}[gallery ids=\"37,15,11\"] {$nbsp}</p>";
     389        $input[] = "<p> &nbsp;[gallery ids=\"37,15,11\"] &nbsp;</p>";
     390
     391        $output = "[gallery ids=\"37,15,11\"]";
     392
     393        foreach($input as $in) {
     394            $this->assertEquals( $output, shortcode_unautop( $in ) );
     395        }
     396    }
    376397}
Note: See TracChangeset for help on using the changeset viewer.