Formatting: Don't make links inside `<script>` and `<style>` tags clickable.

Fixes #30162
Props ninos-ego, adamsilverstein

Built from https://develop.svn.wordpress.org/trunk@35847


git-svn-id: http://core.svn.wordpress.org/trunk@35811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2015-12-09 23:55:32 +00:00
parent 2ae5db3856
commit 8826804952
2 changed files with 3 additions and 3 deletions

View File

@ -2195,9 +2195,9 @@ function make_clickable( $text ) {
$nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
foreach ( $textarr as $piece ) {
if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
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 ) )
$nested_code_pre++;
elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
$nested_code_pre--;
if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-alpha-35846';
$wp_version = '4.5-alpha-35847';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.