Commit Graph

3535 Commits

Author SHA1 Message Date
Sergey Biryukov b72fcb6a47 Tests: Adjust the test for invalid username in `WP_Test_REST_Users_Controller` to match the new string.
Follow-up to [48195].

See #47003.

git-svn-id: https://develop.svn.wordpress.org/trunk@48196 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-28 07:49:29 +00:00
Sergey Biryukov 506fab2814 Docs: Remove extra spaces from `@ticket` tag in unit tests.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48190 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-27 12:01:30 +00:00
Ella van Durpe 24465974cd Editor: update JavaScript packages
Also update default block categories

Props youknowriad, gziolo, aduth.
Fixes #50420, #50278.



git-svn-id: https://develop.svn.wordpress.org/trunk@48177 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-26 13:31:11 +00:00
Sergey Biryukov 7ce1ba7f98 Tests: Reformat `test_wp_list_pages_discarded_whitespace()` for better readability.
See #50466, #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@48176 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-26 12:07:52 +00:00
Timothy Jacobs 5b90ea41b5 REST API: Introduce Block Types endpoint.
This endpoint allows a user to retrieve the block type definition for all server-side registered block types.

Props spacedmonkey, aduth, gziolo, ocean90, TimothyBlynJacobs.
Fixes #47620.


git-svn-id: https://develop.svn.wordpress.org/trunk@48173 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-26 00:44:44 +00:00
Timothy Jacobs 9a604011ee Themes: Introduce register_theme_feature API.
Currently themes can declare support for a given feature by using add_theme_support(). This commit adds a register_theme_feature() API that allows plugins and WordPress Core to declare a list of available features that themes can support.

The REST API uses this to expose a theme's supported features if the feature has been registered with "show_in_rest" set to true.

Props kadamwhite, spacedmonkey, williampatton, desrosj, TimothyBlynJacobs.
Fixes #49406.


git-svn-id: https://develop.svn.wordpress.org/trunk@48171 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-25 22:11:09 +00:00
Felix Arntz 9568134d7b Media: Ensure images have dimensions to reduce layout shift and facilitate lazy-loading.
This changeset ensures that attachment images which are inserted without `width` and `height` attributes still receive them in the frontend, to reduce cumulative layout shift. Adding the dimensions happens as part of the logic for adding `srcset` and `sizes` attributes, which already assume the specific width and height of the respective image.

Images are now only lazy-loaded if they have `width` and `height` attributes present. While missing these attributes itself is what causes layout shifts, lazy-loading such images can make this problem more apparent to the user.

Props adamsilverstein, westonruter.
Fixes #50367. See #44427.


git-svn-id: https://develop.svn.wordpress.org/trunk@48170 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-25 18:43:25 +00:00
Sergey Biryukov de36eb3326 Canonical: Move trailing slash handling for `robots.txt` and sitemaps to a single condition.
Give the unit test a more descriptive name.

Follow-up to [48153], [48155].

See #48025.

git-svn-id: https://develop.svn.wordpress.org/trunk@48166 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-25 11:39:23 +00:00
Sergey Biryukov 72c7f2c41c Administration: Correct and simplify the logic for `asc` and `desc` arguments in `WP_List_Table::get_sortable_columns()`.
Setting the initial order didn't work as expected due to reversed logic.

Follow-up to [48151].

See #45089.

git-svn-id: https://develop.svn.wordpress.org/trunk@48165 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-25 11:33:23 +00:00
Greg Ziółkowski 92585e8df1 Editor: Introduce WP_Block and WP_Block_List classes
Backports functionality added in Gutenberg in the following PRs:
- https://github.com/WordPress/gutenberg/pull/21467
- https://github.com/WordPress/gutenberg/pull/21925
It's a few ideas related to block rendering and the provided block value, which is particularly impactful for work around block context.

Props aduth, TimothyBJacobs, noisysocks, epiqueras, youknowriad, talldanwp, zebulan.
Fixes #49926.



git-svn-id: https://develop.svn.wordpress.org/trunk@48159 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-25 05:14:43 +00:00
Sergey Biryukov 07e3dda9ba Tests: Add a post author to "Parent 1" page fixture in `tests/post/listPages.php`.
This avoids indeterminate ordering in `test_wp_list_pages_sort_column()`.

Fixes #50466.

git-svn-id: https://develop.svn.wordpress.org/trunk@48157 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-24 15:00:43 +00:00
Jake Spurlock 6dba36e4ef Canonical: Add tests for trailing slashes for robots.txt.
See #48025.

Props Toro_Unit, joostdevalk, SergeyBiryukov.


git-svn-id: https://develop.svn.wordpress.org/trunk@48155 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-24 00:05:21 +00:00
Jake Spurlock ec062c08fe Comments: Allow `wp_update_comment()` to return `WP_Error()`.
The `wp_update_comment_data` filter introduced in 4.7 allows comment data to be filtered before it is updated in the database.

The patch aims to handle `WP_Error` as the filter above return value in a similar manner as is done for `wp_new_comment()`.


Fixes #39732.

Props: enricosorcinelli, swissspidy, gkloveweb, jnylen0, jbpaul17, afercia, SergeyBiryukov, audrasjb, imath, davidbaumwald.


git-svn-id: https://develop.svn.wordpress.org/trunk@48154 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-24 00:03:33 +00:00
Jake Spurlock 95b9933e64 Administration: Update `WP_List_Table::get_sortable_columns()` to support `asc` and `desc` arguments.
This makes the API a little more clear, whereas setting `false` used to mean `asc` and `true` meant `desc`, you can now use those directly, while maintaining back-compat.

Fixes #45089.

Props Tkama, SergeyBiryukov, shital-patel, desrosj, birgire, davidbaumwald. 



git-svn-id: https://develop.svn.wordpress.org/trunk@48151 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 23:13:35 +00:00
Greg Ziółkowski 5f6ab44340 Editor: Introduce new API method that register block from `block.json` metadata file
Backports changes added to Gutenberg in:
- https://github.com/WordPress/gutenberg/pull/20794
- https://github.com/WordPress/gutenberg/pull/22519
`register_block_type_from_metadata` function is going to be used to register all blocks on the server using `block.json` metadata files.

Props ocean90, azaozz, aduth, mcsf, jorgefilipecosta, spacedmonkey, nosolosw, swissspidy and noahtallen.
Fixes #50263.



git-svn-id: https://develop.svn.wordpress.org/trunk@48141 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 15:43:19 +00:00
Sergey Biryukov 0a301ec4b5 Docs: Use sentence case for comments in `tests/kses.php`, per the documentation standards.
Follow-up to [48132].

See #49464, #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48139 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 11:09:04 +00:00
Jake Spurlock 8368cc2b44 Embeds: Ensure that classic embed support works in the block editor.
See https://github.com/WordPress/gutenberg/pull/6345

Fixes #45447.

Props swisspidy, pento, audrasjb, aduth, jrchamp, thrijith, TimothyBlynJacobs, whyisjake. 
 


git-svn-id: https://develop.svn.wordpress.org/trunk@48135 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 06:06:11 +00:00
Jake Spurlock 7b08983ce4 Comments: Ensure the proper comment count and pages for unapproved comments.
Previiously, unapproved comments can alter the comment count, returning incorrect page numbers.

Fixes #8973.

Props GregMulhauser, dd32, ryan, mrmist, hakre, solarissmoke, billerickson, ericlewis, SergeyBiryukov, chriscct7, dossy, lukecavanagh, renggo888, jdorner, matjack1, pento, audrasjb, imath, davidbaumwald, whyisjake.  



git-svn-id: https://develop.svn.wordpress.org/trunk@48133 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 05:22:39 +00:00
Jake Spurlock 888421a924 Formatting: Extend `wp_kses_hair` and `wp_kses_hair_parse` to allow digits and underscores.
Fixes a lot of issues around parsing XML/HTML attributes.

Fixes #49464.

See #34406, #48608.

Props codeforest, zodiac1978, johnpgreen, dlh, ayeshrajans, johnpgreen, rilwis, travisnorthcutt, miqrogroove, chriscct7, whyisjake.


git-svn-id: https://develop.svn.wordpress.org/trunk@48132 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 05:05:57 +00:00
Jake Spurlock 800cfa8a82 Privacy: Use relative paths for exported personal data.
Ensures back-compat while moving to paths off of the /exports directory.

Fixes: #44038.

Props: allendav, mrTall, desrosj, garrett-eclipse, cameronamcintyre, nmenescardi, xkon, whyisjake, davidbaumwald.


