44804 Commits

Author SHA1 Message Date
David Baumwald
16b7125de0 Mail: Add wp_mail_succeeded hook to wp_mail.
Adds a new `wp_mail_succeeded` action in `wp_mail` after the mail is sent.  Also, adds a disclaimer to the hook's docblock, clarifying that the hook's firing doesn't necessarily mean the recipient received the mail, only that the mail was processed without any errors.

Props birgire, donmhico, johnbillion.
Fixes #53826.

git-svn-id: https://develop.svn.wordpress.org/trunk@52083 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 22:25:40 +00:00
Tonya Mork
64c6beb7f9 Twenty Twenty-One: Add privacy policy link to footer.
If a privacy policy is set, the page links to the footer of the site. As done in the other bundled themes, this link is added using `the_privacy_policy_link()`.

Follow-up to [49216].

Props ryelle, desrosj, kapilpaul, sabernhardt, audrasjb, justinahinon.
Fixes #53445.

git-svn-id: https://develop.svn.wordpress.org/trunk@52082 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 22:24:47 +00:00
Jonathan Desrosiers
adcc2d3ee0 Bundled Themes: Import Twenty Twenty-Two, the new default theme for WordPress 5.9.
Twenty Twenty-Two arrives during an exciting time for WordPress themes. With the advent of Full Site Editing and Global Styles, themes are changing structurally and functionally to enable far more avenues for customization than users have come to expect in the past.

To take advantage of these new abilities, Twenty Twenty-Two has been designed to be the most flexible default theme ever created for WordPress.

Props sourav926, aristath, audrasjb, bgardner, briceduclos, poena, colorful-tones, dgwyer, dimadin, gregrickaby, ellenbauer, jffng, kafleg, karmatosed, kraftbj, kjellr, littlebigthing, onemaggie, matveb, mburridge, mtoensing, nickcernis, nielslange, williampatton, pgking, ribaricplusplus, scruffian, soean, utz119, youknowriad, desrosj, richtabor.
See #54318.

git-svn-id: https://develop.svn.wordpress.org/trunk@52081 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 21:00:47 +00:00
Timothy Jacobs
aed3eae13f REST API: Expose the site icon in the REST API index.
Props spacedmonkey, palmiak.
Fixes #52321.


git-svn-id: https://develop.svn.wordpress.org/trunk@52080 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 20:36:37 +00:00
Timothy Jacobs
aae0000cef REST API: Introduce Menu management endpoints.
This commit introduces the `/wp/v2/menus`, `/wp/v2/menu-items` and `/wp/v2/menu-locations` REST API endpoints. These endpoints are fully available to users with the `edit_theme_options` capability, but can be read by any user who can edit a REST API available post type.

The `nav_menu` taxonomy and `nav_menu_item` post type now map their capabilities to the `edit_theme_options` primitive capability. This allows developers to provide more fine-grained access control. However, if a developer is currently dynamically removing the `edit_theme_options` capability using `map_meta_cap`, they should use the `user_has_cap` filter instead.

The `wp_update_nav_menu_item()` function has been adjusted to return an error if saving the menu item post or assigning the menu item to a menu generate an error.

Lastly, a new menu item type is introduced, `block`, that can be used to store a Block as a menu item.

Props andraganescu, antonvlasenko, dingo_d, dlh, isabel_brison, kadamwhite, Mamaduka, NateWr, noisysocks, peterwilsoncc, ryelle, schlessera, soean, Spacedmonkey, talldanwp, TimothyBlynJacobs, tobifjellner, westonruter, wpscholar, zieladam.
Fixes #40878.


git-svn-id: https://develop.svn.wordpress.org/trunk@52079 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 18:58:59 +00:00
Jonathan Desrosiers
de9a1e6f94 Coding Standards: Minor alignment fix after [52058].
See #52058.

git-svn-id: https://develop.svn.wordpress.org/trunk@52078 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 18:49:12 +00:00
Jonathan Desrosiers
f22abe7610 Themes: Avoid fatal error loading admin styles when SCRIPT_DEBUG is false.
This removes the use of `get_theme_file_path()` within `WP_Theme_JSON_Resolver` in favor of the similar `get_file_path_from_theme()` method.

