Commit Graph

3732 Commits

Author SHA1 Message Date
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 9a903f7e73 Tests: Update wp-api-generated.js.
[47755] and [47756] caused a schema change, so the wp-api-generated.js file needs to be updated.


git-svn-id: https://develop.svn.wordpress.org/trunk@47757 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-04 00:26:52 +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
Sergey Biryukov 98584d6e11 Build/Test Tools: Update QUnit and Sinon to the latest versions.
Update JS tests per the QUnit 2.x Upgrade Guide.

Fixes #37117.

git-svn-id: https://develop.svn.wordpress.org/trunk@47512 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-27 00:16:58 +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 3d43f46907 Posts, Post Types: Change "Featured Image" post label to use sentence case: "Featured image".
This makes it more consistent with other UI elements in the block editor.

Props mcsf.
Fixes #49371.

git-svn-id: https://develop.svn.wordpress.org/trunk@47194 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-05 19:07:33 +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
Sergey Biryukov 63a53c730f Tests: Adjust XML-RPC unit tests for [47160].
Follow-up to [47162].

See #40096.

git-svn-id: https://develop.svn.wordpress.org/trunk@47163 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-02 04:07:50 +00:00
Sergey Biryukov d5572e9f11 Tests: Adjust XML-RPC unit tests for [47160].
See #40096.

git-svn-id: https://develop.svn.wordpress.org/trunk@47162 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-02 03:30:37 +00:00
Sergey Biryukov fd3083e3f5 Post Thumbnails: Make sure `get_post_thumbnail_id()` returns an integer, to match the documented return value.
This makes the function more consistent with `get_the_ID()` or `wp_get_post_parent_id()`, both returning an integer.

Props 0v3rth3d4wn.
Fixes #40096.

git-svn-id: https://develop.svn.wordpress.org/trunk@47160 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-02 03:06:31 +00:00
Sergey Biryukov 54c6311c96 Accessibility: Text Changes: Use sentence case for the word `Error` in various error messages, instead of all caps.
Using all caps should be avoided for better readability and because screen readers may pronounce all-caps words as abbreviations.

Props afercia, ryokuhi, sabernhardt, garrett-eclipse.
See #47656, #43037, #42945.

git-svn-id: https://develop.svn.wordpress.org/trunk@47156 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-01 21:36:44 +00:00
Sergey Biryukov 097f272455 Tests: Update the expected message in `test_with_draft_post()`.
Follow-up to [47154].

See #42945.

git-svn-id: https://develop.svn.wordpress.org/trunk@47155 602fd350-edb4-49c9-b593-d223f7449a82
2020-02-01 21:11:08 +00:00
Sergey Biryukov b894d8665a Privacy: Introduce a JSON file into the personal data export.
The produced ZIP archive will now include an `export.json` file along with the current `index.html`.

Props xkon.
Fixes #49029. See #46424.

git-svn-id: https://develop.svn.wordpress.org/trunk@47146 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-31 01:34:17 +00:00
Sergey Biryukov 7192a8f562 Privacy: Remove user's email address from personal data export filename.
Use `wp_unique_filename()` to avoid potential collisions instead.

Props xkon, garrett-eclipse, donmhico, Ov3rfly, Clorith, allendav.
Fixes #44197.

git-svn-id: https://develop.svn.wordpress.org/trunk@47144 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-31 00:56:29 +00:00
Sergey Biryukov ac6409a479 HTTP API: Add some basic tests for `wp_remote_fopen()`.
Props pbearne, donmhico.
Fixes #48845.

git-svn-id: https://develop.svn.wordpress.org/trunk@47142 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-31 00:20:47 +00:00
Sergey Biryukov 8ba94ecf5d Tests: Rename `wpValidateBoolean.php` for consistency with other files.
See #30238.

git-svn-id: https://develop.svn.wordpress.org/trunk@47141 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-31 00:14:07 +00:00
K. Adam White 547a08ee03 REST API: Reuse previously-generated embedded objects when building collection response.
Store each generated embedded object in a temporary cache when querying for linked resources so that repeated links to the same resource do not trigger repeated queries or processing.

Props TimothyBlynJacobs.
Fixes #48838.