git-svn-id: https://develop.svn.wordpress.org/trunk@48127 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 22:38:11 +00:00
Jonathan Desrosiers 517c27e297 Docs: Small inline documentation corrections following [48121].
Also, remove the `version` argument from the `wp.deprecated()` call in `password-strength-meter.js`. This argument is for specifying the version a feature will be removed, not when the feature was removed.

Props hareesh-pillai.
Fixes #50413.

git-svn-id: https://develop.svn.wordpress.org/trunk@48124 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 19:07:57 +00:00
Jonathan Desrosiers e26394bb2d General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.

git-svn-id: https://develop.svn.wordpress.org/trunk@48121 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 17:24:34 +00:00
Greg Ziółkowski 9b2b8cad20 Editor: Remove default "layout" block attribute from WP_Block_Type::get_attributes
The merging behavior which assigns the `layout` attribute in `WP_Block_Type` gets removed.

Props aduth, TimothyBlynJacobs.
Fixes #50257.



git-svn-id: https://develop.svn.wordpress.org/trunk@48118 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 12:20:20 +00:00
Greg Ziółkowski 699c8557f9 Blocks: Add context fields to WP_Block_Type
New block context related fields were added as part of https://github.com/WordPress/gutenberg/pull/22686. This changest backports them to WP_Block_Type class.

Props aduth, spacedmonkey, mcsf, epiqueras.
Fixes #47656.  



git-svn-id: https://develop.svn.wordpress.org/trunk@48117 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 10:24:42 +00:00
Andrea Fercia 98d22d5d3d I18N: Restore the "Error:" prefix for error messages.
Partially reverts [48059] as there's no full consensus on the removal of the text prefix. Further actions should be taken to improve consistency and accessibility of the admin notices. Keeps some improvements to the translatable strings from [48059].

Fixes #47656.


git-svn-id: https://develop.svn.wordpress.org/trunk@48115 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-21 13:58:46 +00:00
Sergey Biryukov e8176a19e2 Posts, Post Types: Avoid a PHP warning when `get_the_content()` is called outside of the loop.
This ensures that `$pages` and other globals are only used after they have been set up in `setup_postdata()`.

Follow-up to [44941].

Props tessawatkinsllc, dontdream, spacedmonkey, squarecandy, davidbaumwald, SergeyBiryukov.
Fixes #47824. See #42814.

git-svn-id: https://develop.svn.wordpress.org/trunk@48114 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-21 10:34:35 +00:00
Sergey Biryukov a7264f196d Posts, Post Types: Simplify `test_setup_postdata_loop()`.
The important part here is calling `the_content()` after setting up post data for another post without updating global `$post`.

The `foreach()` loop is not necessary.

Follow-up to [UT1289].

See #47824, #24330.

git-svn-id: https://develop.svn.wordpress.org/trunk@48113 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-21 10:28:52 +00:00
Sergey Biryukov c682da9190 Docs: Use a hyphen with the "non" prefix in a more consistent way.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48106 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-20 12:13:58 +00:00
John Blackbourn 1db25e3d38 Docs: Remove unnecessary variables names from `@return` tags.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48100 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-19 22:53:54 +00:00
Adam Silverstein a1fd329682 Formatting: new filter `safecss_filter_attr_allow_css` on css parts.
Enables developers to determine whether a section of CSS should be allowed or discarded. By default, the value will be false if the part contains \ ( & } = or comments. Returning true allows the CSS part to be included in the output.

Replaces the `safe_style_disallowed_chars` filter introduced in r47891.

Props azaozz.
Fixes #37134.



git-svn-id: https://develop.svn.wordpress.org/trunk@48086 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-18 20:59:43 +00:00
Pascal Birchler b58973554d Sitemaps: Add XML sitemaps functionality to WordPress.
While web crawlers are able to discover pages from links within the site and from other sites, XML sitemaps supplement this approach by allowing crawlers to quickly and comprehensively identify all URLs included in the sitemap and learn other signals about those URLs using the associated metadata.

See https://make.wordpress.org/core/2020/06/10/merge-announcement-extensible-core-sitemaps/ for more details.

This feature exposes the sitemap index via `/wp-sitemap.xml` and exposes a variety of new filters and hooks for developers to modify the behavior. Users can disable sitemaps completely by turning off search engine visibility in WordPress admin.

This change also introduces a new `esc_xml()` function to escape strings for output in XML, as well as XML support to `wp_kses_normalize_entities()`.

Props Adrian McShane, afragen, adamsilverstein, casiepa, flixos90, garrett-eclipse, joemcgill, kburgoine, kraftbj, milana_cap, pacifika, pbiron, pfefferle, Ruxandra Gradina, swissspidy, szepeviktor, tangrufus, tweetythierry.
Fixes #50117.
See #3670. See #19998.


git-svn-id: https://develop.svn.wordpress.org/trunk@48072 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-17 15:22:49 +00:00
TimothyBlynJacobs 2b42ac5a12 REST API: Only register one block renderer route.
Every block has a different set of attributes. These attributes are specified as a JSON Schema object. Previously, every block registered its own block renderer route using its attributes for the schema. This allowed for the attributes to be validated using the built in endpoint validation rules. It had the unfortunate side effect, however, of creating a large number of nearly identical REST API routes, one for each dynamic block. Each registered route has a performance impact. As the number of server side blocks goes up, this becomes more and more of an issue.

Now, we register a single block renderer route and dynamically validate the attributes based on the selected block.

Fixes #48079.
Props gziolo, TimothyBlynJacobs.


git-svn-id: https://develop.svn.wordpress.org/trunk@48069 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-17 03:20:02 +00:00
Jake Spurlock d17a57a945 Themes: Add additional later escaping to `post_class()` and `body_class()` functions.
Additionally, this adds a few tests to test output.

Fixes #20009.

Props mfields, scribu, azaozz, obenland, dd32, nacin, jrf, jdgrimes, garyj, whyisjake. 
 


git-svn-id: https://develop.svn.wordpress.org/trunk@48060 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-16 16:55:45 +00:00
Andrea Fercia 50ece6d31c I18N: Remove the "Error:" prefix from error messages.
For a number of years, most of the WordPress error messages have been prefixed with "Error:". However, these messages appear in a context where it's already clear an error occurred. Whether it's an error, a warning, or any other classification, that's not so relevant for users. The content of the message is the relevant part. The "Error:" prefix doesn't add great value while it does add unnecessary complexity for the message readability.

Also, revises some of these messages to improve clarity and removes HTML from translatable strings.

Props garrett-eclipse, ramiy, SergeyBiryukov, afercia, sabernhardt, quadthemes, audrasjb. 
See #47003, #43037, #42945, #15887.
Fixes #47656.


git-svn-id: https://develop.svn.wordpress.org/trunk@48059 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-16 15:33:37 +00:00
Jonathan Desrosiers 6334056f65 Build/Test Tools: Prevent double `/`s when including PHPMailer files.
`ABSPATH` includes a trailing slash already.

Follow up of [48033].
Props desrosj.
See #50377, #41750.

git-svn-id: https://develop.svn.wordpress.org/trunk@48058 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-16 13:57:05 +00:00
Jonathan Desrosiers dfcbff2db0 Emoji: Upgrade Twemoji to version 13.0.0.
🥸

Props kraftbj, desrosj, otto42.
Fixes #50148.

git-svn-id: https://develop.svn.wordpress.org/trunk@48048 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-15 18:02:14 +00:00
Sergey Biryukov d9c53241dc Networks and Sites: Don't unnecessarily switch to the current blog in `get_blog_details()`.
Props arpitgshah, djennez, acsnaterse, joostdevalk, SergeyBiryukov.
Fixes #50391.

git-svn-id: https://develop.svn.wordpress.org/trunk@48044 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-15 12:29:13 +00:00
Sergey Biryukov eb06a59f53 Posts, Post Types: Introduce `default_category_post_types` filter.
The filter allows custom post types associated with the `category` taxonomy to opt in to requiring a default category, same as regular posts.

Props enrico.sorcinelli.
Fixes #43516.

git-svn-id: https://develop.svn.wordpress.org/trunk@48043 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-14 21:40:10 +00:00
Jonathan Desrosiers 0933882c6e External Libraries: Upgrade PHPMailer to version 6.1.6.
Now that WordPress Core supports PHP >= 5.6, the PHPMailer library can be updated to the latest version.