The former is found within `wp-includes/link-template.php`, which is not currently loaded when `load-styles.php` attempts to load the necessary styles. `self::get_file_path_from_theme()` was used previously, but this was changed in [52049].

Props Mamaduka, audrasjb, hellofromTonya, jorbin, desrosj.
Fixes #54401. See #54336.

git-svn-id: https://develop.svn.wordpress.org/trunk@52077 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 18:06:35 +00:00
Sergey Biryukov
f0de932e45 Coding Standards: Revert unrelated change to wp_send_user_request().
This fixes a mix of tabs and spaces in the email template. Spaces inside a string are not considered WPCS errors, and are not required to be converted to tabs.

Follow-up to [52060], [52063].

See #43700.

git-svn-id: https://develop.svn.wordpress.org/trunk@52076 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 16:21:00 +00:00
Tonya Mork
40da0f6e0b Login and Registration: Fix failing test for "email already exists" registration error improvement.
Follow-up to [52074].

Fixes #53631.

git-svn-id: https://develop.svn.wordpress.org/trunk@52075 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 16:19:05 +00:00
Tonya Mork
4a6df3f37d Login and Registration: Improve "email already exists" registration error message.
Adds the `wp_login_url()` login link to the Error message to be more helpful to users when their user email already is registered.

Improves the error message to more clearly communicate next step.

Follow-up to [16009], [22124], [31963].

Props andynick, costdev, dansoschin, sabernhardt, webcommsat.
Fixes #53631.

git-svn-id: https://develop.svn.wordpress.org/trunk@52074 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 15:27:58 +00:00
Adam Silverstein
2e911f4f16 Media: Add "webp" extension to wp.media.controller.Library isImageAttachment.
Add "webp" extension to a media extension check, fixing an issue where the last used media
link type was not used for WebP images.

Props almendron, desrosj, kallookoo.
Fixes #53917.



git-svn-id: https://develop.svn.wordpress.org/trunk@52073 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 14:59:44 +00:00
Dominik Schilling
04cd9e2db2 Editor, Docs: Add documentation for the $block_editor_context parameter of the block_editor_rest_api_preload_paths hook.
See #52920.
See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@52072 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 12:58:08 +00:00
Riad Benguella
dd9bca79bb Site Editor: Load as full screen by default.
To avoid UI jumps when loading the page, the site-editor.php page
is marked as full screen by default. 
This also matches the behavior of the post editor.

See #54337.


git-svn-id: https://develop.svn.wordpress.org/trunk@52071 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 09:12:38 +00:00
Timothy Jacobs
cd2a9d78f2 REST API: Regenerate wp-api-generated.js after [52068].
See #53063.


git-svn-id: https://develop.svn.wordpress.org/trunk@52070 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 02:26:19 +00:00
Robert Anderson
f034bc832e Add Site Editor and PHP changes from Gutenberg 10.1 - 11.9
- First pass at adding the site editor from the Gutenberg plugin to
  wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.

Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.


git-svn-id: https://develop.svn.wordpress.org/trunk@52069 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 02:15:23 +00:00
Timothy Jacobs
ecf1d6a158 REST API: Add batch support for posts and terms controllers.
This also exposes the value of `allow_batch` in `OPTIONS` requests to a route.

A future commit will add batch support to more resources.

Props spacedmonkey, chrisvanpatten.
See #53063.


git-svn-id: https://develop.svn.wordpress.org/trunk@52068 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 01:57:48 +00:00
Tonya Mork
29615a6c70 Posts, Post Types: Add $old_status parameter to {$new_status}_{$post->post_type} action.
Follow-up to [5797], [28106], [31461].

Props aaroncampbell, audrasjb, desrosj, johnbillion, sebastianpisula, swissspidy.
Fixes #36180.

git-svn-id: https://develop.svn.wordpress.org/trunk@52067 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 01:29:58 +00:00
Tonya Mork
6f023bc765 General: Convert wp_list_filter() into a wrapper for wp_filter_object_list().
The code in `wp_list_filter()` was a duplicate of `wp_filter_object_list()`, minus the `WP_List_Util::pluck()` (used when `$field` is configured).