git-svn-id: https://develop.svn.wordpress.org/trunk@47138 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-30 20:20:30 +00:00
Sergey Biryukov cfc3b57488 Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47122 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-29 00:43:23 +00:00
Sergey Biryukov bd2cd572aa Docs: Improve DocBlocks in `phpunit/includes/object-cache.php` per the documentation standards.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47121 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-29 00:36:17 +00:00
Sergey Biryukov 48110faf25 Coding Standards: Disable WPCS warnings for `date_default_timezone_set()` and `current_time( 'timestamp' )` calls in Date/Time tests.
These calls are intentional and required for the tests.

See #49222.

git-svn-id: https://develop.svn.wordpress.org/trunk@47118 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-28 00:51:42 +00:00
Sergey Biryukov d5e20d8ab5 Comments: Add `In reply to: %s` parent comment link to new comment email notifications.
This information was previously available on the Moderate Comment screen in the admin, but was missing from moderation emails.

Props imath, danieltj, andraganescu, galbaras, SergeyBiryukov.
Fixes #43805. See #43429.

git-svn-id: https://develop.svn.wordpress.org/trunk@47114 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-27 04:31:48 +00:00
Sergey Biryukov af39b30e28 Date/Time: In `wp_maybe_decline_date()`, add support for a range of days, e.g. `February 21–23`.
A potential use case is displaying multi-day events in the WordPress Events and News dashboard widget.

See #47798, #48934.

git-svn-id: https://develop.svn.wordpress.org/trunk@47098 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-21 23:46:36 +00:00
Sergey Biryukov 8660569e82 Date/Time: Add some basic tests for `current_time()`.
Props pbearne, talldanwp, SergeyBiryukov.
Fixes #34378.

git-svn-id: https://develop.svn.wordpress.org/trunk@47081 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-17 02:50:39 +00:00
Sergey Biryukov 0ead760ec6 Tests: Replace `date()` with `gmdate()` in `WP_Test_REST_Posts_Controller` tests.
Follow-up to [45424], [46252].

See #46438, #44491, #39953.

git-svn-id: https://develop.svn.wordpress.org/trunk@47080 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-17 02:02:41 +00:00
Sergey Biryukov a2978bac70 Tests: Update the `wp_maybe_decline_date()` tests for [47078].
See #48934.

git-svn-id: https://develop.svn.wordpress.org/trunk@47079 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-17 01:14:24 +00:00
Sergey Biryukov 5bef137806 Date/Time: Pass the date format to `wp_maybe_decline_date()`.
This ensures that the function has enough context to determine the necessity of replacing the month name with the correct form in locales that require it.

Props SergeyBiryukov, Rarst.
Fixes #48934.

git-svn-id: https://develop.svn.wordpress.org/trunk@47078 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-17 01:10:57 +00:00
Sergey Biryukov 93b2d5ecc0 Tests: Revert [47076], this should have been committed with the related changes to the function.
git-svn-id: https://develop.svn.wordpress.org/trunk@47077 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-17 01:08:28 +00:00
SergeyBiryukov abfca60342 Tests: Move `wp_maybe_decline_date()` tests to the `date` directory.
See #48934.

git-svn-id: https://develop.svn.wordpress.org/trunk@47076 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-17 00:54:02 +00:00
Sergey Biryukov 2daa4b6c82 Tests: In `Tests_Site_Health`, create a `WP_Site_Health` instance before clearing the cron array, as the constructor schedules its own task now.
See #47606.

git-svn-id: https://develop.svn.wordpress.org/trunk@47064 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-12 14:16:57 +00:00
Sergey Biryukov cd5b7df8b8 Docs: Improve documentation for `tests/phpunit/includes/testcase-ajax.php`.
Props andizer, SergeyBiryukov.
Fixes #47568.

git-svn-id: https://develop.svn.wordpress.org/trunk@47041 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-05 15:31:10 +00:00
K. Adam White 746502eaa9 REST API: Issue doing_it_wrong if a taxonomy's specified rest_base is already in use by a different resource.
Props fgiannar, TimothyBlynJacobs, kingkool68, SergeyBiryukov.
Fixes #48401.