The PHPMailer files now reside in a new directory, `wp-includes/PHPMailer`. These files are copied verbatim from the library upstream and will make updating in the future easier. For backwards compatibility, the old files will remain and trigger deprecated file warnings.

The PHPMailer class is also now under the `PHPMailer\PHPMailer\PHPMailer` namespace. The `PHPMailer` class in the global namespace has been aliased for a seamless transition.

This upgrade also clears up a handful of PHP compatibility issues detailed in #49922.

For a full list of changes, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v5.2.27...v6.1.6.

Props Synchro, SergeyBiryukov, desrosj, donmhico, ayeshrajans.
Fixes #41750.

git-svn-id: https://develop.svn.wordpress.org/trunk@48033 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-12 15:45:30 +00:00
Jake Spurlock 2efbc51712 Editor: Ensure latest comments can only be viewed from public posts.
Props: poena, xknown. 


git-svn-id: https://develop.svn.wordpress.org/trunk@47984 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-10 19:18:50 +00:00
Jake Spurlock fe83aca573 Embeds: Ensure that the title attribute is set correctly on embeds.
Props xknown.


git-svn-id: https://develop.svn.wordpress.org/trunk@47947 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-10 16:34:18 +00:00
Timothy Jacobs ddf897db05 REST API: Fix updating "multiple" meta keys with non-string values.
Previously, the REST API would end up deleting each row of metadata and recreating it unnecessarily. This was caused by a type mismatch where the metadata API would always return a string value, and the REST API operated on a typed value.

The REST API now applies the same sanitization and type casting for "multiple" meta keys and "single" meta keys.

Fixes #49339.
Props renathoc.


git-svn-id: https://develop.svn.wordpress.org/trunk@47943 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-10 02:20:18 +00:00
Jonathan Desrosiers 45e9cb7066 Coding Standards: Cleans up some PHPCS issues introduced in [47938].
See #20875.

git-svn-id: https://develop.svn.wordpress.org/trunk@47942 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-09 22:40:50 +00:00
Jake Spurlock d4d78e4ae7 Cache API: Introduce `wp_cache_get_multi()`.
Many caching backend have support for multiple gets in a single request. This brings that support to core, with a compatability fallback that will loop over requests if needed.

Fixes: #20875.
Props: nacin, tollmanz, wonderboymusic, ryan, jeremyfelt, spacedmonkey, boonebgorges, dd32, rmccue, ocean90, jipmoors, johnjamesjacoby, tillkruess, donmhico, davidbaumwald, SergeyBiryukov, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@47938 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-09 19:45:27 +00:00
Sergey Biryukov 65f22692bb Networks and Sites: Ensure the site ID in `wp_insert_site()` is still correct after calling `clean_blog_cache()`.
By saving `$wpdb->insert_id` to a variable, we make sure the ID does not change if another database insert is performed on the `clean_site_cache` action.

Props trepmal.
Fixes #50324.

git-svn-id: https://develop.svn.wordpress.org/trunk@47932 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-09 12:39:09 +00:00
Timothy Jacobs f5dde31290 REST API: Support the (min|max)Items JSON Schema keywords.
A future commit will add support for the uniqueItems keyword.

Props sorenbronsted.
See #48821.


git-svn-id: https://develop.svn.wordpress.org/trunk@47923 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-07 22:40:16 +00:00
Timothy Jacobs 4fb1e58c50 REST API: Add additional fields to the themes controller.
When the themes controller was introduced it only returned a theme's supported features. This adds the majority of a theme's header information to the response.

Props ockham, spacedmonkey.
Fixes #49906.


git-svn-id: https://develop.svn.wordpress.org/trunk@47921 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-07 06:44:08 +00:00
Sergey Biryukov d4d709856b Docs: Update the DocBlock for the `wp_media_attach_action` hook per the documentation standards.
Rename the `$att_id` variable to `$attachment_id` for clarity.

Follow-up to [47909].

See #49614.

git-svn-id: https://develop.svn.wordpress.org/trunk@47913 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-05 08:28:42 +00:00
Jake Spurlock e756de59e5 REST API: Ensure that all properties of `get_endpoint_args_for_item_schema` are listed.
* Add new var $valid_schema_properties to match rest_validate_value_from_schema()
* Unit test to ensure all valid properties exists, and non-valid properties are ignored

Fixes: #50301.
Props: pentatonicfunk, TimothyBlynJacobs.



git-svn-id: https://develop.svn.wordpress.org/trunk@47911 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-04 16:41:47 +00:00
Aaron Jorbin 42efaab548 Build/Test: Die with an error if populate_network fails
If you are missing WP_TESTS_EMAIL, populate_network will fail and it can be hard to debug. As populate_network can return a wp_error object, we can detect that and display the error to a user.

See: https://github.com/WordPress/gutenberg/pull/22613
Fixes: #50251
Props: TimothyBlynJacobs


git-svn-id: https://develop.svn.wordpress.org/trunk@47904 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-03 21:02:42 +00:00
Adam Silverstein fa96d59318 Formatting: add a new 'safe_style_disallowed_chars' filter.
Enable developers to change the regex used in `safecss_filter_attr` to limit characters in the parsed CSS.

Props paulschreiber, swissspidy, rmccue, bartekcholewa, miinasikk.
Fixes #37134.



git-svn-id: https://develop.svn.wordpress.org/trunk@47891 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-02 23:44:40 +00:00
Dominik Schilling 2fed7bf581 Build/Test Tools: Avoid an empty "title" heading if no title is set in `_wp_die_handler_exit()` and `_wp_die_handler_txt()`.
Fixes #50297.

git-svn-id: https://develop.svn.wordpress.org/trunk@47882 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 20:48:27 +00:00
Dominik Schilling 178eeaf57e Build/Test Tools: Let `WP_UnitTestCase_Base` extend the namespaced version of PHPUnit's test case class.
With the minimum PHP version requirement set to 5.6 we're now able to use namespaces by default. This replaces `PHPUnit_Framework_TestCase` with `PHPUnit\Framework\TestCase` for `WP_UnitTestCase_Base` to solve autocompletion issues with code editors when using more recent PHPUnit versions. `PHPUnit\Framework\TestCase` is available since PHPUnit 5.4 and now the minimum required PHPUnit version.

Fixes #50236.

git-svn-id: https://develop.svn.wordpress.org/trunk@47880 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 19:41:50 +00:00
Jake Spurlock 0ad7471880 Canonical: Add the ability to disable `redirect_guess_404_permalink()`.
This also adds a few more filters to make adding redirects easier. Notably:

1. `do_redirect_guess_404_permalink`
2. `pre_redirect_guess_404_permalink`
3. `strict_redirect_guess_404_permalink`

Fixes: #16557.
Props: msafi, nacin, simonwheatley, westi, mboynes, joostdevalk, Lex_Robinson, MikeSchinkel, haukep, paulschreiber, DrewAPicture, ravenswd, esemlabel, stevegibson12, martychc23, DrLightman, jivanpal, neonkowy, laternastudio, apedog, audrasjb, davidbaumwald, Confridin, donmhico, ryotsun. 



git-svn-id: https://develop.svn.wordpress.org/trunk@47878 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 18:47:41 +00:00
Dominik Schilling 028299ac79 Editor: Fix code style for constructor arguments added in [47875].
Also revert unintended changes to `WP_Block_Type::__construct()` DocBlock.

See #48529.

git-svn-id: https://develop.svn.wordpress.org/trunk@47876 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 16:25:18 +00:00
Greg Ziółkowski 822ca9ebc7 Add fields to WP_Block_Type
As part of #47620 and the RFC for block registeration. Server registered blocks are missing some fields. These changeset includes them.

Props spacedmonkey, aduth.

Fixes #48529.



git-svn-id: https://develop.svn.wordpress.org/trunk@47875 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 12:25:34 +00:00
Jake Spurlock 38744d8bd2 Code Standards: Clean up whitespace on the end of a file.
See: #45163.
Props: whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@47866 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-29 23:34:00 +00:00
Jake Spurlock 7b13f5abd8 Taxonomy: Extend `get_term_by` to accept `ID` as a term parameter.
Similar to `get_user_by`, both `ID` and `id` should be able to accepted.

Fixes #45163.
Props emrikol, esoj.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@47865 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-29 22:41:25 +00:00
Dominik Schilling f37a28858d Role/Capability: Use meta caps `edit_post`, `read_post`, and `delete_post` directly.
Rather than consulting the post type object, let `map_meta_cap()` handle that for us.

Props peterwilsoncc, ocean90.
Fixes #50128.
See #23226.

