Commit Graph

3545 Commits

Author SHA1 Message Date
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 `:` 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