Commit Graph

20897 Commits

Author SHA1 Message Date
Felix Arntz
9c56cf2cf7 Emoji: Fix emoji feature detection.
The emoji feature detection that occurs on every page load by default has been broken at least since [45769], causing the feature detection to fail for browsers that in fact support emoji correctly. This has led to the `wp-emoji-release.min.js` file being loaded unnecessarily even in modern browsers, which accounts for roughly 4.7 KB of extra JavaScript on every page load.

This changeset fixes the feature detection, by using the correct sequences of char codes.

Props sergiomdgomes, dmsnell, peterwilsoncc.
Fixes #57301.

Built from https://develop.svn.wordpress.org/trunk@55241


git-svn-id: http://core.svn.wordpress.org/trunk@54774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 21:38:15 +00:00
audrasjb
a816a24b9c Coding Standards: Add missing escaping function in Custom_Image_Header::show_header_selector().
Props chintan1896, SergeyBiryukov.
Fixes #57638.

Built from https://develop.svn.wordpress.org/trunk@55240


git-svn-id: http://core.svn.wordpress.org/trunk@54773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 21:36:17 +00:00
audrasjb
b27543461d Users: Update get_avatar_url() and get_avatar() to include RoboHash support.
Follow-up to [55238].

Fixes #57493.

Built from https://develop.svn.wordpress.org/trunk@55239


git-svn-id: http://core.svn.wordpress.org/trunk@54772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 21:30:18 +00:00
audrasjb
cc6bdd0929 Users: Add support for RoboHash Gravatar images in default user profile pics.
Gravatar includes support for RoboHash auto-generated images. This changeset adds it to the built-in feature for user profile images.

See Gravatar docs: https://en.gravatar.com/site/implement/images/.

Props juliobox, audrasjb.
Fixes #57493.

Built from https://develop.svn.wordpress.org/trunk@55238


git-svn-id: http://core.svn.wordpress.org/trunk@54771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 21:19:17 +00:00
audrasjb
e5b74056b6 External Libraries: Update jQuery Migrate to version 3.4.0.
A full list of changes in this release can be found upstream on the jQuery Migrate GitHub repository:
https://github.com/jquery/jquery-migrate/compare/3.3.2...3.4.0.

Props desrosj, audrasjb, a4jpcom, stalukder03, mukesh27, adeltahri, robinwpdeveloper, mahbubshovan.
Fixes #56743.

Built from https://develop.svn.wordpress.org/trunk@55237


git-svn-id: http://core.svn.wordpress.org/trunk@54770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 20:59:15 +00:00
Felix Arntz
8a805daa9a Themes: Add caching to WP_Theme::is_block_theme().
This changeset adds a `block_theme` entry in the theme cache data, similar to the existing entries `headers`, `errors`, `stylesheet`, and `template`.

Props spacedmonkey, costdev, joemcgill, flixos90, mukesh27, adamsilverstein.
Fixes #57114.

Built from https://develop.svn.wordpress.org/trunk@55236


git-svn-id: http://core.svn.wordpress.org/trunk@54769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 19:59:17 +00:00
Felix Arntz
ee7b88a862 Editor: Use WP_HTML_Tag_Processor in wp_render_elements_support().
Props ntsekouras.
Fixes #57642.

Built from https://develop.svn.wordpress.org/trunk@55235


git-svn-id: http://core.svn.wordpress.org/trunk@54768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 19:43:16 +00:00
Felix Arntz
53c7f7a8a7 Editor: Support the block_types and viewport_width props for remote patterns fetched from Pattern Directory.
Props ntsekouras, ironprogrammer, hellofromtonya, flixos90.
Fixes #57611.

Built from https://develop.svn.wordpress.org/trunk@55234


git-svn-id: http://core.svn.wordpress.org/trunk@54767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 19:40:16 +00:00
desrosj
1593f0615a Build/Test Tools: Update npm dependencies for bundled themes.
This applies several dependency version updates to Twenty Nineteen, Twenty Twenty, and Twenty Twenty-One.

`npm audit fix` has also been run to automatically fix any packages with reported vulnerabilities.

See #57535.
Built from https://develop.svn.wordpress.org/trunk@55233


git-svn-id: http://core.svn.wordpress.org/trunk@54766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 18:55:16 +00:00
desrosj
c1e29c4da6 Build/Test Tools: Update json2php package.
This updates the `json2php` package to the latest version, which is currently `0.0.7`.

See #57535.
Built from https://develop.svn.wordpress.org/trunk@55232


git-svn-id: http://core.svn.wordpress.org/trunk@54765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 18:44:30 +00:00
jorgefilipecosta
1bfd84f99a Block editor: Update WP_Theme_JSON_Resolver and improve its performance.
This commit includes the latest updates WP_Theme_JSON_Resolver class made in the block editor. Some of these updates improve the performance of the class.

Props Mamaduka, hellofromTonya, flixos90, jorgefilipecosta, oandregal, spacedmonkey, audrasjb, costdev, scruffian.
Closes #57545.
Built from https://develop.svn.wordpress.org/trunk@55231


git-svn-id: http://core.svn.wordpress.org/trunk@54764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 15:33:19 +00:00
jorgefilipecosta
f6cb5218c1 Block editor: Add ID support to block wrapper attributes.
This commit adds support for the ID attribute for dynamically rendered blocks.

Props Soean, flixos90, poena, costdev, Mamaduka.
Closes #56852.
Built from https://develop.svn.wordpress.org/trunk@55230


git-svn-id: http://core.svn.wordpress.org/trunk@54763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 15:24:16 +00:00
Sergey Biryukov
ba4ed5f86c Upgrade/Install: Send language pack updates to copy_dir().
If the `clear_working` flag in `WP_Upgrader::install_package()` is false, the source should not be removed, so `copy_dir()` should be used instead.

Partial updates, like language packs, may want to retain the destination. If the destination exists or has contents, this may be a partial update, and the destination should not be removed, so `copy_dir()` should be used instead.

Follow-up to [55204], [55219], [55220], [55223], [55226].

Props afragen, costdev, swissspidy.
See #57557.
Built from https://develop.svn.wordpress.org/trunk@55229


git-svn-id: http://core.svn.wordpress.org/trunk@54762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 14:48:16 +00:00
audrasjb
5c1f181c0a Twenty Fourteen: Correctly reflect text color changes in Pullquote block.
This changeset ensures text color changes on Pullquote block are reflected on both front-end and in the editor.

Props umesh84, audrasjb, sabernhardt, bgoewert, ruchirj, amitbarai013, robinwpdeveloper, shamayel007.
Fixes #56006.

Built from https://develop.svn.wordpress.org/trunk@55228


git-svn-id: http://core.svn.wordpress.org/trunk@54761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 08:59:17 +00:00
audrasjb
b15e530828 Twenty Sixteen: Fix Gallery block images alignement.
This changeset fixes an alignment issue that has been present since the gallery block markup was changed in WordPress 6.0.

Props silicium23, zoonini, sabernhardt, bgoewert, ira2910, tahminar27.
Fixes #56412.

Built from https://develop.svn.wordpress.org/trunk@55227


git-svn-id: http://core.svn.wordpress.org/trunk@54760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 08:26:21 +00:00
Peter Wilson
be3d8fdcc3 Filesystem API: Prevent fatal error in move_dir().
Correctly instantiate `WP_Error()` within `move_dir()` to prevent a fatal error when unable to delete an existing directory that is intended to be replaced.

Follow-up to [55204], [55219], [55220], [55223].

Props swissspidy, costdev, afragen.
Fixes #57375.


Built from https://develop.svn.wordpress.org/trunk@55226


git-svn-id: http://core.svn.wordpress.org/trunk@54759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 04:21:20 +00:00
Sergey Biryukov
cd0d67c8b2 Upgrade/Install: Silence Requests deprecations before preloading.
Intentional preloading of Requests 2.x classes and interfaces using their old (Requests 1.x) names should not produce deprecation notices.

This commit defines `REQUESTS_SILENCE_PSR0_DEPRECATIONS` as `true` in `_preload_old_requests_classes_and_interfaces()`.

Follow-up to [54997], [55007], [55046].

Props costdev, afragen, jrf.
Fixes #54504.
Built from https://develop.svn.wordpress.org/trunk@55225


git-svn-id: http://core.svn.wordpress.org/trunk@54758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-05 00:20:15 +00:00
Pascal Birchler
981111ee90 I18N: Improve method names in WP_Locale_Switcher().
This is a follow-up to [55161] to rename `::get_current_locale()` to `::get_switched_locale()` and `::get_current_user_id()` to `::get_switched_user_id()` for improved clarity.

Also:

* Fix docblock for `switch_locale` filter. The User ID is `false` if missing, not `null`.
* Add additional test involving `restore_previous_locale()` and improve test cleanup.

And most importantly: happy birthday ocean90! 🎂

Props johnjamesjacoby, ocean90.
See #57123.
Built from https://develop.svn.wordpress.org/trunk@55224


git-svn-id: http://core.svn.wordpress.org/trunk@54757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 20:47:18 +00:00
Sergey Biryukov
4b790e3483 Filesystem API: Simplify two conditionals in move_dir().
This updates the check whether the destination directory already exists to only call `$wp_filesystem->exists()` once.

Follow-up to [55204], [55219], [55220].

Props azaozz, afragen, SergeyBiryukov.
Fixes #57375.
Built from https://develop.svn.wordpress.org/trunk@55223


git-svn-id: http://core.svn.wordpress.org/trunk@54756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 15:37:16 +00:00
Sergey Biryukov
cb4b7b6a8b Docs: Use consistent format for the @return tags in _wp_object_name_sort_cb() and _wp_object_count_sort_cb().
Both functions are used as a callback for `uasort()`.

Follow-up to [36013], [55214].

See #57358, #56792.
Built from https://develop.svn.wordpress.org/trunk@55222


git-svn-id: http://core.svn.wordpress.org/trunk@54755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 15:18:16 +00:00
audrasjb
ba5324e2bd Media: Properly escape Download row action link in Media List Table.
Props joedolson, pbiron, audrasjb.
Fixes #57574.

Built from https://develop.svn.wordpress.org/trunk@55221


git-svn-id: http://core.svn.wordpress.org/trunk@54754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 07:10:18 +00:00
Andrew Ozz
552a0c71a8 Upgrade/Install: Use move_dir() instead of copy_dir() in WP_Upgrader::install_package() when possible. This would make the filesystem operations a lot faster in most cases, and potentially reduce failures.
Props: afragen, costdev, peterwilsoncc, pbiron, mukesh27, SergeyBiryukov, azaozz.
Fixes: #57557.
Built from https://develop.svn.wordpress.org/trunk@55220