git-svn-id: https://develop.svn.wordpress.org/trunk@47037 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-03 19:22:32 +00:00
K. Adam White 172e0b01c6 REST API: Short-circuit comment controller permissions check if commented-upon post type does not exist.
Props imani3011, dragosh635, subrataemfluence, timothyblynjacobs.
Fixes #42238.



git-svn-id: https://develop.svn.wordpress.org/trunk@47036 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-03 18:42:09 +00:00
Grzegorz (Greg) Ziółkowski a35e46a937 Build Tools: Integrate DependencyExtractionWebpackPlugin in the JS build.
This patch integrates DependencyExtractionWebpackPlugin which was battle-tested in Gutenberg. 

This will greatly simplify the process of upgrading npm packages which change after every Gutenberg release. It might even useful during the WordPress release cycle as we might need to publish more often as we discover critical bugs and regressions.

Props jonsurrell, adamsilverstein, youknowriad, ocean90, netweb.

Fixes #48154. 



git-svn-id: https://develop.svn.wordpress.org/trunk@47035 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-03 13:15:33 +00:00
Sergey Biryukov ef6973b7f0 Bootstrap/Load: Make handling the `/favicon.ico` requests more flexible.
Previously, `wp_favicon_request()` was introduced in [13205] to avoid a performance hit of serving a full 404 page on every favicon request.

While working as intended, that implementation did not provide a way for theme or plugin authors to manage the behavior of favicon requests.

This changeset implements the following logic (only applied if WordPress is installed in the root directory):

* If there is a Site Icon set in Customizer, redirect `/favicon.ico` requests to that icon.
* Otherwise, use the WordPress logo as a default icon.
* If a physical `/favicon.ico` file exists, do nothing, let the server handle the request.

Handling `/favicon.ico` is now more consistent with handling `/robots.txt` requests.

New functions and hooks:

* Introduce `is_favicon()` conditional tag to complement `is_robots()`.
* Introduce `do_favicon` action to complement `do_robots` and use it in template loader.
* Introduce `do_favicon()` function, hooked to the above action by default, to complement `do_robots()`.
* Introduce `do_faviconico` action to complement `do_robotstxt`, for plugins to override the default behavior.
* Mark `wp_favicon_request()` as deprecated in favor of `do_favicon()`.

Props jonoaldersonwp, birgire, joostdevalk, mukesh27, SergeyBiryukov.
Fixes #47398.

git-svn-id: https://develop.svn.wordpress.org/trunk@47018 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-28 21:18:03 +00:00
Sergey Biryukov 85c7a64791 Docs: Improve `@return` description for `wp_update_comment()` and `WP_UnitTest_Factory_For_Comment::update_object()`.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47017 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-27 00:28:39 +00:00
Sergey Biryukov 079580a6b7 Tests: Set `network_id` instead of `site_id` in `WP_UnitTest_Factory_For_Blog` defaults.
Follow-up to [47011], [47013].

See #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47014 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-26 00:25:20 +00:00
Sergey Biryukov 93eeb8f1d7 Tests: Update legacy arguments passed to `WP_UnitTest_Factory_For_Blog::create_object()`.
This converts the arguments originally meant for `wpmu_create_blog()` to the ones used by `wp_insert_site()`.

Follow-up to [47011].

Fixes #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47013 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-25 21:39:46 +00:00
Sergey Biryukov f8051662b1 Tests: Replace most instances of `wpmu_delete_blog()` not specifically testing that function with `wp_delete_site()`.
Follow-up to [47011].

See #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47012 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-25 18:15:13 +00:00
Sergey Biryukov ebe75fb903 Tests: Switch `WP_UnitTest_Factory_For_Blog::create_object()` to use `wp_insert_site()`.
Map some arguments for backward compatibility with `wpmu_create_blog()` previously used there.

Props davidbaumwald, danielbachhuber, jeremyfelt, SergeyBiryukov.
See #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47011 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-25 18:10:19 +00:00
Sergey Biryukov dbf6a0ba7c Media: Make sure `attachment_url_to_postid()` performs a case-sensitive search for the uploaded file name.
Previously, the first available match was returned, regardless of the case, which was not always the expected result.

