Commit Graph

450 Commits

Author SHA1 Message Date
Sergey Biryukov
20cfcbf86d Fix whitespace issues in [29781]. Remove a redundant comment.
props miqrogroove.
see #29557.
Built from https://develop.svn.wordpress.org/trunk@29873


git-svn-id: http://core.svn.wordpress.org/trunk@29632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-11 02:33:18 +00:00
Scott Taylor
37a0c36d38 The joys of wptexturize():
* Revert parts of [28773] and [28727] and [29748].
* Do not crash PHP. Make the shortcode quantifier possessive to avoid backtracks.
* Reduce backtracking in long HTML comments by 100x.
* Do not ignore unclosed HTML comments.
* Do not break unregistered shortcodes, e.g. `[hello attr="value"]`.
* Do not break HTML in shortcode attributes, e.g. `[hello attr="<"]`.
* Do not match for shortcodes when there is extra whitespace, e.g. `[ hello ]`.
* Add unit tests to show #12690 was not fully resolved.
* Tested PHP 5.2.4, 5.2.13, 5.4.32, and 5.5.8.

Adds/modifies unit tests.

Props miqrogroove.
See #29557.

Built from https://develop.svn.wordpress.org/trunk@29781


git-svn-id: http://core.svn.wordpress.org/trunk@29553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 04:07:15 +00:00
Scott Taylor
0a848a6171 wptexturize() improvements:
* Expand the `wptexturize()` RegEx to include the list of registered shortcodes.
* Avoid backtracking after `[` chars by not filtering params in registered shortcodes. This will cause escaped shortcodes and their params to become texturized if not registered.
* Registered shortcode params will never be texturized, even when escaped.
* Move all tests involving unregistered shortcodes to a new and improved unit.
* Update one test involving HTML within shortcode params.

Props miqrogroove.
See #29557.

Built from https://develop.svn.wordpress.org/trunk@29748


git-svn-id: http://core.svn.wordpress.org/trunk@29520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-17 15:14:17 +00:00
Sergey Biryukov
93903a2a81 Check for [\r\n\t ] instead of \s in sanitize_file_name() to avoid UTF-8 issues.
props p_enrique.
fixes #26094.
Built from https://develop.svn.wordpress.org/trunk@29715


git-svn-id: http://core.svn.wordpress.org/trunk@29489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-07 08:33:16 +00:00
Andrew Nacin
f7392ef917 Pinking shears.
Built from https://develop.svn.wordpress.org/trunk@29707


git-svn-id: http://core.svn.wordpress.org/trunk@29481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-04 15:23:16 +00:00
Andrew Nacin
9db108dbe0 Allow language specified by the WPLANG constant (but not installed) to be chosen.
fixes #29456.

Built from https://develop.svn.wordpress.org/trunk@29691


git-svn-id: http://core.svn.wordpress.org/trunk@29466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-03 08:03:16 +00:00
Drew Jaynes
d33c807723 Fix some documentation typos in various core files.
Props vlajos.
Fixes #29199.

Built from https://develop.svn.wordpress.org/trunk@29479


git-svn-id: http://core.svn.wordpress.org/trunk@29257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-13 03:56:17 +00:00
Scott Taylor
6b3251e931 wptexturize: After [28727], leverage RegeEx possessives (++) to improve performance and avoid libpcre segfaults.
Props kovshenin.
Fixes #12690.

Built from https://develop.svn.wordpress.org/trunk@29431


git-svn-id: http://core.svn.wordpress.org/trunk@29209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-07 19:11:18 +00:00
Andrew Ozz
004da2f6ba Formatting: make the removal of white space around <option> greedy, see #28217.
Built from https://develop.svn.wordpress.org/trunk@29316


git-svn-id: http://core.svn.wordpress.org/trunk@29097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-28 19:55:16 +00:00
Andrew Ozz
ad0f539621 Formatting: no <p> or <br> around <option> tags in both flavours of wpautop, make "selects" easier to read in the Text editor. Fixes #28217.
Built from https://develop.svn.wordpress.org/trunk@29315


git-svn-id: http://core.svn.wordpress.org/trunk@29096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-28 19:44:18 +00:00
Scott Taylor
a14f5b97d5 In sanitize_file_name(), replace %20 and + with dashes. Remove unnecessary code from _wp_handle_upload().
Adds unit tests.

Props ericmann.
Fixes #16330.

Built from https://develop.svn.wordpress.org/trunk@29290