git-svn-id: https://develop.svn.wordpress.org/trunk@47850 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-23 15:22:53 +00:00
Dominik Schilling 584df2a169 Rest API: Ensure `rest_ensure_response()` upgrades `WP_HTTP_Response` to `WP_REST_Response`.
An instance of `WP_HTTP_Response` doesn't ensure that the required methods used in `WP_REST_Server::dispatch()` exist, currently causing a fatal error.

Props ali11007, TimothyBlynJacobs, ocean90.
Fixes #49495.

git-svn-id: https://develop.svn.wordpress.org/trunk@47849 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-23 14:34:38 +00:00
Jake Spurlock 3ab28fd579 REST API: Ensure proper namespacing when registering routes.
The PR will corerce routes that have a leading slash and throwing a `_doing_it_wrong` notice while ensuring a proper namespace.

Fixes #49749.
Props TimothyBlynJacobs, skarabeq, afercia.



git-svn-id: https://develop.svn.wordpress.org/trunk@47842 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-22 20:46:03 +00:00
Peter Wilson 09a6234ed3 KSES: Support the `video` element's `playsinline` attribute.
Allow users without the `unfiltered_html` capability to use the `playsinline` attribute when embedding videos.

Additionally this adds unit tests for passing the video element through kses.

Fixes #50167. See #29826.


git-svn-id: https://develop.svn.wordpress.org/trunk@47837 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-21 04:52:33 +00:00
Timothy Jacobs d8a063eabb REST API: Support the JSON Schema pattern keyword.
Props jason_the_adams, birgire, sorenbronsted.
Fixes #44949.


git-svn-id: https://develop.svn.wordpress.org/trunk@47810 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-16 19:01:49 +00:00
Timothy Jacobs 8b9823f536 REST API: Check required properties are provided when validating an object.
Previously, the WP_REST_Request object validated that top-level properties were defined, but this did not extend to those object's required properties. This adds validation to rest_validate_value_from_schema() directly.

Both the v3 and v4 JSON Schema syntax for required properties is supported.

Props sorenbronsted.
Fixes #48818.


git-svn-id: https://develop.svn.wordpress.org/trunk@47809 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-16 18:41:41 +00:00
Sergey Biryukov 06dbf33561 Tests: Give canonical test fixtures for paginated content more descriptive names.
Follow-up to [47727].

See #28081, #40773, #45337.

git-svn-id: https://develop.svn.wordpress.org/trunk@47781 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-10 20:29:18 +00:00
Sergey Biryukov c395d6fcd9 Coding Standards: Rename some files and classes in `phpunit/tests/functions/` per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@47780 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-10 12:07:49 +00:00
Peter Wilson c860753778 Tests: Add unit tests for `_cleanup_header_comment()`.
Props pbearne.
Fixes #38101. See #8497.


git-svn-id: https://develop.svn.wordpress.org/trunk@47779 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-10 05:21:48 +00:00
Sergey Biryukov efb6e805da Administration: Avoid a PHP 7.4 notice in `add_meta_box()` when attempting to re-add a previously removed box.
The logic for skipping previously removed meta boxes with the `core` priority should also apply to the `sorted` priority that is used when the boxes were manually reordered.

Add a unit test.

Props coolmann, franzarmas, SergeyBiryukov.
Fixes #50019.

git-svn-id: https://develop.svn.wordpress.org/trunk@47777 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-09 12:24:31 +00:00
Sergey Biryukov de14ea86bf Canonical: Redirect paged requests for a static page assigned as the "Posts page".
This avoids displaying duplicate content of the home page under different URLs with appended page numbers.

This change only affects the `<!--nextpage-->` pagination (`page` query variable) and not the regular multiple posts pagination (`paged` query variable).

The posts page does not support the `<!--nextpage-->` pagination, so requests for invalid page numbers should be redirected to the page permalink, applying the logic previously implemented for single posts or pages.

Follow-up to [34492], [47727].

Props jeremyfelt, sachit.tandukar, SergeyBiryukov.
Fixes #45337. See #40773, #28081, #11694.

git-svn-id: https://develop.svn.wordpress.org/trunk@47760 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-04 10:40:06 +00:00
Timothy Jacobs 8153d15f09 REST API: Support more JSON Schemas when filtering a response by context.
The array type, multi-types, and the additional properties keyword are now supported. Additionally, the filter recurses to an infinite depth.

Fixes #48819.


git-svn-id: https://develop.svn.wordpress.org/trunk@47758 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-04 02:44:44 +00:00
Timothy Jacobs 5460e0df1e REST API: Accept POST requests in the block renderer endpoint.
Rendering a block is idempotent, so a GET is the most natural request method. However, the maximum length of URLs prevented blocks with large attributes from being rendered.

Props ryankienstra.
Fixes #49680.


git-svn-id: https://develop.svn.wordpress.org/trunk@47756 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-03 22:56:01 +00:00
Timothy Jacobs ef05acdfaa REST API: Support the uuid JSON Schema format.
This accepts a uuid of any version. A future commit could add support for restricting uuids to a specific version.

Props johnwatkins0.
Fixes #50053.


git-svn-id: https://develop.svn.wordpress.org/trunk@47753 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-03 19:18:40 +00:00
John Blackbourn 4889e7a8d2 Menus: Allow empty taxonomy terms to be surfaced when searching for items.
This brings the behaviour inline with that of browsing terms or using the All Items tab, which correctly shows empty terms.

Props birgire, audrasjb

Fixes #45298

git-svn-id: https://develop.svn.wordpress.org/trunk@47747 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-02 22:34:50 +00:00
Sergey Biryukov af596bcc5b Canonical: Redirect paged requests for non-paginated posts to the post permalink.
This avoids displaying duplicate content of the same post under different URLs and ensures the canonical URL is correct.

Previously, requests for invalid page numbers were only redirected to the post permalink if the post was actually paginated using the `<!--nextpage-->` marker.

Follow-up to [34492].

Props jeremyfelt, prografika, sachit.tandukar, subrataemfluence, hronak, ekatherine, henry.wright, chesio, dd32, SergeyBiryukov.
Fixes #40773. See #45337, #28081, #11694.

git-svn-id: https://develop.svn.wordpress.org/trunk@47727 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-30 12:03:11 +00:00
Sergey Biryukov c61e42db64 Coding Standards: Fix WPCS issues in `tests/formatting/SanitizeFileName.php`.
Follow-up to [47638].

git-svn-id: https://develop.svn.wordpress.org/trunk@47664 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-29 17:23:30 +00:00
Sergey Biryukov 514f7c4cc9 Docs: Correct `@since` versions, remove duplicate comment.
Follow-up to [47633].

git-svn-id: https://develop.svn.wordpress.org/trunk@47663 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-29 17:23:21 +00:00
Jake Spurlock 74d6f9613b Formatting: Expand `sanitize_file_name` to have better support for utf8 characters.
Props: xknown, peterwilsoncc.


git-svn-id: https://develop.svn.wordpress.org/trunk@47638 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-29 15:38:43 +00:00
Jake Spurlock 4354d1fc5c User: Invalidate `user_activation_key` on password update.
Props: sstoqnov, sergeybiryukov.



git-svn-id: https://develop.svn.wordpress.org/trunk@47634 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-29 15:23:37 +00:00
Jake Spurlock cfb690cb8e Customize: Add additional filters to Customizer to prevent JSON corruption.
This solution extends the wp_insert_post_data filter to pass in addition to the slashed/sanitized/processed data, and the slashed/sanitized/unprocessed data, to also pass the initial slashed/unsanitized/unprocessed data which was passed into wp_insert_post(). This then allows plugins to have complete control over how sanitization is performed based on the post type.

Props westonruter, peterwilsoncc, sstoqnov, whyisjake, xknown.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@47633 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-29 15:12:50 +00:00
Timothy Jacobs 86cbde382a REST API: Support the (min|max)Length JSON Schema keywords.
Props sorenbronsted.
Fixes #48820.


git-svn-id: https://develop.svn.wordpress.org/trunk@47627 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-27 02:27:02 +00:00
Sergey Biryukov 3a229d0b47 Comments: Ensure that inserting a comment with an empty type results in correct `comment` type.
Add unit tests for `wp_handle_comment_submission()` and `wp_insert_comment()` receiving an empty type.

Follow-up to [47597].

Props ocean90, imath.
Fixes #49236.