Props archon810, ben.greeley, tristangemus, vsamoletov, SergeyBiryukov.
Fixes #39768.

git-svn-id: https://develop.svn.wordpress.org/trunk@47010 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-25 02:24:38 +00:00
Sergey Biryukov 7abc076e13 Shortcodes: Make sure `wp.shortcode.string()` accepts the `attrs` array keys in any order.
Props yale01, georgestephanis, adamsilverstein, zsusag, mircoraffinetti, SergeyBiryukov.
Fixes #36263.

git-svn-id: https://develop.svn.wordpress.org/trunk@47003 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-21 18:32:45 +00:00
Sergey Biryukov 2c15e0c286 Tests: Don't fail the test in `WP_UnitTestCase_Base::skipOnAutomatedBranches()` if Travis environment variables are unavailable, it prevents from running the test locally.
Follow-up to [47000].

See #49050.

git-svn-id: https://develop.svn.wordpress.org/trunk@47001 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-20 12:13:10 +00:00
Sergey Biryukov d697471bb1 Tests: Correct the check for pull requests in `WP_UnitTestCase_Base::skipOnAutomatedBranches()`.
Mark the test as failed if the environment variables are unavailable.

Fixes #49050.

git-svn-id: https://develop.svn.wordpress.org/trunk@47000 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-20 01:10:23 +00:00
Sergey Biryukov 26cc3cfd19 Tests: Skip external HTTP test for recommended PHP and MySQL versions on 503 errors.
Fixes #49049.

git-svn-id: https://develop.svn.wordpress.org/trunk@46998 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-19 20:27:16 +00:00
Jake Spurlock 2fad299387 Editor: Add unit tests for v5.3.1 block serialization functions
r46896 was intended to have included unit tests for the block serialization functions added as part of the changeset.

Props: @aduth.
Fixes: #49048 



git-svn-id: https://develop.svn.wordpress.org/trunk@46997 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-19 18:48:49 +00:00
Sergey Biryukov 9fe4689f2d Tests: In `test_readme()`, if the HTTP request to `secure.php.net` or `dev.mysql.com` failed, include response code in the error message.
See #40533, #44613.

git-svn-id: https://develop.svn.wordpress.org/trunk@46996 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-19 15:43:33 +00:00
Sergey Biryukov 7cdb642610 Tests: Remove unused cache keys from `data_get_site_caches()`.
Follow-up to [46990].

See #40363.

git-svn-id: https://develop.svn.wordpress.org/trunk@46991 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 03:20:59 +00:00
Sergey Biryukov c8ac42b3dd Docs: Improve comments in `tests/formatting/redirect.php` per the documentation standards.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46987 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:26:23 +00:00
Sergey Biryukov 0d81dcbfb1 Docs: Add `@method` notation for `WP_UnitTest_Factory_For_Term::create_and_get()` for consistency with other factories.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46986 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:24:03 +00:00
Sergey Biryukov a3e674d4f9 Docs: Various documentation fixes for unit test factories.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46985 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:17:54 +00:00
Sergey Biryukov 99ddfa0195 Tests: Use delta comparison in `test_should_fall_back_to_last_post_modified()` to avoid race conditions.
See #48957.

git-svn-id: https://develop.svn.wordpress.org/trunk@46981 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 21:31:08 +00:00
Sergey Biryukov a4b65bfca8 Date/Time: Ensure that `get_feed_build_date()` correctly handles a modified post object with invalid date.
* Clarify in the documentation that the function returns `false` on failure.
* Consistently pass the return value through the `get_feed_build_date` filter.

Props Rarst, dd32, azaozz, tellyworth.
Fixes #48957.

git-svn-id: https://develop.svn.wordpress.org/trunk@46974 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 20:41:09 +00:00
Sergey Biryukov 69ddf953bd Date/Time: Add a unit test for [46968].
See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46969 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-17 14:35:25 +00:00
Andrew Ozz 99ef48a585 Upload: Fix the final file name collision test in `wp_unique_filename()` when uploading a file with upper case extension. Add a unit test to catch that in the future.
Fixes #48975 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@46966 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-16 23:42:34 +00:00
Andrew Ozz 735b3543db Upload:
- Fix PHP warnings in `wp_unique_filename()` when the destination directory is unreadable.
- Run the final name collision test only for files that are saved to the uploads directory.
- Update the unit tests to match.

