Commit Graph

32261 Commits

Author SHA1 Message Date
John Blackbourn 678f2ceb0d Docs: Miscellaneous inline documentation improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@52014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-29 17:28:00 +00:00
Sergey Biryukov 9fb855eb48 Tests: Correct the check for the recommended MySQL version in `readme.html`.
This updates the regular expression in the test to retrieve the date of the first, instead of the last, GA release for the recommended MySQL branch, in order to properly track the EOL date.

Additionally, as the currently recommended MySQL 5.7 branch moved from active support to extended support on 2020-10-21, and WordPress core is not fully compatible with MySQL 8.0 at this time, this commit increases the “supported” period from 5 to 8 years to include extended support.

Follow-up to [31291], [35759], [meta11407], [52420].

See #41490.
Built from https://develop.svn.wordpress.org/trunk@52421


git-svn-id: http://core.svn.wordpress.org/trunk@52013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-29 16:36:05 +00:00
Sergey Biryukov aef38ab0e6 General: Bump the recommended MySQL and MariaDB versions in `readme.html`.
* MySQL 5.6 has reached EOL (“End of Life”) in February 2021. The recommended minimum is bumped to 5.7 for now.
* MariaDB 10.1 has reached EOL in October 2020. The recommended minimum is bumped to 10.2 for now.

Follow-up to [31291], [35759], [52319], [52358], [meta11407].

Props JavierCasares, SergeyBiryukov.
See #41490, #meta5999.
Built from https://develop.svn.wordpress.org/trunk@52420


git-svn-id: http://core.svn.wordpress.org/trunk@52012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-28 17:38:04 +00:00
Sergey Biryukov 05a3e19924 Plugins: Escape the WordPress.org plugin page URL in the Plugin Installation modal.
Follow-up to [8540], [38953].

Props chintan1896, Presskopp, dimadin, henry.wright, aezazshekh, SergeyBiryukov.
Fixes #54362.
Built from https://develop.svn.wordpress.org/trunk@52419


git-svn-id: http://core.svn.wordpress.org/trunk@52011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-27 16:06:02 +00:00
Sergey Biryukov 2caff694aa Tests: Separate the tests for recommended PHP and MySQL versions in `readme.html`
This aims to simplify the individual tests and reduce duplication using a helper function.

Follow-up to [52260], [52319], [52358].

See #41490.
Built from https://develop.svn.wordpress.org/trunk@52418


git-svn-id: http://core.svn.wordpress.org/trunk@52010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-26 23:42:05 +00:00
audrasjb 3366e3859f Login and Registration: Use secondary button style for the Language switcher.
This change avoids having two primary buttons in the login screen.

Props rainbowgeek, audrasjb.
Fixes #54692.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-25 11:36:59 +00:00
audrasjb d738794637 Docs: Typo correction in `validate_file()` comments.
See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-25 11:17:04 +00:00
Sergey Biryukov ef7cf47ec4 Administration: Make sure the `$customize_url` variable is always defined in the admin menu.
This avoids an `Undefined variable` PHP warning when displaying other admin menu items.

Follow-up to [52069], [52134], [52158], [52178], [52414].

Props afragen.
Fixes #54682.
Built from https://develop.svn.wordpress.org/trunk@52415


git-svn-id: http://core.svn.wordpress.org/trunk@52007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-25 03:32:03 +00:00
Sergey Biryukov 7996e87f38 Toolbar: Show the Customize link on front end when using a block theme if any plugins use the Customizer.
In WordPress 5.9, when a block theme is being used, the `Appearance → Customize` admin menu item is not present unless a plugin uses the Customizer.

The Customize admin bar node should be shown on the front end if any plugins are using the Customizer, even if the current theme is a block theme.

This commit mirrors a similar check in the admin menu to determine if the Customize link should be displayed.

Follow-up to [52069], [52134], [52158], [52178].

Props pbiron, audrasjb, sabernhardt, costdev.
Fixes #54683.
Built from https://develop.svn.wordpress.org/trunk@52414


git-svn-id: http://core.svn.wordpress.org/trunk@52006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-25 03:17:04 +00:00
Sergey Biryukov aea5f0cbde External Libraries: Update the SimplePie library to version 1.5.8.
This minor update corrects the `SIMPLEPIE_VERSION` constant and updates the changelog after the previous release.

Release notes: https://github.com/simplepie/simplepie/releases/tag/1.5.8

For a full list of changes in this update, see the SimplePie GitHub:
https://github.com/simplepie/simplepie/compare/1.5.7...1.5.8

Follow-up to [47733], [49176], [52393].

Props faisal03, jrf, audrasjb, SergeyBiryukov.
Fixes #54659.
Built from https://develop.svn.wordpress.org/trunk@52413


git-svn-id: http://core.svn.wordpress.org/trunk@52005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-24 18:06:06 +00:00
Sergey Biryukov 67b9822eda Build/Test Tools: Allow the PHPCS plugin in Composer configuration.
The `dealerdirect/phpcodesniffer-composer-installer` Composer plugin is used to register external PHPCS standards with PHPCS.

As of Composer 2.2, Composer plugins need to be explicitly allowed to run. This commit adds the necessary configuration for that to prevent Composer asking every single time `composer install` or `composer update` is run.

Reference: [https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution Composer 2.2: More secure plugin execution].

Props jrf, johnbillion.
Fixes #54686.
Built from https://develop.svn.wordpress.org/trunk@52412


git-svn-id: http://core.svn.wordpress.org/trunk@52004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-23 20:12:03 +00:00
Sergey Biryukov ee282eba1b Build/Test Tools: Restore the `https` URL for `browserify-aes`.
Follow-up to [52000], [52156], [52402].

See #54487.
Built from https://develop.svn.wordpress.org/trunk@52411


git-svn-id: http://core.svn.wordpress.org/trunk@52003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-23 17:03:04 +00:00
audrasjb b788e6255a Docs: Typo correction in `wp_get_layout_style()` introduced in 5.9.
Follow-up to [52069].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-22 23:20:04 +00:00
Sergey Biryukov 4a22a4cec3 Editor: Add missing default template areas to the post/page editor settings.
This ensures that default template area settings are displayed when editing a template in the post/page editor, which previously got lost during backporting for 5.9.

Follow-up to [52232].

Props Mamaduka, costdev, gziolo.
Fixes #54679.
Built from https://develop.svn.wordpress.org/trunk@52409


git-svn-id: http://core.svn.wordpress.org/trunk@52001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-22 13:00:03 +00:00
Sergey Biryukov 9cb7908de2 Post WordPress 5.9 Beta 4 version bump.
Built from https://develop.svn.wordpress.org/trunk@52408


git-svn-id: http://core.svn.wordpress.org/trunk@52000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 21:14:59 +00:00
Sergey Biryukov e88674b232 WordPress 5.9 Beta 4.
Built from https://develop.svn.wordpress.org/trunk@52407


git-svn-id: http://core.svn.wordpress.org/trunk@51999 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 20:32:59 +00:00
hellofromTonya 673ab8a677 Administration: Add "File" to Theme/Plugin Editor menu names and relocate "Plugin File Editor" to Tools for block themes.
[52232] relocated the Theme Editor menu item from Appearance to Tools for block themes. This commit relocates the Plugin  Editor menu item from Plugins to Tools for block themes for a consistent workflow.

Both the Theme Editor and Plugin Editor menu items are renamed to "Theme File Editor" and "Plugin File Editor" respectively. Why? To better identify their purpose, i.e. to directly edit the code in the theme or plugin files. The rename is not limited to only block themes. 

Follow-up to [52232].

Props poena, annezazu, audrasjb, clorith, courane01, costdev, dryanpress, desrosj, hellofromTonya, ipstenu, jameskoster, joen, johnbillion, joyously, manfcarlo, marybaum, pbiron, SergeyBiryukov, walbo, youknowriad.
Fixes #54382.
Built from https://develop.svn.wordpress.org/trunk@52406


git-svn-id: http://core.svn.wordpress.org/trunk@51998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 20:06:02 +00:00
audrasjb 5e08149bf4 Coding Standards: Remove unwanted whitespaces after [52404].
Follow-up to [52404].

See #54675.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 19:00:00 +00:00
audrasjb d0b3567730 Login and registration: Add a filter to allow to disable the Login screen language dropdown.
This change introduces the `display_login_language_dropdown` filter which allows to disable the Login screen language dropdown. 

Follow-up to [52058].

Props rickcurran, audrasjb, ocean90, hellofromtonya, costdev, johnbillion.
Fixes #54675.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 18:52:03 +00:00
Sergey Biryukov e6b9b96130 Docs: Improve the `@since 5.9.0` note for `WP_Theme_JSON::PRESETS_METADATA`.
Follow-up to [52320], [52401].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52403


git-svn-id: http://core.svn.wordpress.org/trunk@51995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 10:20:04 +00:00
isabel_brison 4939393799 Update @wordpress packages for Beta 4
Update packages with these bug fixes from Gutenberg:

Navigation: Remove hardcoded typography units
Handle parsed request
Navigation: Refactor modal padding to be simpler and more flexible
Show notice on save in site editor
Add aria-pressed true/false to Toggle navigation button based on state
Components FontSizePicker: Use incremental sequence of numbers
Custom keys from theme.json: fix kebabCase conversion
Template Part: Fix 'isMissing' condition check
Multi-Entity Saving: Decode HTML entities in item titles
Font sizes: update default values
Query Loop: Add useBlockPreview, fix Query Loop wide alignment
Only add dialog role to navigation when modal is open
Fix navigation appender
Show a UI warning when user does not have permission to update/edit a Navigation block
Block editor: Fix Enter handling for nested blocks
Update: Use subtitle styles for the palette names
Allow publishing a post while not saving changes to non-post entities
Update: Block top level useSetting paths
Fix Site Logo block alignment issues
Editor: when Toggle navigation receives state false, focus
ToolsPanel: Allow items to register when panelId is null
Block Support Panels - Make block support tools panels compatible
Gallery: Fix block registration hook priority
Navigation: Fix page list issues in overlay
Ensure the overlay menu works when inserting navigation block pattern
Restrict Navigation permissions and show UI warning if cannot create
Add block gap support for group blocks
Try cascading nav styles through classnames
Fix: Impossible to edit theme and default colors
Fix: Color editor discards colors with default name
Site Editor: Fix template author avatar check
Template Editing Mode: Fix options dropdown
Avoid undo issues when reset parent blocks for controlled blocks
Add comment-form and comment-list to html5 theme support and fix comment layout

Props hellofromtonya.
See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 07:02:34 +00:00
hellofromTonya af941fc10c Editor: Add support for nameless font sizes in `WP_Theme_JSON`.
With nameless font sizes support, themes use the defaults by not declaring the `"name"` setting for their `fontSizes` in `theme.json`.

Backport from Gutenberg https://github.com/WordPress/gutenberg/pull/37410.

Follow-up to [50973], [52049], [52275], [52320].

Props ntsekouras, costdev, hellofromTonya.
Fixes #54640. See #54487.
Built from https://develop.svn.wordpress.org/trunk@52401


git-svn-id: http://core.svn.wordpress.org/trunk@51993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 06:02:06 +00:00
hellofromTonya 770e631dfc Editor: Add 'edit_theme_options' capabilities to `wp_navigation` post type.
Adds `'edit_theme_options'` capabilities top restrict Navigation permission.

Partial backport from Gutenberg https://github.com/WordPress/gutenberg/pull/37454.

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

Props spacedmonkey, get_dave, hellofromTonya.
See #54487.
Built from https://develop.svn.wordpress.org/trunk@52400


git-svn-id: http://core.svn.wordpress.org/trunk@51992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 04:26:00 +00:00
hellofromTonya 84229df562 REST API: Support `.` in theme directory names in `WP_REST_Global_Styles_Controller`, `WP_REST_Templates_Controller`, and `WP_REST_Themes_Controller`.
Regex changes from [52376] are reverted to restore the original regex patterns. Why? [52376] used an include characters pattern, which was too limiting. It did not account for localized characters, such as `é`, or other valid directory name characters.

The original theme directory regex pattern, i.e. `[^.\/]+(?:\/[^.\/]+)?` excluded the period `.` character. Removing the `.` character resolves the reported issue by allowing matching for `themes/theme-dirname-1.0/` or `themes/<subdirname>/theme-dirname-1.0/`.

As the pattern used an exclude approach, all characters are valid for matching except for `/`. However, not all characters are cross-platform valid for directory names. For example, the characters `/:<>*?"|` are not valid on Windows OS. The pattern now excludes those characters.

The theme's directory (or subdirectory) name pattern matching is now used in `WP_REST_Global_Styles_Controller`, `WP_REST_Templates_Controller`, and `WP_REST_Themes_Controller`.

Follow-up to [51003], [52051], [52275], [52376].

Props costdev, hellofromTonya, spacedmonkey, TimothyBlynJacobs, bijayyadav, kafleg.
Fixes #54596.
Built from https://develop.svn.wordpress.org/trunk@52399


git-svn-id: http://core.svn.wordpress.org/trunk@51991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 04:14:00 +00:00
hellofromTonya 28b0710360 Application Passwords: Show HTTPS required message without filtering when not enabled or not in local environment.
When `add_filter( 'wp_is_application_passwords_available', '__return_false' )` exists, HTTPS requirement message is shown even if HTTPS is enabled on the site. This happens because `wp_is_application_passwords_available_for_user()` first invokes `wp_is_application_passwords_available()` which is filterable. The situation could happen if the `'wp_is_application_passwords_available_for_user'` filter returns `false`.

To fix this, the check for HTTPS (or if in a 'local' environment) is moved to a new function called `wp_is_application_passwords_supported()`. Then the return from this function is used as an OR condition for the Application Passwords section and for displaying the HTTPS required message.

Tests are included for both `wp_is_application_passwords_supported()` and `wp_is_application_passwords_available()`.

Follow-up to [51980], [51988].

Props davidbinda, SergeyBiryukov, ocean90, felipeelia, costdev, hellofromTonya.
Fixes #53658.
Built from https://develop.svn.wordpress.org/trunk@52398


git-svn-id: http://core.svn.wordpress.org/trunk@51990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 02:45:03 +00:00
hellofromTonya f067011b59 Editor: Explicitly declare `$post_types` and `$area` properties in `WP_Block_Template` class.
The `$post_types` and `$area` properties are assigned in the `_build_block_template_result_from_file()` and `_build_block_template_result_from_post()` functions. However, neither property was explicitly declared in the `WP_Block_Template` class.

This commit explicitly declares both properties in the class. Why? (1) To make the code more readable and maintainable; (2) to avoid a `Deprecated: Creation of dynamic property WP_Block_Template::$post_types is deprecated` deprecation when PHP 8.2 is released.

Ref:
* PHP 8.2 Deprecate dynamic properties https://wiki.php.net/rfc/deprecate_dynamic_properties

Follow-up to [52062].

Props jrf.
Fixes #54670.
Built from https://develop.svn.wordpress.org/trunk@52397


git-svn-id: http://core.svn.wordpress.org/trunk@51989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 00:28:00 +00:00
hellofromTonya bf60226e36 General: Fix `'rel'` argument in `Tests_Functions_wpListBookmarks` test datasets.
`wp_list_bookmarks()` arguments include `'link_rel'`, but not `'rel'`. This commit fixes this argument in the test datasets. It also adds an expected `'rel=""'` result check, i.e. instead of only checking for `'noopener'`.

Follow-up to [52395].

Props davidbinda.
Fixes #53839.
Built from https://develop.svn.wordpress.org/trunk@52396


git-svn-id: http://core.svn.wordpress.org/trunk@51988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 00:12:03 +00:00
hellofromTonya a3dedd1d4d Script Loader: Skip getting `'can_compress_scripts'` option in `script_concat_settings()` during install.
When installing a multisite, there is a potential access to a non-existent database table that needs to be skipped to avoid warnings/errors. This fix checks is WordPress is not installing before getting the `'can_compress_scripts'` option.

Props schlessera.
Fixes #54634.
Built from https://develop.svn.wordpress.org/trunk@52395


git-svn-id: http://core.svn.wordpress.org/trunk@51987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-20 23:53:01 +00:00
audrasjb ea138fdcb9 Docs: Typo correction in `wp_dropdown_languages()` DocBlock.
Follow-up to [52058].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-20 22:26:02 +00:00
Sergey Biryukov c3112cab39 External Libraries: Update the SimplePie library to version 1.5.7.
This version shows significant improvements in the compatibility of SimplePie with PHP 8.0, 8.1, and even contains an initial PHP 8.2 fix. The release also contains a number of other bug fixes.

Release notes: https://github.com/simplepie/simplepie/releases/tag/1.5.7

For a full list of changes in this update, see the SimplePie GitHub:
https://github.com/simplepie/simplepie/compare/1.5.6...1.5.7

Follow-up to [47733], [49176].

Props jrf, SergeyBiryukov.
Fixes #54659.
Built from https://develop.svn.wordpress.org/trunk@52393


git-svn-id: http://core.svn.wordpress.org/trunk@51985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-20 19:33:00 +00:00
jffng 9759353922 Twenty Twenty-Two: Sync updates from GitHub for Beta 4.
This commit syncs changes for the default theme from its active development repository to core. 

This is a follow up to [52081], [52107], [52164], [52222], [52283], [52335], and [52375]. It updates the theme's font size presets and fixes an issue with query padding.

To view the full set of changes, visit 623a4d7982...d6cb56cce4.

Props schlessera, williampatton, hellofromtonya, kjellr.
See #54318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-20 16:50:05 +00:00
Sergey Biryukov cc5119e5e1 Tests: Use shared fixtures in block theme tests.
This removes duplicate test data and aims to avoid future confusion about which themes to use in which tests.

Follow-up to [52049], [52246], [52247], [52279].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@52391


git-svn-id: http://core.svn.wordpress.org/trunk@51983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-19 16:25:02 +00:00
John Blackbourn 3324ed52ad Build/Test Tools: Remove the assertion in `filter_rest_url_for_leading_slash()`.
This assertion can mask the fact that some other tests don't perform an assertion.

Fixes #54661

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


git-svn-id: http://core.svn.wordpress.org/trunk@51982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-19 14:29:00 +00:00
John Blackbourn 1af8544d80 Build/Test Tools: Reduce the use of unnecessary randomness in tests.
This increases the overall reliability of the tests.

Props johnillo

Fixes #37371

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


git-svn-id: http://core.svn.wordpress.org/trunk@51981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-19 13:44:00 +00:00
Sergey Biryukov 3d4ac53c89 Tests: Fix typo in a data provider name.
Follow-up to [52261], [52387].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@52388


git-svn-id: http://core.svn.wordpress.org/trunk@51980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-18 21:46:00 +00:00
Sergey Biryukov 28b48cecd6 Tests: Fix typo in a test method name.
Follow-up to [52261].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@52387


git-svn-id: http://core.svn.wordpress.org/trunk@51979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-18 21:17:59 +00:00
Sergey Biryukov d37081cac2 Tests: Move the tests for theme features that block themes should support by default to a more appropriate place.
As these tests are intended for the `_add_default_theme_supports()` function rather than `WP_Theme` class methods, the `tests/theme.php` file is a more logical place for them than `tests/theme/wpTheme.php`.