git-svn-id: https://develop.svn.wordpress.org/trunk@47626 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-26 13:42:03 +00:00
Sergey Biryukov 46aad811be Embeds: Fix incorrect usage of `get_home_url()` in oEmbed tests.
Switch to `home_url()` for consistency with other tests and to avoid confusion.

Props david.binda.
Fixes #49988.

git-svn-id: https://develop.svn.wordpress.org/trunk@47615 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-23 18:39:32 +00:00
Sergey Biryukov 5d5e3439e4 Users: Change "Your Profile" and "My Profile" links in admin menu and toolbar to just "Profile" for consistency.
Props donmhico, bcworkz, seanchayes, mikeschroder, garrett-eclipse, akhileshsabharwal, ScottSmith, nacin, jenmylo, afercia, swissspidy, felix-edelmann, helen, melchoyce, karmatosed.
Fixes #26769.

git-svn-id: https://develop.svn.wordpress.org/trunk@47600 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-20 08:37:31 +00:00
Sergey Biryukov d5a7a3a45d Comments: Use `comment` instead of an empty string for the `comment_type` DB field value in comments table.
This is the first step to bring support for custom comment types into WordPress.

Add a scheduled upgrade routine to update the type value for existing comments, in batches of 100 at a time.

Props imath, aaroncampbell, jeremyfelt, dshanske.
Fixes #49236.

git-svn-id: https://develop.svn.wordpress.org/trunk@47597 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-17 19:33:52 +00:00
K. Adam White 3abe80eea1 REST API: Handle parameter types consistently within set_param().
A request has multiple parameter types, including "query" and "json." Updating a parameter could previously modify a key's value in the wrong parameter type, leading to confusing and self-contradictory response objects.

Props mnelson4, TimothyBlynJacobs, vagios, jnylen0.
Fixes #40838.


git-svn-id: https://develop.svn.wordpress.org/trunk@47559 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-09 19:28:58 +00:00
Andrew Ozz 7b5d78f82f Media: Enable lazy-loading of images by automatically adding the new `loading="lazy"` attribute to image tags on the front-end.
- Introduces `wp_lazy_loading_enabled()`, `wp_filter_content_tags()`, `wp_img_tag_add_loading_attr()`, and `wp_img_tag_add_srcset_and_sizes_attr()` functions.
- Introduces `wp_lazy_loading_enabled`, `wp_img_tag_add_loading_attr`, and `wp_img_tag_add_srcset_and_sizes_attr` filters.

Props flixos90, addyosmani, mor10, swissspidy, pierlo, westonruter, spacedmonkey, mikeschroder, jonoaldersonwp, peterwilsoncc, narwen, jeffpaul, OptimizingMatters, futtta, mukeshpanchal27, azaozz.

Fixes #44427.

git-svn-id: https://develop.svn.wordpress.org/trunk@47554 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-08 00:53:18 +00:00
Sergey Biryukov d8f5ce0ae5 Tests: Remove `test_post_thumbnails_types_true()`.
The test incorrectly describes the behavior of `current_theme_supports( 'post-thumbnails' )` and only passes by accident.

Follow-up to [30148].

Fixes #49801.

git-svn-id: https://develop.svn.wordpress.org/trunk@47548 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-04 00:25:36 +00:00
K. Adam White b5117e1ad5 REST API: Fix revisions controller get_item permission check.
r45812 incorrectly introduced a delete_post permissions check into the get_item method, breaking some plugins which requested revisions when generating previews.

Props sorenbronsted, yohannp, TimothyBlynJacobs.
Fixes #49645.


git-svn-id: https://develop.svn.wordpress.org/trunk@47547 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-03 19:38:15 +00:00
John Blackbourn fe18be23fd Comments: Ensure all elements in the array returned by `get_comment_count()` are integers.
Previously elements would be a mixture of strings and integers depending on their numeric value.

Props progremzion, m.usama.masood

Fixes #48093

git-svn-id: https://develop.svn.wordpress.org/trunk@47526 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-28 20:42:31 +00:00
K. Adam White bef2746334 REST API: Fix _fields filtering of registered rest fields.
Use rest_is_field_included when determining which additional fields to include to permit filtering by nested field properties.

Props Dudo, kadamwhite, TimothyBlynJacobs.
Fixes #49648.


git-svn-id: https://develop.svn.wordpress.org/trunk@47511 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-26 17:50:39 +00:00
Sergey Biryukov 8e3d204e04 Docs: Update inline comment in `Tests_DB::test_locale_floats()`.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@47498 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-24 01:05:31 +00:00
Andrew Ozz 679fbbc422 Build/Test Tools: Fix PHPUnit bootstrap to install WP from `/build` when tests are run with `npm run test`, `grunt test`, `grunt` then `phpunit`, etc.
Fixes #49663.

git-svn-id: https://develop.svn.wordpress.org/trunk@47496 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-24 00:18:29 +00:00
Sergey Biryukov 31dd2e70f0 General: Trim the input data in `maybe_unserialize()`, for consistency with `is_serialized()`.
Props pbearne, mikeschroder.
Fixes #36416.

git-svn-id: https://develop.svn.wordpress.org/trunk@47454 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-13 21:12:01 +00:00
SergeyBiryukov 5ac6156507 Tests: Extract `is_serialized()` test cases into data providers; reuse them for `maybe_serialize()` and `maybe_unserialize()` tests.
Props pbearne, mikeschroder, SergeyBiryukov.
See #36416.

git-svn-id: https://develop.svn.wordpress.org/trunk@47452 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-13 20:39:02 +00:00
Sergey Biryukov ed9d5c383f Database: Introduce `wpdb::db_server_info()` to retrieve full MySQL server information string as supplied by `mysqli_get_server_info()`.
This complements `wpdb::db_version()`, which only returns a numeric version string and strips any additional information, e.g. vendor name.

Props clarinetlord, birgire, webaware, pento.
Fixes #40037. See #27703.

git-svn-id: https://develop.svn.wordpress.org/trunk@47451 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-12 15:53:01 +00:00
Timothy Jacobs 60edf36394 REST API: Introduce "hex-color" JSON Schema format.
Props spacedmonkey, chrisvanpatten.
Fixes #49270.


git-svn-id: https://develop.svn.wordpress.org/trunk@47450 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-12 02:40:29 +00:00
Sergey Biryukov b6ac7c4f87 Tests: Remove unnecessary use of `wpdb_exposed_methods_for_testing` in `test_utf8mb3_post_saves_with_emoji()`.
Props clarinetlord.
Fixes #39998.

git-svn-id: https://develop.svn.wordpress.org/trunk@47431 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-05 11:53:34 +00:00
Jorge Costa ac4de42983 Scripts: Use core-js url as polyfill for window.URL.
URL polyfill from the polyfill-library library is not spec-conformant, in a way which negatively impacts its usability for pending revisions to the block editor. Specifically, there were revisions to the implementation of the wp-url script to detect URL validity by relying on thrown errors from the URL constructor, but this specific behavior is not implemented in this version of the polyfill.
There was another issue in r47238, which is that the test used to check whether the polyfill should be included is not accurate. This commit uses a different check and fixes the issue.

Props aduth.
Fixes: #49360.

git-svn-id: https://develop.svn.wordpress.org/trunk@47416 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-03 16:53:32 +00:00
Sergey Biryukov 98003a7546 Tests: Add a unit test to ensure the "Supported Versions" section of GitHub Security Policy always includes the latest stable branch.
See #48667, #48521.

git-svn-id: https://develop.svn.wordpress.org/trunk@47403 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-02 01:11:29 +00:00
Sergey Biryukov bc5a7e9506 Build/Test Tools: Remove redundant `Tests_Post_Types::register_post_type()` helper method, use `register_post_type()` directly.
Props gh640, varunshanbhag.
Fixes #49365.

git-svn-id: https://develop.svn.wordpress.org/trunk@47381 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-26 13:16:10 +00:00
Sergey Biryukov a6b80a326a Comments: Restore the fourth parameter of `comments_number()` as `$post_id`, for consistency with `get_comments_number_text()`.
The parameter was previously used as the number of comments, marked as deprecated in [5101].

Given that it's been deprecated for the last 13 years, it should be safe to undeprecate and repurpose it for a cleaner function signature, instead of adding a fifth parameter.

Follow-up to [47276].

Fixes #48772.

git-svn-id: https://develop.svn.wordpress.org/trunk@47366 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-25 17:32:34 +00:00
K. Adam White 4e0062e5be REST API: Correctly infer empty objects passed via query parameters.
Permit passing an empty object as the string "?obj=". The type of the passed empty argument is inferred from the registered schema.