git-svn-id: http://core.svn.wordpress.org/trunk@54753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 03:31:16 +00:00
Andrew Ozz
8cf4b7557f Filesystem API: Update move_dir() to better handle the differences in the WP_Filesystem::move() methods.
Changes `move_dir()` to attempt to delete the destination when overwriting, before calling `WP_Filesystem::move()`.

Props: afragen, costdev, azaozz.
Fixes: #57375.
Built from https://develop.svn.wordpress.org/trunk@55219


git-svn-id: http://core.svn.wordpress.org/trunk@54752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 01:08:17 +00:00
joedolson
e7a506c636 Media: Hide 'view' link if empty string passed to attachment_link.
Fix empty href attribute on 'View' link when the `attachment_link` filter is used to hide attachment pages.

Props oh_hello, iqbalrony.
Fixes #54824.
Built from https://develop.svn.wordpress.org/trunk@55218


git-svn-id: http://core.svn.wordpress.org/trunk@54751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 22:25:16 +00:00
joedolson
4efd5d5623 Media: Pass $size argument to get_attached_file filter.
Pass the new `$size` argument on `get_attached_file()` to `get_attached_file` filter. Follow up to [55199].
 
Props SergeyBiryukov, joedolson.
Fixes #51780.
Built from https://develop.svn.wordpress.org/trunk@55217


git-svn-id: http://core.svn.wordpress.org/trunk@54750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 19:25:21 +00:00
Felix Arntz
1856b98771 Editor: Add missing WP_Theme_JSON::process_blocks_custom_css() method.
Follow up to [55192].

Props aristath, mamaduka, mukesh27, hellofromtonya.
Fixes #57621.

Built from https://develop.svn.wordpress.org/trunk@55216


git-svn-id: http://core.svn.wordpress.org/trunk@54749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 18:25:22 +00:00
spacedmonkey
203ba0cc28 Query: Revert [55169].
Revert [55169] and mark #56689 as wontfix. `get_page_by_path` can not use `WP_Query`, as is results in fatel errors for those using `get_page_by_path` in the `pre_get_posts` action or `posts_pre_query` filter. This sadly means that `WP_Query` can never be used in `get_page_by_path`.

Props spacedmonkey, iandunn, mukesh27, joemcgill, adamsilverstein, otto42. 
See #56689.
Built from https://develop.svn.wordpress.org/trunk@55215


git-svn-id: http://core.svn.wordpress.org/trunk@54748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 16:17:21 +00:00
audrasjb
e3e4d51e11 Fix a PHP 8 deprecation warning in category-template.php uasort() helper.
Props Webrocker, jigar-bhanushali, jrf, audrasjb, costdev.
Fixes #57358.
See #56790.

Built from https://develop.svn.wordpress.org/trunk@55214


git-svn-id: http://core.svn.wordpress.org/trunk@54747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 15:44:19 +00:00
Sergey Biryukov
eff6618cbb Docs: Capitalize X-Pingback in discover_pingback_server_uri() DocBlock.
Follow-up to [55210], [55211], [55212].

See #54225.
Built from https://develop.svn.wordpress.org/trunk@55213


git-svn-id: http://core.svn.wordpress.org/trunk@54746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 14:47:18 +00:00
Sergey Biryukov
e235883c4d HTTP API: Restore one instance of the X-Pingback header capitalization.
The revert in the previous commit appears to be accidental.

Follow-up to [55210], [55211].

See #54225.
Built from https://develop.svn.wordpress.org/trunk@55212


git-svn-id: http://core.svn.wordpress.org/trunk@54745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 14:41:26 +00:00
audrasjb
897eefe2e3 HTTP API: Fix a unit test failure found after [55210].
Follow-up to [55210].

See #54225.

Built from https://develop.svn.wordpress.org/trunk@55211


git-svn-id: http://core.svn.wordpress.org/trunk@54744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 13:53:18 +00:00
audrasjb
28358ab213 HTTP API: Fix request header inconsistencies.
This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes #54225.

Built from https://develop.svn.wordpress.org/trunk@55210


git-svn-id: http://core.svn.wordpress.org/trunk@54743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 13:35:20 +00:00
audrasjb
965fe8f209 Media: Replace consecutive periods in sanitize_file_name().
On some servers, consecutive periods in a filename can cause a 403 Forbidden response.
This changeset replaces consecutive periods with a single period, and adds related unit tests.

Props ArtZ91, costdev, SergeyBiryukov, arthurshlain, mukesh27.
Fixes #57242.

Built from https://develop.svn.wordpress.org/trunk@55209


git-svn-id: http://core.svn.wordpress.org/trunk@54742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 12:48:23 +00:00
Peter Wilson
39aa80cb87 Posts, Post Types: Add test coverage for _truncate_post_slug().
Props xknown, mukesh27, costdev, audrasjb.
Fixes #56868.
See #56793.

Built from https://develop.svn.wordpress.org/trunk@55208


git-svn-id: http://core.svn.wordpress.org/trunk@54741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 04:04:15 +00:00
Peter Wilson
592be344b4 Posts, Post Types: Deprecate get_page_by_title() in favour of WP_Query.
Formally deprecate `get_page_by_title()`. In its current form the function is unpredictable in that it may return a result that leads to a 404 error and will return different results depending on the database version/engine combination used.

It is recommended developers use `WP_Query` instead:

{{{
$query = new WP_Query(
 array(
  'post_type' => 'page',
  'title'     => 'Sample Page',
 )
);
}}}


Props TimothyBlynJacobs, costdev, mukesh27, spacedmonkey, peterwilsoncc.
Fixes #57041.

Built from https://develop.svn.wordpress.org/trunk@55207


git-svn-id: http://core.svn.wordpress.org/trunk@54740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 03:58:16 +00:00
Andrew Ozz
7bc792bb73 Fix couple of typos in inline docs.
Props: ironprogrammer.
See #57575.
Built from https://develop.svn.wordpress.org/trunk@55206


git-svn-id: http://core.svn.wordpress.org/trunk@54739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 02:14:19 +00:00
Andrew Ozz
d5f8d02445 Docs: Document directory support in FTP/SSH2 filesystem ::move() methods.
Props: costdev, flixos90, audrasjb.
Fixes: #57604.
Built from https://develop.svn.wordpress.org/trunk@55205


git-svn-id: http://core.svn.wordpress.org/trunk@54738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 01:59:15 +00:00
Andrew Ozz
47172a2c65 Filesystem API: Add directory support to WP_Filesystem_Direct::move().
Introduces:
- New function: `wp_opcache_invalidate_directory()`, to recursively call `wp_opcache_invalidate()` after overwriting .php files.
- New function: `move_dir()`, similar to `copy_dir()` that uses `WP_Filesystem::move()` followed by `wp_opcache_invalidate_directory()`, and has a fallback to `copy_dir()`.

Props: costdev, afragen, peterwilsoncc, sergeybiryukov, ironprogrammer, flixos90, bronsonquick, mukesh27, azaozz.
Fixes #57375.
Built from https://develop.svn.wordpress.org/trunk@55204


git-svn-id: http://core.svn.wordpress.org/trunk@54737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 01:50:16 +00:00
Andrew Ozz
be73904dc7 Introduce HTML API with HTML Tag Processor
This commit pulls in the HTML Tag Processor from the Gutenbeg repository.

The Tag Processor attempts to be an HTML5-spec-compliant parser that provides the ability in PHP to find specific HTML tags and then add, remove, or update attributes on that tag. It provides a safe and reliable way to modify the attribute on HTML tags.

More information: https://github.com/WordPress/wordpress-develop/pull/3920.

Props: antonvlasenko, bernhard-reiter, costdev, dmsnell, felixarntz, gziolo, hellofromtonya, zieladam, flixos90, ntsekouras, peterwilsoncc, swissspidy, andrewserong, onemaggie, get_dave, aristath, scruffian, justlevine, andraganescu, noisysocks, dlh, soean, cbirdsong, revgeorge, azaozz.
Fixes #57575.
Built from https://develop.svn.wordpress.org/trunk@55203


git-svn-id: http://core.svn.wordpress.org/trunk@54736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 01:05:17 +00:00
Sergey Biryukov
94ede5b18c Docs: Improve the DocBlock for get_attached_file().
Includes:
* Using 3-digit format for the `@since` tag.
* Minor wording updates and formatting corrections.

Follow-up to [3203], [4612], [6379], [8203], [24983], [29090], [55199].

See #51780, #56792.
Built from https://develop.svn.wordpress.org/trunk@55202


git-svn-id: http://core.svn.wordpress.org/trunk@54735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 00:47:19 +00:00
hellofromTonya
a35991eb44 Editor: Add missing controls to flex layouts in wp_get_layout_style().
Adds missing controls to flex layouts in `wp_get_layout_style()` for justify-content and vertical alignment options.