Follow-up to [52369], [52383].

See #54597.
Built from https://develop.svn.wordpress.org/trunk@52386


git-svn-id: http://core.svn.wordpress.org/trunk@51978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-18 21:10:03 +00:00
audrasjb 8698dc9721 Site Health: Typo correction in Site Health help tab.
Follow-up to [52053].

Props pedromendonca.
Fixes #54656.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-18 21:02:04 +00:00
antpb a6a27970a9 Media: Fix selections in Media Library Featured Image modal on open.
In [50829] infinite scrolling was removed from the Media Library and modal which introduced unintended behavior for featured images where only the selected image shows when opening the library. This change reverts only the logic that caused this and applies a proper fix when opening the library.

Props benitolopez, hellofromTonya, joedolson, peterwilsoncc, circlecube, danielbachhuber, PieWP, sabernhardt, szaqal21, dariak, sergeybiryukov.
Fixes #53765.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-17 20:17:05 +00:00
Sergey Biryukov 0795991b6f Tests: Add unit tests for theme features that block themes should support by default.
By default, block themes should have a few theme supports enabled:
* `post-thumbnails`
* `responsive-embeds`
* `editor-styles`
* `html5` for `comment-form`, `comment-list`, `style`, `script`
* `automatic-feed-links`

They should also load core block assets only when the blocks are rendered. This commit adds the associated tests.

Follow-up to [52369].

Props costdev.
See #54597.
Built from https://develop.svn.wordpress.org/trunk@52383


git-svn-id: http://core.svn.wordpress.org/trunk@51975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-16 14:47:04 +00:00
Sergey Biryukov 1eb2a65984 Tests: Mock the HTTP request response in `download_url()` tests.
This aims to speed up the tests and minimize unrelated failures by avoiding an unnecessary external HTTP request, while still performing the intended functionality checks.

Update similar helpers in some other tests to use more consistent terminology.

Follow-up to [37907], [46175], [51626].

See #54420, #53363.
Built from https://develop.svn.wordpress.org/trunk@52382


git-svn-id: http://core.svn.wordpress.org/trunk@51974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-15 20:01:00 +00:00
Sergey Biryukov df494e0987 Tests: Add an assertion to test the `WP_REST_Server::add_site_logo_to_index()` method.
Additionally:
* Move the test for `WP_REST_Server::add_active_theme_link_to_index()` to a more logical place.
* Replace `assertEquals()` with `assertSame()` in site icon test to also check the type of the value.
* Use a more consistent pattern for the tests.

Follow-up to [51241], [52080].

Props ignatggeorgiev, desrosj, SergeyBiryukov.
Fixes #53516. See #53363.
Built from https://develop.svn.wordpress.org/trunk@52381


git-svn-id: http://core.svn.wordpress.org/trunk@51973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-15 18:08:05 +00:00
isabel_brison 7b3c904f37 Fix deprecated usage of passing null to explode()
As of PHP 8.1, explode() does not permit null as its second argument. This results in warnings being spat out on every page because of a usage of this in wp-includes/block-supports/layout.php.

See #53635.
Props noisysocks.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-15 04:08:04 +00:00
Sergey Biryukov e02e7be1b6 Post WordPress 5.9 Beta 3 version bump.
Built from https://develop.svn.wordpress.org/trunk@52379


git-svn-id: http://core.svn.wordpress.org/trunk@51971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 21:25:01 +00:00
Sergey Biryukov 58bb50562c WordPress 5.9 Beta 3.
Built from https://develop.svn.wordpress.org/trunk@52378


git-svn-id: http://core.svn.wordpress.org/trunk@51970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 20:25:59 +00:00
hellofromTonya 4132ac0f48 Editor: Add "Featured" patterns from pattern directory to Patterns in block inserter.
This commit backports the remote "Featured" category request and loads it into the Featured Patterns in the block inserter.

Props ryelle.
Fixes #54623.
Built from https://develop.svn.wordpress.org/trunk@52377


git-svn-id: http://core.svn.wordpress.org/trunk@51969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 19:39:06 +00:00
hellofromTonya 84d67f77f6 REST API: Add block theme support for valid non-alphanumeric characters in theme's directory name.
Themes whose `wp-content/themes/<dirname>` include valid non-alphanumeric (cross-platform) characters work for non-block themes, but did not previously resolve for block themes. For example, a block theme in `wp-content/themes/twentytwentytwo-0.4.0/` directory resulted a 404 "No route was found matching the URL and request method" response when attempting to customize it in the Site Editor.

This commit adds support for the following characters in a theme's root directory: `_`, `.`, `@`, `[`, `]`, `(`, and `)`. Subdirectory themes and `-` are already supported.

Follow-up to [51003], [52051], [52275].

Props mkaz, costdev, hellofromTonya, jffng, justinahinon, peterwilsoncc, spacedmonkey, TimothyBlynJacobs.
Fixes #54596.
Built from https://develop.svn.wordpress.org/trunk@52376


git-svn-id: http://core.svn.wordpress.org/trunk@51968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 18:24:01 +00:00
jffng b3c06d8bb1 Twenty Twenty-Two: Sync updates from GitHub for Beta 3.
This commit syncs minor changes for the default theme from its active development repository to core. 

This is a follow up to [52081], [52107], [52164], [52222], [52283], and [52335]. The two main changes introduce global padding to site content while still allowing content to be full-width, and re-organize block patterns into Core's existing categories. 

To view the full set of changes, visit da994d1fe5...88a8f2e3b4.

Props onemaggie, joen, youknowriad, scruffian, sabernhardt, kjellr.
See #54318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 17:11:01 +00:00
spacedmonkey f1f71a0798 REST API: Ensure that the get_theme_item method should respect fields param.
Fix the `get_theme_item` method in the `WP_REST_Global_Styles_Controller` class to respect the fields param context filtering and to return links. 

Props spacedmonkey, hellofromtonya, peterwilsoncc, costdev.
Fixes #54595.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 16:31:00 +00:00
John Blackbourn 0124d01d1d Database: Correct and improve documentation for properties and parameters in `wpdb`.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 16:24:02 +00:00
hellofromTonya 65a4199149 Themes: Rename public static functions in `WP_Theme_JSON_Resolver` to remove `custom_post_type` references.
WordPress Core is not really custom and does not reference "custom post type" in its function naming. This commit renames 2 public static methods:

* `WP_Theme_JSON_Resolver::get_user_custom_post_type_id()` renamed to `WP_Theme_JSON_Resolver::get_user_global_styles_post_id()`.
* `WP_Theme_JSON_Resolver::get_user_data_from_custom_post_type()` renamed to `WP_Theme_JSON_Resolver:: get_user_data_from_wp_global_styles()`.

Follow-up to [52049], [52051], [52069], [52232], [52275], [52364].

Props antonvlasenko, bernhard-reiter, costdev, desrosj, hellofromTonya, noisysocks, oandregal, SergeyBiryukov.
Fixes #54517.
Built from https://develop.svn.wordpress.org/trunk@52372


git-svn-id: http://core.svn.wordpress.org/trunk@51964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 16:14:01 +00:00
hellofromTonya edf755823b Customize: Overlay incompatible banner for block themes.
Starting in 5.9, block themes are not compatible with (do not support) Customizer; rather, they use the Site Editor. Viewing installed themes in Customizer, this commit adds an overlay message to alert users and give them a way to activate the block theme. Clicking on the "Activate" button activates the block theme and redirects back to the Appearance > Themes interface, where the user can then enter the Site Editor for customization.

Non-block themes are not affected by this change and continue to work in Customizer.

Follow-up to [41648], [41893], [52279].

Props antonvlasenko, costdev, hellofromTonya, jffng, joyously, noisysocks, poena, shaunandrews.
Fixes #54549.
Built from https://develop.svn.wordpress.org/trunk@52371


git-svn-id: http://core.svn.wordpress.org/trunk@51963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 15:33:01 +00:00
hellofromTonya dfef2c917f Formatting: Use `is_scalar()` in `sanitize_key()`.
This is a follow-up to [52292] which introduced `is_string()` to check the given key is a string to be sanitized, else the key is set to an empty string. 