Props TimothyBlynJacobs, steffanhalv, schlessera, dd32.
Fixes #42961.


git-svn-id: https://develop.svn.wordpress.org/trunk@47362 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-25 15:32:27 +00:00
K. Adam White b5190458fe REST API: Permit access to the themes controller if user can edit any post type.
Check a more exhaustive list of post type editing caps beyond "edit_post" to ensure custom user roles with access to to specific post types may still use block editor functionality depending on theme features.

Props miyauchi, TimothyBlynJacobs.
Fixes #46723.


git-svn-id: https://develop.svn.wordpress.org/trunk@47361 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-25 15:18:19 +00:00
K. Adam White a0ac0ff13d REST API: Apply all relevant block rendering filters when rendering block previews.
Several filters were introduced to the render_block method since the initial implementation of the block-renderer/ endpoints, causing the output of those endpoints to diverge from the rendered content of blocks on the frontend.

Props kadamwhite, TimothyBlynJacobs, miinasikk.
Fixes #49387.


git-svn-id: https://develop.svn.wordpress.org/trunk@47360 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-25 15:03:57 +00:00
Sergey Biryukov 317e1c076c Posts, Post Types: Ensure `delete_posts` is included in default post type capabilities regardless of `map_meta_cap` value.
This resolves PHP notices in a few places in core where this capability is checked.

Props Mte90, johnbillion, dipesh.kakadiya, jipmoors, bamadesigner, dd32, johnjamesjacoby, xedin.unknown, flixos90, SergeyBiryukov.
Fixes #30991.

git-svn-id: https://develop.svn.wordpress.org/trunk@47357 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-25 12:48:11 +00:00
K. Adam White 4e18f78ced REST API: Fix namespace shadowing issue in route matching logic.
Following [47260] a namespace such as "test-ns" prevents any namespace such as "test-ns/v1" from being found when matching routes.
While not best practice, this was an unintentional back-compat break; this patch restores the original behavior.

Props david.binda, TimothyBlynJacobs.
Fixes #48530.



git-svn-id: https://develop.svn.wordpress.org/trunk@47351 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-24 18:05:12 +00:00
Sergey Biryukov 8837ebd1f6 Build/Test Tools: Remove unused `::assertPostHasTerms()` method from `tests/term.php`.
The associated test was removed in [30241].

See #49485.

git-svn-id: https://develop.svn.wordpress.org/trunk@47341 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-21 17:03:12 +00:00
Timothy Jacobs 8a62f46beb REST API: Don't assume all item schemas have properties.
All schema types, not just objects, are permitted as the base type of a resource. A future patch could add validation support for those types, but this fix only prevents a PHP warning from being issued.

Props dhavalkasvala, johnwatkins0, birgire.
Fixes #48785.


git-svn-id: https://develop.svn.wordpress.org/trunk@47328 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-20 16:56:17 +00:00
Timothy Jacobs be371a7431 REST API: Fix links format in OPTIONS requests for non-variable routes.
Props nsundberg, johnwatkins0, birgire.
Fixes #49149.


git-svn-id: https://develop.svn.wordpress.org/trunk@47326 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-20 00:53:43 +00:00
Timothy Jacobs 727faabe98 REST API: Warn if registering array settings without an items schema.
The documentation for register_setting has also been clarified to include all of the supported types and the flexibility of the show_in_rest parameter.

Fixes #42875.
Props perrywagle, dshanske, kadamwhite.


git-svn-id: https://develop.svn.wordpress.org/trunk@47325 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-19 22:54:03 +00:00
Sergey Biryukov e4dda92bc5 Tests: Correct assertions in `test_site_dates_are_gmt()`.
`assertSame()` doesn't have the `$delta` parameter, only `assertEquals()` does.

Follow-up to [47313].

See #40364.

git-svn-id: https://develop.svn.wordpress.org/trunk@47318 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-19 04:38:39 +00:00
Sergey Biryukov 2d73050eda Posts, Post Types: Discard `tags_input` parameter in `wp_update_post()` if it's the same as existing post tags.
This ensures that `wp_update_post()` does not unintentionally modify post tags if the post has several tags with the same name but different slugs.

Tags should only be modified if `tags_input` parameter was explicitly provided, and is different from the existing tags.

Props kaggdesign, SergeyBiryukov.
Fixes #45121.

git-svn-id: https://develop.svn.wordpress.org/trunk@47317 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-19 03:50:38 +00:00
Sergey Biryukov 8de22575cd Tests: Use delta comparison in `test_site_dates_are_gmt()` to avoid race conditions.
See #40364.

git-svn-id: https://develop.svn.wordpress.org/trunk@47313 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-19 02:41:53 +00:00
Sergey Biryukov 2213eb37c4 Tests: Remove an irrelevant `tags_input` property assertion from `test_get_page_template_property()`.
This appears to be a copy/paste from the `test_get_tags_input_property()` test above.

See #45121.

git-svn-id: https://develop.svn.wordpress.org/trunk@47311 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-19 01:03:37 +00:00
Sergey Biryukov d4cc38581b Tests: Rename `$d` variable in some date/time tests to `$format` for clarity.
Follow-up to [47287].

See #49222.

git-svn-id: https://develop.svn.wordpress.org/trunk@47288 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-14 00:11:00 +00:00
Sergey Biryukov f97a60c9b7 Privacy: Revert [47269] for now to address side effects on Multisite installations.
See #44176.

git-svn-id: https://develop.svn.wordpress.org/trunk@47280 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 21:46:54 +00:00
Sergey Biryukov 1106d82f93 Privacy: Introduce filters for the headers of all the privacy-related e-mails:
* `wp_privacy_personal_data_email_headers`
* `user_request_confirmed_email_headers`
* `user_erasure_complete_email_headers`
* `user_request_action_email_headers`

Props xkon, garrett-eclipse, zaffarn, desrosj.
Fixes #44501.

git-svn-id: https://develop.svn.wordpress.org/trunk@47279 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 21:41:26 +00:00
Sergey Biryukov b8e935b2f2 Privacy: Add a table of contents to Personal Data Export report for easier navigation.
Props xkon, garrett-eclipse, birgire, karmatosed.
Fixes #46894.

git-svn-id: https://develop.svn.wordpress.org/trunk@47278 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 21:26:25 +00:00
Sergey Biryukov 4020493d45 Comments: Add a `$post_id` parameter to `get_comments_number_text()` and `comments_number()`.
This allow for using these functions outside of the loop.

Props donmhico, garrett-eclipse, Hinjiriyo, imath.
Fixes #48772.

git-svn-id: https://develop.svn.wordpress.org/trunk@47276 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 20:39:12 +00:00
Sergey Biryukov 0ad4121c91 Privacy: Introduce `wp_privacy_additional_user_data` filter to make it easier to include additional user meta in a personal data export.
Props pbiron, xkon, garrett-eclipse, azaozz.
Fixes #47509.

git-svn-id: https://develop.svn.wordpress.org/trunk@47270 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 18:57:51 +00:00
Sergey Biryukov 0911aecf36 Privacy: Un-map privacy capabilities to make them available to be assigned for custom roles:
* `erase_others_personal_data`
* `export_others_personal_data`
* `manage_privacy_options`

Previously mapped to `manage_options` or `manage_network` (on Multisite), these are now added to the Administrator role separately.

Additionally, `manage_privacy_options` is added to the Editor role.

Props garrett-eclipse, xkon, pbiron, desrosj, johnbillion, flixos90, juliobox, lakenh, Ov3rfly, ianatkins.
Fixes #44176.

git-svn-id: https://develop.svn.wordpress.org/trunk@47269 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 18:34:08 +00:00
K. Adam White b6dcb779ed REST API: Introduce rest_{$this->post_type}_item_schema filter to enable manipulation of schema values.
register_rest_field can be used to add properties to a schema, but no mechanism existed to alter existing properties like "content".
Running the schema through this filter lets plugins append additional sub-properties to existing schema definitions.

Props luisherranz, TimothyBlynJacobs, swissspidy, westonruter, kadamwhite.
Fixes #47779.



git-svn-id: https://develop.svn.wordpress.org/trunk@47265 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 16:26:56 +00:00
K. Adam White 886a02686b REST API: Allow meta to be set when creating a new media record via REST.
Props TimothyBlynJacobs, apermo.
Fixes #44567.


git-svn-id: https://develop.svn.wordpress.org/trunk@47261 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 03:37:17 +00:00
K. Adam White fc434a0c77 REST API: Match REST API routes on namespace before performing regex checks.
Rule out groups of API endpoints by simple namespace string comparison to reduce the number of regex checks necessary when matching a route.

