From cfa2246cc74bca85ad488cc17e7a2b5abb626227 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 29 Mar 2014 09:00:15 +0000 Subject: [PATCH] Add braces to wptexturize() after [27839]. see #22692. Built from https://develop.svn.wordpress.org/trunk@27844 git-svn-id: http://core.svn.wordpress.org/trunk@27678 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index e1a0ee3104..5efe0cdadb 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -87,36 +87,44 @@ function wptexturize($text) { $dynamic = array(); // '99 '99s '99's (apostrophe) - if ( "'" != $apos ) + if ( "'" !== $apos ) { $dynamic[ '/\'(?=\d)/' ] = $apos; + } // Single quote at start, or preceded by (, {, <, [, ", or spaces. - if ( "'" != $opening_single_quote ) + if ( "'" !== $opening_single_quote ) { $dynamic[ '/(?<=\A|[([{<"]|' . $spaces . ')\'/' ] = $opening_single_quote; + } // 9" (double prime) - if ( '"' != $double_prime ) + if ( '"' !== $double_prime ) { $dynamic[ '/(?<=\d)"/' ] = $double_prime; + } // 9' (prime) - if ( "'" != $prime ) + if ( "'" !== $prime ) { $dynamic[ '/(?<=\d)\'/' ] = $prime; + } // Apostrophe in a word. No spaces or double primes. - if ( "'" != $apos ) + if ( "'" !== $apos ) { $dynamic[ '/(?|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ( $textarr as &$curl ) { - if ( empty( $curl ) ) + if ( empty( $curl ) ) { continue; + } // Only call _wptexturize_pushpop_element if first char is correct tag opening $first = $curl[0]; @@ -212,8 +221,9 @@ function _wptexturize_pushpop_element($text, &$stack, $disabled_elements, $openi $last = array_pop($stack); // Make sure it matches the opening tag - if ($last != $matches[1]) - array_push($stack, $last); + if ( $last != $matches[1] ) { + array_push( $stack, $last ); + } } } }