Ticket #30162: 30162.diff
| File 30162.diff, 2.2 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/formatting.php
1872 1872 $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code> 1873 1873 foreach ( $textarr as $piece ) { 1874 1874 1875 if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )1875 if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) || preg_match( '|^<script[\s>]|i', $piece ) || preg_match( '|^<style[\s>]|i', $piece ) ) 1876 1876 $nested_code_pre++; 1877 elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre)1877 elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) ) 1878 1878 $nested_code_pre--; 1879 1879 1880 1880 if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) { -
tests/phpunit/tests/formatting/MakeClickable.php
372 372 href='mailto:someone@example.com'>someone@example.com</a>"; 373 373 $this->assertEquals( $html, make_clickable( $html ) ); 374 374 } 375 376 /** 377 * @ticket 30162 378 */ 379 function test_dont_link_script_and_style_tags() { 380 $before = array( 381 '<script>http://wordpress.org</script>', 382 '<style>http://wordpress.org</style>', 383 '<script type="text/javascript">http://wordpress.org</script>', 384 '<style type="text/css">http://wordpress.org</style>', 385 ); 386 387 $expected = array( 388 '<script>http://wordpress.org</script>', 389 '<style>http://wordpress.org</style>', 390 '<script type="text/javascript">http://wordpress.org</script>', 391 '<style type="text/css">http://wordpress.org</style>', 392 ); 393 394 foreach ( $before as $key => $url ) { 395 $this->assertEquals( $expected[ $key ], make_clickable( $url ) ); 396 } 397 } 375 398 }