Commit Graph

3341 Commits

Author SHA1 Message Date
Sergey Biryukov
572934992f Tests: Rename tests methods in tests/pluggable.php per the handbook's naming convention.
See #47632.

git-svn-id: https://develop.svn.wordpress.org/trunk@46466 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-12 03:00:32 +00:00
Sergey Biryukov
5e6d8f584d Docs: Adjust @since note in shortcode_parse_atts() for consistency with similar notes.
See #47863.

git-svn-id: https://develop.svn.wordpress.org/trunk@46465 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-12 02:48:26 +00:00
Sergey Biryukov
9a6bce9f5c Formatting: Make sure wp_sanitize_redirect() encodes spaces in URLs instead of stripping them out.
Props donmhico, hlashbrooke, dd32, azaozz.
Fixes #36998.

git-svn-id: https://develop.svn.wordpress.org/trunk@46462 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-11 23:52:11 +00:00
Mike Schroder
68729adb57 Media: Update fallback previews to support _wp_make_subsizes()
Allows fallback previews (PDF by default, in core) to save image meta
after each size is generated to allow for resuming, and make sizes
immediately available.

Props azaozz, antpb, progremzion, mikeschroder.
See #48111.

git-svn-id: https://develop.svn.wordpress.org/trunk@46459 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-11 07:52:12 +00:00
K. Adam White
70b408c8fe REST API: Fix error in _fields filtering logic where only one of several requested sibling properties would be included.
Props kadamwhite, TimothyBlynJacobs.
Fixes #48266.


git-svn-id: https://develop.svn.wordpress.org/trunk@46456 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-10 17:16:44 +00:00
K. Adam White
22d50c492d REST API: Do not addslash when receiving meta arrays of non-string values.
Slashing non-string data caused PUT requests containing unmodified meta arrays of integers to fail the check against the existing stored meta value, causing a 500 when posting an unmodified response body back to the server.

Props TimothyBlynJacobs, augustuswm.
Fixes #48264.


git-svn-id: https://develop.svn.wordpress.org/trunk@46454 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-09 17:34:20 +00:00
Sergey Biryukov
8ec0a21161 Docs: Add a @since note about new parameters with the spread operator added to function signatures.
Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46451 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-09 04:26:22 +00:00
K. Adam White
e2cf94fa04 REST API: Ensure rest_controller instantiates the post type's declared REST controller class.
Ensures that the ::get_rest_controller() method will always return an instanceof the expected controller class, or null.
Removes unused private static property $post_type_controllers.

Props dlh, TimothyBlynJacobs.
Fixes #45677.



git-svn-id: https://develop.svn.wordpress.org/trunk@46435 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-08 13:41:29 +00:00
K. Adam White
040304def7 REST API: Permit embedding of the 'self' link relation in the /search endpoint.
Removes a special-case prohibition against embedding 'self' which prevented ?_embed from being used with the /wp/v2/search endpoint.

Props TimothyBlynJacobs, chrisvanpatten, kadamwhite.
Fixes #47684.



git-svn-id: https://develop.svn.wordpress.org/trunk@46434 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-08 04:43:10 +00:00
K. Adam White
e17e5aab68 REST API: Ensure users with "moderate_comments" capability may edit comments.
Props meloniq.
Fixes #47024.



git-svn-id: https://develop.svn.wordpress.org/trunk@46433 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-08 04:00:25 +00:00
John Blackbourn
f257bdfbb2 Pings/Trackbacks: Remove a failing test that won't pass as long as WP_IMPORTING gets set during tests.
The `_publish_post_hook()` function checks for `WP_IMPORTING` before setting meta fields fir enclosures and pings, which means this test is doomed to fail.

The test can be re-implemented if the `WP_IMPORTING` constant gets moved to a function similar to how `wp_installing()` works for the `WP_INSTALLING` constant.

See #48014


git-svn-id: https://develop.svn.wordpress.org/trunk@46428 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-07 22:17:22 +00:00
John Blackbourn
16b45f08a9 Pings/Trackbacks: Avoid adding multiple _pingme and _encloseme meta entries to a post when it gets updated prior to pings being done.
Props rebasaurus, whyisjake

Fixes #48014


git-svn-id: https://develop.svn.wordpress.org/trunk@46426 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-07 20:27:20 +00:00
Andrew Ozz
4848b1e3aa REST API: Add support for continuing the post-processing of images after upload. Flow:
1. `POST /wp/v2/media`.
2. If the upload failed (HTTP 500 error), look for a response header with `X-WP-Upload-Attachment-ID` header that contains the newly created attachment ID.
3. `POST /wp/v2/media/{id}/post-process` with `{ "action": "create-image-subsizes" }`. This request may still fail, but it will save its progress.
4. On continued failure, `DELETE /wp/v2/media/{id}` to give up on the upload and instruct the user to resize their image before uploading.

