Smilies: Move convert_smilies
to happen later in the the_content
filter.
In particular, we want it to occur after shortcode handling. The smiley conversion routine doesn't have any concept of shortcode structure, so may inadvertantly replace a smiley with HTML inside a shortcode attribute, which will cause the shortcode to not be parsed correctly. Props Unyson for the initial suggested fix. Fixes #36306. git-svn-id: https://develop.svn.wordpress.org/trunk@37298 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0cc8d27fda
commit
f9e1cf5de0
@ -130,7 +130,7 @@ add_filter( 'the_title', 'convert_chars' );
|
||||
add_filter( 'the_title', 'trim' );
|
||||
|
||||
add_filter( 'the_content', 'wptexturize' );
|
||||
add_filter( 'the_content', 'convert_smilies' );
|
||||
add_filter( 'the_content', 'convert_smilies', 20 );
|
||||
add_filter( 'the_content', 'wpautop' );
|
||||
add_filter( 'the_content', 'shortcode_unautop' );
|
||||
add_filter( 'the_content', 'prepend_attachment' );
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
class Tests_Shortcode extends WP_UnitTestCase {
|
||||
|
||||
protected $shortcodes = array( 'test-shortcode-tag', 'footag', 'bartag', 'baztag', 'dumptag', 'hyphen', 'hyphen-foo', 'hyphen-foo-bar', 'url' );
|
||||
protected $shortcodes = array( 'test-shortcode-tag', 'footag', 'bartag', 'baztag', 'dumptag', 'hyphen', 'hyphen-foo', 'hyphen-foo-bar', 'url', 'img' );
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
@ -78,6 +78,16 @@ class Tests_Shortcode extends WP_UnitTestCase {
|
||||
return 'http://www.wordpress.org/';
|
||||
}
|
||||
|
||||
function _shortcode_img( $atts ) {
|
||||
$out = '<img';
|
||||
foreach ( $atts as $k => $v ) {
|
||||
$out .= " $k=\"$v\"";
|
||||
}
|
||||
$out .= ' />';
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
function test_noatts() {
|
||||
do_shortcode('[test-shortcode-tag /]');
|
||||
$this->assertEquals( '', $this->atts );
|
||||
@ -657,4 +667,13 @@ EOF;
|
||||
$expected = "0 = =https://wordpress.org\n";
|
||||
$this->assertEquals($expected, $out);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 36306
|
||||
*/
|
||||
function test_smilies_arent_converted() {
|
||||
$out = apply_filters( 'the_content', '[img alt="Hello :-) World"]' );
|
||||
$expected = "<img alt=\"Hello :-) World\" />\n";
|
||||
$this->assertEquals( $expected, $out );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user