#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.
Built from https://develop.svn.wordpress.org/trunk@48947
git-svn-id: http://core.svn.wordpress.org/trunk@48709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48945
git-svn-id: http://core.svn.wordpress.org/trunk@48707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that not only the array values being compared are equal, but also that their type is the same.
These new methods replace most of the existing instances of `assertEqualSets()` and `assertEqualSetsWithIndex()`.
Going forward, stricter type checking by using `assertSameSets()` or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.
Follow-up to [48937].
See #38266.
Built from https://develop.svn.wordpress.org/trunk@48939
git-svn-id: http://core.svn.wordpress.org/trunk@48701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that not only the return values match the expected results, but also that their type is the same.
Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.
Props johnbillion, jrf, SergeyBiryukov.
See #38266.
Built from https://develop.svn.wordpress.org/trunk@48937
git-svn-id: http://core.svn.wordpress.org/trunk@48699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48923
git-svn-id: http://core.svn.wordpress.org/trunk@48685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48912
git-svn-id: http://core.svn.wordpress.org/trunk@48674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48910
git-svn-id: http://core.svn.wordpress.org/trunk@48672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48894
git-svn-id: http://core.svn.wordpress.org/trunk@48656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48890
git-svn-id: http://core.svn.wordpress.org/trunk@48652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48888
git-svn-id: http://core.svn.wordpress.org/trunk@48650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48881
git-svn-id: http://core.svn.wordpress.org/trunk@48643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48872
git-svn-id: http://core.svn.wordpress.org/trunk@48634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48862
git-svn-id: http://core.svn.wordpress.org/trunk@48624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.
Built from https://develop.svn.wordpress.org/trunk@48861
git-svn-id: http://core.svn.wordpress.org/trunk@48623 1a063a9b-81f0-0310-95a4-ce76da25c4cd