Commit Graph

42580 Commits

Author SHA1 Message Date
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 0488373778 Tests: Fix a linting error in a test.
See #50679.


git-svn-id: https://develop.svn.wordpress.org/trunk@49085 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-01 21:42:40 +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 19513ff6a0 Build/Test Tools: Remove PHP 8 from allowed failures.
With all known unit test issues now addressed, WordPress 5.6 aims to support PHP 8 as much as possible.

See #50913, #50902.

git-svn-id: https://develop.svn.wordpress.org/trunk@49077 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 16:03:03 +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 8ae4a7614c Build/Test Tools: Comment out the `xdebug` group test run for PHP 8 for now.
Xdebug supports PHP 8 only from version 3.0, which is not released yet.

Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again.

Follow-up to [48957], [49037].

See #50913, #50902.

git-svn-id: https://develop.svn.wordpress.org/trunk@49074 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 13:12:03 +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 3b75e7d0f0 Tests: Require `imagejpeg()` function in Ajax media editing tests.
This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.

These tests rely on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025], [49045], [49050], [49052].

See #50639, #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49069 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-29 14:14:28 +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 9aa0e0c92b Tests: Require `imagejpeg()` function in `WP_Widget_Media_Image::render_media()` test.
This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.

This test relies on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025], [49045], [49050].

See #50639, #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49052 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 14:50:51 +00:00
Sergey Biryukov e2b74bee82 Tests: Correct assertion in `WP_Test_REST_Comments_Controller::check_comment_data()`.
`author_avatar_urls` should be present in the comment data array keys, not values.

The test only passed accidentally due to `assertContains()` not performing a strict type check.

See #38266, #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49051 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 03:12:21 +00:00
Sergey Biryukov 21eb2f0d98 Tests: Require `imagejpeg()` function in one more media test.
This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.

This test relies on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025], [49045].

See #50639, #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49050 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-26 02:32:25 +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 5d1a29deaa Tests: Require `imagejpeg()` function in some REST API attachments controller tests.
This outputs a proper message if the requirement is not met, instead of an obscure failure further in the test.

These tests rely on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025], [49045].

See #50639, #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49047 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 02:21:33 +00:00
Sergey Biryukov 51a7210589 Tests: Correct the check for image sizes in some REST API attachments controller tests.
If the sizes data could not be retrieved, the controller returns an empty object instead of an array.

This makes sure that the value is in fact an array before proceeding, and outputs a proper message in case of failure, instead of an obscure PHP error further in the test.

Follow-up to [49044].

See #50913, #51393.

git-svn-id: https://develop.svn.wordpress.org/trunk@49046 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 02:09:32 +00:00
Sergey Biryukov 5730b983b8 Tests: Require `imagejpeg()` function in some more media tests.
This outputs a proper message if the requirement is not met, instead of an obscure PHP error further in the test.

These tests rely on multiple resized copies of a test JPEG image being generated and available.

Follow-up to [49010], [49024], [49025].

See #50639, #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49045 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 01:43:19 +00:00
Sergey Biryukov 3bfa4606c7 Tests: Check if image sizes were successfully retrieved in some REST API attachments controller tests.
This outputs a proper message in case of failure, instead of an obscure PHP error further in the test.

Props TimothyBlynJacobs.
See #50913, #51393.

git-svn-id: https://develop.svn.wordpress.org/trunk@49044 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-25 01:29:51 +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