Props TimothyBlynJacobs.
Fixes #47987.

git-svn-id: https://develop.svn.wordpress.org/trunk@46422 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-07 17:04:49 +00:00
Sergey Biryukov
3a06234fe4 Tests: Use a consistent group for nav menu tests.
Fixes #48230.

git-svn-id: https://develop.svn.wordpress.org/trunk@46414 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-06 15:12:42 +00:00
Sergey Biryukov
f6267a04ee Menus: In Walker_Nav_Menu, Walker_Category, and Walker_Page, properly output link attributes having a legitimate "empty" value, for example an HTML data attribute with a value of zero (0).
Props nevma, AkSDvP, greenshady, SergeyBiryukov.
Fixes #47720.

git-svn-id: https://develop.svn.wordpress.org/trunk@46413 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-06 15:04:18 +00:00
Sergey Biryukov
56b6b1e803 Themes: In get_theme_mod(), only run the sprintf() replacement on the default value if there's a string format pattern found in the value.
This prevents standalone percent symbols from being stripped out, e.g. in a default value like `100%`.

Props aristath, kuus, moonomo, westonruter, davetgreen, daviedR, katielgc, noisysocks, SergeyBiryukov.
Fixes #34290.

git-svn-id: https://develop.svn.wordpress.org/trunk@46395 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-05 00:53:39 +00:00
Dominik Schilling
25ba9074cc QUnit: Include script dependencies for wp-a11y script to fix a TypeError.
Also, add missing message argument to Customizer notifications to ensure tests are passing.

Fixes #45066.

git-svn-id: https://develop.svn.wordpress.org/trunk@46388 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-04 21:19:17 +00:00
Andrea Fercia
37cdffd3cc Accessibility: Media: Add more headings in the Media Modal.
Headings are the predominant mechanism for screen reader users to find information in a page. They also help all users to better identify the main sections of user interfaces.

- adds three new headings within the media modal 
- improves plural form translation for "item selected" by using `wp.i18n`
- horizontally centers the media modal menu in the responsive view

Props kjellr, karmatosed, melchoyce, afercia.
See #47149.
Fixes #47610.


git-svn-id: https://develop.svn.wordpress.org/trunk@46375 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-03 12:09:31 +00:00
Jake Spurlock
02cf7f526e Shortcodes: Improve handling from shortcode_parse_attts().
Added missing @ticket for #47863 on `data_shortcode_parse_atts()`

Also cleans up some linter fixes that were missed.

Props garrett-eclipse, whyisjake.
ixes #47863.


git-svn-id: https://develop.svn.wordpress.org/trunk@46370 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-01 04:12:15 +00:00
Jake Spurlock
1f5525d2ff Shortcodes: Improve handling from shortcode_parse_attts().
Ensure consistency between `shortcode_parse_attts()` when being used directly.

Props mauteri, birgire, SergeyBiryukov, kadamwhite, whyisjake.
Fixes #47863.



git-svn-id: https://develop.svn.wordpress.org/trunk@46369 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-01 03:41:58 +00:00
Sergey Biryukov
0e26adbaea Comments: Add rel="nofollow ugc" attribute to links in comments.
UGC stands for User Generated Content, and the `ugc` attribute value is recommended for links within user generated content, such as comments and forum posts.

See https://webmasters.googleblog.com/2019/09/evolving-nofollow-new-ways-to-identify.html.

Props audrasjb, joostdevalk, dkarfa, SergeyBiryukov.
Fixes #48022.

git-svn-id: https://develop.svn.wordpress.org/trunk@46349 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-30 01:29:10 +00:00
Sergey Biryukov
47643f7621 Coding Standards: Remove inline assignments and extra whitespace in tests/multisite/network.php.
Props garrett-eclipse, jrf.
See #48142.

git-svn-id: https://develop.svn.wordpress.org/trunk@46343 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-29 12:21:29 +00:00
Sergey Biryukov
c3dfdf84af Docs: Improve comments in tests/multisite/network.php per the documentation standards.
Props garrett-eclipse, jrf.
See #48142.

git-svn-id: https://develop.svn.wordpress.org/trunk@46342 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-29 12:18:48 +00:00
Jake Spurlock
4ffefc2574 Comments: Avoid PHP notice in get_comment_reply_link() for null comment.
If there is no global comment, or the input comment is null, return early to prevent warnings.

