WordPress.org

Make WordPress Core

Ticket #30162: formatting.php.patch

File formatting.php.patch, 1.0 KB (added by Ninos Ego, 7 years ago)
  • formatting.php

     
    18651865        $nested_code_pre = 0; // Keep track of how many levels link is nested inside <pre> or <code>
    18661866        foreach ( $textarr as $piece ) {
    18671867
    1868                 if ( preg_match( '|^<code[\s>]|i', $piece ) || preg_match( '|^<pre[\s>]|i', $piece ) )
     1868                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 ) )
    18691869                        $nested_code_pre++;
    1870                 elseif ( ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) ) && $nested_code_pre )
     1870                elseif ( $nested_code_pre && ( '</code>' === strtolower( $piece ) || '</pre>' === strtolower( $piece ) || '</script>' === strtolower( $piece ) || '</style>' === strtolower( $piece ) ) )
    18711871                        $nested_code_pre--;
    18721872
    18731873                if ( $nested_code_pre || empty( $piece ) || ( $piece[0] === '<' && ! preg_match( '|^<\s*[\w]{1,20}+://|', $piece ) ) ) {