In testing the wrapper, discovered an edge case (and potential bug) in `WP_List_Util::filter()` where if the operator matches an empty array was returned without resetting the output property. Without that property being set correctly, `WP_List_Util::get_output()` was not correct. This commit also fixes this by resetting the property to an empty array.  

Follow-up to [15686], [17427], [38928], [51044].

Props pbearne, sergeybiryukov, hellofromTonya.
Fixes #53988.

git-svn-id: https://develop.svn.wordpress.org/trunk@52066 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 01:09:11 +00:00
Felix Arntz
8649d6d4ff Media: Refine the heuristics to exclude certain images and iframes from being lazy-loaded to improve performance.
This changeset implements the refined lazy-loading behavior outlined in https://make.wordpress.org/core/2021/07/15/refining-wordpress-cores-lazy-loading-implementation/ in order to improve the Largest Contentful Paint metric, which can see a regression from images or iframes above the fold being lazy-loaded. Adjusting this so far has been possible for developers via filters and still is, however this enhancement brings a more accurate behavior out of the box for the majority of themes.

Specifically, this changeset skips the very first "content image or iframe" on the page from being lazy-loaded. "Content image or iframe" denotes any image or iframe that is found within content of any post in the current main query loop as well as any featured image of such a post. This applies both to "singular" as well as "archive" content: On a "singular" page the first image/iframe of the post is not lazy-loaded, while on an "archive" page the first image/iframe of the _first_ post in the query is not lazy-loaded.

This approach refines the lazy-loading behavior correctly for the majority of themes, which use a single-column layout for post content. For themes with multi-column layouts, a new `wp_omit_loading_attr_threshold` filter can be used to change how many of the first images/iframes are being skipped from lazy-loaded (default is `1`). For example, a theme using a three-column grid of latest posts for archives could use the filter to override the threshold to `3` on archive pages, so that the first three content images/iframes would not be lazy-loaded.

Props adamsilverstein, azaozz, flixos90, hellofromtonya, jonoaldersonwp, mte90, rviscomi, tweetythierry, westonruter.
Fixes #53675. See #50425.


git-svn-id: https://develop.svn.wordpress.org/trunk@52065 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 00:34:17 +00:00
Tonya Mork
fab9d0685e Users: Introduce wp_list_users() function.
Introduces a new function called `wp_list_users()`. Similar to other list functions such as `wp_list_authors()`, it lists all the users of the site. Options are available to configure the HTML output.

Following the same pattern of the other list functions, the list's HTML output is rendered by default. Setting the `echo` argument to `false`, returns the list's HTML output.

A new test class is included.

Props afercia, audrasjb, chriscct7, costdev, desrosj, greenshady, hellofromTonya, mte90, nacin, rohan013, sergeybiryukov.
Fixes #15145.

git-svn-id: https://develop.svn.wordpress.org/trunk@52064 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-09 00:22:34 +00:00
Joe Dolson
9558873885 Coding Standards: PHP Code style errors.
Fixes coding standards issues.

Follow up to [52060].

See #43700.

git-svn-id: https://develop.svn.wordpress.org/trunk@52063 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 23:18:35 +00:00
Robert Anderson
39e33bed83 Editor: Add block theme infrastructure
Adds the required infrastructure to render block-based themes. This is sourced
from the Gutenberg plugin.

Fixes #54335.
Props bernhard-reiter, youknowriad, ntsekouras, hellofromtonya.


git-svn-id: https://develop.svn.wordpress.org/trunk@52062 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 23:09:53 +00:00
Tonya Mork
81b29a2865 General: Add "noopener" to wp_list_bookmarks() output.
In the bookmarks walker `_walk_bookmarks()`, add a `'noopener'` to the bookmark's `rel` attribute when there's `target` attribute.

Adds a new test class for `wp_list_bookmarks()` and tests for this change.

Follow-up to [3880], [10712].

Props birgire, costdev, hellofromTonya, mukesh27 , sergeybiryukov, tw2113.
Fixes #53839.

git-svn-id: https://develop.svn.wordpress.org/trunk@52061 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 23:05:50 +00:00
Joe Dolson
4a77621488 Coding Standards: PHP Code style errors.
Fixes coding standards issues.

Follow up to [52058].

See #43700.