Fixes #41846
Props birgire, earnjam



git-svn-id: https://develop.svn.wordpress.org/trunk@46335 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-27 14:45:49 +00:00
Sergey Biryukov
d9e6a5dd68 Tests: Correct ::assertArrayHasKey() capitalization in [46252].
Props dkarfa, david.binda.
Fixes #48155.

git-svn-id: https://develop.svn.wordpress.org/trunk@46329 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-26 20:30:35 +00:00
John Blackbourn
6b983b1d5c Themes: Add a test to ensure get_template_part() does not return a value.
This function must not be modified to return anything due to existing themes which output the return value, for example via `echo get_template_part( ... )`.

See #40969


git-svn-id: https://develop.svn.wordpress.org/trunk@46328 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-26 20:25:59 +00:00
Sergey Biryukov
4f77abf6b9 REST API: Use delta comparison for floating date test added in [46279] to avoid race conditions.
See #48113.

git-svn-id: https://develop.svn.wordpress.org/trunk@46318 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-26 01:39:19 +00:00
Sergey Biryukov
f68fe85b41 Coding Standards: Remove inline assignment in test_wp_delete_term_should_invalidate_cache().
See #48142.

git-svn-id: https://develop.svn.wordpress.org/trunk@46317 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-26 01:33:44 +00:00
Jake Spurlock
628a545369 General: Further phpcs cleanup.
In [46312] and [46313] we attempted to do some phpcs cleanup. This commit cleans up three issues that were introduced in [46309].

Fixes #48142.

Props: whyisjake, garrett-eclipse, desrosj


git-svn-id: https://develop.svn.wordpress.org/trunk@46314 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-26 00:36:20 +00:00
Jake Spurlock
ad7b57b611 General: Linter cleanup
`phpcbf` was able to clean up a few files. Tests were breaking as a result of code formatting.

Fixes #48142
Props whyisjake