`sanitize_key()` is clearly identified (in the documentation) to only work with ''string'' keys. However, it had a bug in it that allowed non-strings to pass through it:
* A non-scalar "key" would throw a PHP Warning (which was resolved in [52292]. 
* A non-string scalar "key" was handled by the PHP native `strtolower()` which converted it into a string.

While `is_string()` is valid, non-string scalar types passed as the key to be sanitized were being set to an empty string. Given that `strtolower()` handles these without error or deprecation as of PHP 8.1, `is_scalar()` protects the website from issues while retaining the past behavior of converting integer keys (for example) into a string.

Changes include:
* Using `is_scalar()` instead of `is_string()`
* Refactor for readability and less code
* More tests

Please note, this does not change the behavior of the function, nor redefine it to now accept non-string scalars.

References:
* https://developer.wordpress.org/reference/functions/sanitize_key/
* https://www.php.net/manual/en/function.strtolower.php

Follow-up [52292].

Props wppunk, hellofromTonya, costdev, jrf.
Fixes #54160.
Built from https://develop.svn.wordpress.org/trunk@52370


git-svn-id: http://core.svn.wordpress.org/trunk@51962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 15:01:03 +00:00
audrasjb 9b694a6f49 Editor: Activate missing default theme features for block themes.
By default, block themes should have a few theme supports enabled by default. These are: `post-thumbnails`, `responsive-embeds`, `editor-styles`, `html5`, `automatic-feed-links`. This changeset backports the changes introduced in https://github.com/WordPress/gutenberg/pull/35593.

Props noisysocks, ocean90, youknowriad, audrasjb, hellofromTonya.
Fixes #54597.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 09:49:00 +00:00
audrasjb 1309e62457 Posts, Post Types: Add missing translation context on FSE related post types labels.
This makes it easier for translators to identify the context of each label. This change also brings consistency with other built-in post types.

Follow-up to [52145], [52069], [52062], [52041], [51003].

Props audrasjb, hellofromTonya.
Fixes #54611.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 09:09:01 +00:00
audrasjb bcb9285589 Docs: Use generic references to "Database" in `wp-config-sample.php`.
This replaces the references to "MySQL" info in the WordPress configuration sample file. Using the generic term "Database" now refers to either MySQL or MariaDB.

Props Ov3rfly, audrasjb, hellofromTonya.
Fixes #54610.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 08:44:02 +00:00
audrasjb e5a1ed2fb2 Docs: Typo correction in TinyMCE related JS file.
Follow-up to [45066].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 08:30:04 +00:00
noisysocks 3cd0e25c03 Filter custom block templates with PHP
This method calls get_block_templates once and uses block template properties
directly for filtering. This way, we can avoid hitting the database for each
public post type.

The previous method is useful when we already know the current post type we
request templates for, like when using REST API.

Follows [52334].
See #54335.
Props mamaduka, youknowriad.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 02:46:00 +00:00
noisysocks 935058d178 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Image block: Set image display to grid when no alignment sent to properly align caption on resize
- Update and align template descriptions
- Site Editor - prevent loading state from showing the admin menu.
- Add client side routing for Site Editor
- Navigation: Add clearance for appender in submenus.
- Fix CSS Custom Properties for presets in the site editor
- Add/navigation blocks post processing after migration from menu items
- Allow selector ordering to ensure theme.json root selector margin takes precedence 
- Do not remove theme presets if defaults are hidden
- Format library: fix unsetting highlight color
- FSE: Fix template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity
- ColorPalette: Improving accessibility and visibility
- Update: Make the color popover on the gradient picker appear as expected
- Site Editor: Display a notice if export fails
- Fix docs and function naming for gallery block registration in PHP
- Switch to addEventListener for load event in the navigation block view script
- Fix mistake in _remove_theme_attribute_in_block_template_content
- Better synchronisation between Gutenberg and Core code
- Move the block page templates hook into compat/5.9 folder
- Moves to the template loader hooks and functions into lib/compat folder
- Refactor the gutenberg_is_fse_theme function to use wp_is_block_theme
- Site Editor: Update support doc URL in Welcome Guide
- Global Styles: Add Welcome Guide toggle
- Hide remove control point when removing would break gradient control
- Don't request the deprecated navigation areas endpoint outside of the Gutenberg plugin
- Image: Fix resizer controls being hidden in Safari when switching between alignments
- Remove Navigation Menus from WP Admin sidebar
- Site Editor: Hide the block appender in the Template Part editor
- Site Editor: Use server definition for the Template Areas
- Synchronize wp_is_block_theme and block-templates block support with Core
- E2E: Retry login again after a bad nonce request to prevent intermittent test failures 
- Fix theme requirement validation with WP 5.8
- Fix WP 5.9 check for conditionally running code
- Fix post comment form input width
- Border Style Control: Update styling for consistency with border width control
- Fix form-submit styles by adding button classes to the submit-button in post-comments block
- Site Editor: Fix edit template part link in header dropdown
- Move duotone palette to the bottom of global styles gradients
- Fix how appearanceTools works
- Move WP 5.9 wp-admin menus compatibility code to lib/compat folder
- Revert "Site Editor: Set the <title> on the list page to be same as the CPT name"
- Site Editor: Document Actions: add SR text to heading 1
- Do not register global styles CPT in WordPress 5.9
- Global Styles: Move the 'Edit colors' button to a standard menu item
- Fix styles for previews and patterns
- Site Editor: Fix failing E2E test
- Templates: Search for old template names in the parent theme too
- Remove 4 instances of 'gutenberg' text domain from WordPress core
- Fix content loss when ungrouping template parts or reusable blocks
- Simplify the RESET_BLOCK action to fix template part focus mode content loss
- [Global Styles]: Make Blocks section more distinguishable
- Only use block markup for comment form button when using a block theme
- Navigation: Fix vertical alignment of page list in modal.
- Fix: ToggleGroupControl active state
- Remove gutenberg_ prefix from @wordpress/block-library

Props ocean90, oandregal, hellofromtonya, youknowriad.
See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-14 01:57:26 +00:00
spacedmonkey 120b1ab117 REST API: Ensure that the parent link, uses the rest_get_route_for_post function.
In [51962] the `rest_get_route_for_post` function was implemented in all places where link to a post's REST API endpoint is needed. However in this commit, the up link, which links to the parent post of the current object, did not use this function.   

Props Spacedmonkey, SergeyBiryukov.
Fixes #53656.



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


git-svn-id: http://core.svn.wordpress.org/trunk@51955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-13 15:20:03 +00:00
Sergey Biryukov d09d194f12 Docs: Capitalize "ID", when referring to a widget ID or sidebar ID, in a more consistent way.
Follow-up to [48104], [52357], [52361].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52362


git-svn-id: http://core.svn.wordpress.org/trunk@51954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-13 10:21:07 +00:00
audrasjb cfd6406f8f Docs: Capitalize "ID", when referring to a sidebar ID in a more consistent way.
Follow-up to [52016].

See #53399.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-12 19:01:02 +00:00
audrasjb f4683efbc9 Docs: Document the global used in `upgrade_590()` function.
Follow-up to [51917].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-12 17:57:00 +00:00
Sergey Biryukov 02e384322f Build/Test Tools: Disable WP Cron when installing PHPUnit tests.
During the WordPress installation process when running the test suite, an HTTP request was always fired by a cron task and failed, because tests are run in CLI mode only.

To avoid that, the `DISABLE_WP_CRON` constant was previously added to the `bootstrap.php` file. However, the constant is not passed to the `install.php` script. This commit makes a similar change to `install.php`.

Follow-up to [760/tests], [872/tests].

Props Chouby.
Fixes #54612.
Built from https://develop.svn.wordpress.org/trunk@52359


git-svn-id: http://core.svn.wordpress.org/trunk@51951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-12 15:48:00 +00:00
Sergey Biryukov 88bf87de8c General: Mark the recommended MariaDB version number in `readme.html` with a `<strong>` tag.
This brings consistency with the MySQL version number.

Follow-up to [52319].

See #41490.
Built from https://develop.svn.wordpress.org/trunk@52358


git-svn-id: http://core.svn.wordpress.org/trunk@51950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-12 14:58:00 +00:00
Sergey Biryukov 6cb050d878 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
Follow-up to [48104].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52357


git-svn-id: http://core.svn.wordpress.org/trunk@51949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-12 14:54:00 +00:00
Sergey Biryukov 75fc6b755b Docs: Update a comment in `wp-admin/load-styles.php` per the documentation standards.
Follow-up to [52352].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52356


git-svn-id: http://core.svn.wordpress.org/trunk@51948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-12 14:52:02 +00:00
Sergey Biryukov 8bdaf90a14 Docs: Update some `@var` tags per the documentation standards.
Follow-up to [27398], [29487], [41626], [51003].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52355


git-svn-id: http://core.svn.wordpress.org/trunk@51947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-11 19:50:59 +00:00
audrasjb adee0cbf6b Docs: Docblock adjustments in some 5.9 block related functions.
Adds missing `@since` mention to `wp_enqueue_block_style()` and `_wp_multiple_block_styles()`, and a few other minor changes. 

Follow-up to [52069].

See #53359.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-11 11:16:03 +00:00
hellofromTonya f847144952 Themes: Show only "Customize" or "Activate" button in block theme's Theme Details modal.
At the bottom of a block theme's "Theme Details" modal, only one button will be displayed:
* "Customize" button when the block theme is activated;
* Else, the "Activate" button.

The "Live Preview", "Editor beta", and "Navigation Menus" buttons are removed.

Follow-up to [15646], [52341], [52346].

Props poena, ryelle, kafleg, antonvlasenko, costdev, SergeyBiryukov, hellofromTonya.
Fixes #54578.
Built from https://develop.svn.wordpress.org/trunk@52353


git-svn-id: http://core.svn.wordpress.org/trunk@51945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-10 20:33:00 +00:00
Sergey Biryukov 3beb1d25ab Docs: Correct the format of some comments per the documentation standards.
Follow-up to [10357], [10939], [43309], [51003], [51266], [51653], [51738], [52110].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52352


git-svn-id: http://core.svn.wordpress.org/trunk@51944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-10 20:30:05 +00:00
Peter Wilson 88b1019dc3 Upgrade/install: Revert upgrader rollback features.
Revert the rollback features introduced for theme and plugin upgrades during the WordPress 5.9 cycle. A bug (suspected to be in third party virtualisation software) causes the upgrades to fail consistently on some set ups. The revert is to allow contributors further time to investigate mitigation options.

Reverts [52337], [52289], [52284], [51951], [52192], [51902], [51899], [51898], [51815].

Props pbiron, dlh, peterwilsoncc, galbaras, SergeyBiryukov, afragen, costdev, bronsonquick, aristath, noisysocks, desrosj, TobiasBg, hellofromTonya, francina, Boniu91.
See #54543, #54166, #51857.



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


git-svn-id: http://core.svn.wordpress.org/trunk@51943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-10 00:06:04 +00:00
Sergey Biryukov 852fad7531 Coding Standards: Remove a trailing comma from a `compact()` call in `_wp_customize_include()`.
This fixes a `Trailing comma's are not allowed in function calls in PHP 7.2 or earlier` error in the PHP compatibility check.

Follow-up to [52348].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@52350


git-svn-id: http://core.svn.wordpress.org/trunk@51942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 15:32:01 +00:00
Sergey Biryukov 7ffc7c29cc Editor: Add an editor settings flag to enable the new gallery for mobile apps for 5.9.
Currently the WordPress mobile apps rely on the `__unstableGalleryWithImageBlocks` flag being set in order to enable the new gallery block format.

This commit includes the value in the `get_default_block_editor_settings()` function in order to ensure that versions of the mobile app >= 18.2 will be able to add and edit gallery blocks in the new format.

Props glendaviesnz, ocean90, hellofromTonya, noisysocks.
Fixes #54583.
Built from https://develop.svn.wordpress.org/trunk@52349


git-svn-id: http://core.svn.wordpress.org/trunk@51941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 15:25:01 +00:00
Sergey Biryukov d8934f9acb Coding Standards: Simplify or wrap some long conditions in `wp-includes/theme.php` for better readability.
Includes adjusting some DocBlocks per the documentation standards.

Follow-up to [35595], [41937], [52256].

See #53359, #53399.
Built from https://develop.svn.wordpress.org/trunk@52348


git-svn-id: http://core.svn.wordpress.org/trunk@51940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 15:13:04 +00:00
youknowriad 0441885c15 Themes: Auto-enable block-templates support for all block themes.
Block themes without theme.json file used to have block-templates support disabled.
This commit brings this in sync with the behavior in the gutenberg plugin.

See #54335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51939 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-09 09:56:04 +00:00
Sergey Biryukov 62574145ce Coding Standards: Use camel case with a lowercase first letter for the `blockTheme` array key.
This matches the WordPress JS naming conventions and the naming of other keys in the `$prepared_themes` array.

Follow-up to [52341].

See #54578, #53359.
Built from https://develop.svn.wordpress.org/trunk@52346


git-svn-id: http://core.svn.wordpress.org/trunk@51938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-08 10:16:05 +00:00
audrasjb 12369a6425 Coding Standards: Correct alignment in `blocks.php` and `class-wp-rest-templates-controller`.
See #53359.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 22:49:59 +00:00
Sergey Biryukov abed17b03d Post WordPress 5.9 Beta 2 version bump.
Built from https://develop.svn.wordpress.org/trunk@52344


git-svn-id: http://core.svn.wordpress.org/trunk@51936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 21:58:01 +00:00
Sergey Biryukov 600aa23dd6 WordPress 5.9 Beta 2.
Built from https://develop.svn.wordpress.org/trunk@52343


git-svn-id: http://core.svn.wordpress.org/trunk@51935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 21:20:59 +00:00
spacedmonkey ec370a0af4 REST API: Improve permission handling in global style endpoint.
The new wp_global_styles post type is registered to use edit_theme_options in the capability settings. The WP_REST_Global_Styles_Controller class's permission checks methods use the capability in a hard coded form rather than looking up the capability via the post type object. Changing the permission callbacks to lookup capabilities via the post type object, allows theme and plugin developers to modify the capability used for editing global styles via a filter and these values to be respected via the Global Styles REST API.

Props Spacedmonkey, peterwilsoncc, hellofromTonya , antonvlasenko, TimothyBlynJacobs, costdev, zieladam.
Fixes #54516.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 20:58:00 +00:00
hellofromTonya 9aba2584bb Themes: Hide "Live Preview" button for FSE block themes.
Currently, the Site Editor does not have a live preview feature for non-activated block themes.

This commit is a stop-gate to remove the "Live Preview" button for those themes. It avoids confusing users and avoiding a notification message that doesn't make sense.

Props antonvlasenko, costdev, hellofromTonya, kafleg, paaljoachim.
Fixes #54578.
Built from https://develop.svn.wordpress.org/trunk@52341


git-svn-id: http://core.svn.wordpress.org/trunk@51933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 20:07:00 +00:00
spacedmonkey 40b22d1209 REST API: Ensure that the export template endpoint returns a valid WP_Error object.
Ensure that the export template endpoint returns a WP_Error object, including code and message, so that the site editor can display an error message. 
Add some basic unit tests to ensure that permission checks are working as expected. 

Follow-up to [52286].

Props Spacedmonkey, dlh, hellofromTonya , Mamaduka, TimothyBlynJacobs.
Fixes #54448.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 18:38:02 +00:00
audrasjb 153e27f625 Coding Standards: Replace `else if` with `elseif` after [52338].
Follow-up to [52338].

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


git-svn-id: http://core.svn.wordpress.org/trunk@51931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 17:49:01 +00:00
audrasjb cdafa716f7 Script Loader: Allow for `wp_register_script()` to be called after `wp_enqueue_script()`.
When a plugin registers styles/scripts on `wp_enqueue_scripts` (as plugin authors are encouraged to do), and conditionally enqueues their script/style on `the_content` filter, things "just work". In block themes, `the_content` is run prior to the header being processed, which results in the above scenario failing.

This change makes a `wp_enqueue_script( 'example' ); wp_register_script( 'example' );` work, where as currently the enqueue silently fails (no "doing it wrong" message) and the following register has no impact. Scripts can therefore be enqueued and dequeued (by "handle") before they are registered.

Fixes #54529.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 17:46:01 +00:00
hellofromTonya 4f0c8ef665 Upgrade/Install: Fix moving plugins folder in `WP_Upgrader:: move_to_temp_backup_dir()`.
[51815] introduced the creation of a temporary backup of plugins before updating.

The `move()` (and later, `move_dir()`) call) uses a `$src` parameter.
For Hello Dolly, this is `<path>/wp-contents/plugins/.` (note the period at the end).

