Ticket #9437: 9437.2.diff
File 9437.2.diff, 1.9 KB (added by , 9 years ago) |
---|
-
src/wp-includes/formatting.php
541 541 // Optionally insert line breaks. 542 542 if ( $br ) { 543 543 // Replace newlines that shouldn't be touched with a placeholder. 544 $pee = preg_replace_callback('/<(script|style ).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee);544 $pee = preg_replace_callback('/<(script|style|svg).*?<\/\\1>/s', '_autop_newline_preservation_helper', $pee); 545 545 546 546 // Normalize <br> 547 547 $pee = str_replace( array( '<br>', '<br/>' ), '<br />', $pee ); … … 4791 4791 $short_url = substr( $short_url, 0, $length - 3 ) . '…'; 4792 4792 } 4793 4793 return $short_url; 4794 } 4795 No newline at end of file 4794 } -
tests/phpunit/tests/formatting/Autop.php
524 524 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 525 525 } 526 526 527 /** 528 * wpautop() should ignore inline SVG graphics 529 * 530 * @ticket 9437 531 */ 532 function test_that_wpautop_ignores_inline_svgs() { 533 $content= 534 '<svg xmlns="http://www.w3.org/2000/svg"> 535 <circle cx="50" cy="50" r="30" fill="blue"> 536 <animateTransform attributeName="transform" type="scale" to="1.5" dur="2s" fill="freeze"/> 537 </circle> 538 </svg>'; 539 $expected='<p>'.$content.'</p>'; 540 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 541 } 542 543 /** 544 * wpautop() should ignore inline scripts 545 * 546 * @ticket 9437 547 */ 548 function test_that_wpautop_ignores_inline_scripts() { 549 $content= 550 '<script type="text/javascript"> 551 552 var dummy = 1; 553 </script>'; 554 $expected='<p>'.$content.'</p>'; 555 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 556 } 557 527 558 }