git-svn-id: https://develop.svn.wordpress.org/trunk@52060 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 23:02:40 +00:00
Anthony Burchell
56ff78042c Media: Change upload button to a file input for better e2e targeting.
Changes the media library upload button to `input type="file"` for better end to end testing capabilities.

Props  justinahinon, joedolson, sabernhardt, audrasjb.
Fixes #54168.



git-svn-id: https://develop.svn.wordpress.org/trunk@52059 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 22:47:09 +00:00
Joe Dolson
99514de6bb I18N: Add language switcher on login/registration screens.
Load a language switcher on the login and registration screens that allows users to choose any already-installed language. Set user locale on registration.

Props johnbillion, Nikschavan, afercia, sabernhardt, garrett-eclipse, keyur5, paaljoachim, Clorith, tobifjellner.
Fixes #43700.

git-svn-id: https://develop.svn.wordpress.org/trunk@52058 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 22:36:11 +00:00
Jorge Costa
0f0735a888 Add: get_query_pagination_arrow function to core.
Fixes a crash that is happening when using an FSE theme because a function required is missing. Ports the function from the Gutenberg plugin.

Props oandregal, youknowriad.

git-svn-id: https://develop.svn.wordpress.org/trunk@52057 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 22:30:41 +00:00
Jorge Costa
3c482788b9 Fix: Linting error affecting trunk.
Props oandregal.

git-svn-id: https://develop.svn.wordpress.org/trunk@52056 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 21:56:17 +00:00
John James Jacoby
3e4677b94b Admin/Help: add commas to end of multi-line array items.
Follow up to r52053.

See #54357.

git-svn-id: https://develop.svn.wordpress.org/trunk@52055 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 21:53:50 +00:00
Jorge Costa
8e30713cd5 Add: Public functions for interacting with global styles & settings.
This commit ports the public functions to interact with the global styles & settings.

See #54336.
Props oandregal.

git-svn-id: https://develop.svn.wordpress.org/trunk@52054 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 21:44:12 +00:00
John James Jacoby
a2015573eb Admin/Help: add docs links to several screens.
This change intends to better guide users towards many of the useful resources available on WordPress.org.

* Appearance/Customizer - Add link to Customizer docs.
* Appearance/Editor - Improve link text & destination.
* Privacy Settings - Link to Privacy Settings docs.
* Site Health - Link to Site Health docs.

Props audrasjb, jdy68, webcommsat.

Fixes #54357.

git-svn-id: https://develop.svn.wordpress.org/trunk@52053 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 21:41:43 +00:00
Jorge Costa
872b818794 Add: Global styles user content escaping.
This commit adds global styles user content escaping. In addition, it ports the logic on the Gutenberg plugin implemented on WordPress/gutenberg#28061 to the core.
The logic tries to follow what was done for standard post content.

See #54336.
Props oandregal.

git-svn-id: https://develop.svn.wordpress.org/trunk@52052 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 21:23:34 +00:00
Jorge Costa
5ca3347268 Add: Global Styles Rest endpoints.
This commit ports the global styles rest endpoints from the Gutenberg plugin into the core.

See #54336.
Props oandregal, aristath, timothyblynjacobs, spacedmonkey, youknowriad.

git-svn-id: https://develop.svn.wordpress.org/trunk@52051 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 20:58:56 +00:00
Jorge Costa
247159da45 Fix: Update block-theme-pl_PL.mo file.
See #54336.
Props oandregal.

git-svn-id: https://develop.svn.wordpress.org/trunk@52050 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 20:32:39 +00:00
Jorge Costa
60725c46ca Update theme.json classes for WordPress 5.9.
This commit ports to core the changes to the classes that deal with theme.json code.

See #54336.
Props oandregal, spacedmonkey, noisysocks, hellofromtonya, youknowriad.

git-svn-id: https://develop.svn.wordpress.org/trunk@52049 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 19:18:39 +00:00
Sergey Biryukov
31e9247872 Tests: Remove the formatting group from wp_is_numeric_array() tests.
Similar to `wp_array_slice_assoc()` or other array-related functions, this appears to be a general-purpose function unrelated to the Formatting component.

Add missing `public` visibility keyword.

Follow-up to [52037].

See #53971.