For users on Linux and Mac, this doesn't appear to cause any problems.
However, on Windows, the move causes the plugins folder to be moved which then causes a failure when attempting to call `mkdir()`.

This commit skips any plugin whose slug is `'.'` as this slug results in the `$src` value ending in a period. 

Follow-up to [51815].

Props costdev, boniu91, hellofromTonya.
Fixes #54543.
Built from https://develop.svn.wordpress.org/trunk@52337


git-svn-id: http://core.svn.wordpress.org/trunk@51929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 16:51:03 +00:00
youknowriad ec25c4ee57 Site Editor: Render the template descriptions properly.
The initializaion of the editor was a bit different between Gutenberg and Core.
This brings them in sync which solves the missing descriptions from the template header
in the site editor.

See #54337.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 16:40:01 +00:00
jffng ef4271cfee Twenty Twenty-Two: Sync updates from GitHub.
This commit syncs minor changes for the default theme from its active development repository to core. 

This is a follow up to [52081], [52107], [52164], [52222], and [52283]. It reduces the size of a video asset, renames the templates and template parts directories, and adds CSS for button hover states. To view the full set of changes, visit 1a121e0224...da994d1fe5.

Props kjellr, mburridge, sabernhardt, hellofromtonya, scruffian.
See #54318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 16:38:02 +00:00
youknowriad 76419adcaa Block Editor: Only list custom block templates in the template selector.
Previously all block templates including the hierarchy templates were being shown in the CPT template selector.

Props mamaduka.
See #54335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 16:33:05 +00:00
hellofromTonya 177a4d830b REST API: Pass post type name to `rest_get_route_for_post_type_items()`.
The new `rest_get_route_for_post_type_items()` function accepts a string, not an object. This commit passes the post type name instead of the object to resolve a notice in the site editor page.

Follow-up to [52281].

Props walbo.
Fixes #54536.
Built from https://develop.svn.wordpress.org/trunk@52333


git-svn-id: http://core.svn.wordpress.org/trunk@51925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 16:15:02 +00:00
John Blackbourn 39bff93b6b Docs: Various inline documentation corrections and improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:20:02 +00:00
youknowriad bc3356601e Site Editor: Update the block template descriptions.
Align the template descriptions with the latest changes from the Gutenberg plugin.

Props jameskoster, SergeyBiryukov.
See #54335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 12:12:04 +00:00
hellofromTonya f70fb51f99 Themes: Better names for `WP_Theme::is_block_theme()` and `wp_is_block_theme()` and make `wp_is_block_theme()` a wrapper.
This commit renames the following method and function to better represent block theme terminology:

* `WP_Theme::is_block_based()` to `WP_Theme::is_block_theme()`
* `wp_is_block_template_theme()` to `wp_is_block_theme()`

It also changes `wp_is_block_theme()` to be a helper wrapper (sugar syntax) for `wp_get_theme()->is_block_theme();`. Why? To ensure both the method and function behave the same, to help Gutenberg maintain WordPress cross-version compatibility, and to make it less cumbersome to port changes from Gutenberg to Core.

Follow-up to [52069], [52247], [52279].

Props antonvlasenko, costdev, hellofromTonya, noisysocks.
Fixes #54550.
Built from https://develop.svn.wordpress.org/trunk@52330


git-svn-id: http://core.svn.wordpress.org/trunk@51922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-07 00:02:02 +00:00
hellofromTonya 2e2829904b Editor: Allow theme.json to take precedence in setting the root level element's reset margin value.
Any margin added to the root element via `theme.json` is overwritten by a CSS reset margin value provided by the Gutenberg Plugin.

This commit makes `theme.json` setting take precedence by generating the global styles body reset prior to processing the theme.json.

Follow-up to [52049].

Props get_dave, hellofromTonya.
Fixes #54550.
Built from https://develop.svn.wordpress.org/trunk@52329


