Commit Graph

17895 Commits

Author SHA1 Message Date
Sergey Biryukov
5bad4e7f8d Code Modernization: Use explicit visibility for class property declarations.
Using `var` or only `static` to declare a class property is PHP 4 code.

This updates the codebase to use explicit visibility modifiers introduced in PHP 5.

Props jrf.
Fixes #51557. See #22234.

git-svn-id: https://develop.svn.wordpress.org/trunk@49184 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 16:24:35 +00:00
John Blackbourn
5b6a20af07 Docs: Fix and upgrade various object docblock notations.
See #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49183 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 16:03:58 +00:00
Sergey Biryukov
b91257e97f Feeds: Fix "Only variables should be passed by reference" PHP notice in atomlib.php.
Props jrf.
Fixes #51558.

git-svn-id: https://develop.svn.wordpress.org/trunk@49182 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 15:43:39 +00:00
John Blackbourn
ff18031d1b Docs: Miscellaneous docblock fixes.
See #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49181 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 14:52:04 +00:00
John Blackbourn
b1833128fe Administration: Fix a coding standards issue after [49179].
See #50699


git-svn-id: https://develop.svn.wordpress.org/trunk@49180 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 12:32:45 +00:00
Andrew Ozz
6a2ef2d5b2 Fix and improve arranging of postboxes/metaboxes:
- Enable arranging only when the Screen Options tab is open.
- Prevent accidental/unintended dragging. Seen it happen mostly on laptops when using the mousepad/trackpad.
- Improve discoverability and usefulness by always showing the "drop zones" outline when postboxes are draggable/arrangeable.
- Add some (brief) explanation to the Screen Options tab helping the user understand what options are available and how to change them. This is especially helpful for screen reader users to give an idea how to use the screen options and what to expect.
- Fix/enhance some of the code in `postbox.js` and make it coding standards compliant.

See #50699.

git-svn-id: https://develop.svn.wordpress.org/trunk@49179 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 09:58:34 +00:00
Sergey Biryukov
14e3433b85 Administration: Wrap the list table items count to a new line on small screens.
This avoids overlapping with action buttons and brings some consistency to bottom paddings across various screens.

Props passoniate, afercia, anuj2, rolfsiebers, uxkai, ireneyoast, thijsvanloef, hellofromTonya, audrasjb, helen, SergeyBiryukov.
Fixes #49246.

git-svn-id: https://develop.svn.wordpress.org/trunk@49178 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-17 01:11:58 +00:00
Sergey Biryukov
0f6305e246 Accessibility: Widgets: Conditionally wrap the tag cloud widget in a <nav> element.
If the theme declares support for the `html5` feature `navigation-widgets`, the tag cloud widget is now wrapped in a `<nav>` element to improve semantics and accessibility.

The `<nav>` elements are native landmark regions, which helps assistive technology users to navigate through them.

Follow-up to [48349] for other widgets.

Props audrasjb, justinahinon, ravipatel.
Fixes #51455. See #48170.

git-svn-id: https://develop.svn.wordpress.org/trunk@49177 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-16 18:30:53 +00:00
Jonathan Desrosiers
f3f2aa135e External Libraries: Update the SimplePie library to version 1.5.6.
This version fixes a handful of PHP 8 compatibility issues.

A full list of changes included in this update can be found on GitHub: https://github.com/simplepie/simplepie/compare/1.5.5...1.5.6.

Props jrf, ayeshrajans.
Fixes #51521.

git-svn-id: https://develop.svn.wordpress.org/trunk@49176 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-16 17:18:11 +00:00
Mike Schroder
505fe2f0b8 Media: Work around use-cropbox bug in Ghostscript 8.70
Wraps `Imagick::readImage()` for PDFs with exception handling, trying again without `use-cropbox` if this fails.

Introduces `WP_Image_Editor_Imagick::pdf_load_source()`.

Works around a known issue in Ghostscript 8.70 (fixed in 8.71) that results in a stack underflow.
While it only affects this version, it remains a common version found on hosts, and prevented some PDF thumbnails from being generated.

See this Ghostscript bug for more details: https://bugs.ghostscript.com/show_bug.cgi?id=690676

Props azaozz, joseaneto, cranewest, dantahoua, n5hzr, mikeschroder.
Fixes #48853.

git-svn-id: https://develop.svn.wordpress.org/trunk@49174 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-16 10:46:58 +00:00
Sergey Biryukov
46119b8367 Docs: Add @since tags for the fire_after_hooks parameter of wp_insert_post(), wp_update_post(), and wp_insert_attachment().
Document the parameter as optional.

Follow-up to [49172].

See #45114.

git-svn-id: https://develop.svn.wordpress.org/trunk@49173 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-16 09:38:17 +00:00
Peter Wilson
254ca903b2 REST API, Posts: Add a hook to fire once a post, its terms and meta update.
Introduces the action `wp_after_insert_post` inside a wrapper function of the same name. This hook allows plugin developers to access a posts full data (including its terms and meta data) regardless of the workflow used to save it.

A new parameter is introduced to `wp_insert_post()` to indicate whether the hook should be fired within the function call or will be fired afterward.

Props aristath, Collizo4sky, danielbachhuber, joyously, kadamwhite, kraftbj, markparnell, mikeschroder, noisysocks, peterwilsoncc, SergeyBiryukov, talldanwp, thewebprincess, TimothyBlynJacobs.
Fixes #45114.


git-svn-id: https://develop.svn.wordpress.org/trunk@49172 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-16 03:32:11 +00:00
Peter Wilson
3965584a04 Taxonomy: Fix warnings thrown by custom term count callbacks.
Add a `use` to a closure to avoid an undefined variable throwing a warning. Adds unit tests to ensure the custom callbacks run as expected when defined.

Follow up to [49141].
Props ocean90, dd32.
Fixes #40351.



git-svn-id: https://develop.svn.wordpress.org/trunk@49171 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-16 02:41:15 +00:00
Sergey Biryukov
901edbe510 Privacy: Denote removed suggested privacy policy text in a more noticeable way.
Props garrett-eclipse, sabernhardt, audrasjb.
Fixes #51435.

git-svn-id: https://develop.svn.wordpress.org/trunk@49170 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-16 01:27:14 +00:00
Sergey Biryukov
45432f4c39 Upgrade/Install: Check if plugin or theme update results are available before applying the notification filters.
This avoids a PHP notice for an undefined index of either `plugin` or `theme` in the `auto_{plugin|theme}_update_send_email` filter hook.

Props afragen, audrasjb.
Fixes #51400.