git-svn-id: https://develop.svn.wordpress.org/trunk@52048 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 17:07:49 +00:00
Jonathan Desrosiers
7e04f4dd82 Build/Test Tools: Update/Audit NPM dependencies for bundled themes.
This updates several NPM dependencies to their latest (or latest allowed) versions for bundled themes that have a `package.json` file (Twenty Nineteen and newer).

These updates did not result in any changes to the built files in Twenty Nineteen or Twenty Twenty. Some unnecessary parenthesis have been removed from `calc()` function calls within Twenty Twenty-One.

This change also contains several updates to the `package-lock.json` files made by running `npm audit fix` within each of these themes.

See #53361.

git-svn-id: https://develop.svn.wordpress.org/trunk@52047 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 16:24:38 +00:00
Jonathan Desrosiers
81f3e49b3f Build/Test Tools: Update/Audit NPM dependencies for 5.9.
This updates several NPM dependencies to their latest (or latest allowed) versions.

- `autoprefixer` from `9.8.6` to `9.8.8`
- `chalk` from `4.1.1` to `4.1.2`
- `grunt-contrib-concat` from `1.0.1` to `2.0.0`
- `grunt-contrib-jshint` from `3.0.0` to `3.1.1`
- `grunt-contrib-qunit` from `4.0.0` to `5.1.1`
- `qunit` from `2.16.0` to `2.17.2`
- `sass` from `1.34.1` to `1.43.4`
- `sinon` from `11.1.1` to `12.0.1`
- `sinon-test` from `3.1.0` to `3.1.1`
- `uglify-js` from `3.13.9` to `3.14.3`
- `wait-on` from `5.3.0` to `6.0.0`

This change also contains several updates to the `package-lock.json` file made by running `npm audit fix`.

See #53361.

git-svn-id: https://develop.svn.wordpress.org/trunk@52046 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 16:13:32 +00:00
Tonya Mork
588f155406 Posts/Post Types: Improves the 'is_post_type_viewable' filter boolean return.
As a follow-up to [52024], simplifies the strict boolean type check to conserve memory and processing. Also includes an explanation of why a strict boolean is required as the returned filtered value. This commit is consistent with the implementation in [52043].

Follow-up to [33666], [36402], [52024].

Props hellofromTonya, peterwilsoncc, cybr, jrf.
Fixes #49628.


git-svn-id: https://develop.svn.wordpress.org/trunk@52045 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 15:33:10 +00:00
Jonathan Desrosiers
874c62cde2 Themes: Remove temporary Full Site Editing safety checks.
These checks were added in [51193] and [51197] as a temporary measure to prevent a site owner from activating a Full Site Editing theme when Gutenberg plugin was not active.

Because Core only had partial support for the features required for FSE, the front end of the site would display a white screen or error message to visitors. Unless the site owner visited the front end, there would be no indication that there was a problem.

Since 5.9 will include the remaining features required for FSE, these checks can be removed.

Props poena, jffng.
Fixes #54366. See #534190.

git-svn-id: https://develop.svn.wordpress.org/trunk@52044 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 15:26:32 +00:00
Tonya Mork
18004914f3 Posts/Post Types: Introduce 'is_post_status_viewable ' filter in is_post_status_viewable().
Introduces a new filter 'is_post_status_viewable' which allows overriding the check.

The function's return signature is a boolean type. This commit ensures
the return signature remains unchanged by requirinng a strict boolean
type of the returned filtered value.

Why?
* To maintain this signature and backwards-compatibility.
* To future prepare for PHP 8.1 and beyond.

An explanation is included in the filter's DocBlock.

Follow-up to [50130].

Props audrasjb, hellofromTonya, peterwilsoncc.
Fixes #54375.

git-svn-id: https://develop.svn.wordpress.org/trunk@52043 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 15:20:51 +00:00
Riad Benguella
fdb2dacc19 Block Editor: Update the WordPress Packages based on Gutenberg 11.9 RC1.
This brings the JS packages up to date and is the first step that will allow us 
to include the other block editor updates for WordPress 5.9:
FSE infrastrucutre, site editor and global styles.

Props noisysocks.
See #54337.