git-svn-id: http://core.svn.wordpress.org/trunk@29072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-24 22:09:16 +00:00
Drew Jaynes
c5a59037f1 Inline documentation cleanup for 4.0 audit.
Various improvements:
* Adds `@see` reference for `wp_list_comments()` in 'wp_list_comments_args' filter docs, added in [28285]
* Various phpDoc tweaks for the 'run_wptexturize' filter docs, added in [28715]
* Sentence and wrapping changes for `is_https_url()`, added in [28894]
* Documents the `$args` parameter for `wp_dropdown_languages()`, added in [29007]
* Adds a period to the parameter description for `_update_posts_count_on_delete()`, added in [28835]
* Documents a global in `is_customize_preview()`, added in [28999]
* phpDoc tweaks, adds an access modifier for `wpdb::esc_like()`, added in [28711]

See #28885.

Built from https://develop.svn.wordpress.org/trunk@29163


git-svn-id: http://core.svn.wordpress.org/trunk@28947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:02:15 +00:00
Sergey Biryukov
8d358a16c3 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
2014-07-06 08:50:18 +00:00
Scott Taylor
5eb23f8e3c Optimize regexp usage in wptexturize() for a "3x Performance Boost."
Props miqrogroove.
See #28724.

Built from https://develop.svn.wordpress.org/trunk@28986


git-svn-id: http://core.svn.wordpress.org/trunk@28775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-04 01:15:15 +00:00
John Blackbourn
fd2d2ebb2e Correct typo in sanitize_html_class() docblock.
Built from https://develop.svn.wordpress.org/trunk@28973


git-svn-id: http://core.svn.wordpress.org/trunk@28762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-03 16:58:16 +00:00
Sergey Biryukov
c6c1f56d60 Fix texturization of quotes when enclosed by angle brackets.
props miqrogroove.
fixes #28718.
Built from https://develop.svn.wordpress.org/trunk@28971


git-svn-id: http://core.svn.wordpress.org/trunk@28760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-03 16:22:14 +00:00
Scott Taylor
a71d57da0a Remove obsolete comment in wptexturize().
http://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2014-06-30&sort=asc#m879104

See [28831].

Built from https://develop.svn.wordpress.org/trunk@28929


git-svn-id: http://core.svn.wordpress.org/trunk@28727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-30 17:59:14 +00:00
Scott Taylor
9997f77d7f Use less greedy regex in wptexturize(). Adds unit tests.
Props miqrogroove.
See #28564.

Built from https://develop.svn.wordpress.org/trunk@28852


git-svn-id: http://core.svn.wordpress.org/trunk@28656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-26 17:15:14 +00:00
Scott Taylor
8c39368644 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.

Built from https://develop.svn.wordpress.org/trunk@28831


git-svn-id: http://core.svn.wordpress.org/trunk@28635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-25 17:49:14 +00:00
Scott Taylor
856e5ef55e Remove noscript from wpautop()'s list of block elements.
Props mdawaffe.
Fixes #27268.

Built from https://develop.svn.wordpress.org/trunk@28817


git-svn-id: http://core.svn.wordpress.org/trunk@28624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-24 00:54:17 +00:00
Sergey Biryukov
8b272f4379 Remove mbstring_binary_safe_strlen(). Use mbstring_binary_safe_encoding() and reset_mbstring_encoding() directly.
fixes #28162.
Built from https://develop.svn.wordpress.org/trunk@28808


git-svn-id: http://core.svn.wordpress.org/trunk@28617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-23 22:21:15 +00:00
Sergey Biryukov
9ceb642b2a Introduce a binary-safe wrapper for strlen() and use it in seems_utf8(), utf8_uri_encode(), and wp_read_image_metadata().
Use binary-safe POMO_Reader::strlen() in MO::export_to_file_handle().

fixes #28162.
Built from https://develop.svn.wordpress.org/trunk@28806


git-svn-id: http://core.svn.wordpress.org/trunk@28615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-23 14:48:14 +00:00
Sergey Biryukov
64e67b0dbb Revert [28776] and use a correct variable instead.
props miqrogroove.
fixes #28575.
Built from https://develop.svn.wordpress.org/trunk@28802


git-svn-id: http://core.svn.wordpress.org/trunk@28611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-22 22:13:16 +00:00
Sergey Biryukov
ce0d1a026c Move preg_match() that should only run once out of the loop.
props dllh.
fixes #28575.
Built from https://develop.svn.wordpress.org/trunk@28776


git-svn-id: http://core.svn.wordpress.org/trunk@28589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-19 00:01:16 +00:00
Scott Taylor
b2f6e1f674 In wptexturize() + tests:
* Allow well-formed HTML inside of shortcode attributes
* Restrict recursion. HTML is allowed but ignored.
* Do not allow exotic HTML comments in shortcode attributes.
* Continue to ignore the [ and ] chars if they appear in any HTML attribute.
* Update related regex patterns.
* Update unit tests.