Props eden159, audrasjb, azaozz.
Fixes #48960 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@46965 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-16 23:22:00 +00:00
Jake Spurlock 7c38cf178a Prevent stored XSS in the block editor.
Prevent escaped unicode characters become unescaped in unsafe HTML during JSON decoding.

Props: aduth, epiqueras, 


git-svn-id: https://develop.svn.wordpress.org/trunk@46896 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 18:00:45 +00:00
Jake Spurlock 39a8eacb5f Update `wp_kses_bad_protocol()` to recognize `&colon;` on uri attributes,
`wp_kses_bad_protocol()` makes sure to validate that uri attributes don’t contain invalid/or not allowed protocols. While this works fine in most cases, there’s a risk that by using the colon html5 named entity, one is able to bypass this function.

Props: xknown, nickdaugherty, peterwilsoncc.


git-svn-id: https://develop.svn.wordpress.org/trunk@46895 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 17:52:18 +00:00
Jake Spurlock dcab984b1b Prevent stored XSS through wp_targeted_link_rel().
Props: vortfu, whyisjake, peterwilsoncc, xknown,  SergeyBiryukov, flaviozavan.



git-svn-id: https://develop.svn.wordpress.org/trunk@46894 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-12 17:51:35 +00:00
Sergey Biryukov b73180da85 Tests: Docs: Correct `@param` formatting in `SpeedTrapListener` after [35226] and [45607].
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46882 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-11 15:46:51 +00:00
Sergey Biryukov c1ab0cc974 Menus: Avoid a PHP warning in `add_submenu_page()` when the same value is passed for both `$parent_slug` and `$menu_slug` parameters.
Props welcher, ispreview, ayeshrajans, NextScripts, adamsilverstein, garrett-eclipse, 123host.
Fixes #48599.

git-svn-id: https://develop.svn.wordpress.org/trunk@46868 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 21:01:13 +00:00
Sergey Biryukov bdca31b322 Date/Time: XML-RPC: Сalculate the proper offset for GMT in `wp.newPost`, `wp.editComment`, `mw.newPost`, `mw.editPost` when `post_date` or `comment_date` is set.
Previously, `post_date` or `comment_date` was assumed to be GMT, which is only true if the timezone string for the site matches GMT.

Add unit tests.

Props Rarst, smerriman, justdaiv, wonderboymusic, noyle.
Fixes #30429.

git-svn-id: https://develop.svn.wordpress.org/trunk@46864 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 19:54:16 +00:00
Sergey Biryukov 50f01f47e3 Date/Time: When determining whether to decline the month name in `wp_maybe_decline_date()`, take word boundaries into account.
Add more unit tests.

Props Rarst, Clorith, timon33, Xendo, SergeyBiryukov.
Fixes #48606.