git-svn-id: https://develop.svn.wordpress.org/trunk@52042 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 14:26:27 +00:00
jorgefilipecosta
7bbee20833 Add: wp_global_styles custom post type.
This commit adds the wp_global_styles custom post type following the same approach used to add other core custom post types. It also updates the wp_theme taxonomy to include the wp_global_styles post type.
The post type is registered in the same way it is on the plugin we just adapt the location for the core.

See #54336.
Props oandregal.

git-svn-id: https://develop.svn.wordpress.org/trunk@52041 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 14:24:02 +00:00
Tonya Mork
1046682e4f General: Introduce polyfills for str_ends_with() and str_starts_with() added in PHP 8.0.
PHP 8.0 introduced two new functions: `str_ends_with()` and `str_starts_with()`. These perform a case-sensitive check indicating if the string to search in (haystack) ends or begins with the given substring (needle).

These polyfills make these functios available for use in Core.

Ref:
* PHP RFC https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions
* PHP manual `str_ends_with()` https://www.php.net/manual/en/function.str-ends-with.php
* PHP manual `str_starts_with()`  https://www.php.net/manual/en/function.str-starts-with.php

Props costdev, hellofromTonya, pbearne, pbiron.
Fixes #54377.

git-svn-id: https://develop.svn.wordpress.org/trunk@52040 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 14:21:44 +00:00
Tonya Mork
3cc8f1237a General: Introduce polyfill for str_contains() added in PHP 8.0.
PHP 8.0 introduced a new function: `str_contains()`. It performs a case-sensitive check indicating if given substring (needle) is contained in the string to search in (haystack).

This polyfill makes this function available for use in Core.

Ref:
* PHP RFC https://wiki.php.net/rfc/str_contains
* PHP manual https://www.php.net/manual/en/function.str-contains.php

Props ayeshrajans, costdev, desrosj, hellofromTonya, knutsp, pbearne.
Fixes #49652.

git-svn-id: https://develop.svn.wordpress.org/trunk@52039 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 14:02:54 +00:00
Tonya Mork
b21d748b41 General: Introduce polyfills for array_key_first() and array_key_last() added in PHP 7.3.0.
PHP 7.3.0 introduced two new functions: `array_key_first()` and `array_key_last()`. These two functions return the first and last key of each array respectively, without affecting the internal state of the array.

The polyfills make these two functions available for use in Core on PHP versions less than 7.3.0.

Ref:
* PHP RFC https://wiki.php.net/rfc/array_key_first_last
* PHP manual `array_key_first()` https://www.php.net/manual/en/function.array-key-first.php
* PHP manual `array_key_last()` https://www.php.net/manual/en/function.array-key-last.php

Props desrosj, pbearne, costdev, hellofromTonya, ayeshrajans, manzoorwanijk, audrasjb, sergeybiryukov.
Fixes #45055.

git-svn-id: https://develop.svn.wordpress.org/trunk@52038 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 13:50:35 +00:00
Tonya Mork
2648a5f984 General: Add phpunit tests for wp_is_numeric_array().
Adds new test class `Tests_Functions_WpIsNumericArray` for `wp_is_numeric_array()`.

Props pbearne, hareesh-pillai, hellofromTonya.
Fixes #53971.

git-svn-id: https://develop.svn.wordpress.org/trunk@52037 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 13:29:25 +00:00
Greg Ziółkowski
105584a5f7 Fix relative URLs in inlined block styles that involve external assets
When styles got inlined, relative URLs break. The problem was that URLs inside CSS files are relative to the stylesheet's path, and when styles get inlined that relation is lost. This patch fixes the issue by finding relative URLs which then get modified to be relative to the site's root.

Fixes #54243.
Props aristath, cdyerkes, hellofromtonya.



git-svn-id: https://develop.svn.wordpress.org/trunk@52036 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 13:23:44 +00:00
John Blackbourn
d088e31c73 Docs: Various docblock improvements and corrections.
See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@52035 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 10:47:55 +00:00
John Blackbourn
a247caa0af Docs: Fix some docblock syntax errors and add a missing canonical reference.
See #53399, #52867, #38942, #53668


git-svn-id: https://develop.svn.wordpress.org/trunk@52034 602fd350-edb4-49c9-b593-d223f7449a82
2021-11-08 10:43:52 +00:00