git-svn-id: http://core.svn.wordpress.org/trunk@51921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 22:42:00 +00:00
Sergey Biryukov 47c4ff7102 HTTP API: Revert changeset [52244].
Reverting Requests 2.0.0 changes and moving to WordPress 6.0 cycle. Why? The namespace and file case renaming revealed 2 issues in Core's upgrader process.

See https://core.trac.wordpress.org/ticket/54504#comment:22 for more information.

Follow-up to [52327].

See #54562, #54504.
Built from https://develop.svn.wordpress.org/trunk@52328


git-svn-id: http://core.svn.wordpress.org/trunk@51920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 21:30:03 +00:00
hellofromTonya 8045f6a42b HTTP API: Revert changeset [52315].
Reverting Requests 2.0.0 changes and moving to WordPress 6.0 cycle. Why? The namespace and file case renaming revealed 2 issues in Core's upgrader process.

See https://core.trac.wordpress.org/ticket/54504#comment:22 for more information.

See #54562, #54504.
Built from https://develop.svn.wordpress.org/trunk@52327


git-svn-id: http://core.svn.wordpress.org/trunk@51919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 18:31:05 +00:00
Sergey Biryukov 18d741be37 KSES: Use the polyfilled PHP 8 string functions in `_wp_kses_allow_pdf_objects()`:
* `str_contains()`
* `str_ends_with()`
* `str_starts_with()`

Additionally, include a test for a PDF file in an `<object>` tag with an unsupported protocol.

Follow-up to [51963], [52039], [52040], [52304], [52309].

Props TobiasBg, ramonopoly.
See #54261.
Built from https://develop.svn.wordpress.org/trunk@52326


git-svn-id: http://core.svn.wordpress.org/trunk@51918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 11:08:01 +00:00
Sergey Biryukov a9edd7ba88 Build/Test Tools: Remove the `replace:emoji-banner-text` Grunt task.
The task was previously used to ensure that `/*! This file is auto-generated */` comment is not included on front end as part of the inline emoji detection script.

As the `wp-emoji-loader.js` script is now included via `file_get_contents()` and `wp_print_inline_script_tag()` instead of `grunt-include` to simplify the logic, the task does not find anything to replace and is no longer necessary.

Additionally, include a line break before the `wp-emoji-loader.js` script content for better line wrapping.

Follow-up to [48096], [50651], [52132].

See #44632, #44306, #53363.
Built from https://develop.svn.wordpress.org/trunk@52325


git-svn-id: http://core.svn.wordpress.org/trunk@51917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 10:14:06 +00:00
noisysocks 3060ce0b59 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Gallery block: turn on auto-migration of v1 Gallery blocks to v2 format when edited
- Add accessible labelling to submenu buttons.
- Improve performance of wp_navigation lookup. 
- Various inline docblock corrections
- Use core version of template and template part post types and REST endpoints for WP 5.9, with back compat for 5.8
- Gradients: Enable adding custom gradient when gradients are disabled
- Custom color palette: add default color name
- Color Picker: Re-instate debounce and controlled value to fix issue with gradient picker
- Add aria-current="page" to active navigation item
- Site Editor: Templat list fallback to slug
- Fix: Custom color picker popover position
- Fix: php 5.6 error in theme JSON class.
- Update the WP_Theme_JSON_Gutenberg class to be like the core one
- Update the WP_Theme_JSON_Resolver_Gutenberg class to be like the core one
- Move Global Styles code to lib/compat/wordpress-5.9 folder
- E2E Tests: Fix failing image e2e test by waiting for required element
- Navigation: Try removing absorb toolbar prop.
- Navigation: Fix navigation justifications.
- Fix wordbreak for URLs
- Polish unset color indicator.
- Template revert flow: Make label description source agnostic
- [Block Library - Navigation]: Fix vertical layout
- Add: Corners to custom color picker popover
- Add: Missing margin to the color picker clear button
- Gradient: Fix clearing a custom gradient from throwing a React warning
- [Block Library]: Rename Query Pagination blocks
- PHP Unit Tests: Use global transients 
- Remove CSS that causes conflict with theme.json
- Add actions which fire during the loading process of block template parts
- Fix usage of useSetting('color.palette')
- Update micromodal, include click-through fix
- Site Editor: Remove unused PHP code
- Don't try and render unstable location if Nav block has ID
- Fix gutenberg prefixed function references in core
- Card: support the extraSmall option for the size prop
- Gallery block: enable the new gallery block by default if running in core 
- Block fixtures: Change port to 8889 to placate KSES
- Full Site Editing: Remove block template resolution unit tests
- Site Editor: Sync export API

See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 06:20:27 +00:00
Sergey Biryukov f5d79e0b23 Docs: Add missing summary for `WP_Theme_JSON_Resolver::get_merged_data()`.
Follow-up to [50959].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@52323


git-svn-id: http://core.svn.wordpress.org/trunk@51915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-05 18:02:08 +00:00
Sergey Biryukov 6e09421269 Coding Standards: Break the `$path` reference after a `foreach` loop in `block_editor_rest_api_preload()`.
When using a `foreach` loop with a value assigned by reference, the variable continues to point to the last array element even after the loop, so it is recommended to destroy it by `unset()` to avoid unexpected behavior later on.