Props miqrogroove.
Fixes #28564.

Built from https://develop.svn.wordpress.org/trunk@28773


git-svn-id: http://core.svn.wordpress.org/trunk@28586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-18 19:49:15 +00:00
Scott Taylor
f1a15dd4fe Fix abbreviations mixed with quotes, example: '99% of people'.
Add/alter unit tests.

Props miqrogroove.
Fixes #26850.

Built from https://develop.svn.wordpress.org/trunk@28765


git-svn-id: http://core.svn.wordpress.org/trunk@28578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-17 20:19:14 +00:00
Scott Taylor
2bac3b660f In wptexturize(), adjust for the treatment of abbreviated years at the end of quotations.
Silence some unit tests that have never passed and may no longer be applicable.

Props miqrogroove.
Fixes #18549.

Built from https://develop.svn.wordpress.org/trunk@28764


git-svn-id: http://core.svn.wordpress.org/trunk@28577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-17 20:14:15 +00:00
Scott Taylor
3b3fb72ce3 Add unit tests to confirm that --- is properly converted to &#8212; by wptexturize() where appropriate.
Props miqrogroove.
Fixes #28483.

Built from https://develop.svn.wordpress.org/trunk@28763


git-svn-id: http://core.svn.wordpress.org/trunk@28576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-17 18:07:14 +00:00
Scott Taylor
f7ac0eed90 Add Unit Tests for i18n and wptexturize(). Don't confuse closing single quotes and apostrophes.
See #27426.

Built from https://develop.svn.wordpress.org/trunk@28762


git-svn-id: http://core.svn.wordpress.org/trunk@28575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-17 17:57:14 +00:00
Scott Taylor
337e5f7ae4 wptexturize() adjustments:
* Only place an apostrophe before a number when it has exactly two digits.
* Never match '99' with the single prime pattern.
* Always assume '99' is an abbreviated year at the end of a quotation.
* Add unit tests.
* Resolves the unit test broken in [28721] for #8775.

See #26850.

Built from https://develop.svn.wordpress.org/trunk@28761


git-svn-id: http://core.svn.wordpress.org/trunk@28574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-17 17:41:15 +00:00
Scott Taylor
658170b179 In wptexturize(), ensure that texturization does not corrupt contents of HTML elements, HTML comments, and smartcode attributes.
Adds a variety of unit tests/assertions.

Props miqrogroove.
Fixes #12690, #8912, #27602.

Built from https://develop.svn.wordpress.org/trunk@28727


git-svn-id: http://core.svn.wordpress.org/trunk@28541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 14:34:13 +00:00
Scott Taylor
4c067bd327 In wptexturize(), allow dashes before and after curly quotes. Example: This is what she said---"Wow that is cool."
Adds unit tests.

Props adamsilverstein, miqrogroove.
Fixes #20342.

Built from https://develop.svn.wordpress.org/trunk@28726


git-svn-id: http://core.svn.wordpress.org/trunk@28540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 14:22:15 +00:00
Scott Taylor
3d3c166f11 wptexturize() should handle apostrophes before primes.
Props nacin, miqrogroove.
Fixes #22823.

Built from https://develop.svn.wordpress.org/trunk@28725


git-svn-id: http://core.svn.wordpress.org/trunk@28539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 14:14:17 +00:00
Drew Jaynes
5755eaf372 Improve inline documentation for the wp_spaces_regexp filter.
Fixes #27588.

Built from https://develop.svn.wordpress.org/trunk@28724


git-svn-id: http://core.svn.wordpress.org/trunk@28538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 06:46:15 +00:00
Drew Jaynes
0290f79eac Add inline documentation for the run_wptexturize filter.
Props miqrogroove for the original patch.
Fixes #19550.

Built from https://develop.svn.wordpress.org/trunk@28723


git-svn-id: http://core.svn.wordpress.org/trunk@28537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 06:29:14 +00:00
Scott Taylor
f8b03aa528 Fix curly quotes around numbers when applicable.
Adds unit tests.

Props filosofo, mrmist, aliso, MikeHansenMe, miqrogroove.
Fixes #8775.

Built from https://develop.svn.wordpress.org/trunk@28721


git-svn-id: http://core.svn.wordpress.org/trunk@28535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 02:43:14 +00:00
Scott Taylor
4666c1abe2 In wptexturize(), don't convert C-style hexadecimals to mathematical ×.
Adds unit tests.

Props harrym, kurtpayne, miqrogroove.
Fixes #19308.

Built from https://develop.svn.wordpress.org/trunk@28719


