mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 17:44:25 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@28716 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -373,4 +373,25 @@ EOF;
|
||||
remove_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts2' ), 10, 3 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that shortcode_unautop() will always recognize spaces around shortcodes.
|
||||
*
|
||||
* @ticket 22692
|
||||
*/
|
||||
function test_spaces_around_shortcodes() {
|
||||
$nbsp = "\xC2\xA0";
|
||||
|
||||
$input = array();
|
||||
|
||||
$input[] = "<p>[gallery ids=\"37,15,11\"]</p>";
|
||||
$input[] = "<p> [gallery ids=\"37,15,11\"] </p>";
|
||||
$input[] = "<p> {$nbsp}[gallery ids=\"37,15,11\"] {$nbsp}</p>";
|
||||
$input[] = "<p> [gallery ids=\"37,15,11\"] </p>";
|
||||
|
||||
$output = "[gallery ids=\"37,15,11\"]";
|
||||
|
||||
foreach($input as $in) {
|
||||
$this->assertEquals( $output, shortcode_unautop( $in ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user