References:
* [https://github.com/WordPress/gutenberg/pull/47134 Gutenberg PR 47134].

Follow-up to [54274].

Props isabel_brison, andrewserong, jameskoster, joen, onemaggie , ndiego.
Fixes #57602.
Built from https://develop.svn.wordpress.org/trunk@55201


git-svn-id: http://core.svn.wordpress.org/trunk@54734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 00:36:17 +00:00
hellofromTonya
fbfd2b4372 Widgets: Preserve classic sidebars when switching to a block theme.
When switching to a block theme, classic sidebars were orphaned and their widgets remapping to the `'wp_inactive_widgets'` sidebar . This changeset preserves the sidebars and their widgets, providing a migration path to a block theme without losing the widgets.

Classic sidebars are now:

* Stored in a new theme mod called `'wp_classic_sidebars'`;
* Restored to the `$wp_registered_sidebars` global variable when the `'widgets_init'` action fires (via a new internal function called `_wp_block_theme_register_classic_sidebars()`);
* And marked as `'inactive'` when interacting with sidebars REST API endpoint.

References:
* [https://github.com/WordPress/gutenberg/pull/45509 Gutenberg PR 45509] which adds an option for importing widgets from sidebars into template parts.

Follow-up to [50995], [6334].

Props mamaduka, audrasjb, hellofromTonya, ironprogrammer, jameskoster, joen, matveb, mukesh27, noisysocks, poena, youknowriad.
Fixes #57531.
Built from https://develop.svn.wordpress.org/trunk@55200


git-svn-id: http://core.svn.wordpress.org/trunk@54733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 00:15:21 +00:00
joedolson
848a832fa0 Media: Add argument to get_attached_file() for subsizes.
Add a `$size` argument to `get_attached_file()` to simplify getting the path to an intermediate image size.
 
Props paulschreiber, audrasjb, Mista-Flo.
Fixes #51780.
Built from https://develop.svn.wordpress.org/trunk@55199


git-svn-id: http://core.svn.wordpress.org/trunk@54732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 23:40:16 +00:00
audrasjb
93234049f2 Media: Add a Download row action to the Media List Table.
This changeset makes it easier for users to download their uploaded media by providing a Download row action to the Media List Table. It also rephrases the Copy URL row action for better consistency and to give room for the new Download action.

Follow-up to [55156].

Props pbiron, joedolson, kebbet, Mista-Flo, costdev, amin7, mukesh27.
Fixes #57574.

Built from https://develop.svn.wordpress.org/trunk@55198


git-svn-id: http://core.svn.wordpress.org/trunk@54731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 22:48:16 +00:00
audrasjb
0874553f76 Plugins: Rephrase Add Plugins screen description for better clarity.
This changeset rephrases the Add Plugins screen description to clarify the purpose of the two available options for installing plugins.

Props tahmidulkarim, audrasjb, costdev, ryokuhi, krupalpanchal, SergeyBiryukov.
Fixes #57155.

Built from https://develop.svn.wordpress.org/trunk@55197


git-svn-id: http://core.svn.wordpress.org/trunk@54730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 21:50:16 +00:00
audrasjb
09d26de216 I18N: Pass $locale parameter to override_load_textdomain filter.
In [53874] the `$locale` parameter was added to `load_textdomain()` so it can be used to properly fill `WP_Textdomain_Registry`. Since `$locale` may not be the same value as `determine_locale()` returns (e.g. when filtered by `plugin_locale` in `load_plugin_textdomain()`) this changeset also passes the `$locale` parameter to the filter so custom file loading implementations are using the same locale as `load_textdomain()` got.

Follow-up to [53874].

Props ocean90, cadic, SergeyBiryukov, swissspidy, costdev.
Fixes #57056.

Built from https://develop.svn.wordpress.org/trunk@55196


git-svn-id: http://core.svn.wordpress.org/trunk@54729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 21:31:18 +00:00
audrasjb
bc802e7b51 Help/About: Update help tab texts to consistently describe button labels.
This changeset ensures help tab texts consistently refer to the related button labels.

Props kebbet, costdev.
Fixes #57608.

Built from https://develop.svn.wordpress.org/trunk@55195


git-svn-id: http://core.svn.wordpress.org/trunk@54728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 20:24:20 +00:00
jorgefilipecosta
cae1a31e55 Editor: Remove need for template prefix in get_template_hierarchy.
This commit removes the need to pass a template prefix in get_template_hierarchy.
This is required because, in some block editor usages, the template prefix is not known.

Props youknowriad, davidbaumwald, jorgefilipecosta.
Fixes #57614.
Built from https://develop.svn.wordpress.org/trunk@55194


git-svn-id: http://core.svn.wordpress.org/trunk@54727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 19:38:19 +00:00
Felix Arntz
043e2016a3 Editor: Remove unnecessary CSS comments from compiled styles.
Props aristath, adamsilverstein, SergeyBiryukov, gziolo.
Fixes #56388.

Built from https://develop.svn.wordpress.org/trunk@55193


git-svn-id: http://core.svn.wordpress.org/trunk@54726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 18:59:20 +00:00
Felix Arntz
5b4af6125a Editor: Add support for custom CSS in global styles.
This changeset introduces functions `wp_get_global_styles_custom_css()` and `wp_enqueue_global_styles_custom_css()`, which allow accessing and enqueuing custom CSS added via global styles.

Custom CSS via global styles is handled separately from custom CSS via the Customizer. If a site uses both features, the custom CSS from both sources will be loaded. The global styles custom CSS is then loaded after the Customizer custom CSS, so if there are any conflicts between the rules, the global styles take precedence.

Similarly to e.g. [55185], the result is cached in a non-persistent cache, except when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

Props glendaviesnz, oandregal, ntsekouras, mamaduka, davidbaumwald, hellofromtonya, flixos90.
Fixes #57536.

Built from https://develop.svn.wordpress.org/trunk@55192


git-svn-id: http://core.svn.wordpress.org/trunk@54725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 18:52:17 +00:00
desrosj
ae378d5095 Build/Test Tools: Update npm dependencies.
This updates the following npm dependencies to their latest versions:

- `chalk` from `5.1.0` to `5.2.0`.
- `dotenv-expand` from `9.0.0` to `10.0.0`.
- `grunt-contrib-qunit` from `6.2.0` to `6.2.1`.
- `prettier` from `2.0.5` to `2.6.2`.
- `qunit` from `2.19.1` to `2.19.4`.
- `sass` from `1.55.0` to `1.58.0`.
- `sinon` from `14.0.1` to `15.0.1`.
- `sinon-test` from `3.1.4` to `3.1.5`.
- `source-map-loader` from `4.0.0` to `4.0.1`.
- `uglify-js` from `3.17.3` to `3.17.4`.
- `wait-on` from `6.0.1` to `7.0.1`.
- `webpack` from `5.74.0` to `5.75.0`.

Additionally, `npm audit fix` has been run to further update packages that may contain vulnerabilities.

Props naeemhaque, mukesh27, desrosj.
See #57535.
Built from https://develop.svn.wordpress.org/trunk@55191


git-svn-id: http://core.svn.wordpress.org/trunk@54724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 16:36:32 +00:00
Sergey Biryukov
12aba159d9 Coding Standards: Rename the $cat_ID variable to $cat_id in wp_update_category().
This resolves a few WPCS warnings:
{{{
Variable "$cat_ID" is not in valid snake_case format, try "$cat_i_d"
}}}

Follow-up to [2695], [4490], [52958].

Props hilayt24, viralsampat, desrosj, robinwpdeveloper, tanazmasaba, costdev, SergeyBiryukov.
See #56754.
Built from https://develop.svn.wordpress.org/trunk@55190


git-svn-id: http://core.svn.wordpress.org/trunk@54723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 13:59:18 +00:00
audrasjb
3f4a005ea6 Twenty Twenty-Two: Improve spacing for the legacy Post Comments block.
This changeset adds margins to improve spacing in the legacy Post Comments block. This change only affects users who have not updated to the new Comments block.

Props patelhitesh, audrasjb, poena, miguelaxcar.
Fixes #57560.

Built from https://develop.svn.wordpress.org/trunk@55189


git-svn-id: http://core.svn.wordpress.org/trunk@54722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 09:25:17 +00:00
audrasjb
7e3b08c8af Themes: Increase HTTP timeout for Theme API requests.
This changeset modifies the HTTP request in `themes_api()` to use the same HTTP request timeout as in `plugins_api()`, which is 15 seconds, instead of a default value of 5 seconds.

Props ahortin, peterwilsoncc, dd32, costdev.
Fixes #57315.

Built from https://develop.svn.wordpress.org/trunk@55188


git-svn-id: http://core.svn.wordpress.org/trunk@54721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 09:14:17 +00:00
joedolson
01236f5948 Media: Fix inconsistent font weight in media detail views.
Make font weight consistent between different screens and different parts of media views.
 
Props szaqal21, sabernhardt.
Fixes #54509.
Built from https://develop.svn.wordpress.org/trunk@55187


git-svn-id: http://core.svn.wordpress.org/trunk@54720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 02:16:12 +00:00
Andrew Ozz
9d580a0fcb Emoji: Always skip nodes with the wp-exclude-emoji CSS class.
Patches twemoji.js to add support for a `doNotParse()` callback. Uses that callback to always exclude emojis in HTML elements with the above class.

Props: dd32, peterwilsoncc, azaozz.
Fixes #52219.
Built from https://develop.svn.wordpress.org/trunk@55186


git-svn-id: http://core.svn.wordpress.org/trunk@54719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 00:53:25 +00:00
Felix Arntz
9feba5fa8b Editor: Use a non-persistent object cache instead of transient in wp_get_global_stylesheet().
This changeset is part of a greater effort to enhance the caching strategy for theme.json based data. Similar to [55138], [55148], and [55155], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

Props spacedmonkey, oandregal, flixos90, ajlende, hellofromtonya.
Fixes #57568.

Built from https://develop.svn.wordpress.org/trunk@55185


git-svn-id: http://core.svn.wordpress.org/trunk@54718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 22:59:13 +00:00
hellofromTonya
1056e0175c KSES: Allow position-related CSS properties.
Adds support for the following CSS properties considered safe for inline CSS:
* `position`
* `top`
* `right`
* `bottom`
* `left`
* `z-index`

References:
* [https://github.com/WordPress/gutenberg/pull/46142 Gutenberg PR 46142].

Follow-up to [54117].

Props andrewserong, mukesh27.
Fixes #57504.
Built from https://develop.svn.wordpress.org/trunk@55184


git-svn-id: http://core.svn.wordpress.org/trunk@54717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 22:52:14 +00:00
joedolson
379bec8ea6 Media: Ensure media IDs are type int in bulk editing.
Cast all array values to integers using `array_map` so functions like `wp_delete_attachment` receiving the expected variable type.
 
Props eherman24, joedolson.
Fixes #56170.
Built from https://develop.svn.wordpress.org/trunk@55183


git-svn-id: http://core.svn.wordpress.org/trunk@54716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 22:17:15 +00:00
audrasjb
e8bd962c4e Embeds: Add oEmbed support for crowdsignal.net surveys.
Crowdsignal has a block-editor powered survey/project editor. Surveys created using this editor appear on `*.crowdsignal.net` when published. This changeset adds oEmbed support for these URLs to embed Crowdsignal surveys.

Props donncha, audrasjb, Mamaduka, ntsekouras.
Fixes #57543.

Built from https://develop.svn.wordpress.org/trunk@55182


git-svn-id: http://core.svn.wordpress.org/trunk@54715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 21:45:16 +00:00
hellofromTonya
e8096f0883 Editor: Add 'wp-polyfill' to _wp_get_iframed_editor_assets() for inert attribute in Firefox.
Adds the polyfill script to the iframe to make the `inert` attribute work correctly in Firefox. This solves the problem that the site editor can operate on the block editor in Firefox even in browse mode.

Why?

The inert attribute is intended to render the element and its sub-tree elements `inert`, but Firefox doesn't support this attribute. For the `inert` attribute to work as intended in Firefox, even within an iframe, the script needs to be injected into the iframe as well as the global document.

References:
* [https://github.com/WordPress/gutenberg/pull/47398 Gutenberg PR 47398].

Follow-up to [53160].

Props wildworks, mamaduka, youknowriad.
Fixes #57552.
Built from https://develop.svn.wordpress.org/trunk@55181


git-svn-id: http://core.svn.wordpress.org/trunk@54714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 20:44:11 +00:00
joedolson
237cb1da8f Media: Remove meta data after restoring w/IMAGE_EDIT_OVERWRITE.
When IMAGE_EDIT_OVERWRITE is defined as true the meta field `_wp_attachment_backup_sizes` is deleted after an image is restored.
 
Props mitogh, jeawhanlee, robinwpdeveloper, iapial.
Fixes #55150.
Built from https://develop.svn.wordpress.org/trunk@55180


git-svn-id: http://core.svn.wordpress.org/trunk@54713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 20:31:14 +00:00
hellofromTonya
b0521eaa50 Editor: Separate content styles for iframe in __wp_get_iframed_editor_assets() and wp_default_styles().
This changeset:
* Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`).
* Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies.

Why?

These PHP changes are part of the initiative to:

* Separate the content styles contained in the block editor package into a separate stylesheet.
* Avoid loading all block editor styles into the iframe.

References:
* [https://github.com/WordPress/gutenberg/pull/44298 Gutenberg PR 44298].

Follow-up to [53160], [50761].

Props ellatrix, youknowriad.
Fixes #57550.
Built from https://develop.svn.wordpress.org/trunk@55179


git-svn-id: http://core.svn.wordpress.org/trunk@54712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 20:17:13 +00:00
joedolson
7334d79f5c Media: Fix upload not visible if added after deleting media.
Unset GET parameters in the media library so they don't suppress error notifications and messages. Fix an issue where uploading an image after being redirected from deleting media did not show the new upload in the gallery.
 
Props rnitinb, Mista-Flo, desrosj, zebaafiashama, joedolson, antpb.
Fixes #49178.
Built from https://develop.svn.wordpress.org/trunk@55178


git-svn-id: http://core.svn.wordpress.org/trunk@54711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 19:47:12 +00:00
hellofromTonya
96f54a8132 REST API: Declare 'edit_css' capability in links within WP_REST_Global_Styles_Controller.
Updates the Global Styles endpoint to expose the `'edit_css'` capability via action links.

References:
* [https://github.com/WordPress/gutenberg/pull/46815 Gutenberg PR 46815] Part of an effort to hide custom CSS setting for users without `'edit_css'` capability.

Follow-up to [52342], [52051].

Props mamaduka, dsas, glendaviesnz, mmtr86, talldanwp, timothyblynjacobs.
Fixes #57526.
Built from https://develop.svn.wordpress.org/trunk@55177


git-svn-id: http://core.svn.wordpress.org/trunk@54710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 18:38:14 +00:00
hellofromTonya
263ef5505d Themes: Add shadow presets support for theme.json.
Adds shadow presets support for `theme.json` within the `WP_Theme_JSON` by 

* Adding it to presets metadata and valid settings.
* Defining the default shadow presets in Core's `theme.json`.

Includes PHPUnit tests. 

References:
* [https://github.com/WordPress/gutenberg/pull/46813 Gutenberg PR 46813]
* [https://github.com/WordPress/gutenberg/pull/47272 Gutenberg PR 47272]

Follow-up to [54162], [52049], [50973].

Props madhudollu, mamaduka, oandregal, scruffian, hellofromTonya.
Fixes #57559.
Built from https://develop.svn.wordpress.org/trunk@55176


git-svn-id: http://core.svn.wordpress.org/trunk@54709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 18:07:12 +00:00
hellofromTonya
048b304deb Editor: Introduce minimum height dimensions block support.
This changeset adds the new dimension feature's PHP code for supporting minimum height in the block editor inspector and in global styles. Minimum height is quite useful for defining the minimum vertical dimensions of a block, while allowing it to expand beyond that size. 

In this changeset:

* Adds support in `theme.json`.
* Adds support in the style engine.
* Adds support in `wp_apply_dimensions_support()`.
* Renames the setting from `'__experimentalDimensions'` to `dimensions` in `wp_register_dimensions_support()`.
* Adds PHPUnit tests.

Is renaming `'__experimentalDimensions'` a backwards-compatibility (BC) break?

Though the setting has been in the code since 5.9.0, it was never wired to anything, ie it did not expose any controls or styles. Notice in `wp_register_dimensions_support()` and `wp_apply_dimensions_support()` prior to this changeset, there are inline comments as placeholders for height and width support, but no code.

If a developer opted in to use it, it had no effect.

A search in wp.org's plugin and themes repo showed no instances of this experimental setting.

Given there was no functionality attached to it (until this changeset), no change in behavior or effect from removing it, and no usage found in the plugins and themes repository, it does appear to be a BC break.

References:
* [https://github.com/WordPress/gutenberg/pull/45300 Gutenberg PR 45300]
* [https://github.com/WordPress/gutenberg/pull/45334 Gutenberg PR 45334]

Follow-up to [53076], [52069].

Props andrewserong, aaronrobertshaw , costdev, hellofromTonya, isabel_brison, joen, paaljoachim, mukesh27, ntsekouras, oandregal, ramonopoly.
Fixes #57582.
Built from https://develop.svn.wordpress.org/trunk@55175


git-svn-id: http://core.svn.wordpress.org/trunk@54708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 16:15:15 +00:00
Sergey Biryukov
1b359fb4b9 Docs: Document the inserter property in WP_Block_Patterns_Registry::register().
Follow-up to [53152], [55173].

See #56792.
Built from https://develop.svn.wordpress.org/trunk@55174


git-svn-id: http://core.svn.wordpress.org/trunk@54707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 15:29:13 +00:00
Sergey Biryukov
d099f2f708 Docs: Improve documentation for block pattern properties.
Includes:
* Adding the `templateTypes` property to the `WP_Block_Patterns_Registry::register()` DocBlock.
* Adding `@since` notes for the `postTypes` and `templateTypes` properties to:
 * `_register_theme_block_patterns()`
 * `WP_Block_Patterns_Registry::register()`
* Bringing some consistency to the order of properties between:
 * `_register_theme_block_patterns()`
 * `WP_Block_Patterns_Registry::register()`
 * `WP_REST_Block_Patterns_Controller::prepare_item_for_response()`
 * `WP_REST_Block_Patterns_Controller::get_item_schema()`

Follow-up to [52943], [53152], [54263], [55168].

See #56792.
Built from https://develop.svn.wordpress.org/trunk@55173


git-svn-id: http://core.svn.wordpress.org/trunk@54706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 15:02:14 +00:00
hellofromTonya
cafd7544c2 Editor: Add support for editing block style variations in global styles.
To allow editing of block style variations in global styles, this changeset adds the following for server side support:

* building of block style schema into `WP_Theme_JSON::sanitize()`.
* appending of style variation selectors to block metadata in `WP_Theme_JSON::get_blocks_metadata()`.
* building of selectors and variations for nodes in `WP_Theme_JSON::get_block_nodes()`.

Tests for happy and unhappy paths are included.

Reference:
* [https://github.com/WordPress/gutenberg/pull/46343 Gutenberg PR 46343]

Follow-up to [54118], [50973], [50959].

Props isabel_brison, 
Fixes #57583.
Built from https://develop.svn.wordpress.org/trunk@55172


git-svn-id: http://core.svn.wordpress.org/trunk@54705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 13:43:18 +00:00
Felix Arntz
d8246e8f7a Media: Allow to omit decoding="async" on tags from wp_get_attachment_image().
When adding `decoding="async"` to images was introduced in [53480], it did not provide the ability to customize that behavior specifically for image tags returned from `wp_get_attachment_image()`.

With this changeset it is now possible to explicitly provide a `decoding` value of e.g. boolean `false` in the `$attr` parameter of the function, to ensure the attribute is omitted.

Props maximej, adamsilverstein, flixos90, costdev, peterwilsoncc, mukesh27.
Fixes #57086.

Built from https://develop.svn.wordpress.org/trunk@55171


git-svn-id: http://core.svn.wordpress.org/trunk@54704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 19:41:14 +00:00
John Blackbourn
e6cc65d39e Cron API: Improve the docs for some cron event and cron schedule related functions.
See #56792

Built from https://develop.svn.wordpress.org/trunk@55170


git-svn-id: http://core.svn.wordpress.org/trunk@54703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 17:50:12 +00:00
spacedmonkey
449fdda55f Query: Use WP_Query in get_page_by_path.
Replace raw database queries in `get_page_by_path` with a call to `WP_Query` class. This has a number of benefits, including improved caching and priming of post caches. To maintain backwards compatibility, this function calls `WP_Query` to gets all matching posts of all post statuses.  

Props spacedmonkey, peterwilsoncc, costdev, 
Fixes #56689.
Built from https://develop.svn.wordpress.org/trunk@55169


git-svn-id: http://core.svn.wordpress.org/trunk@54702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 16:56:12 +00:00
jorgefilipecosta
49c1d2066c Add: Template types to the patterns API.
Backports https://github.com/WordPress/gutenberg/pull/45814 into the core.
This commit adds a new templateType property to the patterns registration API.
This property allows a pattern to specify which template it makes sense on, e.g.: 404, single-post, single-product, category.

Props youknowriad, ntsekouras, 
spacedmonkey.
Built from https://develop.svn.wordpress.org/trunk@55168


git-svn-id: http://core.svn.wordpress.org/trunk@54701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 16:49:16 +00:00
jorgefilipecosta
5a6c222bfa Update: Improve performance of gutenberg_render_layout_support_flag.
Backports https://github.com/WordPress/gutenberg/pull/46074 into the core.
render_layout_support_flag is run per block, and inside we called get_global_settings three times. get_global_settings calls get_merged_data, which is costly. render_layout_support_flag is a filter called during the block render. When the blocks start rendering, there is no expectation that the theme.json settings change during the block render, so the settings and their derived information should all be static information of this function.
This simple change removes 3*NUMBER_OF_BLOCKS calls of get_merged_data to just one call.

Props oandregal, aristath, felixarntz, tellthemachines, andrewserong, aaronrobertshaw, aaronrobertshaw.
Built from https://develop.svn.wordpress.org/trunk@55167


git-svn-id: http://core.svn.wordpress.org/trunk@54700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 15:24:14 +00:00
Sergey Biryukov
3ec35fac02 Docs: Fix typo in the send_auth_cookies filter DocBlock.
Follow-up to [55164], [55165].

See #56971, #39367.
Built from https://develop.svn.wordpress.org/trunk@55166


git-svn-id: http://core.svn.wordpress.org/trunk@54699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 12:20:16 +00:00
Sergey Biryukov
a389692e5a Docs: Remove a duplicate line in the send_auth_cookies filter DocBlock.
Describe the default values for the `$send` and `$expire` parameters.

Follow-up to [55164].

See #56971, #39367.
Built from https://develop.svn.wordpress.org/trunk@55165


git-svn-id: http://core.svn.wordpress.org/trunk@54698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 12:18:22 +00:00
audrasjb
67abe8cfb3 Users: Add context to the send_auth_cookies filter.
This changeset adds `$user_id`, `$expire`, `$expiration` and `$token` parameters to provide context to `send_auth_cookies` hook, which allows the filter to skip sending auth cookies.

Props dd32, mukesh27, costdev, peterwilsoncc, audrasjb.
Fixes #56971.
See #39367.

Built from https://develop.svn.wordpress.org/trunk@55164


git-svn-id: http://core.svn.wordpress.org/trunk@54697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 08:46:13 +00:00
Sergey Biryukov
15af7662df Code Modernization: Allow some parameters with reserved keywords in wp-includes/class-wp-text-diff-renderer-*.php.
This commit adds inline comments instructing PHPCS to ignore parameters with reserved keywords in the affected methods that should not be renamed:
* `$string` parameter in `WP_Text_Diff_Renderer_inline::_splitOnWords()`
* `$final` parameter in `WP_Text_Diff_Renderer_Table::_changed()` and `::interleave_changed_lines()`

This resolves a few WPCS warnings along the lines of:
{{{
It is recommended not to use reserved keyword "string" as function parameter name. Found: $string
It is recommended not to use reserved keyword "final" as function parameter name. Found: $final
}}}

The two `WP_Text_Diff_Renderer_*` classes in question extend the `Text_Diff_Renderer_inline` and `Text_Diff_Renderer` classes from the `Text_Diff` package and should have the same parameters as the parent class methods, per the Task 1 section of ticket #51553.

The `Text_Diff` library currently included in WordPress core is no longer kept in sync with the upstream project and can be considered “adopted”, so the `$string` and `$final` parameters in the  parent class methods can technically be renamed, e.g. to `$input_string` and `$modified`, respectively.

However, the “final” wording is also used to represent modified content in other parts the library, so it is more internally consistent to keep these parameters as is for now.

Follow-up to [7747], [38352], [55136].

See #56788.
Built from https://develop.svn.wordpress.org/trunk@55163


git-svn-id: http://core.svn.wordpress.org/trunk@54696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-30 15:24:13 +00:00
Sergey Biryukov
ff399d17fe Code Modernization: Rename parameters that use reserved keywords in wp-includes/formatting.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$class` parameter to `$classname` in `sanitize_html_class()`.

Follow-up to [54927].

See also: [search:?q=code+modernization+rename+parameters+that+use+reserved+keywords&changeset=on equivalent commits for other files].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55162


git-svn-id: http://core.svn.wordpress.org/trunk@54695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-30 14:15:16 +00:00
Pascal Birchler
5edb22187d I18N: Introduce switch_to_user_locale().
This new function makes it easier to switch to a specific user’s locale by reducing duplicate code and storing the user’s ID as additional context for plugins to consume. Existing usage of `switch_to_locale()` in core has been replaced with `switch_to_user_locale()` where appropriate.

Also, this change ensures `WP_Locale_Switcher` properly filters `determine_locale` so that anyyone using the `determine_locale()` function will get the correct locale information when switching is in effect.

Props costdev.
Fixes #57123.
See #26511.
Built from https://develop.svn.wordpress.org/trunk@55161


git-svn-id: http://core.svn.wordpress.org/trunk@54694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-30 10:27:16 +00:00
Sergey Biryukov
319fadaa9c Build/Test Tools: Back up and restore the $wp_filters global when running tests.
Introduced along with the `did_filter()` function, the `$wp_filters` global stores the number of times each filter has been applied during the current request.

This commit adds `$wp_filters` to the list of globals that are saved in `WP_UnitTestCase_Base::_backup_hooks()` and restored in `::_restore_hooks()` so that hooks set by the current test do not accidentally affect future tests.

Additionally, this commit brings some consistency by backing up and restoring the hook-related globals in the same order they are defined in `wp-includes/plugin.php`.

Follow-up to [29251], [53803].

Props sanjucta, SergeyBiryukov.
Fixes #57236.
Built from https://develop.svn.wordpress.org/trunk@55160


git-svn-id: http://core.svn.wordpress.org/trunk@54693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-29 16:26:15 +00:00
audrasjb
9c04271f60 Media: Deprecate unused method WP_Media_List_Table::column_desc().
This changeset formally deprecates the `column_desc()` method from `WP_Media_List_Table`, as it was never used anywhere in core.

Props iandunn, JeffMatson, antpb, costdev, audrasjb.
Fixes #39710.

Built from https://develop.svn.wordpress.org/trunk@55159


git-svn-id: http://core.svn.wordpress.org/trunk@54692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-28 22:17:16 +00:00
Sergey Biryukov
c588aebc84 Database: Replace substr_compare() usage with substr() in wpdb::prepare().
This amends the previous commit to avoid a warning on PHP < 7.2.18 if haystack is an empty string:
{{{
Warning: substr_compare(): The start position cannot exceed initial string length
}}}

Follow-up to [55151], [55157].

See #52506.
Built from https://develop.svn.wordpress.org/trunk@55158


git-svn-id: http://core.svn.wordpress.org/trunk@54691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-28 20:58:12 +00:00
Sergey Biryukov
d9de5c33a0 Database: Replace str_ends_with() usage in wpdb::prepare().
This avoids a fatal error if the file is included directly outside of WordPress core, e.g. by HyperDB.

While WordPress core does include a polyfill function, it is not directly loaded in the `wpdb` class.

This commit replaces the `str_ends_with()` calls with `substr_compare()` for now.

Follow-up to [55151].

Props Otto42.
See #52506.
Built from https://develop.svn.wordpress.org/trunk@55157


git-svn-id: http://core.svn.wordpress.org/trunk@54690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-28 13:48:20 +00:00
joedolson
ac0cb7a37b Media: Add download link to media modal and attachment details.
Make it easier for users to download their uploaded media by providing a download link on the attachment details screen and in the media modal.

Props countrymusicchicago, joedolson, amin7
Fixes #41474.
Built from https://develop.svn.wordpress.org/trunk@55156


git-svn-id: http://core.svn.wordpress.org/trunk@54689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 23:07:13 +00:00
Felix Arntz
fef356b375 Editor: Use a non-persistent object cache in wp_get_global_settings().
This changeset is part of a greater effort to enhance the caching strategy for `theme.json` based data. Similar to [55138] and [55148], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

This addition of a non-persistent cache results in a significant performance improvement for the overall load time of WordPress, with the Server-Timing load metric being ~8% faster and Time to First Byte being 25+% faster than before.

Props oandregal, spacedmonkey, hellofromtonya, flixos90, azaozz, aristath.
Fixes #57502.

Built from https://develop.svn.wordpress.org/trunk@55155


git-svn-id: http://core.svn.wordpress.org/trunk@54688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 22:14:12 +00:00
Adam Silverstein
5df3679f34 Revisions: only create autosave when content changed.
In the autosave REST API endpoint, avoid excessive database writes when an autosave is sent with content that is unchanged from the saved post. 

Before this fix, clicking "preview" in the editor (which uses the autosave feature) multiple times would cause an identical autosave entry to be deleted and re-created repeatedly.

Props inwerpsel, aduth, mukesh27, ironprogrammer.
Fixes #49532.


Built from https://develop.svn.wordpress.org/trunk@55154


git-svn-id: http://core.svn.wordpress.org/trunk@54687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 22:03:19 +00:00
davidbaumwald
0d27540b5e Tests: Resolve some line endings issues in blocks/renderCommentTemplate.php on Windows machines.
This change resolves a unit test failure in `Tests_Blocks_RenderReusableCommentTemplate::test_rendering_comment_template_nested()` on systems using `\r\n` line endings.

Props SergeyBiryukov.
See #56793.
Built from https://develop.svn.wordpress.org/trunk@55153


git-svn-id: http://core.svn.wordpress.org/trunk@54686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 20:51:12 +00:00
desrosj
a85f69da41 Build/Test Tools: Update third-party GitHub Actions.
This updates the following third-party GitHub Actions to their latest versions.

- `actions/cache`
- `actions/checkout`
- `actions/upload-artifact`
- `actions/setup-node`
- `actions/setup-php`
- `actions/github-script`

See #57572.
Built from https://develop.svn.wordpress.org/trunk@55152


git-svn-id: http://core.svn.wordpress.org/trunk@54685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 19:25:13 +00:00
davidbaumwald
d25ae5dd33 Database: Add %i placeholder support to $wpdb->prepare to escape table and column names, take 2.
[53575] during the 6.1 cycle was reverted in [54734] to address issues around multiple `%` placeholders not being properly quoted as reported in #56933.  Since then, this issue has been resolved and the underlying code improved significantly.  Additionally, the unit tests have been expanded and the inline docs have been improved as well.

This change reintroduces `%i` placeholder support in `$wpdb->prepare()` to give extenders the ability to safely escape table and column names in database queries.

Follow-up to [53575] and [54734].

Props craigfrancis, jrf, xknown, costdev, ironprogrammer, SergeyBiryukov.
Fixes #52506.
Built from https://develop.svn.wordpress.org/trunk@55151


git-svn-id: http://core.svn.wordpress.org/trunk@54684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 18:49:16 +00:00
desrosj
d4085bc90d Build/Test Tools: Update PostCSS to version 8.
This updates PostCSS related dependencies for the main Core build process to versions that use the latest major version of PostCSS, 8.x.

There were no changes to any versioned CSS files as a result of this update directly. However, two occurrences of `-o-tab-size` have been removed due to the version of `caniuse-lite` used being updated in the process.

See #57554, #57555.
Built from https://develop.svn.wordpress.org/trunk@55150


git-svn-id: http://core.svn.wordpress.org/trunk@54683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 15:56:28 +00:00
Sergey Biryukov
a61dc175a8 Themes: Add "Style Variations" to the list of WordPress theme features.
Follow-up to [meta12372].

Props poena, mukesh27, costdev.
Fixes #56869. See #meta6545.
Built from https://develop.svn.wordpress.org/trunk@55149


git-svn-id: http://core.svn.wordpress.org/trunk@54682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-27 15:54:19 +00:00
Felix Arntz
24bcc488b0 Editor: Use a non-persistent object cache instead of transient in wp_get_global_stylesheet().
This changeset is part of a greater effort to enhance the caching strategy for `theme.json` based data. Similar to [55138], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

Props oandregal, spacedmonkey, hellofromtonya, flixos90, ironprogrammer, azaozz, aristath, costdev, mcsf.
Fixes #56910.

Built from https://develop.svn.wordpress.org/trunk@55148


git-svn-id: http://core.svn.wordpress.org/trunk@54681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-26 23:03:14 +00:00
hellofromTonya
74241b9205 Editor: Add is block theme setting to get_block_editor_settings().
The block editor's iframe needs to know if the theme is a block theme. This changeset adds a setting to `get_block_editor_settings()`.

Reference:
* https://github.com/WordPress/gutenberg/pull/46212

Props ellatrix, alexstine, costdev, dgwyer, glendaviesnz, scruffian.
Fixes #57549.
Built from https://develop.svn.wordpress.org/trunk@55147


git-svn-id: http://core.svn.wordpress.org/trunk@54680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-26 20:01:12 +00:00
Felix Arntz
cbb418fbe2 Themes: Avoid unnecessary database queries from get_default_block_editor_settings() in WP_Theme_JSON_Resolver::get_theme_data().
The `get_default_block_editor_settings()` function included several pieces of data that are irrelevant for the purpose that `WP_Theme_JSON_Resolver` was calling it for, yet resulted in three database queries on page load that can be avoided.

This changeset introduces a new function `get_classic_theme_supports_block_editor_settings()` to takes responsibility of only the data needed in `WP_Theme_JSON_Resolver`, which now uses that function. This leads to a reduction of database queries and accordingly a performance improvement.

Props mamaduka, spacedmonkey, oandregal, flixos90, audrasjb, mukesh27.
Fixes #57547.

Built from https://develop.svn.wordpress.org/trunk@55146


git-svn-id: http://core.svn.wordpress.org/trunk@54679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-26 18:39:13 +00:00
Sergey Biryukov
89706afd21 Coding Standards: Bring some consistency to the order of attributes in password fields.
Follow-up to [11359], [13592], [13696], [33023], [33246], [33353], [41556], [46256], [49248], [53111], [55094].

See #56791.
Built from https://develop.svn.wordpress.org/trunk@55145


git-svn-id: http://core.svn.wordpress.org/trunk@54678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-26 18:12:11 +00:00
hellofromTonya
a0c53b91a3 Docs: Update $types param for wp_get_global_stylesheet().
In 6.1.0, the values the `$types` parameter accepts changed to include `'base-layout-styles'`.

This commit updates the DocBlock to reflect this change and provide clear information of what the function will load if no types are passed to it.

Reference:
* https://github.com/WordPress/gutenberg/pull/46817

Follow-up to [54162], [52054].

Props oandregal, jorgefilipecosta , ntsekouras.
Fixes #57563.
See #56792.
Built from https://develop.svn.wordpress.org/trunk@55144


git-svn-id: http://core.svn.wordpress.org/trunk@54677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-26 17:23:15 +00:00
Felix Arntz
54b4f3aa8e Bootstrap/Load: Avoid initializing WP_Recovery_Mode when fatal error handler is disabled.
The WordPress recovery mode only works in combination with the fatal error handler that works as the entry mode for recovery mode. The fatal error handler can be disabled using the `WP_DISABLE_FATAL_ERROR_HANDLER` constant, but so far the logic in the `WP_Recovery_Mode` class was still being initialized even when that constant was set to `true`, which is unnecessary.

This changeset updates the WordPress bootstrap process to only initialize `WP_Recovery_Mode` when needed.

Props costdev.
Fixes #56848.

Built from https://develop.svn.wordpress.org/trunk@55143


git-svn-id: http://core.svn.wordpress.org/trunk@54676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-26 00:07:14 +00:00
Felix Arntz
d0e699bb2c Editor: Fix undefined variable following [54805].
Props mamaduka, costdev, mukesh27.
See #56974, #57067.

Built from https://develop.svn.wordpress.org/trunk@55142


git-svn-id: http://core.svn.wordpress.org/trunk@54675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 22:09:13 +00:00
hellofromTonya
1b6b3a0765 Editor: Remove WP_DEBUG defined check in wp_tinycolor_hue_to_rgb().
The constant `WP_DEBUG` is a default constant that is set within `wp_initial_constants()` when not defined. This means the constant will always be defined, thus making the `defined( 'WP_DEBUG' )` unnecessary.

Removing the `defined()` provides these benefits:
* Makes the code more readable.
* Tiny performance optimization.

References:
* https://github.com/WordPress/gutenberg/pull/45979

Follow-up to [52049].

Props ocean90, spacedmonkey, mamaduka.
See #57527. 
Built from https://develop.svn.wordpress.org/trunk@55141


git-svn-id: http://core.svn.wordpress.org/trunk@54674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 21:56:15 +00:00
hellofromTonya
e9a172b0ef Editor: Use in/decrementors in wp_tinycolor_hue_to_rgb().
Replaces `+=` and `-=` with `++$t` and `--$t` (in/decrementors) within the `wp_tinycolor_hue_to_rgb()`. 

Why? For performance: in/decrementors are more performant than an assignment with a calculation.

References:
* https://www.php.net/manual/en/language.operators.increment.php
* https://github.com/WordPress/gutenberg/pull/44551

Follow-up to [50929].

Props jrf, czapla, antonvlasenko, aristath, mamaduka.
See #57527. 
Built from https://develop.svn.wordpress.org/trunk@55140


git-svn-id: http://core.svn.wordpress.org/trunk@54673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 21:42:15 +00:00
desrosj
adbfbb6bfb Build/Test Tools: Revert [55137].
This changeset resulted in some unexpected JavaScript validation failures.

See #57555.
Built from https://develop.svn.wordpress.org/trunk@55139


git-svn-id: http://core.svn.wordpress.org/trunk@54672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 20:22:12 +00:00
hellofromTonya
652f2244c6 Themes: Add static cache variable to wp_theme_has_theme_json().
For performance, a static variable is added to `wp_theme_has_theme_json()` to cache the boolean result of determining if a theme (or its parent) has a `theme.json` file. 

This cache avoids the overhead of calling `get_stylesheet_directory()` and `get_template_directory()` each time `wp_theme_has_theme_json()` is invoked.

The cache is lean, non-persistent, and encapsulated within the function (i.e. function scope and not available externally).

The cache is ignored when:
* `WP_DEBUG` is on to avoid interrupting theme developer's workflow and for extender automated test suites.
* `WP_RUN_CORE_TESTS` is on to ensure each Core test exercises the checking code.

Follow-up to [55092], [55086].

Props oandregal, azaozz, costdev, dmsnell, flixos90, hellofromTonya, Otto42, spacedmonkey.
Fixes #56975.
Built from https://develop.svn.wordpress.org/trunk@55138


git-svn-id: http://core.svn.wordpress.org/trunk@54671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 19:38:14 +00:00
desrosj
9fe4e0b6f4 Build/Test Tools: Update caniuse-lite to the latest version.
This updates the `caniuse-lite` database from `1.0.30001407` to `1.0.30001448` and applies the resulting changes to generated WP Admin CSS.

This removes two occurrences of `-o-tab-size`, which was required for partial support of the `tab-size` property in Opera Mini. Usage has dropped below 1%, hence this vendor prefix being removed.

See #57555.
Built from https://develop.svn.wordpress.org/trunk@55137


git-svn-id: http://core.svn.wordpress.org/trunk@54670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 19:15:15 +00:00
Sergey Biryukov
27529e9dee Coding Standards: Allow some parameters with reserved keywords in wp-includes/compat.php.
Parameter names for PHP polyfills in WordPress core need to 100% match the native PHP parameter names. Otherwise using named parameters with those functions could cause fatal errors for installations where the polyfills kick in.

This commit adds inline comments instructing PHPCS to ignore parameters with reserved keywords in the affected functions that should not be renamed:
* `$string` parameter in `mb_substr()` and `mb_strlen()`
* `$array` parameter in `array_key_first()` and `array_key_last()`

This resolves a few WPCS warnings along the lines of:
{{{
It is recommended not to use reserved keyword "string" as function parameter name. Found: $string
}}}

Follow-up to [7140], [10707], [17603], [17621], [32114], [52038], [53365].

Props jrf.
See #56788, #56791.
Built from https://develop.svn.wordpress.org/trunk@55136


git-svn-id: http://core.svn.wordpress.org/trunk@54669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 01:40:12 +00:00
audrasjb
a0b0f4560b Menus: Add missing escaping function in Admin Menu walker.
Props aniketpatel, mukesh27, costdev.
Fixes #57541.

Built from https://develop.svn.wordpress.org/trunk@55135


git-svn-id: http://core.svn.wordpress.org/trunk@54668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 21:32:14 +00:00
audrasjb
0cdd1f8069 Code Modernization: Fix a JS error in wpdialog.
This changeset replaces `this.element._trigger('focus');` with `this.element.trigger('focus');` in `wpdialog` to fix a JS error introduced in [55052].

Indeed, `this` inside the `open()` function of `wpdialog` refers to the jQuery UI widget, whereas `this.element` is the jQuery object of the DOM element. Thus, native jQuery methods need to be used, as `_trigger` is only defined on the jQuery UI widget.

Follow-up to [55052].

Props TobiasBg, audrasjb, shubham1gupta.
Fixes #56830.

Built from https://develop.svn.wordpress.org/trunk@55134


git-svn-id: http://core.svn.wordpress.org/trunk@54667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 21:13:12 +00:00
hellofromTonya
fe2c8f9237 Editor: Adds 'settings.typography.fluid.minFontSize' support to wp_get_typography_font_size_value().
In `wp_get_typography_font_size_value()`, adds support for using a minimum font size for fluid typography when defined in a theme's `theme.json` file.

Reference:
* Part of [https://github.com/WordPress/gutenberg/pull/42489 Gutenberg PR 42489]

Follow-up to [54497], [54260].

Props andrewserong, ramonopoly, hellofromTonya, joen.
Fixes #57529.
Built from https://develop.svn.wordpress.org/trunk@55133


git-svn-id: http://core.svn.wordpress.org/trunk@54666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 20:40:10 +00:00
hellofromTonya
16b9fdfc34 Editor: Adds pagination and ordering support to WP_REST_Pattern_Directory_Controller.
Adds pagination and ordering support to `WP_REST_Pattern_Directory_Controller` by allow listing `'per_page'`, `'page'`, `'offset'`, `'order'`, and `'orderby'` query parameters. This change enables pagination and ordering features in the pattern directory explorer by using the same sort as wordpress.org/patterns.

Reference:
* [https://github.com/WordPress/gutenberg/pull/45293 Gutenberg PR 45293]

Follow-up to [55098], [51206], [51021].

Props ntsekouras, ryelle, arrasel403, hellofromTonya, ironprogrammer, mukesh27, robinwpdeveloper.
Fixes #57501.
Built from https://develop.svn.wordpress.org/trunk@55132


git-svn-id: http://core.svn.wordpress.org/trunk@54665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 16:54:11 +00:00
Sergey Biryukov
28f3369220 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/kses.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$global` parameter to `$global_name` in `Tests_Kses::test_kses_globals_are_defined()`.

Follow-up to [52229], [54203], [55090].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55131


git-svn-id: http://core.svn.wordpress.org/trunk@54664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 16:05:12 +00:00
Sergey Biryukov
c5913fc3de Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/functions/wpRefererField.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$echo` parameter to `$display` in `Tests_Functions_wpRefererField::test_wp_referer_field_should_respect_display_arg()`.

Follow-up to [54420], [54929].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55130


git-svn-id: http://core.svn.wordpress.org/trunk@54663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 15:55:10 +00:00
Sergey Biryukov
eda80ba004 Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-theme-json.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$default` parameter to `$default_value` in `WP_Theme_JSON::get_metadata_boolean()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119], [55120], [55126], [55127].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55129


git-svn-id: http://core.svn.wordpress.org/trunk@54662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 15:45:11 +00:00
Sergey Biryukov
378246f1dc Docs: Add missing @since tag for WP_Theme_JSON_Resolver::remove_json_comments().
Follow-up to [54162].

See #56792.
Built from https://develop.svn.wordpress.org/trunk@55128


git-svn-id: http://core.svn.wordpress.org/trunk@54661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 15:41:15 +00:00
Sergey Biryukov
73b9d96f77 Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-theme-json-resolver.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$array` parameter to `$input_array` in `WP_Theme_JSON_Resolver::remove_json_comments()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119], [55120], [55126].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55127


git-svn-id: http://core.svn.wordpress.org/trunk@54660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 15:37:12 +00:00
Sergey Biryukov
74567338b8 Code Modernization: Rename parameters that use reserved keywords in wp-includes/blocks.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$default` parameter to `$default_value` in `block_has_support()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119], [55120].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55126


git-svn-id: http://core.svn.wordpress.org/trunk@54659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 14:42:17 +00:00
hellofromTonya
45ef4c0623 Editor: Migrate old to the new pattern categories.
Adds a new non-public `WP_REST_Block_Patterns_Controller::migrate_pattern_categories()` method to automatically migrate existing content's pattern categories to the new ones introduced in [55098].

Old to  New
`'buttons'` to `'call-to-action'`
`'columns'` to `'text'`
`'query'`   to `'posts'`

Reference:
* Part of [https://github.com/WordPress/gutenberg/pull/46144 Gutenberg PR 46144]

Follow-up to [55098], [53152].

Props ntsekouras, annezazu, jameskoster, joen, hellofromTonya, mcsf, paaljoachim, ryelle.
Fixes #57532.
Built from https://develop.svn.wordpress.org/trunk@55125


git-svn-id: http://core.svn.wordpress.org/trunk@54658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 14:36:12 +00:00
audrasjb
190350ecea Twenty Twenty-One: Refine primary-navigation.js behavior for anchor links.
This changeset fixes a bug where clicking on an anchor link in the content changes the state of the button that opens and closes the responsive menu. It adds a conditional to check if the clicked anchor link is inside the primary navigation menu (`#site-navigation`), in order to prevent content anchor links from changing the state of the button.

Known limitations: The state of the button is not reset when the browser is resized. If a menu anchor link is first clicked while on desktop width, and the browser width is reduced, the menu button will show the text "Close" even though the menu is not opened.

Props andreaboe, sabernhardt, poena, afercia, chaion07, cu121, mukesh27.
Fixes #53331.

Built from https://develop.svn.wordpress.org/trunk@55124


git-svn-id: http://core.svn.wordpress.org/trunk@54657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 12:59:10 +00:00
audrasjb
037d3406ee Docs: Various improvements in ms-blogs.php function descriptions, as per docblocks standards.
See #56792.

Built from https://develop.svn.wordpress.org/trunk@55123


git-svn-id: http://core.svn.wordpress.org/trunk@54656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 12:57:15 +00:00
audrasjb
215de3c5f3 Twenty Twenty-Two: Remove color reference from pattern names.
This changeset removes color names from pattern names to make them less opinionated, and avoid mismatching when the user changes related colors. It does not update filenames for now, as they are not directly exposed to end users.

Props poena, mukesh27.
Fixes #56720.

Built from https://develop.svn.wordpress.org/trunk@55122


git-svn-id: http://core.svn.wordpress.org/trunk@54655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 08:51:12 +00:00
audrasjb
0939d89ded Themes: Support additional link related pseudo classes in theme.json.
This changeset adds support for `:link` and `:any-link` in `theme.json`, using the `VALID_ELEMENT_PSEUDO_SELECTORS` array. `:link` can be used to style unvisited links and `:any-link` can be used to style any link containing an `href` attribute.

Props peterwilsoncc, whaze, audrasjb, costdev, mukesh27.
Fixes #57053.

Built from https://develop.svn.wordpress.org/trunk@55121


git-svn-id: http://core.svn.wordpress.org/trunk@54654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 08:11:15 +00:00
Sergey Biryukov
c47eae0612 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/widgets/wpWidgetMedia.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$object` parameter to `$widget` in `Tests_Widgets_wpWidgetMedia::filter_widget_mocked_instance()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55120


git-svn-id: http://core.svn.wordpress.org/trunk@54653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-23 16:54:11 +00:00
Sergey Biryukov
0cc0ff91a6 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/shortcode.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$return` parameter to `$output` in:
 * `Tests_Shortcode::filter_pre_do_shortcode_tag_attr()`
 * `Tests_Shortcode::filter_do_shortcode_tag_replace()`
 * `Tests_Shortcode::filter_do_shortcode_tag_generate()`
 * `Tests_Shortcode::filter_do_shortcode_tag_attr()`
* Amends the `$return` parameter of the `pre_do_shortcode_tag` filter for consistency.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55119


git-svn-id: http://core.svn.wordpress.org/trunk@54652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-23 16:35:12 +00:00
Sergey Biryukov
e474ef7192 Tests: Use wp_recursive_ksort() in WP_Theme_JSON_Resolver tests.
This replaces a helper method in `Tests_Theme_wpThemeJsonResolver` with the `wp_recursive_ksort()` function that was introduced later for the same purpose.

Follow-up to [52049], [53129], [55117].

See #56793.
Built from https://develop.svn.wordpress.org/trunk@55118


git-svn-id: http://core.svn.wordpress.org/trunk@54651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-23 16:03:10 +00:00
Sergey Biryukov
227ba555ae Code Modernization: Rename parameters that use reserved keywords in wp-includes/functions.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$array` parameter to `$input_array` in `wp_recursive_ksort()`.
* Moves the function next to other array-related functions for consistency.

Follow-up to [53129], [54929].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55117


git-svn-id: http://core.svn.wordpress.org/trunk@54650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-23 15:54:10 +00:00
Sergey Biryukov
a864df149a Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/rest-api.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$string` parameter to `$date` in:
 * `Tests_REST_API::test_rest_parse_date()`
 * `Tests_REST_API::test_rest_parse_date_force_utc()`
* Amends the `$value` and `$valid` parameters to `$expected` for consistency.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112], [55115].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55116


git-svn-id: http://core.svn.wordpress.org/trunk@54649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-23 12:12:11 +00:00
Sergey Biryukov
fba1aa6a4f Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/post.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$default` parameter to `$override_slug` in `Tests_Post::filter_pre_wp_unique_post_slug()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55115


git-svn-id: http://core.svn.wordpress.org/trunk@54648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-23 11:09:12 +00:00
audrasjb
e4f070a161 Bundled Themes: Fix Separator block "Dots" style variation on various themes.
This changeset fixes an issue with the "Dots" style of the Separator block on multiple bundled themes. It adds `max-width: 100%` to this style variation on the following themes: Twenty Eleven, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, and Twenty Sixteen.

Props umesh84, sabernhardt, audrasjb, amin7, esratpopy, multidots1896.
Fixes #56114.

Built from https://develop.svn.wordpress.org/trunk@55114


git-svn-id: http://core.svn.wordpress.org/trunk@54647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-22 20:07:12 +00:00
audrasjb
524bd7ba46 Posts, Post Types: Increase the input field's width in the Slug metabox.
This changeset adds a `large-text` attribute and removes the `size` attribute of the text input field located in the Slug metabox. It improves its usability, at least for as long as the Slug metabox is available in the Classic Editor.

Props ABTOP, nacin, helen, sabernhardt, abitofmind, tyxla, audrasjb.
Fixes #16346.

Built from https://develop.svn.wordpress.org/trunk@55113


git-svn-id: http://core.svn.wordpress.org/trunk@54646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-22 11:11:12 +00:00
Sergey Biryukov
e550644ab0 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/pluggable/signatures.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$function` parameter to `$function_name` in `Tests_Pluggable_Signatures::test_pluggable_function_signatures_match()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55112


git-svn-id: http://core.svn.wordpress.org/trunk@54645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-22 00:17:12 +00:00
Sergey Biryukov
4568b1fb32 Docs: Further clarify the wp_ajax_save_attachment filter parameters description.
Follow-up to [55106].

See #23148.
Built from https://develop.svn.wordpress.org/trunk@55111


git-svn-id: http://core.svn.wordpress.org/trunk@54644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-21 15:58:10 +00:00
audrasjb
89f144ea9e Upgrade/Install: Disable spellcheck for password field on Setup screen.
This changeset adds `spellcheck="false"` attribute to Database Password field on the Database Setup screen.

Follow-up to [55094], [55095], [55096].

See #56763.

Built from https://develop.svn.wordpress.org/trunk@55110


git-svn-id: http://core.svn.wordpress.org/trunk@54643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-21 09:07:15 +00:00
audrasjb
c58a08d9df Menus: Hide the "Remove selected item" from Menus screen when no item is selected.
This changeset removes the "Remove selected item" from the classic Navigation Menus screen when no item is selected, and makes it non focusable from assistive technologies.

Plus, this changeset fixes a small unrelated coding standard issue in `nav-menus.css`.

Props kebbet, joedolson, audrasjb.
Fixes #56942.

Built from https://develop.svn.wordpress.org/trunk@55109


git-svn-id: http://core.svn.wordpress.org/trunk@54642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-20 22:06:13 +00:00
audrasjb
73f6748ea4 Quick/Bulk Edit: Add an action hook on bulk_edit_posts().
This changeset introduces the `bulk_edit_posts` action hook, triggered after processing the post data for bulk edit and before it returns its results. For example, it allows developers to save additional data without having to perform any `.ajax()` call.

Props helgatheviking, helen, Mte90, afercia, mrasharirfan, desrosj, itowhid06, pento, mensmaximus, audrasjb, costdev.
Fixes #28112.

Built from https://develop.svn.wordpress.org/trunk@55108


git-svn-id: http://core.svn.wordpress.org/trunk@54641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-20 21:43:11 +00:00
joedolson
c0b3839620 Plugins: Add visible focus on plugin modal close button.
Change the focus and hover state of the plugin modal close button to use `#f0f0f1` with visible outline to be visible against modal overlay.

Props dperonne, viralsampat, jeawhanlee, mukesh27, sabernhardt, joedolson.
Fixes #56604.
Built from https://develop.svn.wordpress.org/trunk@55107


git-svn-id: http://core.svn.wordpress.org/trunk@54640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-20 21:28:14 +00:00
audrasjb
fe3e932421 Media: Add an action hook on wp_ajax_save_attachment().
This changeset introduces the `wp_ajax_save_attachment` action hook, triggered after an attachment has been updated and before the JSON response is sent. For example, it allows developers to update any additional attachment fields that have been rendered by extending the `media.view.Attachment.Details` subview.

Props griffinjt, bradyvercher, pputzer, antpb, sc0ttkclark, audrasjb, costdev, hellofromTonya.
Fixes #23148.

Built from https://develop.svn.wordpress.org/trunk@55106


git-svn-id: http://core.svn.wordpress.org/trunk@54639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-20 14:17:16 +00:00
Sergey Biryukov
28562c4306 Code Modernization: Use correct property in IXR_Message::tag_open().
The `IXR_Message` class declares a property `_currentTag`, which is never assigned or used. It does assign to `currentTag` instead, which outside of that one assignment is never used either.

Since there are various other underscore-prefixed properties declared on the class, including one named `_currentTagContents` which is used in several places, it appears that the declared property is correct and the assignment is a typo.

This commit resolves a notice on PHP 8.2:
{{{
Deprecated: Creation of dynamic property IXR_Message::$currentTag is deprecated
}}}

Follow-up to [1346].

Props bjorsch, kraftbj, jrf, mukesh27, SergeyBiryukov.
See #56790.
Built from https://develop.svn.wordpress.org/trunk@55105


git-svn-id: http://core.svn.wordpress.org/trunk@54638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-20 01:36:10 +00:00
Sergey Biryukov
c5297203d6 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/rest-api/rest-*-controller.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$object` parameter to `$response_data` in:
 * `WP_Test_REST_Attachments_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Autosaves_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Categories_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Comments_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Post_Statuses_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Post_Types_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Posts_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Revisions_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Tags_Controller::additional_field_get_callback()`
 * `WP_Test_REST_Users_Controller::additional_field_get_callback()`
* Amends the `$data` and `$prepared` parameters for consistency in:
 * `WP_REST_Controller::add_additional_fields_to_object()`
 * `WP_REST_Controller::filter_response_by_context()`
 * `rest_filter_response_by_context()`

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55104


git-svn-id: http://core.svn.wordpress.org/trunk@54637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-20 00:21:15 +00:00
audrasjb
26d9268e3c Permalinks: Remove floating on Permalinks settings screen.
This changeset replaces floating elements with `flex` CSS positioning, while the markup stays the same to keep the elements' semantic value.

Follow-up to [53706].

Props sabernhardt, kebbet, audrasjb.
Fixes #56673.
See #55498.

Built from https://develop.svn.wordpress.org/trunk@55103


git-svn-id: http://core.svn.wordpress.org/trunk@54636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 22:57:14 +00:00
Sergey Biryukov
a1b4d027f3 Tests: Correct additional_field_get_callback() parameters in some REST API tests.
The second parameter passed to `get_callback` in `WP_REST_Controller::add_additional_fields_to_object()` is the field name, not the request details.

Includes moving the `get_callback` and `update_callback` helper functions next to the tests they are used in.

Follow-up to [38832], [43768].

See #56793.
Built from https://develop.svn.wordpress.org/trunk@55102


git-svn-id: http://core.svn.wordpress.org/trunk@54635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 21:48:17 +00:00
audrasjb
ee8958557a Twenty Twenty-One: Fix obsolete navigation block styles for better Global Styles support.
This changeset removes some CSS custom properties that targets navigation menu items to avoid preventing the block from inheriting padding values set by the Global Styles system.

Props Joen, desrosj, poena, audrasjb, hellofromtonya, SergeyBiryukov.
Fixes #53220.

Built from https://develop.svn.wordpress.org/trunk@55101


git-svn-id: http://core.svn.wordpress.org/trunk@54634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 17:41:16 +00:00
Sergey Biryukov
f48bb425ed Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/option/themeMods.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$default` parameter to `$default_value` in `Tests_Option_ThemeMods::test_theme_mod_default_value_with_percent_symbols()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55100


git-svn-id: http://core.svn.wordpress.org/trunk@54633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 17:09:13 +00:00
Pascal Birchler
58545bacce I18N: Allow installing new translations when changing the user locale on the profile page.
Up until now, new translations could only be installed via Settings -> General.
When editing the user profile, one could only select locales that were already installed.

This change allows also installing new translations if the editing user has the necessary capabilities.

Props barryceelen, johnbillion, ocean90, swissspidy.
Fixes #38664.
Built from https://develop.svn.wordpress.org/trunk@55099


git-svn-id: http://core.svn.wordpress.org/trunk@54632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 14:13:13 +00:00
youknowriad
ff7751868f Editor: Updated the bundled block pattern categories.
This adds descriptions to the existing pattern categories.
It also updates backports the new pattern categories: 
banner, call to action, posts, team, testimonials, services,
portfolio and contact.

Fixes #57479.

Built from https://develop.svn.wordpress.org/trunk@55098


git-svn-id: http://core.svn.wordpress.org/trunk@54631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 12:21:19 +00:00
youknowriad
0831f905f0 Editor: Allow block pattern categories to have descriptions.
Updates the corresponding REST API endpoint and unit test.

Fixes #57478.

Built from https://develop.svn.wordpress.org/trunk@55097


git-svn-id: http://core.svn.wordpress.org/trunk@54630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 12:13:14 +00:00
audrasjb
f92b90116a Application Passwords: Disable spellcheck for password field.
This changeset adds `spellcheck="false"` attribute to application password field.

Follow-up to [55094], [55095].

Props Spaceshipone.
Fixes #56763.

Built from https://develop.svn.wordpress.org/trunk@55096


git-svn-id: http://core.svn.wordpress.org/trunk@54629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 11:48:12 +00:00
audrasjb
a97156c76d Twenty Twenty-One: Disable spellcheck for post password field.
This changeset adds `spellcheck="false"` attribute to various password fields.

Follow-up to [55094].

Props dziudek, audrasjb, gainesm, fosuahmed.
See #56763.

Built from https://develop.svn.wordpress.org/trunk@55095


git-svn-id: http://core.svn.wordpress.org/trunk@54628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 09:12:12 +00:00
audrasjb
0f28fc7aed Login and Registration: Disable spellcheck for password fields.
This changeset adds `spellcheck="false"` attribute to various password fields.

The spellcheck global attribute defines whether the element may be checked for spelling errors. The `false` value indicates that the element should not be checked for spelling errors, which is relevant for a password field.

Furthermore, and as per MDN specs, using spellchecking can have consequences for users' security and privacy. The specification does not regulate how spellchecking is done and the content of the element may be sent to a third party for spellchecking results. Thus, it is recommended to set `spellcheck` attribute to `false` for elements that can contain sensitive information. Which is the case for password fields.

Props dziudek, audrasjb, gainesm, fosuahmed.
Fixes #56763.

Built from https://develop.svn.wordpress.org/trunk@55094


git-svn-id: http://core.svn.wordpress.org/trunk@54627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 08:53:13 +00:00
Felix Arntz
1a21c14d85 Media: Allow for customization of lazy-loading featured images.
When lazy-loading images was introduced, in [52065] the check for `wp_lazy_loading_enabled()` was omitted by accident in the logic to set the attribute with its default value on `img` tags from `get_the_post_thumbnail()`. Without this check, it is impossible for third-party developers to modify the behavior for featured images.

This changeset fixes the problem by introducing the check.

Props flixos90, joemcgill, mukesh27.
Fixes #57490.

Built from https://develop.svn.wordpress.org/trunk@55093


git-svn-id: http://core.svn.wordpress.org/trunk@54626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 07:34:14 +00:00
hellofromTonya
18b551b84d Themes: Revert caching from r55086.
Calls to `wp-admin/load-styles.php` do not include the loading of `wp_cache_*()` functions. With [55086], this caused a fatal error:

{{{
Fatal error: Uncaught Error: Call to undefined function wp_cache_get() in /wp-includes/global-styles-and-settings.php on line 285
}}}

In some production and local environments running `trunk`, the admin area looked broken as the styling was not loaded as there were no HTTP requests.

This commit reverts the caching from [55086] to restore sites running `trunk` until a solution is found.

Follow-up to [55086].

Props Otto42, dmsnell, costdev.
See #56975.
Built from https://develop.svn.wordpress.org/trunk@55092


git-svn-id: http://core.svn.wordpress.org/trunk@54625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-18 21:59:13 +00:00