git-svn-id: http://core.svn.wordpress.org/trunk@28533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 02:18:15 +00:00
Scott Taylor
12e7d6744b In wptexturize(), treat &nbsp; like whitespace when texturizing hyphens.
Adds unit tests.

Props redsweater, miqrogroove.
Fixes #23185.

Built from https://develop.svn.wordpress.org/trunk@28718


git-svn-id: http://core.svn.wordpress.org/trunk@28532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 02:09:15 +00:00
Scott Taylor
6cb51c9ceb smilies_init(), treat &nbsp; like whitespace when converting smilies.
Adds unit tests.

Props miqrogroove.
Fixes #27587.

Built from https://develop.svn.wordpress.org/trunk@28717


git-svn-id: http://core.svn.wordpress.org/trunk@28531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 02:03:14 +00:00
Scott Taylor
66d2144e9a Ensure that shortcode_unautop() treats &nbsp; like whitespace.
`shortcode_unautop()` and `wptexturize()` now use `wp_spaces_regexp()` instead of raw regex.

Adds unit tests.

Props miqrogroove.
See #27588.

Built from https://develop.svn.wordpress.org/trunk@28716


git-svn-id: http://core.svn.wordpress.org/trunk@28530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 01:55:15 +00:00
Scott Taylor
b4b0efe701 Add a $run_texturize static var to wptexturize() that is filterable via a new run-once filter: 'run_wptexturize'. Allows user to disable texturization.
Needs filter docs.

Props nacin, SergeyBiryukov.
See #19550.

Built from https://develop.svn.wordpress.org/trunk@28715


git-svn-id: http://core.svn.wordpress.org/trunk@28529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 01:46:14 +00:00
Scott Taylor
82bdc78500 LIKE escape sanity:
* Deprecate `like_escape()`
* Add a method to `$wpdb`, `->esc_like()`, and add unit tests

`$wpdb::esc_like()` is not used yet. As such, many unit tests will throw `Unexpected deprecated notice for like_escape`. Subsequent commits will alleviate this.

Props miqrogroove.
See #10041.

Built from https://develop.svn.wordpress.org/trunk@28711


git-svn-id: http://core.svn.wordpress.org/trunk@28527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:30:15 +00:00
Scott Taylor
46f82b03e7 Add a function: wp_spaces_regexp(). It is not used yet.
This function is required by a bunch of patches by miqrogroove. Needs filter docs.

Props miqrogroove.
See #27588.

Built from https://develop.svn.wordpress.org/trunk@28708


git-svn-id: http://core.svn.wordpress.org/trunk@28524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-09 19:30:14 +00:00
Sergey Biryukov
c20cdfcc38 Add a filter to human_time_diff().
props slimndap.
fixes #27271.
Built from https://develop.svn.wordpress.org/trunk@28670


git-svn-id: http://core.svn.wordpress.org/trunk@28488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-05 00:39:14 +00:00
Sergey Biryukov
5c2d25aa77 Filter out empty and duplicate values in Comment Moderation and Comment Blacklist settings.
props GaVrA.
fixes #23800.
Built from https://develop.svn.wordpress.org/trunk@28444


git-svn-id: http://core.svn.wordpress.org/trunk@28271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-16 11:10:14 +00:00
Andrew Nacin
cfa2246cc7 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
2014-03-29 09:00:15 +00:00
Andrew Nacin
d04cd4147a Texturize: Massive performance improvements (~600% faster); better handling of nbsp, double, and weird spaces; 136 new unit tests.
big props miqrogroove.
fixes #22692.

Built from https://develop.svn.wordpress.org/trunk@27839


git-svn-id: http://core.svn.wordpress.org/trunk@27673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-29 07:16:16 +00:00
Andrew Nacin
2133c89e8f Remove select and input from wpautop()'s HTML blocks list.
props rachelbaker, DH-Shredder.
fixes #22230.

Built from https://develop.svn.wordpress.org/trunk@27761


git-svn-id: http://core.svn.wordpress.org/trunk@27598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-27 00:01:15 +00:00
Scott Taylor
0f55595472 In sanitize_file_name(), replace a UTF-8-encoded Unicode representation of a non-breaking space (\u00a0 / \xc2\xa) with an old-fashioned space: .
Fixes #27281.


Built from https://develop.svn.wordpress.org/trunk@27617


git-svn-id: http://core.svn.wordpress.org/trunk@27460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-19 07:16:15 +00:00
John Blackbourn
184dc2bc33 figcaption should not be treated as a block-level element by wpautop(). See #25646. Props oso96_2000.
Built from https://develop.svn.wordpress.org/trunk@27527


git-svn-id: http://core.svn.wordpress.org/trunk@27370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-13 21:51:16 +00:00