Props TimothyBlynJacobs.
Fixes #48530.


git-svn-id: https://develop.svn.wordpress.org/trunk@47260 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 03:20:05 +00:00
K. Adam White d06637f9b5 REST API: List all core theme feature support details in /themes endpoint response.
Fully list which first-party core theme features are supported in the /themes endpoint response. This brings the REST API themes controller's response more in line with the output of get_theme_support().

Props adamboro, apieschel, koke, spacedmonkey, TimothyBlynJacobs.
See #49037.


git-svn-id: https://develop.svn.wordpress.org/trunk@47258 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 01:58:08 +00:00
Sergey Biryukov 49d8c4eff3 Docs: Improve documentation for `tests/phpunit/includes/spy-rest-server.php`.
Props andizer.
Fixes #47567.

git-svn-id: https://develop.svn.wordpress.org/trunk@47253 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-11 00:18:28 +00:00
Jorge Costa f558f5ff37 Block Editor: Update WordPress Packages; Remove navigation block; Add social links block
The following package versions were changed:
@wordpress/annotations: 1.11.0 -> 1.12.0
@wordpress/api-fetch: 3.10.0 -> 3.11.0
@wordpress/block-directory: 1.4.0 -> 1.5.0
@wordpress/block-editor: 3.6.0 -> 3.7.0
@wordpress/block-library: 2.13.0 -> 2.14.0
@wordpress/blocks: 6.11.0 -> 6.12.0
@wordpress/components: 9.1.0 -> 9.2.0
@wordpress/core-data: 2.11.0 -> 2.12.0
@wordpress/data: 4.13.0 -> 4.14.0
@wordpress/data-controls: 1.7.0 -> 1.8.0
@wordpress/e2e-test-utils: 4.2.0 -> 4.3.0
@wordpress/edit-post: 3.12.0 -> 3.13.0
@wordpress/editor: 9.11.0 -> 9.12.0
@wordpress/format-library: 1.13.0 -> 1.14.0
@wordpress/icons: 1.0.0 -> 1.1.0
@wordpress/keyboard-shortcuts: 1.0.0 -> 1.1.0
@wordpress/list-reusable-blocks: 1.12.0 -> 1.13.0
@wordpress/media-utils: 1.6.0 -> 1.7.0
@wordpress/notices: 1.12.0 -> 2.0.0
@wordpress/nux: 3.11.0 -> 3.12.0
@wordpress/plugins: 2.11.0 -> 2.12.0
@wordpress/primitives: 1.0.0 -> 1.1.0
@wordpress/rich-text: 3.11.0 -> 3.12.0
@wordpress/server-side-render: 1.7.0 -> 1.8.0
@wordpress/url: 2.10.0 -> 2.11.0
@wordpress/viewport: 2.12.0 -> 2.13.0
The navigation block inclusion was reverted.
The social links block was included.

Props gziolo, youknowriad, mcsf, noisysocks.
Fixes #49397.

git-svn-id: https://develop.svn.wordpress.org/trunk@47250 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 22:31:13 +00:00
Sergey Biryukov a6a02eaca7 Privacy: Give progress indication for export and erasure.
This adds a progress indicator for "Download Personal Data" and "Erase Personal Data" row actions, which can take a while with a lot of data.

Props garrett-eclipse, allendav, dominic_ks, xkon, karmatosed, birgire.
Fixes #44264.

git-svn-id: https://develop.svn.wordpress.org/trunk@47246 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 20:17:58 +00:00
Sergey Biryukov c0c2fd3f63 Privacy: Rename `wp_get_user_request_data()` to `wp_get_user_request()` for clarity; deprecate the old function.
The function returns an instance of the `WP_User_Request` object itself, not its `$request_data` property.

Follow-up to [44606].

Props garrett-eclipse.
Fixes #46302.

git-svn-id: https://develop.svn.wordpress.org/trunk@47245 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 19:55:51 +00:00
Timothy Jacobs e7399111b4 REST API: Add support for the REDIRECT_HTTP_AUTHORIZATION header.
Previously the REST API did not account for server configurations where the Authorization header must be added using ModRewrite. This caused major DUX issues when trying to use custom authentication mechanisms.

Fixes #47077.
Props dshanske, cklosows.


git-svn-id: https://develop.svn.wordpress.org/trunk@47239 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 16:06:58 +00:00
Andrew Duthie 2c795289c8 Script Loader: Add polyfill for window.URL, window.DOMRect.
Pending block editor revisions for WordPress 5.4 will make use of `window.URL` and `window.DOMRect`. These are not available in Internet Explorer (or pre-Chromium Edge for `DOMRect`) and must be polyfilled to avoid script errors.

The changes make use of the existing polyfill pattern, and existing `polyfill-library` dependency. The dependency is bumped to the latest version, since the previous version did not include the `DOMRect` polyfill.

Props jorgefilipecosta.
Fixes #49360.


git-svn-id: https://develop.svn.wordpress.org/trunk@47238 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 15:15:07 +00:00
Sergey Biryukov 5b0be97e7c Privacy: Include session tokens in Personal Data Export.
Session tokens contain an IP address and user agent.

Props garrett-eclipse, nickylimjj, lakenh, xkon, rconde.
Fixes #45889.

git-svn-id: https://develop.svn.wordpress.org/trunk@47237 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 05:42:52 +00:00
Sergey Biryukov 8fef1b28a9 Privacy: Include `community-events-location` user meta value in Personal Data Export.
The value is used by the WordPress Events and News widget to show relevant WP community events.

The location information may include an IP address, location description, and latitude/longitude coordinates.

Props garrett-eclipse, coreymckrill, xkon.
Fixes #43921.

git-svn-id: https://develop.svn.wordpress.org/trunk@47236 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 05:30:03 +00:00
Sergey Biryukov 023d4b2796 Administration: Capitalize `Trash` consistently in various messages and comments.
When used as a noun referring to the "virtual" place, `Trash` should be capitalized.

Props garrett-eclipse, aandrewdixon, Presskopp.
Fixes #45317.

git-svn-id: https://develop.svn.wordpress.org/trunk@47233 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-10 04:10:09 +00:00
Timothy Jacobs 98e5dd52de REST API: Introduce selective link embedding.
Previously the _embed flag would embed all embeddable links in a response even if only a subset of the links were necessary. Now, a list of link relations can be passed in the _embed parameter to restrict the list of embedded objects.

Props rheinardkorf, adamsilverstein, jnylen0, cklosows, chrisvanpatten, TimothyBlynJacobs.
Fixes #39696.


git-svn-id: https://develop.svn.wordpress.org/trunk@47224 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-09 20:52:06 +00:00
Sergey Biryukov 2aecc8f3e6 Tests: Add a basic test for `wp()` function.
Props pbearne, donmhico.
Fixes #48844.

git-svn-id: https://develop.svn.wordpress.org/trunk@47212 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-08 05:29:54 +00:00
Sergey Biryukov 3096571047 Tests: Change a few remaining `include_once` statements to `require_once`, for consistency.
See #48082.

