From 8d358a16c3df0e0859bff4689fabc3ed5cc8a13b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 6 Jul 2014 08:50:18 +0000 Subject: [PATCH] Exclude a newline between delimeters from further checks in wptexturize() for better performance. props miqrogroove. fixes #28724. Built from https://develop.svn.wordpress.org/trunk@29008 git-svn-id: http://core.svn.wordpress.org/trunk@28796 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 4afb487a07..69923584c7 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -234,6 +234,11 @@ function wptexturize($text, $reset = false) { _wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags ); } + } elseif ( '' === trim( $curl ) ) { + // This is a newline between delimeters. Performance improves when we check this. + + continue; + } elseif ( '[' === $first && 1 === preg_match( '/^\[(?:[^\[\]<>]|<[^>]+>)+\]$/', $curl ) ) { // This is a shortcode delimeter. @@ -245,6 +250,8 @@ function wptexturize($text, $reset = false) { // Do not texturize. // Do not push to the shortcodes stack. + continue; + } elseif ( empty( $no_texturize_shortcodes_stack ) && empty( $no_texturize_tags_stack ) ) { // This is neither a delimeter, nor is this content inside of no_texturize pairs. Do texturize. diff --git a/wp-includes/version.php b/wp-includes/version.php index b81dd90066..6a80cd4605 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.0-alpha-20140705'; +$wp_version = '4.0-alpha-20140706'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.