See [https://www.php.net/manual/en/control-structures.foreach.php PHP Manual: foreach].

Follow-up to [52312], [52313].

Props TobiasBg.
See #54558.
Built from https://develop.svn.wordpress.org/trunk@52322


git-svn-id: http://core.svn.wordpress.org/trunk@51914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-04 17:20:00 +00:00
Sergey Biryukov 6b84ae03ad Docs: Further update some `@since` notes in `WP_Theme_JSON` methods for clarity.
Follow-up to [52049], [52306], [52320].

See #53399, #54336.
Built from https://develop.svn.wordpress.org/trunk@52321


git-svn-id: http://core.svn.wordpress.org/trunk@51913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-04 15:57:01 +00:00
Sergey Biryukov 7f9d7a5905 Docs: Some documentation improvements for `WP_Theme_JSON` and `WP_Theme_JSON_Resolver` classes:
* Make the `@since 5.9.0` notes more specific. When mentioning that parameters or values have been added or changed, it is generally also helpful to include their exact names and the nature of changes for future reference.
* Update some DocBlocks per the documentation standards.

Follow-up to [52049], [52306].

See #53399, #54336.
Built from https://develop.svn.wordpress.org/trunk@52320


git-svn-id: http://core.svn.wordpress.org/trunk@51912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-04 12:58:01 +00:00
audrasjb 3d5b5f21e1 General: Add MariaDB in the `readme.html` requirements.
This change updates the WordPress `readme.html` file to reflect WordPress.org requirements: as of WordPress 5.9, MariaDB 10.1 and higher versions are supported by WP. See https://wordpress.org/about/requirements/. 

Fixes #41490.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 23:09:59 +00:00
audrasjb 9a9afacf38 Docs: Replace `@since 5.9` with `@since 5.9.0` in `block-template-utils.php`.
Follow-up to [52317], [52275], [52062].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 22:26:59 +00:00
audrasjb a945234aba Docs: Miscellaneous Docblock corrections for `block-template-utils.php` file.
Follow-up to [52275], [52062].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 22:09:59 +00:00
hellofromTonya 64fe3efe28 Editor: Resolve template request `?_wp-find-template=true` for new posts and pages.
The template resolution system makes a request like `/?page_id=1234&_wp-find-template=true`, depending on `WP_Query` to resolve a page or post using the page_id or p (post_id) in the query string. With new posts/pages, a placeholder post with the status auto-draft is created. But by default `WP_Query` will not resolve these posts, unless the query is specifically set to look for them.

This commit handles the query string to properly resolve a page or post. It adds 2 private callbacks for the processing.

Props poena, noisysocks, bernhard-reiter, costdev, hellofromTonya.
Fixes #54553.
Built from https://develop.svn.wordpress.org/trunk@52316


git-svn-id: http://core.svn.wordpress.org/trunk@51908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 19:39:00 +00:00
hellofromTonya b32e8f7284 HTTP API: Fix classname `WpOrg\Requests\Proxy\Http` in `WP_Http::request()`.
Renaming the classname was missed in [52244] when updating changes in `WP_Http::request()` for the Requests 2.0.0 external library upgrade. `HTTP` class no longer exists and caused a fatal error `Fatal error: Uncaught Error: Class 'WpOrg\Requests\Proxy\HTTP' not found`.

This commit renames the class to `Http` and resolves the fatal error.

Follow-up to [52244].

Props alexeydemidov, costdev, mukesh27.
Fixes #54562.
Built from https://develop.svn.wordpress.org/trunk@52315


git-svn-id: http://core.svn.wordpress.org/trunk@51907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 18:03:59 +00:00
hellofromTonya 6f51efd066 Editor: Enable incomplete unit tests in `Tests_Block_Template_Utils:: test_get_block_template_from_file()`.
At the time tests were backported from Gutenberg, a block template theme was not available in the test suite; thus, the test was marked as `markTestIncomplete()`.

Now that `block-theme` and `block-theme-child` test fixture block template themes are available, this commit removes the `markTestIncomplete()` and adjusts the test to run by switching to the `block-theme` test fixture.

Follow-up to [51003], [52062], [52247].

Props bernhard-reiter.
Fixes #54551.
Built from https://develop.svn.wordpress.org/trunk@52314


git-svn-id: http://core.svn.wordpress.org/trunk@51906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 16:59:00 +00:00
audrasjb b09f0e4fdd Coding standards: Address a few coding standards issues after [52312].
Follow-up to [52312].

See #54558.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 15:36:00 +00:00
audrasjb dc86357471 Editor: Avoid `undefined index` notices in the Template Parts Editor.
This changes adds a leading slash when needed in the `?context=edit` path to avoid an `undefined index` notice in the Template Parts Editor.

Follow-up to [52275].

Props kafleg, costdev, mukesh27, Boniu91.
Fixes #54558.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 15:30:08 +00:00
audrasjb cbadb65a2a REST API: Use global transients for URL details endpoint.
Follow-up to [51973].

Props peterwilsoncc, costdev.
Fixes #54499.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 11:36:09 +00:00
Sergey Biryukov 9ff51215ad Tests: Fix typo in a `WP_Test_REST_Posts_Controller` test method name.
Follow-up to [42423].

See #53363.
Built from https://develop.svn.wordpress.org/trunk@52310


git-svn-id: http://core.svn.wordpress.org/trunk@51902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 05:59:01 +00:00
Peter Wilson 37180741b4 KSES: Accept port number in PDF upload paths.
Improves the URL validation in `_wp_kses_allow_pdf_objects()` to account for sites using an upload path that contains a port, for example wp.org:8080.

Follow up to [51963], [52304].

Props ocean90, ramonopoly, talldanwp.
See #54261.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-03 02:44:00 +00:00
audrasjb ddfe23a9aa Editor: Allow child theme PHP templates to take precedence over parent theme block templates.
This change fixes template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity.

Before this change, when a theme was using a PHP template of a certain specificity (e.g. `page-home.php`), and it happened to be a child theme of another theme which had a block template for the same specificity (e.g. `page-home.html`), WordPress was picking the parent theme’s block template over the child theme’s PHP template to render the page. If the PHP and block template have equal specificity, the child theme's template should be used.

The issue was fixed before in Gutenberg so the fix now needs to happen in Core.

This change also re-enables the preexisting template resolution unit tests.

Follow-up to [51003].

Props bernhard-reiter, youknowriad.
Fixes #54515.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-02 23:36:59 +00:00
audrasjb 53096e6796 Docs: Docblock typo correction in `WP_Theme_JSON_Schema`.
Follow-up to [52306].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-02 20:45:01 +00:00
audrasjb ef4fe197b8 Docs: Add missing `@since` tag to `WP_Theme_JSON_Schema` functions.
Follow-up to [52049].

See #53399, #54336.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-02 20:27:07 +00:00
Sergey Biryukov 2d6493056b Docs: Fix typo in some `get_edit_term_link()` test DocBlocks.
Follow-up to [52180], [52255].

See #50225, #53399.
Built from https://develop.svn.wordpress.org/trunk@52305


git-svn-id: http://core.svn.wordpress.org/trunk@51897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-02 05:41:04 +00:00
Peter Wilson 2d944ca1d9 KSES: Allow attributes to be restricted via callbacks.
Add callback validation to HTML tag attributes for increased flexibility over an array of values only.

In `object` tags, validate the `data` attribute via a callback to ensure it is a PDF and matches the `type` attribute. This prevents mime type mismatches in browsers.

Follow up to [51963].

Props Pento, dd32, swissspidy, xknown, peterwilsoncc.
Fixes #54261.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-02 00:56:01 +00:00
audrasjb 8d723966d0 Docs: Add missing `@param` to `wp_set_unique_slug_on_create_template_part()`.
Follow-up to [52062].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-02 00:01:00 +00:00
audrasjb 38e19413f6 Docs: Miscellaneous Docblock corrections in several `/block-supports` files.
See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 23:16:04 +00:00
audrasjb 931b03e4f9 Docs: Misc Docblock corrections in `duotone.php` file.
Follow-up to [50929].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 14:07:59 +00:00
John Blackbourn 614b866cb0 Plugins: Correct the documented allowable types for to the `$callback` parameter of various hook related functions.
These functions don't require the callback to be a valid callable, therefore `array` and `string` are also valid types for this parameter.

Props malthert

Fixes #54440

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


git-svn-id: http://core.svn.wordpress.org/trunk@51892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 13:22:01 +00:00
John Blackbourn 9a982b4ae8 Docs: Various docblock corrections.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 12:17:00 +00:00
audrasjb 15d7d368f3 Docs: Docblock corrections in `_disable_block_editor_for_navigation_post_type()`.
Follow-up to [52145].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 11:41:59 +00:00
Sergey Biryukov 980ea5611a Docs: Use a duplicate hook reference for `theme_file_path` in `WP_Theme::get_file_path()`.
Follow-up to [38578], [52279].

See #51506, #53399.
Built from https://develop.svn.wordpress.org/trunk@52297


git-svn-id: http://core.svn.wordpress.org/trunk@51889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 09:20:04 +00:00
Sergey Biryukov 71f33ed63f Post WordPress 5.9 Beta 1 version bump.
Built from https://develop.svn.wordpress.org/trunk@52296


git-svn-id: http://core.svn.wordpress.org/trunk@51888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 23:34:01 +00:00
Sergey Biryukov 0cb7d322c7 WordPress 5.9 Beta 1.
Built from https://develop.svn.wordpress.org/trunk@52295


git-svn-id: http://core.svn.wordpress.org/trunk@51887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 21:36:02 +00:00
Sergey Biryukov 566d5d2170 Options, Meta APIs: Improve error handling in `sanitize_option()`.
To prevent potential false negatives, set `$error` to `null` initially, so we can better tell if it was ever changed during the sanitization and be able to better react if an empty string is added to it.

Additionally, and mainly for the sake of the Settings API at this point, add error messages to some `WP_Error` objects returned from `wpdb` methods that were previously causing the issues here.

Follow-up to [32791].

Props iCaleb, audrasjb, hellofromTonya, SergeyBiryukov.
Fixes #53986.
Built from https://develop.svn.wordpress.org/trunk@52294


git-svn-id: http://core.svn.wordpress.org/trunk@51886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 21:03:00 +00:00
hellofromTonya 2b2313d56b Editor: Hide visibility and status settings for `wp_navigation` post type.
Adds CSS to hide both the visibility and status settings for the `wp_navigation` post type.

Props antonvlasenko , costdev. 
Fixes #54407.
Built from https://develop.svn.wordpress.org/trunk@52293


git-svn-id: http://core.svn.wordpress.org/trunk@51885 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 21:01:02 +00:00
hellofromTonya 9ede1fe55b Formatting: Handle non-scalar types passed to `sanitize_key()`.
`sanitize_key()` expects a string type for the given `key`. Passing any other data type to `strtolower()` can result in `E_WARNING: strtolower() expects parameter 1 to be string, array given`.

A check is added that if the key is not a string, the key is set to an empty string. For performance, the additional string processing is skipped if the key is an empty string.

This change maintains backwards-compatibility for valid string keys while fixing the bug of non-string keys.

Props costdev, dd32. 
Fixes #54160.
Built from https://develop.svn.wordpress.org/trunk@52292


git-svn-id: http://core.svn.wordpress.org/trunk@51884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 20:11:02 +00:00
audrasjb 25b3d172b7 Editor: Avoid a JS console error on the Navigation block view.
Props mkaz, sabernhardt, costdev.
Fixes #54456.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 20:02:01 +00:00
hellofromTonya 68537a8eed Twenty Fourteen: Adjust capability queries when using version before WordPress 5.9-alpha.
As capability queries was introduced in 5.9, this commit allows for previous versions by assigning the "who" and unsetting "capability". 

Follow-up to [51943].

Props johnbillion, swissspidy.
Fixes #16841.
Built from https://develop.svn.wordpress.org/trunk@52290


git-svn-id: http://core.svn.wordpress.org/trunk@51882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 19:25:01 +00:00
Sergey Biryukov 576116927b Upgrade/Install: Make some adjustments to the `move_dir()` function:
* Check for direct PHP flle access and only use `rename()` if true.
* Check whether the destination directory was successfully created.
* Clear the working directory so there is internal parity within the function between the results of a successful `rename()` and a fallback to `copy_dir()`.
* Use `move_dir()` in `WP_Upgrader::move_to_temp_backup_dir()` and `::restore_temp_backup()`.

Follow-up to [51815], [51898], [51899], [51902], [52192], [52284].

Props afragen, peterwilsoncc, dd32, SergeyBiryukov.
See #54166, #51857.
Built from https://develop.svn.wordpress.org/trunk@52289


git-svn-id: http://core.svn.wordpress.org/trunk@51881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 19:12:00 +00:00
hellofromTonya 308f814105 Media: Use `infiniteScrolling` global setting in `js/media/controllers/featured-image.js` and `js/media/controllers/replace-image.js`.
Follow-up to [52287] which added an undefined variable. The variable should have been the global `wp.media.view.settings.infiniteScrolling`. This commit brings that global setting into each of the functions and renames the variable using camelCase to comply with JS coding standards.

Follow-up to [52287].

Props SergeyBiryukov.
Fixes #53765.
Built from https://develop.svn.wordpress.org/trunk@52288


git-svn-id: http://core.svn.wordpress.org/trunk@51880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 19:07:00 +00:00
hellofromTonya be55859f78 Media: Featured image modal loads only selected image when infinite scroll is disabled.
Follow-up to [52167], which partially fixed a bug introduced in [50829] that caused media modal to only load the selected image.

This commit adds additional checks to ensure infinite scroll is disabled.

Follow-up to [50829], [52167].

Props dariak, joedolson, szaqal21. 
Fixes #53765.
Built from https://develop.svn.wordpress.org/trunk@52287


git-svn-id: http://core.svn.wordpress.org/trunk@51879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 18:08:01 +00:00
spacedmonkey 13c5637263 Site Editor: Add site export REST API endpoint.
Add a REST API to export site templates and template part as html files. When the REST API is requested, it responds by downloading a single ZIP file and exits early, without completing full request.  To create the exported zip, the ZipArchive class is required. If this class is not present then the export will gracefully fail, returning a `WP_Error` object and 500 status error code. 

Props spacedmonkey, youknowriad, Mamaduka, walbo, peterwilsoncc. 
Fixes #54448 .


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


git-svn-id: http://core.svn.wordpress.org/trunk@51878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 17:32:02 +00:00
hellofromTonya 5c414db9ad External Libraries: Further fix jQuery deprecations in WordPress core.
Follow-up to [50001], [50270], [50367], [50383], [50410], [50420], [50429], [50547].

Props chaion07, Clorith, costdev, desrosj, malthert, peterwilsoncc, presskopp, promz, sabernhardt, SergeyBiryukov, toro_unit, wpnomad.
Fixes #51519.
Built from https://develop.svn.wordpress.org/trunk@52285


git-svn-id: http://core.svn.wordpress.org/trunk@51877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 17:18:01 +00:00
Sergey Biryukov 5e35ad4b4a Upgrade/Install: Check that WordPress is installed before scheduling cleanup of the `temp-backup` directory.
Trying to schedule cron jobs before WordPress is installed results in DB errors, which is suboptimal.

This addresses a  `Table 'wp_options' doesn't exist` error when running the installation with `WP_DEBUG` enabled.

Follow-up to [51815], [51898], [51899], [51902], [52192].

Props dlh, pbiron.
See #51857.
Built from https://develop.svn.wordpress.org/trunk@52284


git-svn-id: http://core.svn.wordpress.org/trunk@51876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 17:12:01 +00:00
jffng 2caa789ee0 Twenty Twenty-Two: Sync updates from GitHub.
This commit syncs minor changes for the default theme from its active development repository to core. 

This is a follow up to [52081], [52107], [52164], and [52222]. It includes changes to template part markup, theme.json appearance flags, navigation block markup, and text domains. For a full set of changes, visit 742df6cb2b...1a121e0224.

Props poena, kjellr, onemaggie, hellofromtonya.
See #54318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 16:19:00 +00:00
audrasjb b22dfaf657 Tests: Update `WP_REST_Global_Styles_Controller_Test` "Custom Styles" string after [52280].
Follow-up to [52280].

See #54518.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 15:55:59 +00:00
hellofromTonya 14f6cf230b REST API: Replace hardcoded `wp/v2/` preloaded paths with `rest_get_route_for_taxonomy_items()` and `rest_get_route_for_post_type_items()` in `wp-admin/site-editor.php`.
[51962] and [51964] introduced two new functions: `rest_get_route_for_post_type_items()` and `rest_get_route_for_taxonomy_items()`. These functions replaced hardcoded references in all parts of core that reference taxonomy and post type rest controller endpoints. However, several instances were missed in the `wp-admin/site-editor.php` file.

This commit replaces those remaining hardcoded instances.

Follow-up to [51962], [51964], [52232].

Props spacedmonkey.
Fixes #54536.
Built from https://develop.svn.wordpress.org/trunk@52281


git-svn-id: http://core.svn.wordpress.org/trunk@51873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 15:54:03 +00:00
audrasjb 4212bcfe36 Editor: Do not translate the title of "Custom Styles" specific posts.
This change removes the internationalization of the "Custom Styles" specific posts as the post title being hardcoded is consistent with `wp_template_part` and `wp_template` post types, and is not publicly visible, except in the database. Moreover, using consistent "Custom Styles" post title may make is easier to retrieve the related posts in the database.

Props antonvlasenko, audrasjb, desrosj, hellofromTonya.
Fixes #54518.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 15:35:01 +00:00
hellofromTonya ce3aed3186 Administration: For block themes, link to Site Editor interface instead of Customizer in Dashboard's welcome panel and Themes interface.
For block themes (like Twenty Twenty-Two), Customizer menu item is removed and replaced with the Site Editor menu item. However, other links exist in the Dashboard's welcome panel "Customize Your Site" button and the "Customize" button in each theme listed in the Appearance > Themes interface.

This commit changes each of those remaining links to link to the Site Editor interface instead of the Customizer.

To help identify block vs non-block themes, two method methods are introduced in `WP_Theme`:

* `WP_Theme:: is_block_based()` which identifies if the theme is a block theme or not.
* `WP_Theme::get_file_path()` which is similar to `get_theme_file_path()` but uses the directories within the theme object.

Both of these new methods include test coverage including the addition of a parent and child block theme in test data.

Follow-up to [18749], [35483], [42013], [42169].

Props antonvlasenko, jameskoster, hellofromTonya, matveb, noisysocks, poena, sergeybiryukov.
Fixes #54460.
Built from https://develop.svn.wordpress.org/trunk@52279


git-svn-id: http://core.svn.wordpress.org/trunk@51871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 14:27:03 +00:00
Sergey Biryukov 9c9c576d88 I18N: Remove redundant `default` text domain parameter in some `__()` calls.
Follow-up to [51160], [52069].

See #53359.
Built from https://develop.svn.wordpress.org/trunk@52278


git-svn-id: http://core.svn.wordpress.org/trunk@51870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 08:33:05 +00:00
noisysocks dc3ffcbde3 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Include cascading properties in Navigation deprecation
- Reorganize e2e tests folders and file
- Border panel: Update to display multiple palette origins
- Add CSS fix for 33580
- Add: Uneditable duotone palette on the palette gradient panel
- Site Editor: Allow editing custom template title
- Writing Flow: Double escape unselects all blocks
- Fix icon scaling.
- [Block Library - Query Pagination Next/Previous]: Remove text and link color support
- Add: Border indication to global styles colors.
- Color Picker: Improve border, padding, and box shadow styles.
- theme.json: sort keys alphabetically
- Remove navigationArea context.

See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 05:48:28 +00:00
Peter Wilson 43290b2e04 REST API: Fire `wp_after_insert_post` later in new post object endpoints.
In the new menu items, global items and template controllers manually call the function `wp_after_insert_post()` to manually fire the action of the same name after all potential data is updated.

This accounts for the use case in which a theme or plugin developer has modified the endpoints use of either taxonomy or meta data.

The new parameter `$fire_after_hooks` is added to `wp_update_nav_menu_item()` to control whether the `wp_after_insert_post` action is fired when it in turn calls `wp_insert_post()`.

Props spacedmonkey, peterwilsoncc, zieladam.
Fixes #54536.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 01:10:08 +00:00
noisysocks e4b553a201 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Update Pattern block category and add documentation
- Fix non existent menu handling in nav block
- Make Reusable blocks available in the Site Editor
- Add caching to WP_Theme_JSON_Resolver_Gutenberg::get_user_data_from_custom_post_type()
- theme.json: add appearanceTools flag to opt-in into appearance UI controls
- Update the block theme folders to templates and parts
- Remove reference to gutenberg_, swap with wp_
- Use table layout in templates list screen
- Update featured image placeholder graphic.
- [Inserter]: Adjust order of theme blocks and reorder inserter items
- Implement suitable fallback for Nav block on front end of site when no menu selected
- Toggle Group Control: add tooltip
- Use first non-empty Nav post as primary fallback for Nav block
- Change .nvmrc and documentation for Node.js version (LTS to 14.18.1)
- Update: Migrate global styles user database data on the rest endpoint
- Update global styles public API
- Update: Rename user preset origin to custom
- Try always generating navigation post title
- Show all templates and template parts on the site editor list screens
- Highlight "Site" in the navigation panel
- Fix template part slug generation when creating through the block placeholder
- [Block Library - Post Title]: Fix render error when setting Page to homepage
- Add 'Clear customizations' button to template list page
- Gallery v1: Allow clicks within replace media placeholder state
- Site Editor: Set the <title> on the list page to be same as the CPT name
- Gallery: Fix stuck image size options loader
- Cover: Fix undo trap
- Add success and error snackbars to the templates list page
- Fix: theme colors cannot override defaults
- Fix: Color palette is not being stored
- Add elements support to the typography panel in global styles
- Make links plural in global styles
- Add: Gradient palette editor
- Update some small style regressions in the template list
- Add: Transparency support on global styles colors
- Fix: apply by slug on all origins
- Render empty Nav block if no fallback block can be utilised
- Allow filtering of Nav block fallback
- Fix Nav block fallback DB query to match on full block grammar start tag
- Remove unstable max pages attribute from Nav block
- DateTimePicker: set PM hours correctly
- Update delete template button
- Site Editor: Template list add rename action
- Fix Nav block editing wrong entity on creation of new Menu
- [REST] Restore the missing double slash in the ID received by /templates
- Add icons to navigation sidebar items
- Update function names for the public global styles API functions
- Templates Controller: Add missing 'is_custom' prop
- Rename gutenberg_ to wp_ for some functions that land in WordPress 5.9
- [Block Library - Template Part]:Remove support for conversion to Reusable block
- Global Styles: Call "palettes" and not "color palettes" on panel label
- Add button text when no colors found
- Update: Global Styes: Count all color palette origins on the palette counter
- Rename navigationMenuId to ref
- Offset the parent iframe when computing Popover position 
- Fix: Failing PHPUnit test
- Show theme, plugin or author in Added By column with appropriate icon or avatar
- Add origin and author to template rest api

See #54487.
Props talldanwp, mamaduka, oandregal.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 00:24:27 +00:00
Peter Wilson 8294b090fb Build/Test Tools: Revert ignore prop change in [52272].
See #54506.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-29 23:45:03 +00:00
noisysocks 57aee3ba4d Restore block PHP to canonical version in @wordpress/block-library
r52272 erroneously modified `src/wp-includes/blocks/navigation.php`. This file
is copied from `@wordpress/block-library` and so must be updated via npm. This
commit restores the file by running `grunt build --dev`.

Follows [52272].
See #54506.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-29 23:31:05 +00:00