git-svn-id: https://develop.svn.wordpress.org/trunk@47200 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-06 21:40:05 +00:00
Jorge Costa 8640eaa96e Block Editor: Update WordPress Packages.
The following package versions were changed:
@wordpress/a11y: 2.6.0 -> 2.7.0
@wordpress/annotations: 1.10.0 -> 1.11.0
@wordpress/api-fetch: 3.9.0 -> 3.10.0
@wordpress/autop: 2.5.1 -> 2.6.0
@wordpress/blob: 2.6.0 -> 2.7.0
@wordpress/block-directory: 1.3.0 -> 1.4.0
@wordpress/block-editor: 3.5.0 -> 3.6.0
@wordpress/block-library: 2.12.0 -> 2.13.0
@wordpress/block-serialization-default-parser: 3.4.1 -> 3.5.0
@wordpress/blocks: 6.10.0 -> 6.11.0
@wordpress/components: 9.0.0 -> 9.1.0
@wordpress/compose: 3.10.0 -> 3.11.0
@wordpress/core-data: 2.10.0 -> 2.11.0
@wordpress/custom-templated-path-webpack-plugin: 1.5.0 -> 1.6.0
@wordpress/data: 4.12.0 -> 4.13.0
@wordpress/data-controls: 1.6.0 -> 1.7.0
@wordpress/date: 3.7.0 -> 3.8.0
@wordpress/dependency-extraction-webpack-plugin: 2.1.0 -> 2.2.0
@wordpress/deprecated: 2.6.1 -> 2.7.0
@wordpress/dom: 2.7.0 -> 2.8.0
@wordpress/dom-ready: 2.6.0 -> 2.7.0
@wordpress/e2e-test-utils: 4.1.0 -> 4.2.0
@wordpress/edit-post: 3.11.0 -> 3.12.0
@wordpress/editor: 9.10.0 -> 9.11.0
@wordpress/element: 2.10.0 -> 2.11.0
@wordpress/escape-html: 1.6.0 -> 1.7.0
@wordpress/format-library: 1.12.0 -> 1.13.0
@wordpress/hooks: 2.6.0 -> 2.7.0
@wordpress/html-entities: 2.5.0 -> 2.6.0
@wordpress/i18n: 3.8.0 -> 3.9.0
@wordpress/is-shallow-equal: 1.7.0 -> 1.8.0
@wordpress/keyboard-shortcuts: 0.2.0 -> 1.0.0
@wordpress/keycodes: 2.8.0 -> 2.9.0
@wordpress/library-export-default-webpack-plugin: 1.5.0 -> 1.6.0
@wordpress/list-reusable-blocks: 1.11.0 -> 1.12.0
@wordpress/media-utils: 1.5.0 -> 1.6.0
@wordpress/notices: 1.11.0 -> 1.12.0
@wordpress/nux: 3.10.0 -> 3.11.0
@wordpress/plugins: 2.10.0 -> 2.11.0
@wordpress/priority-queue: 1.4.0 -> 1.5.0
@wordpress/redux-routine: 3.6.2 -> 3.7.0
@wordpress/rich-text: 3.10.0 -> 3.11.0
@wordpress/scripts: 6.2.0 -> 7.0.0
@wordpress/server-side-render: 1.6.0 -> 1.7.0
@wordpress/shortcode: 2.5.0 -> 2.6.0
@wordpress/token-list: 1.8.0 -> 1.9.0
@wordpress/url: 2.9.0 -> 2.10.0
@wordpress/viewport: 2.11.0 -> 2.12.0
@wordpress/wordcount: 2.6.2 -> 2.7.0
Added these new packages:
@wordpress/warning
@wordpress/primitives
@wordpress/icons
Re-added keyboard-shortcuts to script loader removed by mistake on revision 47198.

Props gziolo, itsjonq, youknowriad, mcsf, andraganescu.
Fixes #49358.

git-svn-id: https://develop.svn.wordpress.org/trunk@47199 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-06 21:01:16 +00:00
Sergey Biryukov e72fff9cef Code Modernization: Replace `dirname( __FILE__ )` calls with `__DIR__` magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.

git-svn-id: https://develop.svn.wordpress.org/trunk@47198 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-06 06:31:22 +00:00
Sergey Biryukov 011962fae0 Posts, Post Types: Add default `menu_icon` values for built-in post types.
This allows the icons to be retrieved via `get_post_type_object()`.

Props m.usama.masood, michael.ecklund, SergeyBiryukov.
Fixes #38844.

git-svn-id: https://develop.svn.wordpress.org/trunk@47196 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 22:38:11 +00:00
Sergey Biryukov 56e4630c0e Tests: In `Tests_dbDelta`, only force MyISAM database engine on MySQL versions older than 5.7.
Since MySQL 5.7, InnoDB engine supports `FULLTEXT` indexes, so forcing MyISAM is unnecessary.

Follow-up to [47193], which addressed the issue in `Tests_dbDelta::setUp()`, but missed other tests.

Props xkon, joonasvanhatapio, SergeyBiryukov.
Fixes #49367.

git-svn-id: https://develop.svn.wordpress.org/trunk@47195 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 22:05:50 +00:00
Sergey Biryukov ddf2d5ad06 Tests: In `Tests_dbDelta::setUp()`, only force MyISAM database engine on MySQL versions older than 5.7.
Since MySQL 5.7, InnoDB engine supports `FULLTEXT` indexes, so forcing MyISAM is unnecessary.

Props xkon, joonasvanhatapio, SergeyBiryukov.
Fixes #49367.

git-svn-id: https://develop.svn.wordpress.org/trunk@47193 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 18:19:11 +00:00
Sergey Biryukov e4d8eac50f Taxonomy: In `register_taxonomy()`, return the registered taxonomy object on success, for consistency with `register_post_type()`.
Props krynes, SergeyBiryukov.
Fixes #48558.

git-svn-id: https://develop.svn.wordpress.org/trunk@47186 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 06:24:16 +00:00
Sergey Biryukov 6c00abab9e Coding Standards: Fix WPCS issue in [47184].
See #49344.

git-svn-id: https://develop.svn.wordpress.org/trunk@47185 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 05:01:55 +00:00
Sergey Biryukov 629b9a778a Tests: Allow `dbDelta()` tests to (mostly) run on MySQL 8.0.11+.
* MySQL 8.0.11 changed the `GeometryCollection` data type name to `GeomCollection`, with the latter being the preferred name.
* MySQL 8.0.17 removed support for the display width attribute for integer data types. Previously, default display width of 20 digits was used: `BIGINT(20)`.

The affected tests now check the MySQL server version and use the appropriate data types.

This leaves one unresolved failure on MySQL 8.0.17+ to be addressed in the future, caused by the same `BIGINT` display width discrepancy coming from `wp_get_db_schema()`.

Props kaggdesign, ottok, jeremyfelt, SergeyBiryukov.
Fixes #44384, #49344. See #49364.

git-svn-id: https://develop.svn.wordpress.org/trunk@47184 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 04:28:13 +00:00
Sergey Biryukov b34f289bfd Tests: Allow `wpdb::set_sql_mode()` tests to run on MySQL 8.0.11+.
MySQL 8.0.11 removed support for the `NO_AUTO_CREATE_USER` SQL mode, which was used in as an example of a mode compatible with WordPress.

`NO_AUTO_VALUE_ON_ZERO` is now used in the affected tests instead, which is supported on both MySQL 5.7.x and 8.0.x.

Props kaggdesign, jeremyfelt, afragen.
Fixes #44586. See #49344.

git-svn-id: https://develop.svn.wordpress.org/trunk@47183 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 03:28:33 +00:00
Sergey Biryukov 5e8563eb6b Posts, Post Types: Fail gracefully when checking whether a single post with an unregistered post status should be displayed in `WP_Query::get_posts()`.
If the post status is not registered, assume it's not public, but still allow access to users with edit permissions (same as for a protected post status, e.g. `draft`), so that they could recover orphaned content.

Add unit tests.

Follow-up to [47178].

Props roytanck, SergeyBiryukov.
Fixes #48653.

git-svn-id: https://develop.svn.wordpress.org/trunk@47181 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 01:31:38 +00:00
Sergey Biryukov 6f15251aa4 Posts, Post Types: Fail gracefully when checking mapped cap against unregistered post status.
With `map_meta_cap` enabled for a post type, the `read_post` capability for posts with a public status is supposed to be mapped to the post type's `read` capability.

When a post is left in the database after the post status is no longer present, and WP does a `read_post` check against it, a PHP notice was thrown, and the cap check always failed.

As a more graceful fallback, the cap is now mapped onto `edit_others_posts`, which allows highly privileged users to be able to access orphaned content.

A `_doing_it_wrong()` notice is also added, so that developers and site administrators are aware that the cap mapping is failing in the absence of the registered post status.

Follow-up to [34091], which introduced a similar approach to checking mapped caps against an unregistered post type.

Props roytanck, SergeyBiryukov.
Fixes #48653.

git-svn-id: https://develop.svn.wordpress.org/trunk@47178 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-04 22:13:15 +00:00
Jorge Costa 4bcf9be615 Block Editor: Include navigation block server logic.
Core did not include the navigation block PHP files.
This commit fixes the issue referred, and now the navigation block is executed on the frontend. The block still does not work as expected and throws an error during frontend execution. That problem is going to be fixed on the next WordPress package update.
This commit adds the file as it is on the npm package used.

Props gziolo.
Fixes #49348.

git-svn-id: https://develop.svn.wordpress.org/trunk@47176 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-04 20:14:50 +00:00
Sergey Biryukov dd48b7f757 Canonical: When removing trailing punctuation from query string arguments, match the whole query var name.
Props daveslaughter.
Fixes #49347.

git-svn-id: https://develop.svn.wordpress.org/trunk@47169 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-03 00:12:22 +00:00