Optimize the wptexturize() loop:

* Take the ampersand pattern out of the loop for speed.
* Fix old bugs in the ampersand pattern.
* Refactor `_wptexturize_pushpop_element()` without PCRE for speed.
* Update unit tests.

Props miqrogroove.
Fixes #28623.


git-svn-id: https://develop.svn.wordpress.org/trunk@28831 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-06-25 17:48:20 +00:00
parent 69101fe0f3
commit 96484fd3f9
2 changed files with 72 additions and 40 deletions
+23 -3
View File
@@ -829,9 +829,17 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
"word & word",
"word & word",
),
array(
"word ઼ word",
"word ઼ word",
),
array(
"word Δ word",
"word Δ word",
),
array(
"word &# word",
"word &# word", // invalid output?
"word &# word",
),
array(
"word &44; word",
@@ -839,11 +847,19 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
),
array(
"word && word",
"word && word",
"word && word",
),
array(
"word &!amp; word",
"word &!amp; word",
"word &!amp; word",
),
array(
"word &#",
"word &#",
),
array(
"word &",
"word &",
),
);
}
@@ -1285,6 +1301,10 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
'<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>',
'<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>',
),
array(
'word <img src="http://example.com/wp-content/uploads/2014/06/image-300x216.gif" /> word', // Ensure we are not corrupting image URLs.
'word <img src="http://example.com/wp-content/uploads/2014/06/image-300x216.gif" /> word',
),
);
}