git-svn-id: https://develop.svn.wordpress.org/trunk@46862 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 18:48:50 +00:00
Sergey Biryukov e76722f70f Tests: Change `group` annotation for `test_unique_filename_with_dimension_like_filename()` to `ticket.
See #42437.

git-svn-id: https://develop.svn.wordpress.org/trunk@46835 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 12:16:43 +00:00
Sergey Biryukov de38dfdd47 Tests: Make sure network factory returns an integer ID for created objects, for consistency with other factories and the documented value.
See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46831 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 11:29:14 +00:00
Sergey Biryukov 102cb95559 Tests: Pad incrementors used in factories with leading zeros to make sure MySQL sorting works as expected.
Previously, tests could create sequential objects with names like `Term 99`, `Term 100`, which by default would be returned in reverse order when sorted by name alphabetically, causing seemingly random test failures that are extremely hard to debug.

See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46830 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 10:39:39 +00:00
Sergey Biryukov 0660804327 Tests: Speed up comment submission unit tests by creating less fixtures and reusing them where possible.
See #30017, #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46829 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-08 18:00:23 +00:00
Andrew Ozz 5464dcb2c5 Upload: fix `wp_unique_filename()` to prevent name collisions with existing or future image sub-size file names, and add unit tests.
Props Viper007Bond, pbiron, azaozz.
Fixes #42437.

git-svn-id: https://develop.svn.wordpress.org/trunk@46822 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-06 22:26:19 +00:00
John Blackbourn bcfccc7344 Docs: Correct various docblocks documentation.
See #48303

git-svn-id: https://develop.svn.wordpress.org/trunk@46821 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-06 22:21:07 +00:00
Sergey Biryukov 0c673c2308 Tests: Remove duplicate `test_get_page_by_path_priority()` test.
The test was moved into its own file in [37478], but never removed from its previous location.

See #36711.

git-svn-id: https://develop.svn.wordpress.org/trunk@46819 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-06 17:25:32 +00:00
Sergey Biryukov 4bd7b37ef9 Tests: Merge [24251] from `_wp_filter_build_unique_id()` to `_test_filter_build_unique_id()`, for consistency.
See #47407.

git-svn-id: https://develop.svn.wordpress.org/trunk@46806 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-29 22:15:31 +00:00
Sergey Biryukov 890bd870e8 Docs: Correct `@param` type for the function parameter in `tests_add_filter()` and `_test_filter_build_unique_id()`.
Synchronize documentation for `add_filter()`, `tests_add_filter()`, `_wp_filter_build_unique_id()`, `_test_filter_build_unique_id()`.

Add a note that `$tag` and `$priority` are no longer used in `_wp_filter_build_unique_id()` since [46220], and the function always returns a string now.

Props donmhico, remcotolsma, SergeyBiryukov.
Fixes #47407. See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46801 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-29 21:40:58 +00:00
Sergey Biryukov e720a9ddc7 Date/Time: Make `get_permalink()` more resilient against PHP timezone changes.
Overriding default PHP timezone with `date_default_timezone_set()`, while not recommended, should not inadvertently result in changing existing permalinks.

Add a unit test.

Props Rarst, steevithak, archon810, maciejmackowiak, Ov3rfly, Cybr, hometowntrailers, scvleon, miette49.
Fixes #48623.

git-svn-id: https://develop.svn.wordpress.org/trunk@46795 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-28 13:40:19 +00:00
Sergey Biryukov 9737e5fdc3 KSES: Add support for gradient backgrounds.
Props jorgefilipecosta.
Fixes #48376.

git-svn-id: https://develop.svn.wordpress.org/trunk@46793 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-28 00:27:21 +00:00
Sergey Biryukov 4159a41cef Tests: Add `feed` group for `get_feed_build_date()` test added in [46756].
See #48675.

git-svn-id: https://develop.svn.wordpress.org/trunk@46785 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-26 16:17:02 +00:00
Sergey Biryukov 6ce8175456 Date/Time: Remove `mysql2date()` usage in `get_feed_build_date()` to ensure the output includes correct timezone offset.
With the changes in [45908], `mysql2date()` works correctly for all local time inputs, but should not be used for UTC time inputs.

Add a unit test.

Props Rarst, lisota.
Fixes #48675.

git-svn-id: https://develop.svn.wordpress.org/trunk@46756 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-21 13:16:50 +00:00
Sergey Biryukov 3b54ab37ed Customize: If the return URL for Close button is a page added to the Appearance menu by a deactivated theme, fall back to the Themes screen.
Props JarretC, Jean-David, SergeyBiryukov.
Fixes #46686.

git-svn-id: https://develop.svn.wordpress.org/trunk@46754 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-20 18:47:08 +00:00
Sergey Biryukov 6c776ea07b Bundled Themes: Update copyright year in `readme.txt`.
Add a unit test to ensure the year stays up to date.

Props dkarfa, SergeyBiryukov.
Fixes #48566.

git-svn-id: https://develop.svn.wordpress.org/trunk@46719 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-12 17:34:05 +00:00
Jake Spurlock 91312ab695 Tests: Fix a typo in an inline comment.
Fix a regression from [46568].

Props david.binda.
See #48312.


git-svn-id: https://develop.svn.wordpress.org/trunk@46707 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-11 18:48:06 +00:00