git-svn-id: https://develop.svn.wordpress.org/trunk@49166 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 23:25:19 +00:00
Jonathan Desrosiers
805351a478 External Libraries: Update React, ReactDOM and Lodash.
This updates:
- `react` and `react-dom` from `16.9.0` to `16.13.1`.
- `lodash from `4.17.15` to `4.17.19`.

Props isabel_brison.
Fixes #51505.

git-svn-id: https://develop.svn.wordpress.org/trunk@49165 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 23:06:49 +00:00
Sergey Biryukov
93a325ccf8 Bootstrap/Load: Don't assume WP_CONTENT_DIR is defined.
When the `mysql` extention isn't loaded and a custom db dropin is not in place, we give folks a nice error. However, we can't assume that the `WP_CONTENT_DIR` constant is set yet since this runs before we define default constants.

This fixes a PHP 8 error.

Props jorbin.
Merges [49161] to trunk.
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49163 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 21:14:35 +00:00
Sergey Biryukov
c0f41b5d3c Comments: Further remove unnecessary context switch in Walker_Comment.
Follow-up to [49157].

See #51533.

git-svn-id: https://develop.svn.wordpress.org/trunk@49160 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 15:24:57 +00:00
Sergey Biryukov
fee906ad14 Twenty Nineteen: Remove extra space from the comment link in TwentyNineteen_Walker_Comment.
Fixes #51533.

git-svn-id: https://develop.svn.wordpress.org/trunk@49159 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 15:22:42 +00:00
Sergey Biryukov
7bfe507dad Twenty Twenty: Remove extra space from the comment link in TwentyTwenty_Walker_Comment.
See #51533.

git-svn-id: https://develop.svn.wordpress.org/trunk@49158 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 15:11:43 +00:00
Sergey Biryukov
8bf847bdf4 Comments: Remove extra space from the comment link in Walker_Comment.
Props poena, mukesh27, SergeyBiryukov.
See #51533.

git-svn-id: https://develop.svn.wordpress.org/trunk@49157 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 15:05:09 +00:00
Timothy Jacobs
efe06cdcea Site Health, REST API: Move async tests to REST API endpoints.
This provides more flexibility when writing tests and benefits from running in a front-end context which is necessary for some tests like checking that updates are supported. Additionally, this provides a more robust interface for developers who want to integrate with Site Health tests.

Because the `wp/v2` endpoint is reserved for modeling core entities, site health is registered in its own `wp-site-health/v1` namespace.

The existing ajax actions have been maintained for backward compatibility.

Props Clorith, chrisvanpatten, afragen, pokhriyal, TimothyBlynJacobs.
Fixes #48105.


git-svn-id: https://develop.svn.wordpress.org/trunk@49154 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 01:58:28 +00:00
Sergey Biryukov
50fa352cbb Docs: Improve description of the $email parameter in email_exists().
Follow-up to [49148].

Props garrett-eclipse.
See #51379.

git-svn-id: https://develop.svn.wordpress.org/trunk@49153 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-15 00:14:51 +00:00
Ian Dunn
52f2d0db81 Community Events: Update timezone-related @since tags to 5.5.2.
r49145 and r49146 were originally planned for 5.6 when they were committed, but are now planned for 5.5.2.

See #51130.


git-svn-id: https://develop.svn.wordpress.org/trunk@49152 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 21:33:10 +00:00
Dominik Schilling
d0ec93f293 I18N: Use wp.i18n for translatable strings in wp-admin/js/dashboard.js.
* Deprecate the `l10n` property on `communityEventsData`.
* Introduce `version` parameter for `deprecateL10nObject` and backfill the version for deprecated objects in 5.5.0.
* Add a noop version of `deprecateL10nObject` for QUnit testing.

Fixes #51498.

git-svn-id: https://develop.svn.wordpress.org/trunk@49151 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 21:11:09 +00:00
Helen Hou-Sandi
0aa3ade1fe Updates: Reduce secondary buttons for less visual complexity.
Props audrasjb, karmatosed.
Fixes #51523.


git-svn-id: https://develop.svn.wordpress.org/trunk@49150 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 20:25:17 +00:00
Helen Hou-Sandi
c8d94810d3 Admin Menu: Better wrapping for long menu item names.
Props munyagu, jagirbaheshwp, harshbarach, pratikkry, hareesh-pillai, naveenkharwar, mukesh27, chetan200891, dushanthi, worldweb, audrasjb, afercia, amolv, iqbalbary, davidbaumwald, sabernhardt, johnjamesjacoby, garrett-eclipse, garrett-eclipse.
Fixes #42201.


git-svn-id: https://develop.svn.wordpress.org/trunk@49149 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 19:51:12 +00:00
Sergey Biryukov
d011853b7b Users: Introduce email_exists filter, to complement username_exists.
Props garrett-eclipse, apermo, mukesh27, Mista-Flo, sebastian.pisula, mikelopez.
Fixes #51379. See #35509.

git-svn-id: https://develop.svn.wordpress.org/trunk@49148 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 19:02:22 +00:00
Ian Dunn
0fbe425a3e Community Events: Apply coding standards.
The previous commits intentionally didn't include these, because it would have added an unreasonable amount of diff noise.

See #51130


git-svn-id: https://develop.svn.wordpress.org/trunk@49147 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 18:20:40 +00:00
Ian Dunn
92aa799e89 Community Events: Display dates and times in the user's time zone.
Fixes #51130
Props sippis, hlashbrooke, audrasjb, Rarst, iandunn


git-svn-id: https://develop.svn.wordpress.org/trunk@49146 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 18:19:43 +00:00
Ian Dunn
92eba9720e Community Events: Trim events by Unix timestamp for accuracy.
The `date` and `end_date` fields are ''WP'' timestamps representing the venue's local time. As of meta:changeset:10270 (#meta4480), new `start_unix_timestamp` and `end_unix_timestamp` values are available, providing a proper ''Unix'' timestamp in the  UTC timezone. Using those is more precise, and removes the time window where the event has expired but still appears in the Events Widget.

To simplify the function, it now only accepts and returns the events themselves, rather than the entire response body.

See #51130
See #meta4480
Related: https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/


git-svn-id: https://develop.svn.wordpress.org/trunk@49145 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 18:17:55 +00:00
Sergey Biryukov
3a19ff15f9 General: Move wp_array_get() next to wp_array_slice_assoc(), for a bit more consistent placement.
Follow-up to [49135], [49143].

See #51461.

git-svn-id: https://develop.svn.wordpress.org/trunk@49144 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 02:14:34 +00:00
Sergey Biryukov
f3f53fb4e4 General: Move wp_array_get() from a separate file to wp-includes/functions.php, for consistency.
Add missing `@since` tag, adjust the DocBlock per the documentation standards.

Follow-up to [49135].

Props isabel_brison, ocean90.
Fixes #51461.

git-svn-id: https://develop.svn.wordpress.org/trunk@49143 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 02:08:54 +00:00
Sergey Biryukov
de89e7292e Administration: Make sure list table row actions in Extended view stay visible when a single row gets focus.
Follow-up to [48398], [48423], [48424], [48450], [48670].

Props ryelle.
Fixes #51516. See #49715.

git-svn-id: https://develop.svn.wordpress.org/trunk@49142 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 02:01:00 +00:00
Peter Wilson
36ef9cbca9 Taxonomy: Improve performance of term recounting database queries.
When modifying terms assigned to an object, replace full term recounts with incrementing/decrementing the count as appropriate. This provides a significant performance boost on sites with a high number of term/object relationships and/or posts.

Introduces the functions `wp_increment_term_count()`, `wp_decrement_term_count()`, `wp_modify_term_count_by()` and `wp_modify_term_count_by_now()` for updating the term count.

Introduces the function `_wp_prevent_term_counting()` for preventing double counting on posts that are about to transition.

Adds the parameter `update_count_by_callback` to `register_taxonomy()` to allow developers to use a custom callback for incrementing or decrementing a term count.

Props boonebgorges, davidbaumwald, hellofromTonya, johnbillion, lcyh78, mattoperry, peterwilsoncc, rebasaurus, whyisjake.
Fixes #40351.



git-svn-id: https://develop.svn.wordpress.org/trunk@49141 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-14 00:49:52 +00:00
Dominik Schilling
e676d46723 Users: Enable Application Passwords for local development environments, even if HTTPS is not available.
This will make testing the new feature easier since the local development environment is only accessible via HTTP by default.
Also update docs to link to the relevant filters.

See #42790.
Fixes #51503.

git-svn-id: https://develop.svn.wordpress.org/trunk@49139 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-13 20:08:23 +00:00
Dominik Schilling
798a3ba35e Administration: Restore alternative admin menu position for menu items with the same position value as an existing menu item.
Reverts parts of [49108].

Props johnjamesjacoby.
Fixes #42918.

git-svn-id: https://develop.svn.wordpress.org/trunk@49138 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-13 19:57:10 +00:00
Sergey Biryukov
5fa77839fe Sitemaps: Check the result of get_term_link() when collecting the URLs in WP_Sitemaps_Taxonomies::get_url_list().
This avoids a PHP warning during sitemap generation if `get_term_link()` returns an error, e.g. due to term ID being shared between multiple taxonomies.

Additionally, pass the `$taxonomy` argument to `get_term_link()` to properly disambiguate the call.

Props dd32.
Fixes #51416.

git-svn-id: https://develop.svn.wordpress.org/trunk@49137 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-13 15:02:23 +00:00
Sergey Biryukov
3021eff927 External Libraries: Upgrade PHPMailer to version 6.1.8.
For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.1.7...v6.1.8

Props ayeshrajans.
Fixes #51502.

git-svn-id: https://develop.svn.wordpress.org/trunk@49136 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-13 13:58:15 +00:00
Jorge Costa
27ad65df4d Editor: update packages; Port block supports to WordPress core.
The following package versions were changed:
@wordpress/a11y: 2.11.0 -> 2.13.0
@wordpress/annotations: 1.20.4 -> 1.22.0
@wordpress/api-fetch: 3.18.0 -> 3.20.0
@wordpress/autop: 2.9.0 -> 2.10.0
@wordpress/blob: 2.9.0 -> 2.10.0
@wordpress/block-directory: 1.13.7 -> 1.16.0
@wordpress/block-editor: 4.3.7 -> 5.0.0
@wordpress/block-library: 2.22.7 -> 2.25.0
@wordpress/block-serialization-default-parser: 3.7.0 -> 3.8.0
@wordpress/blocks: 6.20.3 -> 6.23.0
@wordpress/components: 10.0.6 -> 11.0.0
@wordpress/compose: 3.19.3 -> 3.21.0
@wordpress/core-data: 2.20.3 -> 2.23.0
@wordpress/data: 4.22.3 -> 4.24.0
@wordpress/data-controls: 1.16.3 -> 1.18.0
@wordpress/date: 3.10.0 -> 3.12.0
@wordpress/deprecated: 2.9.0 -> 2.10.0
@wordpress/dom: 2.13.1 -> 2.15.0
@wordpress/dom-ready: 2.10.0 -> 2.11.0
@wordpress/e2e-test-utils: 4.11.2 -> 4.14.0
@wordpress/edit-post: 3.21.7 -> 3.24.0
@wordpress/editor: 9.20.7 -> 9.23.0
@wordpress/element: 2.16.0 -> 2.18.0
@wordpress/escape-html: 1.9.0 -> 1.10.0
@wordpress/format-library: 1.22.7 -> 1.24.0
@wordpress/hooks: 2.9.0 -> 2.10.0
@wordpress/html-entities: 2.8.0 -> 2.9.0
@wordpress/i18n: 3.14.0 -> 3.16.0
@wordpress/icons: 2.4.0 -> 2.7.0
@wordpress/is-shallow-equal: 2.1.0 -> 2.3.0
@wordpress/keyboard-shortcuts: 1.9.3 -> 1.11.0
@wordpress/keycodes: 2.14.0 -> 2.16.0
@wordpress/library-export-default-webpack-plugin: 1.7.0 -> 1.9.0
@wordpress/list-reusable-blocks: 1.21.6 -> 1.23.0
@wordpress/media-utils: 1.15.0 -> 1.17.0
@wordpress/notices: 2.8.3 -> 2.10.0
@wordpress/nux: 3.20.6 -> 3.22.0
@wordpress/plugins: 2.20.3 -> 2.22.0
@wordpress/primitives: 1.7.0 -> 1.9.0
@wordpress/priority-queue: 1.7.0 -> 1.9.0
@wordpress/redux-routine: 3.10.0 -> 3.12.0
@wordpress/rich-text: 3.20.4 -> 3.22.0
@wordpress/scripts: 12.1.1 -> 12.3.0
@wordpress/server-side-render: 1.16.6 -> 1.18.0
@wordpress/shortcode: 2.9.0 -> 2.11.0
@wordpress/token-list: 1.11.0 -> 1.13.0
@wordpress/url: 2.17.0 -> 2.19.0
@wordpress/viewport: 2.21.3 -> 2.23.0
@wordpress/warning: 1.2.0 -> 1.3.0
@wordpress/wordcount: 2.10.0 -> 2.12.0

Props isabel_brison, youknowriad, mcsf.
Fixes #51461.

git-svn-id: https://develop.svn.wordpress.org/trunk@49135 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-13 13:07:23 +00:00
Timothy Jacobs
9f502abafd REST API: Add HTTP/1.0 emulation to wp.apiRequest().
This allows for making REST API calls with the PUT and DELETE HTTP methods that may be blocked or unsupported by some server configurations.

Props yakimun.
Fixes #43605.


git-svn-id: https://develop.svn.wordpress.org/trunk@49133 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-12 20:09:14 +00:00
Timothy Jacobs
c39f290124 REST API: Introduce search post format handler.
This allows for clients to search the used post formats via the /wp/v2/search endpoint by using a type=post-format query parameter.
Fixes #51459.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.


git-svn-id: https://develop.svn.wordpress.org/trunk@49132 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-12 19:52:57 +00:00
Sergey Biryukov
405a561301 Rewrite Rules: Add missing newline to the HTTP_AUTHORIZATION rewrite rule.
Follow-up to [49109].

Props nendeb55, georgestephanis, johnbillion.
Fixes #51495. See #42790.

git-svn-id: https://develop.svn.wordpress.org/trunk@49131 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-12 19:08:24 +00:00
Sergey Biryukov
1ca1817ced Docs: Correct comments in wpmu_new_site_admin_notification() per the documentation standards.
See #42134.

git-svn-id: https://develop.svn.wordpress.org/trunk@49130 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-12 15:45:27 +00:00
John Blackbourn
564fb09efd Media: Allow the gallery_shortcode() and get_image_tag() functions to correctly accept an array of image dimensions.
These functions did previously accept an array of image dimensions but their class attributes were not properly constructed.

Fixes #51362


git-svn-id: https://develop.svn.wordpress.org/trunk@49128 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-11 19:59:15 +00:00
John Blackbourn
f14a2dfbba Networks and Sites: Extract into a new function the email that gets sent to the network administrator when a new site is created, and introduce filters to disable and modify its
contents.

* The `send_new_site_email` filter can be used to disable this email.
* The `new_site_email` filter can be used to modify its contents.

Props Dhruvin, Dharm1025, dharmin16, jipmoors

Fixes #42134


git-svn-id: https://develop.svn.wordpress.org/trunk@49127 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-11 19:27:21 +00:00
John Blackbourn
402820ebba Posts, Post Types: Switch to restoring posts to draft status by default when they are untrashed.
This allows for edits to be made to a restored post before it goes live again. This also prevents scheduled posts being published unexpectedly if they are untrashed after their originally scheduled date.

The old behaviour of restoring untrashed posts to their original status can be reinstated using the `wp_untrash_post_set_previous_status()` helper function.

Also fixes an issue where the incorrect post ID gets passed to hooks if no post ID is passed to the function.

Props harrym, bananastalktome, jaredcobb, chriscct7, melchoyce, johnbillion, pankajmohale

Fixes #23022


git-svn-id: https://develop.svn.wordpress.org/trunk@49125 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-11 13:37:04 +00:00
John Blackbourn
039c63595d Administration: Allow context and priority to be specified when adding dashboard widgets.
Props davidjlaietta, soulseekah, johnbillion

Fixes #42791


git-svn-id: https://develop.svn.wordpress.org/trunk@49123 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-10 20:38:49 +00:00
John Blackbourn
781d8a54ed Site Health: Remove an unused function that was erroneously added when the site health feature was introduced.
This function was and is never used as the `is_in_debug_mode` check is a direct one.

Fixes #50282


git-svn-id: https://develop.svn.wordpress.org/trunk@49122 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-10 20:22:41 +00:00
John Blackbourn
6b1440e29a Docs: Standardise the type name for booleans and integers.
This brings these docs inline with the documentation standards.

Props ravipatel, justinahinon

Fixes #51426


git-svn-id: https://develop.svn.wordpress.org/trunk@49120 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-10 20:00:30 +00:00
John Blackbourn
6917c731f8 Docs: Fix the types for some properties and parameters that use the generic object type.
See #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49119 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-10 19:12:04 +00:00
Adam Silverstein
4f3c9c1f30 Users: prevent saving empty passwords, trim space from password ends on save.
Fix an issue where users could save a password with only spaces, or spaces at the beginning or end of their password, preventing them from logging in.

Props ronakganatra, 1naveengiri, ajensen, oolleegg55, bookdude13, nrqsnchz, aristath.
Fixes #42766.



git-svn-id: https://develop.svn.wordpress.org/trunk@49118 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-10 16:49:35 +00:00
John Blackbourn
38beea2e3a General: Docblock improvements for the WP_Error class.
Props garrett-eclipse

See #38777


git-svn-id: https://develop.svn.wordpress.org/trunk@49116 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-09 22:28:54 +00:00
John Blackbourn
df7554985d General: Introduce the ability to merge multiple WP_Error objects into one another, and to store more than one item of data for an error.
This allows multiple errors to be instantiated independently but collected into one without having to manually combine their properties.

Props rmccue, dlh, TimothyBlynJacobs

Fixes #38777


git-svn-id: https://develop.svn.wordpress.org/trunk@49115 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-09 22:20:50 +00:00
Ian Dunn
797b7e1fe2 Dashboard: Show 2 w.org news items to preserve clustered posts.
These days there are often 2 posts published close to each other, like a release announcement and a Month In WordPress post. When that happens, the earlier post is often pushed out of the widget before many people have had a chance to see it.

Ideally, the number of total items would remain at `4`, to reduce visual clutter. Implementing a conditional item would require a significant refactor, though. Increasing the total number of items to `5` is a practical compromise.

Props hlashbrooke, tellyworth.
Fixes #43441.


git-svn-id: https://develop.svn.wordpress.org/trunk@49114 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-09 16:05:37 +00:00
Sergey Biryukov
c35126e1b9 Accessibility: Widgets: Add a "Cancel" link when editing a widget in accessibility mode.
This allows the user to go back without saving any changes to the widget.

Props garrett-eclipse, audrasjb, afercia.
Fixes #49354.

git-svn-id: https://develop.svn.wordpress.org/trunk@49113 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-09 15:51:34 +00:00
Sergey Biryukov
98866f5032 Docs: Correct description for wp_set_comment_status hook.
The action fires immediately after transitioning a comment's status from one to another in the database and removing the comment from the object cache, but prior to all status transition hooks.

Props davidbaumwald, henry.wright.
Fixes #51481.

git-svn-id: https://develop.svn.wordpress.org/trunk@49111 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-09 01:26:27 +00:00
Sergey Biryukov
b455d336e3 I18N: Add missing placeholders in some translator comments.
Follow-up to [49109].

See #42790.

git-svn-id: https://develop.svn.wordpress.org/trunk@49110 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-09 01:04:53 +00:00
TimothyBlynJacobs
1856d0fe2a REST API: Introduce Application Passwords for API authentication.
In WordPress 4.4 the REST API was first introduced. A few releases later in WordPress 4.7, the Content API endpoints were added, paving the way for Gutenberg and countless in-site experiences. In the intervening years, numerous plugins have built on top of the REST API. Many developers shared a common frustration, the lack of external authentication to the REST API.

This commit introduces Application Passwords to allow users to connect to external applications to their WordPress website. Users can generate individual passwords for each application, allowing for easy revocation and activity monitoring. An authorization flow is introduced to make the connection flow simple for users and application developers.

Application Passwords uses Basic Authentication, and by default is only available over an SSL connection.

Props georgestephanis, kasparsd, timothyblynjacobs, afercia, akkspro, andraganescu, arippberger, aristath, austyfrosty, ayesh, batmoo, bradyvercher, brianhenryie, helen, ipstenu, jeffmatson, jeffpaul, joostdevalk, joshlevinson, kadamwhite, kjbenk, koke, michael-arestad, Otto42, pekz0r, salzano, spacedmonkey, valendesigns.
Fixes #42790.


git-svn-id: https://develop.svn.wordpress.org/trunk@49109 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-08 22:12:02 +00:00
Sergey Biryukov
79703088c4 General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.

git-svn-id: https://develop.svn.wordpress.org/trunk@49108 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-08 21:13:57 +00:00
Sergey Biryukov
07b37cdb6b Twenty Ten: Docs: Fix typo in twentyten_custom_excerpt_more() DocBlock.
Update `@return` tag for `twentyten_auto_excerpt_more()` for consistency with Twenty Eleven.

See #51477, #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@49106 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-08 09:25:01 +00:00
Sergey Biryukov
31a063b866 Twenty Eleven: Docs: Add missing @return type for twentyeleven_auto_excerpt_more().
Props ravipatel.
Fixes #51477.

git-svn-id: https://develop.svn.wordpress.org/trunk@49105 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-08 09:21:57 +00:00
Robert Anderson
cf8c11c2f3 Tests: Fix dependency tests
Fixes test_block_styles_for_editing_with_theme_support and
test_block_styles_for_viewing_with_theme_support by partially reverting [49102]
and only calling wp_should_load_block_editor_scripts_and_styles() when on an
admin screen.

Props TimothyBlynJacobs.
See #51330.


git-svn-id: https://develop.svn.wordpress.org/trunk@49104 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-08 03:34:31 +00:00
Timothy Jacobs
5b6f5f9f6d REST API: Introduce search term handler.
This allows for clients to search the available terms via the `/wp/v2/search` endpoint by using a `type=term` query parameter.

Fixes #51458.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.


git-svn-id: https://develop.svn.wordpress.org/trunk@49103 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-08 01:30:25 +00:00
Robert Anderson
b7b1584139 Editor: Only call should_load_block_editor_scripts_and_styles on admin screens
Do not call the should_load_block_editor_scripts_and_styles filter on non-admin
screens. This makes it less likely that one will accidentally call
get_current_screen() when it doesn't exist.

Follow-up to [49080].
Props noahtallen.
See #51330.


git-svn-id: https://develop.svn.wordpress.org/trunk@49102 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-08 01:19:10 +00:00
Andrew Ozz
9c50d3dda5 Update jQuery step two:
- Add jquery-migrate.js v.3.3.1 to core and load it in debug mode when `SCRIPT_DEBUG` is true.
- Add jquery.min.js, update jquery.js to 3.5.1 non-minified. This should help when debugging.
- Rebuild jQuery UI 1.12.1 and add it to core.
- Fix/adjust tests to match the above changes.

See #50564.

git-svn-id: https://develop.svn.wordpress.org/trunk@49101 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-07 16:31:53 +00:00
Sergey Biryukov
26a18bc72c Docs: Add missing @return tag for wp_xmlrpc_server::_is_greater_than_one().
Props ankitmaru.
Fixes #51465.

git-svn-id: https://develop.svn.wordpress.org/trunk@49098 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-07 11:00:33 +00:00
Sergey Biryukov
39a2ad729a Coding Standards: Add missing space in js/_enqueues/lib/comment-reply.js.
Props saqibameen, hareesh-pillai, imath, davidbaumwald.
Fixes #43907.

git-svn-id: https://develop.svn.wordpress.org/trunk@49097 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-07 10:36:11 +00:00
Sergey Biryukov
af9db19b45 Docs: Correct @since version for add_allowed_options().
Follow-up to [48121].

Props coffee2code.
Fixes #51450.

git-svn-id: https://develop.svn.wordpress.org/trunk@49096 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-06 15:53:25 +00:00
Sergey Biryukov
3ebeaffe80 Docs: Synchronize descriptions of some query functions and their counterpart methods in WP and WP_Query classes:
* `set_query_var()`
* `get_query_var()`
* `get_queried_object()`
* `get_queried_object_id()`

Switch to third-person singular verbs, per the documentation standards.

See #50768, #42783.

git-svn-id: https://develop.svn.wordpress.org/trunk@49095 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-06 08:57:38 +00:00
Robert Anderson
34a9527acf Docs: Improve set_query_var() inline docs.
Makes the inline docs for set_query_var() consistent with the inline docs for
get_query_var().

See #42783.
Props stevenlinx, markparnell.


git-svn-id: https://develop.svn.wordpress.org/trunk@49094 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-06 05:38:46 +00:00
Robert Anderson
03fe4eb692 Editor: Rename _should_load_block_editor_scripts_and_styles to wp_should_load_block_editor_scripts_and_styles
Follow-up to [49080].
Props zieladam, frank-klein.
See #51330.


git-svn-id: https://develop.svn.wordpress.org/trunk@49093 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-06 04:16:43 +00:00
Sergey Biryukov
7d14c81be1 Docs: Add brackets to function names in some @see tags, for consistency.
Props ravipatel, davidbaumwald.
Fixes #51441.

git-svn-id: https://develop.svn.wordpress.org/trunk@49092 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-05 14:01:10 +00:00
Sergey Biryukov
b31b69ab49 Docs: Add missing @return tag to Language_Pack_Upgrader::check_package().
Synchronize documentation of the `::check_package()` method between `Plugin_Upgrader`, `Theme_Upgrader`, and `Language_Pack_Upgrader`.

Props ankitmaru, mukesh27, desrosj.
Fixes #51448.

git-svn-id: https://develop.svn.wordpress.org/trunk@49091 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-05 13:42:04 +00:00
Sergey Biryukov
c8ed3ebb30 Privacy: Improve clarity of privacy error strings.
Primarily this adds "user privacy" to the strings for privacy requests, so they are more easily distinguished from other system actions within logs.

Props garrett-eclipse, carike, birgire.
Fixes #51351.

git-svn-id: https://develop.svn.wordpress.org/trunk@49090 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-04 03:21:38 +00:00
Sergey Biryukov
64e937d66c Docs: Add @since notes for the $id parameter of REST API search controller accepting a string.
Follow-up to [49088].

See #51131.

git-svn-id: https://develop.svn.wordpress.org/trunk@49089 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-03 01:20:49 +00:00
Timothy Jacobs
a3eb0d803e REST API: Allow for string ids in the search controller.
Previously, the search controller infrastructure required that the id property was an integer. This prevents data models that use a string id from utilizing the search infrastructure.

This commit lifts the restraint that search handlers return integer ids. This will allow for the Post Formats search handler coming in 5.6 to use slugs instead of creating fake ids.

Props stoyangeorgiev.
Fixes #51131.


git-svn-id: https://develop.svn.wordpress.org/trunk@49088 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-02 17:45:49 +00:00
Adam Silverstein
540b331096 Media: clear inputs after cropping on attachment details screen.
Clear the crop selection input fields after the crop action is complete. 
Fixes unexpected re-cropping behavior if the crop button was clicked more than once.

Props davidbinda.
Fixes #30155.



git-svn-id: https://develop.svn.wordpress.org/trunk@49087 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-02 15:09:46 +00:00
Sergey Biryukov
5d4a0c0411 Coding Standards: Make checks for an empty post in wp-includes/post.php more consistent.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@49086 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-02 12:35:34 +00:00
Helen Hou-Sandi
150d9bd17e Media: Don't unnecessarily check for a valid attachment before getting meta.
This makes `wp_get_attachment_metadata()` run significantly faster. See ticket for benchmarking.

Props Tkama, donmhico.
Fixes #50679.


git-svn-id: https://develop.svn.wordpress.org/trunk@49084 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-01 17:53:38 +00:00
Helen Hou-Sandi
7cca745052 WP Date: Add timezone abbreviation to wp-date settings.
Props mkaz.
Fixes #50624.


git-svn-id: https://develop.svn.wordpress.org/trunk@49083 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-01 17:41:18 +00:00
Timothy Jacobs
f60aa51988 REST API: Support the patternProperties JSON Schema keyword.
Props yakimun.
Fixes #51024.


git-svn-id: https://develop.svn.wordpress.org/trunk@49082 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-01 02:47:08 +00:00
Sergey Biryukov
062db8120d Docs: Add missing @since entry for _should_load_block_editor_scripts_and_styles().
Follow-up to [49080].

See #51330.

git-svn-id: https://develop.svn.wordpress.org/trunk@49081 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-01 01:12:16 +00:00
Robert Anderson
443ed5bf18 Editor: Add should_load_block_editor_scripts_and_styles
Adds a new should_load_block_editor_scripts_and_styles filter which can be used
by plugins including Gutenberg to more precisely customise when block editor
scripts and styles should be loaded by script-loader.php. Previously, plugins
had to fiddle with $current_screen->is_block_editor(). 

Props zieladam.
See #51330.


git-svn-id: https://develop.svn.wordpress.org/trunk@49080 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-01 00:37:54 +00:00
Sergey Biryukov
550bcd4f31 Script Loader: Update versions for MediaElement.js and related files.
Follow-up to [49070].

See #51315.

git-svn-id: https://develop.svn.wordpress.org/trunk@49079 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-01 00:02:48 +00:00
John Blackbourn
02c419aca1 Docs: Various docblock improvements related to user and site signup functionality.
See #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49078 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 21:52:27 +00:00
Sergey Biryukov
76516b0830 Code Modernization: Ignore the _multiwidget property when collecting widget numbers in WP_Customize_Manager::import_theme_starter_content().
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison

In particular, when calling `max()` on an array with numeric values and a non-numeric string, in PHP 8 the string is returned instead of a number.

For `::import_theme_starter_content()`, this resulted in retrieving the `_multiwidget` property instead of the maximum widget number for a particular type.

By explicitly ignoring the `_multiwidget` property, we make sure to retrieve the correct widget number value.

Follow-up to [48960], [49043].

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49076 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 15:44:09 +00:00
Sergey Biryukov
8e3636b0d6 Docs: Fix typos in some DocBlocks in js/_enqueues/wp/api.js.
Additionally, rename a variable for clarity.

Props mukesh27.
Fixes #51420.

git-svn-id: https://develop.svn.wordpress.org/trunk@49075 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 13:52:24 +00:00
Sergey Biryukov
498fae638d Code Modernization: Check if the file to retrieve metadata from in get_file_data() was successfully opened.
This avoids a fatal error on PHP 8 caused by passing a `false` value to `fread()`, instead of a file resource.

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49073 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 12:18:36 +00:00
Sergey Biryukov
63e0d969b6 Code Modernization: Return false from wpdb::query() if the query was filtered to an empty string using the query filter.
This avoids a fatal error on PHP 8 caused by passing an empty string to `mysqli_query()`, and maintains the current behaviour.

Follow-up to [48980], [48981].

See #50913, #50639.

git-svn-id: https://develop.svn.wordpress.org/trunk@49072 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 12:07:13 +00:00
Sergey Biryukov
f2bd8d0481 Docs: Correct description for wp_ajax_update_widget().
Follow-up to [28355].

Props burhandodhy, sabernhardt.
Fixes #44583.

git-svn-id: https://develop.svn.wordpress.org/trunk@49071 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 09:42:16 +00:00
Jonathan Desrosiers
6d786bb311 External Libraries: Update MediaElementJS to version 4.2.16.
This change brings a handful of bug fixes made since the previous update in [46436]. For a full list of changes included, see https://github.com/mediaelement/mediaelement/compare/4.2.13...4.2.16.

Props mukesh27, hareesh-pillai, SergeyBiryukov.
Fixes #51315.

git-svn-id: https://develop.svn.wordpress.org/trunk@49070 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-29 15:51:48 +00:00
Sergey Biryukov
bf945a81ec Code Modernization: Remove a single trailing percent sign before calling sprintf() on the $default parameter in get_theme_mod().
This avoids a "Missing format specifier at end of string" fatal error on PHP 8, and maintains the current behaviour.

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49068 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-29 10:01:05 +00:00
Sergey Biryukov
f070145fa9 Posts, Post Types: Avoid a PHP notice in wp_get_shortlink() if the post type is no longer registered.
Props apedog.
Fixes #51376.

git-svn-id: https://develop.svn.wordpress.org/trunk@49067 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-28 11:52:00 +00:00
SergeyBiryukov
b6f5a94631 Docs: Clarify the false return value of get_post_type_archive_link() and get_post_type_archive_feed_link().
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@49066 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-28 11:10:01 +00:00
Sergey Biryukov
0432229195 Docs: Correct formatting for the autosave() function return value in js/_enqueues/wp/autosave.js.
Props dilipbheda, mukesh27.
Fixes #51401.

git-svn-id: https://develop.svn.wordpress.org/trunk@49065 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-28 10:45:01 +00:00
Sergey Biryukov
581e45426c Media: Make the "Copy URL" button implementation more consistent with other instances in core:
* Make the "Copied!" text green.
* Make the button verbiage clear that it's copied "to clipboard".

Props garrett-eclipse, mukesh27.
Fixes #51355.

git-svn-id: https://develop.svn.wordpress.org/trunk@49064 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 20:46:44 +00:00
Timothy Jacobs
dbf692583c REST API: Support the multipleOf JSON Schema keyword.
Props yakimun.
Fixes #51022.


git-svn-id: https://develop.svn.wordpress.org/trunk@49063 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 19:01:18 +00:00
Sergey Biryukov
7b64dc237a Media: Check if the item is defined before setting the skipHistory property in media frame router.
This avoids a JS error when refreshing the "Attachment details" modal for an item that is not currently queried.

Follow-up to [41021].

Props Mista-Flo, mukesh27.
Fixes #51395.

git-svn-id: https://develop.svn.wordpress.org/trunk@49062 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 08:48:05 +00:00
Sergey Biryukov
0c4958bdbc Docs: Add missing @return tags for some WP_Automatic_Updater methods:
* `::is_vcs_checkout()`
* `::should_update()`
* `::send_core_update_notification_email()`

Props ankitmaru, mukesh27.
Fixes #51385.

git-svn-id: https://develop.svn.wordpress.org/trunk@49061 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 08:34:51 +00:00
Sergey Biryukov
8357bb923c Taxonomy: Restore documentation for the taxonomy parameter of wp_list_categories().
The parameter's default value is different from the one in `WP_Term_Query::__construct()`, and should be documented accordingly.

This also clarifies that the `taxonomy` parameter of `wp_list_categories()` only accepts a string, not an array.

Follow-up to [40903], [41767], [45894], [45895].

Props grapplerulrich, mukesh27, TimothyBlynJacobs, SergeyBiryukov.
Fixes #51378. See #47896.

git-svn-id: https://develop.svn.wordpress.org/trunk@49060 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 08:17:25 +00:00
Sergey Biryukov
742754d5a1 Docs: Correct description for the taxonomy parameter of wp_dropdown_categories().
Follow-up to [40903], [41767].

Props grapplerulrich, mukesh27, TimothyBlynJacobs.
See #51378.

git-svn-id: https://develop.svn.wordpress.org/trunk@49059 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 07:47:04 +00:00
SergeyBiryukov
c729e4d732 Docs: Fix typo in a comment in js/media/routers/manage.js.
Props mukesh27, garrett-eclipse.
Fixes #51397.

git-svn-id: https://develop.svn.wordpress.org/trunk@49058 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 07:36:02 +00:00
Sergey Biryukov
73779aaa0a External Libraries: Backport a commit from sodium_compat trunk to fix a PHP 8 error.
This addresses an "Undefined constant `MB_OVERLOAD_STRING`" fatal error in the `ParagonIE_Sodium_Core_Util::isMbStringOverride()` method.

In PHP 8, the `MB_OVERLOAD_STRING` constant has been removed, along with the `mbstring` function overloading feature.

Fixes #51399.

git-svn-id: https://develop.svn.wordpress.org/trunk@49057 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 05:15:03 +00:00
Sergey Biryukov
3366793a8d Upgrade/Install: Update sodium_compat to v1.13.0.
This includes a few autoloader fixes and improvements.

A full list of changes in this update can be found on GitHub:
https://github.com/paragonie/sodium_compat/compare/v1.12.1...v1.13.0

See #51399.

git-svn-id: https://develop.svn.wordpress.org/trunk@49056 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-27 04:44:01 +00:00
Timothy Jacobs
4ad4eeaf7d Add ircs and irc6 to the list of allowed protocols.
This adds support for the secure and ipv6 variants of the already allowed irc protocol.

Props arealnobrainer, markparnell, ctmartin.


git-svn-id: https://develop.svn.wordpress.org/trunk@49055 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 21:00:19 +00:00
Timothy Jacobs
9b9b59c4ee REST API: Correct @since version after [49053].
See #51023.


git-svn-id: https://develop.svn.wordpress.org/trunk@49054 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 18:54:48 +00:00
Timothy Jacobs
d5c2c86bd8 REST API: Support the minProperties and maxProperties JSON Schema keywords.
Props yakimun.
Fixes #51023.


git-svn-id: https://develop.svn.wordpress.org/trunk@49053 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 18:18:53 +00:00
Sergey Biryukov
ce87b260bc Upload: Add a check in wp_check_filetype_and_ext() to account for CSV files having the application/csv MIME type.
Previously, the PHP Fileinfo extension used to detect CSV files as `text/plain`.

In PHP 8, this has changed, and CSV files are detected as `application/csv`.

Follow-up to [44438].

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49049 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 01:09:52 +00:00
John Blackbourn
5346800a92 Upgrade/Install: Introduce the wp_installed_email filter for filtering the contents of the email sent when WordPress is installed, without needing to override the wp_new_blog_notification() pluggable function.
Props Dharm1025, nikolam, johnbillion

Fixes #42133


git-svn-id: https://develop.svn.wordpress.org/trunk@49048 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 22:31:27 +00:00
Sergey Biryukov
da93663d01 Code Modernization: Correct the check for parent argument in wp_insert_term() and wp_update_term().
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison

In particular, checking if a non-empty, non-numeric string is greater than zero in PHP 8 evaluates to `true`, not `false`.

For `wp_insert_term()`, this resulted in a "Parent term does not exist" error for a non-numeric string, instead of discarding the value.

By explicitly casting the value to `int`, we make sure to compare both values as numbers, rather than a string and a number.

Follow-up to [29196], [29830], [29867].

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49043 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 00:02:39 +00:00
Sergey Biryukov
0ae6b563b6 Docs: Add a @since note to wp_privacy_exports_dir and wp_privacy_exports_url filters about exports using relative paths since WordPress 5.5.
When changing exports location via these filters, make sure to migrate the files to the new directory, to avoid breaking any existing exports.

Follow-up to [48127], [48330].

Props garrett-eclipse.
Fixes #51361.

git-svn-id: https://develop.svn.wordpress.org/trunk@49042 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-24 04:58:27 +00:00
Robert Anderson
28963e897c Documentation: Add 'template' arg documentation
Add inline documentation for the 'template' arg accepted by
register_post_type().

Props milana_cap.
See #46261.


git-svn-id: https://develop.svn.wordpress.org/trunk@49041 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-24 03:10:26 +00:00
Robert Anderson
165adab5e7 Editor: Hide Screen Options tab from block editor
The block editor provides its own interface for managing screen options, so we
can safely hide Screen Options tab found in the top right of the page.

Props aduth.
See #46157.


git-svn-id: https://develop.svn.wordpress.org/trunk@49040 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-24 02:58:17 +00:00
Sergey Biryukov
7826f31e26 Docs: Remove obsolete $wpdb global reference from get_site_by_path().
Follow-up to [37628].

Props ravivaddweb, mukesh27.
Fixes #51380.

git-svn-id: https://develop.svn.wordpress.org/trunk@49038 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 14:09:03 +00:00
Sergey Biryukov
7d15225ad0 Users: Check if the user ID passed as selected to wp_dropdown_users() corresponds to an existing user.
This avoids a few PHP notices if the `include_selected` parameter was specified and a non-existing user ID was passed.

Props campusboy1987.
Fixes #51370.

git-svn-id: https://develop.svn.wordpress.org/trunk@49036 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 00:25:47 +00:00
Jonathan Desrosiers
83eb948b7f Privacy: Ensure bulk action related strings end with periods.
Props garrett-eclipse, mukesh27.
Fixes #51371.

git-svn-id: https://develop.svn.wordpress.org/trunk@49035 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-22 18:38:51 +00:00
Jonathan Desrosiers
45197f9d4e External Libraries: Upgrade PHPMailer to version 6.1.7.
For a full list of changes in this update, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v6.1.6...v6.1.7.

Props ayeshrajans, jrf.
Fixes #51311.

git-svn-id: https://develop.svn.wordpress.org/trunk@49034 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-22 18:35:10 +00:00
John Blackbourn
4a929fe723 Users: Introduce the invited_user_email filter for filtering the contents of the email sent when an existing user is invited to a site on Multisite.
Props contact-banker, anand.au14, nikolam, johnbillion

Fixes #42132


git-svn-id: https://develop.svn.wordpress.org/trunk@49029 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 17:14:33 +00:00
John Blackbourn
0fbc8b1ac7 Docs: Correct the indentation for some array type docs.
See #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49028 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 16:44:35 +00:00
Sergey Biryukov
e8b00da747 Privacy: Check if the accumulated data in wp_privacy_process_personal_data_export_page() is not empty.
This avoids an error on PHP 8 caused by passing an empty string to `array_merge()`, instead of an array.

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49026 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 13:49:07 +00:00
Sergey Biryukov
f7570fec4a General: Give the $is variable in is_wp_error() a more descriptive name.
Follow-up to [49022].

See #40568.

git-svn-id: https://develop.svn.wordpress.org/trunk@49023 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-21 11:11:10 +00:00
John Blackbourn
2b742beb5c General: Introduce the wp_error_added and wp_error_checked actions.
These actions allow debugging tools to track `WP_Error` instances as they're created and subsequently passed between functions which check for error objects.

Props Shelob9, Mte90, TimothyBlynJacobs, johnbillion

Fixes #40568



git-svn-id: https://develop.svn.wordpress.org/trunk@49022 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 17:43:00 +00:00
John Blackbourn
dd076bb611 Media: Standardise the description for image size parameters.
This brings continuity to all the image related functions and filters which accept or pass a size parameter.

Props dilipbheda, johnbillion

Fixes #47364


git-svn-id: https://develop.svn.wordpress.org/trunk@49021 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 16:21:42 +00:00
John Blackbourn
b620440519 Docs: Inline documentation improvements for media related functions and hooks.
See #47364, #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49020 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 15:53:52 +00:00
Sergey Biryukov
e020b1183d Media: Return a WP_Error from WP_Image_Editor_GD::load() if file contents could not be retrieved.
This avoids an error on PHP 8 caused by calling `imagecreatefromstring()` on an empty result.

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49019 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 14:26:38 +00:00
John Blackbourn
ab25da99a0 Media: Correct some types for attachment ID parameters passed to functions and filters.
See #47364, #50768 


git-svn-id: https://develop.svn.wordpress.org/trunk@49017 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 14:03:17 +00:00
John Blackbourn
db684af2c1 Media: Correct some types in docblocks for filters related to thumbnails.
Props dilipbheda

See #47364, #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49016 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:38:04 +00:00
John Blackbourn
42019042de I18N: Add a language icon next to the Default Language network option.
Fixes #51359


git-svn-id: https://develop.svn.wordpress.org/trunk@49013 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:16:12 +00:00
John Blackbourn
9462c458ff Media: Correct the image thumbnail logic in media templates.
This ensures the correct data properties are checked before displaying image thumbnails.

Props chetan200891

Fixes #49655


git-svn-id: https://develop.svn.wordpress.org/trunk@49012 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 13:13:46 +00:00
John Blackbourn
74688add2c Themes: Remove the ability to delete themes from the single site Appearance screen on Multisite installations.
This brings theme deletion inline with plugin deletion and theme and plugin editing, which can only be performed from within Network Admin.

Props Mista-Flo, williampatton, johnbillion

Fixes #41441


git-svn-id: https://develop.svn.wordpress.org/trunk@49011 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-20 12:01:32 +00:00
Peter Wilson
1ffdfdaea7 Posts, Post Types: Ensure default terms are added by wp_publish_post().
Transitioning posts from `auto-draft` to `publish` via `wp_publish_post()` could result in published posts without the default category or custom taxonomy default terms.

Props frank-klein, TimothyBlynJacobs, peterwilsoncc.
Fixes #51292.



git-svn-id: https://develop.svn.wordpress.org/trunk@49000 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-19 01:20:48 +00:00
Sergey Biryukov
f78acee893 Docs: Add a @since note about adjacent_posts_rel_link_wp_head() no longer being used in core.
Follow-up to [48966].

Props jnylen0.
See #39111.

git-svn-id: https://develop.svn.wordpress.org/trunk@48995 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 11:04:48 +00:00
Sergey Biryukov
8bc03cf494 Docs: Add a @since note for the recovery_mode_email filter about the $email argument now including the attachments key.
Follow-up to [48964].

See #51276.

git-svn-id: https://develop.svn.wordpress.org/trunk@48994 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 11:01:52 +00:00
Sergey Biryukov
cb356d9cfc Twenty Twenty: Update the URL for PHP date formats table in translator comments.
Follow-up to [48991].

Props hareesh-pillai, mukesh27, iandunn.
Fixes #51335. See #51332.

git-svn-id: https://develop.svn.wordpress.org/trunk@48992 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 10:42:26 +00:00
Sergey Biryukov
7d23a212c4 Docs: Update the URL for PHP date formats table in translator comments.
Props hareesh-pillai, iandunn.
Fixes #51332.

git-svn-id: https://develop.svn.wordpress.org/trunk@48991 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-18 10:35:41 +00:00
Sergey Biryukov
cb38bc973e Comments: Assign the array of comment data returned from the comments_pre_query filter to the comments property of the current WP_Comment_Query instance.
This avoids the performance overhead of calling `WP_Comment_Query::get_comments()` twice: first when creating the object instance, then to retrieve the filtered results.

This also makes the filter a bit more consistent with other similar filters, e.g. `posts_pre_query`, `terms_pre_query`, or `users_pre_query`.

Follow-up to [46086].

Props dinhtungdu, imath, spacedmonkey, adamsilverstein, SergeyBiryukov.
Fixes #50521.

git-svn-id: https://develop.svn.wordpress.org/trunk@48990 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 19:53:47 +00:00
Anthony Burchell
7da52b8eae Media: Allow contextually generated images to show in Media Library grid view.
In grid view, contextually generated or cropped media is filtered out causing page numbering to be offset and incorrect. This also impacted any media utilizing `media-models.js`.
Props webmandesign, audrasjb, afercia, pbiron, mista-flo.
Fixes #46127, #50410, #47215.



git-svn-id: https://develop.svn.wordpress.org/trunk@48989 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 14:40:47 +00:00
Sergey Biryukov
e145c9aaba Docs: Reformat comments_pre_query, networks_pre_query, sites_pre_query DocBlocks for better readability.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48986 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 11:08:04 +00:00
Sergey Biryukov
8621e8d5c8 Docs: Fix typo in *_pre_query filter DocBlocks.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48985 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 10:43:23 +00:00
Sergey Biryukov
77647aea23 Docs: Correct the parameter type for networks_pre_query filter.
The filter should return the network count as an integer if `$this->query_vars['count']` is set.

Follow-up to [46100].

See #50768, #47599.

git-svn-id: https://develop.svn.wordpress.org/trunk@48984 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 10:35:51 +00:00
Sergey Biryukov
9cb0da3754 Formatting: Make sure links_add_target() adds the target attribute to the correct tag.
Previously, the attribute could unintentionally be added to a tag that starts with the same characters, e.g. `<aside>` instead of `<a>`.

Props antonlukin.
Fixes #51313.

git-svn-id: https://develop.svn.wordpress.org/trunk@48983 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-17 10:12:32 +00:00
Helen Hou-Sandi
9648bcd373 i18n: Ensure block type strings in the REST API end with a full stop.
Props ramiy, justinahinon.
Fixes #50805.



git-svn-id: https://develop.svn.wordpress.org/trunk@48982 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-16 19:21:03 +00:00
Sergey Biryukov
2cc4276746 Code Modernization: Return an empty string from wpdb::prepare() if there are not enough arguments to match the placeholders.
This avoids a fatal error on PHP 8 caused by passing mismatched arguments to `vsprintf()`, and maintains the current behaviour.

Follow-up to [48979], [48980].

See #50913, #50639.

git-svn-id: https://develop.svn.wordpress.org/trunk@48981 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-16 02:27:42 +00:00
Sergey Biryukov
35ceac68f4 Code Modernization: Return an empty string from wpdb::_real_escape() if a non-scalar value is passed.
This avoids a fatal error on PHP 8 caused by passing a non-string value to ` mysqli_real_escape_string()`, and maintains the current behaviour.

See #50913, #50639.

git-svn-id: https://develop.svn.wordpress.org/trunk@48980 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-16 01:46:25 +00:00
Sergey Biryukov
54fd2f7a80 Docs: Document the usage of $wpdb global in wp_delete_attachment_files().
Props jontyravi.
Fixes #51309.

git-svn-id: https://develop.svn.wordpress.org/trunk@48976 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-14 13:41:33 +00:00
Sergey Biryukov
82a4978a71 Docs: Document the usage of $wpdb global in wp_get_post_autosave().
Follow-up to [48422].

Props ravivaddweb.
Fixes #51308. See #34560.

git-svn-id: https://develop.svn.wordpress.org/trunk@48975 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-14 13:35:10 +00:00
Sergey Biryukov
9066eb15a2 Coding Standards: Explicitly declare the $wp_version global used in some core files.
Props jaydeep-rami, sabernhardt.
Fixes #44932.

git-svn-id: https://develop.svn.wordpress.org/trunk@48971 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-12 00:10:16 +00:00
Sergey Biryukov
2c843f03d5 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-plugin-install-list-table.php.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@48970 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-11 01:03:54 +00:00
Helen Hou-Sandi
b8e4f37a57 REST API: Include attribute name in schema validation error message.
Props bobbingwide.
Fixes #51231.


git-svn-id: https://develop.svn.wordpress.org/trunk@48969 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-10 16:32:52 +00:00
Sergey Biryukov
c0570b1398 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-plugins-list-table.php.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@48968 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-10 14:20:08 +00:00
Sergey Biryukov
54f62fc234 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-ms-themes-list-table.php.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@48967 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-10 14:19:35 +00:00
John Blackbourn
db9a91a2a8 Posts, Post Types: Don't output the adjacent posts rel link by default.
This has a considerable performance impact on sites which don't otherwise show previous and next post links, and has no SEO benefit.

Props joostdevalk, swissspidy, johnbillion

Fixes #39111

git-svn-id: https://develop.svn.wordpress.org/trunk@48966 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-09 21:32:07 +00:00
Helen Hou-Sandi
19bdc1e3f9 Privacy: Remove extraneous colon from settings screen.
Props vinita29, garrett-eclipse.
Fixes #50414.


git-svn-id: https://develop.svn.wordpress.org/trunk@48965 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-09 19:41:07 +00:00
Jonathan Desrosiers
0548043076 Site Health: Allow attachments to be added to recovery mode emails.
The `wp_mail()` function has the ability to add attachments to emails. There is currently no way to add attachments to the recovery mode email sent out to site admins when a PHP error is encountered on their site.

This change adds that ability through the use of the `recovery_mode_email` filter, allowing developers to use the full capabilities of `wp_mail()`.

Props desrosj, timothyblynjacobs.
Fixes #51276.

git-svn-id: https://develop.svn.wordpress.org/trunk@48964 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-09 16:19:33 +00:00
Jonathan Desrosiers
2c6df53917 Administration: Add the aria-hidden attribute to admin menu icons.
The admin menu icons are included as a visual element to support the text links. Without the `aria-hidden=“true”` attribute, they are also exposed to assistive technologies (which can process icon fonts in unpredictable ways).

This change improves the experience for multiple types of assistive technologies, including screen reading and voice control software. With `aria-hidden=“true”` added, the icons will not be read, and a user can now trigger a click of a top level admin menu item with commands such as “click posts”, or “click plugins”.

Props joedolson, afercia, audrasjb, adriantirusli.
Fixes #51012.

git-svn-id: https://develop.svn.wordpress.org/trunk@48963 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-09 16:13:17 +00:00
Jonathan Desrosiers
506c46593b Docs: Improve the recovery_mode_email inline docs.
See #51267, #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48962 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-09 15:46:30 +00:00
Sergey Biryukov
875acd7b37 Code Modernization: Remove unnecessary reference sign from get_comment() definition.
This fixes a PHP 8 "argument must be passed by reference, value given" error when using `array_map( 'get_comment', ... )`.

Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around.

Note: This reverts [48838], which is now redundant.

Follow-up to a similar change for `get_post()` in [21572].

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@48961 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-09 03:53:50 +00:00
Sergey Biryukov
f6f117a0a9 Code Modernization: Correct the check for negative post IDs in WP_Query::parse_query() to work as expected on PHP 8.
PHP 8 changes the way string to number comparisons are performed: https://wiki.php.net/rfc/string_to_number_comparison

In particular, checking if an empty string is less than zero in PHP 8 evaluates to `true`, not `false`.

For `WP_Query`, this resulted in unintentionally returning a 404 error for most of front-end requests, instead of the relevant content.

By explicitly casting the value to `int`, we make sure to compare both values as numbers, rather than a string and a number.

Follow-up to [38288].

Props trepmal.
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@48960 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-09 02:33:22 +00:00
Sergey Biryukov
427d72c8a1 Comments: Check if a valid comment ID was passed when editing a comment.
This avoids a PHP notice after submitting the Edit Comment form.

Props regan.khadgi.
Fixes #51263.

git-svn-id: https://develop.svn.wordpress.org/trunk@48958 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-08 13:39:41 +00:00
Timothy Jacobs
84d524e189 REST API: Extract WP_REST_Controller::get_endpoint_args_for_item_schema() to a standalone function.
This method is useful whenever a JSON Schema needs to be converted to a format suitable for argument validation with `WP_REST_Request`. Moving the logic into a standalone function allows developers to use it outside of the `WP_REST_Controller` context.

Props pentatonicfunk.
Fixes #50876. 


git-svn-id: https://develop.svn.wordpress.org/trunk@48951 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-07 02:35:52 +00:00
Timothy Jacobs
d803f6bf82 REST API: Refactor WP_REST_Server::dispatch() to make internal logic reusable.
#50244 aims to introduce batch processing in the REST API. An important feature is the ability to enforce that all requests have valid data before executing the route callbacks in "pre-validate" mode.

This necessitates splitting `WP_REST_Server::dispatch()` into two methods so the batch controller can determine the request handler to perform pre-validation and then respond to the requests.

The two new methods, `match_request_to_handler` and `respond_to_request`, have a public visibility, but are marked as `@access private`. This is to allow for iteration on the batch controller to happen in the Gutenberg repository. Developers should not rely upon these methods, their visibility may change in the future.

See #50244.
Props andraganescu, zieladam, TimothyBlynJacobs.


git-svn-id: https://develop.svn.wordpress.org/trunk@48947 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-05 21:50:31 +00:00
Sergey Biryukov
1c1a7b8365 Media: In wp_ajax_image_editor(), check if the error property exists before accessing it.
This avoids a PHP notice when editing an image.

Follow-up to [48375].

Props Mista-Flo.
Fixes #51251.

git-svn-id: https://develop.svn.wordpress.org/trunk@48946 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-05 18:10:47 +00:00
Timothy Jacobs
88ec90d6df REST API: Support a route-level validation callback.
Most request data is validated on a per-parameter basis. Often, however, additional validation is needed that operates on the entire request object. Currently, this is done in the route callback and often in the `prepare_item_for_database` method specifically.

#50244 aims to introduce batch processing in the REST API. An important feature is the ability to enforce that all requests have valid data before executing the route callbacks in "pre-validate" mode.

This patch introduces support for calling a `validate_callback` after all parameter validation has succeeded. That allows moving more validation outside of the route callback and into `WP_REST_Request` which will improve "pre-validate" support.

Props TimothyBlynJacobs, zieladam.
Fixes #51255.
See #50244.




git-svn-id: https://develop.svn.wordpress.org/trunk@48945 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-05 18:07:46 +00:00
Sergey Biryukov
677af117a9 Comments: Rename WP_Comments_List_Table::comment_status_dropdown() to ::comment_type_dropdown().
This better reflects the purpose of the method, which doesn't have anything to do with a comment status.

Follow-up to [48521].

Props davidbaumwald, johnbillion, SergeyBiryukov.
Fixes #51248.

git-svn-id: https://develop.svn.wordpress.org/trunk@48943 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-05 00:31:03 +00:00
Sergey Biryukov
267e754b83 Docs: Further correct placement for wp_editor_expand filter DocBlock.
This ensures that the filter is only applied if the conditions before it are evaluated to true.

Follow-up to [48714].

Props johnbillion.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48942 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-04 21:46:11 +00:00
John Blackbourn
d34a21c950 Docs: Various docblock corrections and improvements.
See #50768

git-svn-id: https://develop.svn.wordpress.org/trunk@48941 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-04 20:39:47 +00:00
Sergey Biryukov
5e2a75ef29 Administration: Give the $error variable in wp-admin/admin-header.php a more descriptive name.
This avoids a conflict with the same global variable used elsewhere, e.g. in Theme Editor.

Follow-up to [48850].

Props vinayak.anivase.
Fixes #51219.

git-svn-id: https://develop.svn.wordpress.org/trunk@48938 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-03 01:41:47 +00:00
Sergey Biryukov
5f4a8f75b5 Docs: Synchronize the description of the $format parameter in various date/time functions for posts and comments.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48929 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-01 00:41:19 +00:00
Sergey Biryukov
23528d419a Script Loader: Add backward compatibility for JavaScript i18n globals and properties deprecated in WordPress 5.5.
The recommended approach for any plugins using these globals or properties is to switch to the newer `wp.i18n` functions.

In the meantime, this ensures that accessing any of these globals does not break the rest of the code on the page, and an appropriate warning message is logged to the JavaScript console.

Follow-up to: https://core.trac.wordpress.org/query?summary=~wp.i18n&milestone=5.5

Props omarreiss, peterwilsoncc, kbjohnson90, johnbillion, TimothyBlynJacobs, joostdevalk, ocean90, desrosj, SergeyBiryukov.
Fixes #51123.

git-svn-id: https://develop.svn.wordpress.org/trunk@48923 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-31 20:28:41 +00:00
Sergey Biryukov
d33fa375f6 Date/Time: In get_the_date() and related functions, pass the original, unmodified $format value to the filters.
Additionally, simplify the `$format` argument checks for consistency with similar checks in `get_the_modified_date()` and `get_the_modified_time()`.

Follow-up to [48912].

Props Rarst.
See #51184.

git-svn-id: https://develop.svn.wordpress.org/trunk@48918 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-31 18:28:42 +00:00
Sergey Biryukov
390f84b715 Themes: Normalize the installed theme path in Theme_Installer_Skin::do_overwrite() before comparing with the uploaded theme.
This ensures that the data for the currently installed theme is picked up properly when uploading a theme update on Windows.

Follow-up to [48390].

Props bobbingwide, wpamitkumar, mukesh27.
Fixes #51182.

git-svn-id: https://develop.svn.wordpress.org/trunk@48913 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-31 17:09:35 +00:00
Sergey Biryukov
3309309f6b Date/Time: Make sure get_the_date() and related functions return correct time if the format was specified as false.
Technically, the `$format` argument should always be a string, but passing `false` used to work before [47808], so this restores backward compatibility.

The list of affected functions:
* `get_the_date()`
* `get_the_time()`
* `get_comment_date()`
* `get_comment_time()`

Props wittich, Rarst, akabarikalpesh, SergeyBiryukov.
Fixes #51184.

git-svn-id: https://develop.svn.wordpress.org/trunk@48912 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-31 15:56:41 +00:00
Sergey Biryukov
c2aaa14d57 Docs: Add a @since note to the display_post_states filter to clarify that it is now also applied in the Customizer context.
If any admin functions are used within the filter, their existence should be checked with `function_exists()` before being used.

Follow-up to [47763], [48620].

Props audrasjb, garrett-eclipse, Howdy_McGee, dlh, khag7, SergeyBiryukov.
Fixes #51081.

git-svn-id: https://develop.svn.wordpress.org/trunk@48910 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-31 13:30:20 +00:00
Sergey Biryukov
812f49ae05 Docs: Clarify the usage of null for auto_update_{$type} filter.
The value is internally used to detect whether nothing has hooked into this filter.

Props audrasjb, pbiron, johnbillion, SergeyBiryukov.
Fixes #50848.

git-svn-id: https://develop.svn.wordpress.org/trunk@48909 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-31 13:18:39 +00:00
Sergey Biryukov
5ec12d64d6 Administration: Correct the padding for "Warning: these pages should not be the same" messages on Reading Settings screen.
Replace the legacy `.error` class with a more appropriate `.notice-warning`.

Props musicaljoeker, shital-patel, man4toman, garrett-eclipse, SergeyBiryukov.
Fixes #50766.

git-svn-id: https://develop.svn.wordpress.org/trunk@48906 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-29 00:41:00 +00:00
Sergey Biryukov
0013f5979c Media: Make the is_gd_image() function available on front end.
This avoids a fatal error if a plugin calls image creation or editing functions like `wp_imagecreatetruecolor()` outside of the admin.

Follow-up to [48798]

Props BackuPs.
Fixes #51174. See #50833.

git-svn-id: https://develop.svn.wordpress.org/trunk@48905 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-28 16:43:31 +00:00
Sergey Biryukov
673fcd7927 Comments: Check if reply heading text node exists before accessing its property in comment-reply.js.
Follow-up to [47506], [48876].

Props johannadevos, mailnew2ster.
Fixes #38009.

git-svn-id: https://develop.svn.wordpress.org/trunk@48904 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-28 13:10:29 +00:00
Sergey Biryukov
2afabce1c1 Docs: Correct formatting of the auto_theme_update_send_email filter DocBlock.
Synchronize description of the `$enabled` parameter with the `auto_plugin_update_send_email` filter.

Follow-up to [48889].

See #50768, #50988.

git-svn-id: https://develop.svn.wordpress.org/trunk@48903 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-28 02:36:39 +00:00
Sergey Biryukov
bb40a2698a Upgrade/Install: Only display the auto-update links on the Network Admin > Themes screen for themes that support the feature.
Follow-up to [48669], [48688].

Props afragen, pbiron, audrasjb, desrosj, SergeyBiryukov.
Fixes #51129.

git-svn-id: https://develop.svn.wordpress.org/trunk@48899 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 22:22:23 +00:00
Sergey Biryukov
a0b40ebd6a Script Loader: Disable concatenation for scripts with translations to ensure they are printed in the right order.
Props herregroen, ocean90, desrosj, mikeyarce, bobbingwide, audrasjb, johnbillion.
Fixes #50999.

git-svn-id: https://develop.svn.wordpress.org/trunk@48897 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 21:57:01 +00:00
Sergey Biryukov
6c395a5f3e Bootstrap/Load: Check if the __() function is available in wp_get_environment_type().
The function would not exist in `SHORTINIT` mode.

Follow-up to [48894].

See #50992.

git-svn-id: https://develop.svn.wordpress.org/trunk@48895 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 21:37:33 +00:00
Sergey Biryukov
a0864835a5 Bootstrap/Load: Remove the ability to alter the list of environment types in wp_get_environment_type().
The intention of `wp_get_environment_type()` is to provide a consistent means of identifying the environment type, not of identifying a specific environment.

Actual environments should fit within one of the existing types: `local`, `development`, `staging`, or `production`. That should cover the types that plugins and themes might be concerned about when toggling functionality. 

Props johnbillion, joostdevalk, TimothyBlynJacobs, jeremyfelt, batmoo, claytoncollie, Clorith, markjaquith, garrett-eclipse, GaryJ, elrae.
Fixes #50992.

git-svn-id: https://develop.svn.wordpress.org/trunk@48894 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 21:30:33 +00:00
Sergey Biryukov
6a6241ac6a Script Loader: Change the jquery handle back to an alias for jquery-core.
This ensures that `wp_localize_script( 'jquery', ... )` continues to work as expected, since `WP_Scripts::localize()` rewrites the `jquery` handle to `jquery-core` internally.

Follow-up to [48323].

Props mukesh27, rajeshsingh520, johnbillion, TimothyBlynJacobs, TobiasBg.
Fixes #50919.

git-svn-id: https://develop.svn.wordpress.org/trunk@48890 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 20:31:23 +00:00
Jonathan Desrosiers
c14417c5c9 Upgrade/Install: Pass details about the specific plugin and theme updates attempted to filters.
This adds an additional parameter to the `auto_plugin_update_send_email` and `auto_theme_update_send_email` filters to provide the additional context of which updates were attempted and their outcome. This will help plugin and theme auto-update emails to be better tailored to a site owner’s liking.

Props audrasjb, Paddy Landau, desrosj.
Fixes #50988.

git-svn-id: https://develop.svn.wordpress.org/trunk@48888 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 19:25:38 +00:00
Jorge Costa
fb04a13f46 Editor: update packages.
The following package versions were changed:
@wordpress/block-directory: 1.13.6 -> 1.13.7
@wordpress/block-editor: 4.3.6 -> 4.3.7
@wordpress/block-library: 2.22.6 -> 2.22.7
@wordpress/components: 10.0.5 -> 10.0.6
@wordpress/edit-post: 3.21.6 -> 3.21.7
@wordpress/editor: 9.20.6 -> 9.20.7
@wordpress/format-library: 1.22.6 -> 1.22.7
@wordpress/list-reusable-blocks: 1.21.5 -> 1.21.6
@wordpress/nux: 3.20.5 -> 3.20.6
@wordpress/server-side-render: 1.16.5 -> 1.16.6
Includes PR WordPress/gutenberg#24828

Props nosolosw, desrosj, SergeyBiryukov, youknowriad.
Fixes: #51151.

git-svn-id: https://develop.svn.wordpress.org/trunk@48884 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 16:34:37 +00:00
Timothy Jacobs
6c76a13139 REST API: Fix multi-type schemas with integer fields.
In [48306] support for multi-typed schemas was improved to first detect the data type of the value before applying further validation. The `integer` data type was detected using the new `rest_is_integer` function. This function used logic, however, that assumed that the value had already passed an `is_numeric` check. This meant that if `integer` and `string` were both acceptable types, the value would always be considered an `integer` causing the later accurate type validation to fail.

This commit fixes the `rest_is_integer` logic to include an `is_numeric` check.

Props rtagliento.
Fixes #51146.


git-svn-id: https://develop.svn.wordpress.org/trunk@48881 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 02:55:39 +00:00
Sergey Biryukov
c8b5610b91 Taxonomy: Make sure wp_terms_checklist() and Walker_Category_Checklist::start_el() properly handle an array of strings as selected_cats or popular_cats values.
Even with these values documented as an array of integers, they can technically also accept an array of strings, e.g. as form results.

Add a unit test.

Props brianhogg, TimothyBlynJacobs, SergeyBiryukov.
Fixes #51137.

git-svn-id: https://develop.svn.wordpress.org/trunk@48880 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 02:46:22 +00:00
Sergey Biryukov
3066546426 Comments: Correct the check for reply element existence in comment-reply.js.
`document.getElementById()` returns `null` if no matching element was found, so the previous comparison didn't work as expected.

Follow-up to [47506].

Props mailnew2ster, sarahricker.
Fixes #38009.

git-svn-id: https://develop.svn.wordpress.org/trunk@48876 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 01:56:39 +00:00
Peter Wilson
bae635f1a0 Sitemaps: Prevent incorrect redirection of paged sitemap requests.
Update `redirect_canonical()` to account for custom pagination and URL format used by sitemaps in order to follow standard practices.

Introduce the function `get_sitemap_url()` to simplify getting the index and provider URLs as needed.

Props jonathanstegall, pbiron, GamerZ, salvoaranzulla, peterwilsoncc.
Fixes #50910.



git-svn-id: https://develop.svn.wordpress.org/trunk@48872 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 01:28:24 +00:00
Jonathan Desrosiers
066882a4a8 Media: Disable lazy-loading for custom logos by default.
Custom site logos are most commonly displayed above the fold, so lazy-loading is unnecessary.

Props demetris, khag7, johnbillion, rebasaurus, audrasjb.
Fixes #50933.

git-svn-id: https://develop.svn.wordpress.org/trunk@48870 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-27 01:06:01 +00:00
Sergey Biryukov
c7f5af72dc Upgrade/Install: Make the check for empty home option in __get_option() more resilient.
This addresses a regression in [47808], where the `home` check expected an empty string to use `siteurl` as a fallback, but `wpdb::get_var()` returns `null` if the option is empty.

Props fjarrett.
Fixes #51011.

git-svn-id: https://develop.svn.wordpress.org/trunk@48868 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 16:55:36 +00:00
Sergey Biryukov
2a9c68872e Quick/Bulk Edit: Revert [48134] to address the bottom "Bulk actions" dropdown not functioning properly on Posts and Users list tables.
A better solution for the original issue will be explored in a future release.

Props audrasjb, garrett-eclipse, webzunft, Krstarica, chunkysteveo, SergeyBiryukov.
Fixes #50882, #50998. See #46872.

git-svn-id: https://develop.svn.wordpress.org/trunk@48866 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 14:16:12 +00:00
Sergey Biryukov
efc5c63254 Editor: Remove some hardcoded text color values from patterns that have body text with no specific background color.
This ensures that the patterns respect the theme's default color for body text and avoids contrast issues, particularly in dark themes.

Props nrqsnchz, mapk, fullofcaffeine.
Fixes #50892.

git-svn-id: https://develop.svn.wordpress.org/trunk@48864 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 13:32:05 +00:00
Sergey Biryukov
cae856c8eb Administration: Remove non-color related styling from Modern color scheme.
Color schemes should only affect colors, to avoid diverging from a consistent and predictable layout, especially if core CSS rules subsequently change.

Follow-up to [48277], [48286], [48345].

Props Joen, johnbillion, afercia, johnjamesjacoby.
Fixes #51127. See #50504.

git-svn-id: https://develop.svn.wordpress.org/trunk@48862 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 13:17:36 +00:00
Sergey Biryukov
ad9f02ed80 Twenty Twenty: Add context to adjectives and homonyms.
This allows for better localization in languages where adjectives are translated differently depending on which noun they modify, or when a different translation is required for a noun vs. a verb.

Props dimadin, justinahinon.
Fixes #49797.

git-svn-id: https://develop.svn.wordpress.org/trunk@48861 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-26 01:33:45 +00:00
Sergey Biryukov
04d555e91d Editor: Make some hardcoded strings in block patterns translatable.
Follow-up to [48726].

Props justinahinon, audrasjb, nabilmoqbel, tobifjellner, yoavf, ramiy.
Fixes #50845.

git-svn-id: https://develop.svn.wordpress.org/trunk@48859 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-25 12:38:21 +00:00
Sergey Biryukov
25c9718a1e Bootstrap/Load: Add local environment type to wp_get_environment_type().
This gives developers a better control over their existing development workflow and ensures that `local` is not the exact same as `development` if it does not need to be.

Props claytoncollie, johnbillion, jeremyfelt, kreppar, dushakov, TimothyBlynJacobs, Ipstenu, khag7, knutsp, Clorith, markjaquith, joostdevalk, SergeyBiryukov.
Fixes #51064.

git-svn-id: https://develop.svn.wordpress.org/trunk@48856 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 22:30:36 +00:00
Sergey Biryukov
8e7e3c5b72 Docs: Improve documentation for wp_lazy_loading_enabled() per the documentation standards.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@48855 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 22:14:17 +00:00
Sergey Biryukov
4869de2a1c Docs: Add a @since note about the $srcset and $sizes attributes added to wp_get_attachment_image().
Follow-up to [34855].

See #51122.

git-svn-id: https://develop.svn.wordpress.org/trunk@48853 602fd350-edb4-49c9-b593-d223f7449a82
2020-08-24 22:10:25 +00:00