diff --git src/wp-includes/formatting.php src/wp-includes/formatting.php
index 44376e5..b1f997f 100644
|
|
|
function shortcode_unautop( $pee ) {
|
| 486 | 486 | return $pee; |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | | $tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) ); |
| | 489 | /** |
| | 490 | * Filter the list of shortcodes to run through the 'unautop' routine. |
| | 491 | * |
| | 492 | * @since 4.1.0 |
| | 493 | * |
| | 494 | * @param array $shortcode_tags Shortcode tags to run through the 'unautop' routine. |
| | 495 | */ |
| | 496 | $unautop_shortcode_tags = apply_filters( 'unautop_shortcodes', array_keys( $shortcode_tags ) ); |
| | 497 | |
| | 498 | $tagregexp = join( '|', array_map( 'preg_quote', $unautop_shortcode_tags ) ); |
| 490 | 499 | $spaces = wp_spaces_regexp(); |
| 491 | 500 | |
| 492 | 501 | $pattern = |
diff --git tests/phpunit/tests/shortcode.php tests/phpunit/tests/shortcode.php
index 7e8b971..8ead9f2 100644
|
|
|
EOF;
|
| 407 | 407 | $this->assertTrue( has_shortcode( $content_nested, 'gallery' ) ); |
| 408 | 408 | remove_shortcode( 'foo' ); |
| 409 | 409 | } |
| | 410 | |
| | 411 | /** |
| | 412 | * @ticket 12061 |
| | 413 | */ |
| | 414 | function test_unautop_shortcodes_filter() { |
| | 415 | // trim() is necessary because the shortcode_unautop(wpautop()) combo causes whitespace that we don't care about |
| | 416 | $this->assertEquals( '_shortcode_hyphen', trim( do_shortcode( shortcode_unautop( wpautop( '[hyphen]' ) ) ) ) ); |
| | 417 | // Filter 'hyphen' out of the shortcodes that are unautop'd and test again |
| | 418 | add_filter( 'unautop_shortcodes', array( $this, '_shortcode_unautop_filter' ) ); |
| | 419 | $this->assertEquals( '<p>_shortcode_hyphen</p>', trim( do_shortcode( shortcode_unautop( wpautop( '[hyphen]' ) ) ) ) ); |
| | 420 | } |
| | 421 | |
| | 422 | function _shortcode_unautop_filter( $shortcodes ) { |
| | 423 | return array_diff( $shortcodes, array( 'hyphen' ) ); |
| | 424 | } |
| 410 | 425 | } |