From 33f728034df71eb3857562c90bdb5d06297c4ee2 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 29 Mar 2014 08:59:38 +0000 Subject: [PATCH] Add braces to wptexturize() after [27839]. see #22692. git-svn-id: https://develop.svn.wordpress.org/trunk@27844 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/formatting.php | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php index e1a0ee3104..5efe0cdadb 100644 --- a/src/wp-includes/formatting.php +++ b/src/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 ); + } } } }