git-svn-id: https://develop.svn.wordpress.org/trunk@46312 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-25 22:52:54 +00:00
Jake Spurlock
6649b3638c Themes: Improve Twenty Fifteen sticky sidebar logic
The current logic in TwentyFifteen (#30366) for making the sidebar sticky while still allowing to scroll through it when the sidebar height is larger than the viewport height is flawed and massively overcomplicated.
This can be mitigated by removing the admin bar specific logic and leaving most of the heavy lifting up to the browser.

Fixes #37536

Props DvanKooten, lukecavanagh, karmatosed, ianbelanger, davidbaumwald



git-svn-id: https://develop.svn.wordpress.org/trunk@46308 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-25 21:37:09 +00:00
Jonathan Desrosiers
2d4521d82a Build/Test Tools: Remove stray + introduced in [45979].
Props david.binda.
Fixes #48127.

git-svn-id: https://develop.svn.wordpress.org/trunk@46294 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-25 19:54:18 +00:00
Sergey Biryukov
197d99a589 Twenty Twenty: Rename widget areas to sidebar-1 and sidebar-2.
This ensures that widgets are mapped correctly and is consistent with the previous default themes.

See https://github.com/WordPress/twentytwenty/issues/481.

Reverts [46282].

Props ocean90, garrett-eclipse, desrosj, SergeyBiryukov.
See #48110.

git-svn-id: https://develop.svn.wordpress.org/trunk@46283 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 23:16:59 +00:00
Sergey Biryukov
bb41a65acd Tests: Correct sidebar names for Twenty Twenty.
See #48110.

git-svn-id: https://develop.svn.wordpress.org/trunk@46282 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 22:03:53 +00:00
Sergey Biryukov
4b6a9f92ca REST API: Use delta comparison for floating date tests added in [46252] to avoid race conditions.
See #39953.

git-svn-id: https://develop.svn.wordpress.org/trunk@46280 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 21:17:04 +00:00
K. Adam White
b7f36f7f56 Posts, Post Types: Build list of "date floating" post stati dynamically when inserting post.
Completes work begun in #39953 to expose "date floating" status information to frontend clients via the REST API.

Props TimothyBlynJacobs.
Fixes #48113.


git-svn-id: https://develop.svn.wordpress.org/trunk@46279 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 21:01:16 +00:00
Jonathan Desrosiers
0f1636c621 Bundled Themes: Make Twenty Twenty the new default theme.
After being imported in [46271], Twenty Twenty can now be set as the default theme in WordPress.

See #48110.
Props desrosj, ocean90.

git-svn-id: https://develop.svn.wordpress.org/trunk@46278 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 20:59:48 +00:00
K. Adam White
49155e679c REST API: Introduce WP_Post_Type::get_rest_controller() caching method to prevent unnecessary REST controller construction.
Cache REST controller references on their associated post type object to prevent unnecessary controller re-instantiation, which previously caused "rest_prepare_{$post_type}" and "rest_{$post_type}_query" to run twice per request.

Props TimothyBlynJacobs, patrelentlesstechnologycom.
Fixes #45677.


git-svn-id: https://develop.svn.wordpress.org/trunk@46272 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 20:24:59 +00:00
Sergey Biryukov
f29fdab426 Coding Standards: Fix WPCS issue in [46262].
See #47952.

git-svn-id: https://develop.svn.wordpress.org/trunk@46266 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 19:28:43 +00:00
Sergey Biryukov
06868d4d12 Privacy: Introduce wp_privacy_personal_data_email_to and wp_privacy_personal_data_email_subject filters.
Pass email data to the `wp_privacy_personal_data_email_content` filter.

Props garrett-eclipse, thakkarhardik, birgire.
Fixes #46303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46265 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 19:24:20 +00:00
John Blackbourn
f3a268f58c Build/Test tools: Ensure the create_and_get() factory method returns the appropriate WP_Error when creating a term fails.
Fixes: #47952 


git-svn-id: https://develop.svn.wordpress.org/trunk@46262 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 18:54:16 +00:00
Andrea Fercia
5863bd30a0 Fix PHP coding standards after [46251].
git-svn-id: https://develop.svn.wordpress.org/trunk@46259 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 18:11:15 +00:00
K. Adam White
42e5e4d5d5 REST API: Introduce date_floating property on status endpoint response objects.
Expose a date_floating property on all status objects to permit clients (including the block editor) to make correct decisions about date handling for posts of varying status.

Props mnelson4, earnjam, kadamwhite, jnylen0, nerrad, pento.
See #39953.



git-svn-id: https://develop.svn.wordpress.org/trunk@46252 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 17:39:36 +00:00
John James Jacoby
f2b03e208a Multisite/Sites: Add links to filter websites by status.
This commit brings the Network-Admin Sites list page up-to-speed with other similar list-table powered pages, by adding links to filter the results by Site Status.

Includes a single unit test for the newly introduced `wp_count_sites()` multisite function, named to match the `wp_count_` function pattern from other list tables.

Fixes #37392. Props mnelson4, spacedmonkey, pbiron.



git-svn-id: https://develop.svn.wordpress.org/trunk@46251 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 17:34:20 +00:00
K. Adam White
27a5302e7d REST API: Pass "null" as the post date property to reset post to initial "floating" date value.
Props TimothyBlynJacobs, adamsilverstein, jnylen0, mnelson4.
Fixes #44975.



git-svn-id: https://develop.svn.wordpress.org/trunk@46249 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 17:24:58 +00:00
Peter Wilson
123c17536f KSES: Add support for modern layout techniques in style attribute.
Adds support for `flex`, `grid` and `column` layout techniques to the list of CSS attributes considered safe for inline CSS. The `\` character and CSS functions, eg `minmax()` are not yet supported.

Extends support of `border` properties to include `border-radius` and individual `background` properties to include all those implicitly supported by the shorthand attribute.

Props mrahmadawais, marybaum, birgire, peterwilsoncc, azaozz.
Fixes #37248.
See #47367.


git-svn-id: https://develop.svn.wordpress.org/trunk@46235 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-22 22:16:19 +00:00
Sergey Biryukov
4d6ca5bfe5 Tests: Correct assertion in test_wp_validate_boolean() to make sure the return type is properly tested.
Props jrf.
Fixes #39868.

git-svn-id: https://develop.svn.wordpress.org/trunk@46224 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-21 10:28:53 +00:00
Sergey Biryukov
0bd3d78db1 Tests: Remove a workaround for str_getcsv().
The `str_getcsv()` function was introduced in PHP 5.3.0, so no longer needs a polyfill.

Props jrf.
Fixes #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46222 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:43:50 +00:00
Sergey Biryukov
5f0fb23a3b Tests: Remove a workaround for get_called_class().
The `get_called_class()` function was introduced in PHP 5.3, so no longer needs a workaround.

Mark `WP_UnitTestCase_Base::get_called_class()` as deprecated. Leave it in place for now as plugins or themes using the WP unit test framework might still call this method.

Props jrf.
See #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46221 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:39:23 +00:00
Sergey Biryukov
3a49864e41 Tests: Remove a test for rest_preload_api_request() only relevant for PHP 5.2.
Props dkarfa.
See #48074.

git-svn-id: https://develop.svn.wordpress.org/trunk@46219 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-20 22:26:18 +00:00