176 Commits

Author SHA1 Message Date
Pascal Birchler
22796f5869 I18N: Improve support for using only PHP translation files.
This builds on top of the PHP translation file support added in WordPress 6.5, improving the behavior for projects using solely `.l10n.php` translation files and no `.mo.` and `.po` files.

Updates `wp_get_installed_translations()`, which is used when updating language packs and when uninstalling plugins/themes (to remove the translations again), to look for PHP translation files and read metadata from them. Additionally, the file lookup is now cached thanks to using `WP_Textdomain_Registry`.

Updates `Language_Pack_Upgrader::check_package()` to allow language packs that only contain PHP translation files. While WordPress.org continues to serve `.mo` and `.po` files, third-party services might want to only use the PHP file format.

Props swissspidy.
Fixes #60554.

git-svn-id: https://develop.svn.wordpress.org/trunk@58061 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-30 08:34:50 +00:00
Adam Silverstein
2074392c5c Media: fix potential error in class-avif-info.php::get_item_features().
Import upstream fix from libavifinfo, correcting a potential fatal error.

Props yguyon.
Fixes #60980.



git-svn-id: https://develop.svn.wordpress.org/trunk@58049 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-26 15:00:03 +00:00
Dennis Snell
3b9aefb06c HTML API: Validate HTML Processor against external test suite from html5lib.
In this patch, the test suite from html5lib validates the tree-construction
steps in the HTML Processor to ensure that they are behaving according to the
HTML specification. This suite of tests is also used by the servo project to
test its html5ever package.

A new test module in the HTML API transforms HTML Processor output to match
the expected tree shape from the external tests. For cases where there are
tests validating behaviors of unsupported HTML tags and constructs, the tests
are marked as skipped. As the HTML API continues to expand its own support,
the number of skipped tests will automatically shrink down towards zero.

Additional tests are skipped through the `SKIP_TEST` array in the test runner.

Fixes #60227.
See #58517.
Props azaozz, costdev, dmsnell, hellofromtonya, jonsurrell, jorbin, swisspidy.



git-svn-id: https://develop.svn.wordpress.org/trunk@58010 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-16 12:06:46 +00:00
Pascal Birchler
11bc9c9e8c Docs: Fix various typos and spelling mistakes.
Props swissspidy, jucaduca, sergeybiryukov.
See #60699.

git-svn-id: https://develop.svn.wordpress.org/trunk@57987 602fd350-edb4-49c9-b593-d223f7449a82
2024-04-12 17:45:23 +00:00
Pascal Birchler
9bf06950a1 Editor: disable shadow.defaultPresets for classic themes.
With this change default shadow presets are never shown for classic themes, and classic themes have no options for adding custom ones.
This essentially reverts [57717] and [57827] / [57828], which had unintended consequences.

Props ajlende, oandregal, madhudollu, swissspidy, get_dave, andrewserong, desrosj.
Fixes #60815.

git-svn-id: https://develop.svn.wordpress.org/trunk@57885 602fd350-edb4-49c9-b593-d223f7449a82
2024-03-27 15:58:46 +00:00
Pascal Birchler
da1e42392c Build/Test Tools: Fix typo in variation-new-font-family.json fixture file.
Props huzaifaalmesbah, mukesh27.
Fixes #60712.

git-svn-id: https://develop.svn.wordpress.org/trunk@57788 602fd350-edb4-49c9-b593-d223f7449a82
2024-03-07 06:25:33 +00:00
Riad Benguella
18b21c34c8 Tests: Synchronize Theme.JSON unit test between Core and Gutenberg.
Merges the changes from Core and Gutenberg for the following tests:

- WP_REST_Global_Styles_Controller_Test
- Tests_Theme_wpThemeJsonResolver
- Tests_Theme_wpThemeJsonSchema
- Tests_Theme_wpThemeJson

This will help ensure the stability of the theme.json style generation.

Props ajlende, scruffian, aaronrobertshaw, get_dave, youknowriad.
Fixes #60387.

git-svn-id: https://develop.svn.wordpress.org/trunk@57662 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-20 09:53:11 +00:00
Pascal Birchler
dfd9b1afd2 I18N: Prevent incorrect language dropdown entries when there are .l10n.php files.
In [57516], the just-in-time translation loading logic was enhanced to support cases where only `.l10n.php` translation exist but no `.mo` or `.po` files. This caused a slight regression in `get_available_languages()`, which uses the list of files to populate the language dropdown list on the settings page.

To address this, the new file extension is now properly stripped off, and the resulting file list is de-duplicated. New test files are added to allow the existing tests to cover this new scenario.

See #59656.
Fixes #60553.

git-svn-id: https://develop.svn.wordpress.org/trunk@57639 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-16 10:26:14 +00:00
Greg Ziółkowski
0422b53ad2 Blocks: Allow reading the script handle from asset files
In the [documentation for WPDefinedAsset definition](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#wpdefinedasset) for block metadata there is a note about the handle. That was missing in WordPress core.

Props gziolo, jsnajdr, youknowriad.
Fixes #60485.




git-svn-id: https://develop.svn.wordpress.org/trunk@57590 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-12 11:40:49 +00:00
Greg Ziółkowski
e42bf01555 Editor: Add viewScriptModule handling to block.json metadata
Syncing changes from the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/57437.

Scripts and styles can be registered for blocks via `block.json` metadata. There is now a Modules API, but was no way to register or associate module assets with blocks via `block.json`.

Fixes #60233.
Props jonsurrell, gziolo, cbravobernal, luisherranz, youknowriad.



git-svn-id: https://develop.svn.wordpress.org/trunk@57565 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-08 10:39:24 +00:00
Riad Benguella
d928e5f916 Editor: Fix Font Library PHP unit tests.
These font assets files used in phpunit tests were missing in the original commit [57539].

Props mukesh27.
See #59166.

git-svn-id: https://develop.svn.wordpress.org/trunk@57540 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-06 09:22:39 +00:00
Peter Wilson
2ac96bcd07 Upload: Fallback to PclZip to validate ZIP file uploads.
`ZipArchive` can fail to validate ZIP files correctly and report valid files as invalid. This introduces a fallback to `PclZip` to check validity of files if `ZipArchive` fails them.

This introduces the new function `wp_zip_file_is_valid()` to validate archives.

Follow up to [57388].

Props audunmb, azaozz, britner, cdevroe, colorful-tones, costdev, courane01, endymion00, feastdesignco, halounsbury, jeffpaul, johnbillion, jorbin, jsandtro, karinclimber, kevincoleman, koesper, maartenbelmans, mathewemoore, melcarthus, mujuonly, nerdpressteam, olegfuture, otto42, peterwilsoncc, room34, sayful, schutzsmith, stephencronin, svitlana41319, swissspidy, tnolte, tobiasbg, vikram6, welaunchio.
Fixes #60398.


git-svn-id: https://develop.svn.wordpress.org/trunk@57537 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-05 22:21:35 +00:00
Peter Wilson
ac240f068d Build/Test Tools: Mock plugin API response in WP_REST_Plugins_Controller_Test.
Avoid false test failures due to network conditions in the `WP_REST_Plugins_Controller_Test` class. This mocks HTTP responses from the plugin information endpoint for the link-manager plugin.

Props: peterwilsoncc, costdev.
See #59647.



git-svn-id: https://develop.svn.wordpress.org/trunk@57531 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-04 22:02:02 +00:00
Adam Silverstein
7e34c4b7d3 Media: fix AVIF tests.
Follow up to r57524. Properly add AVIF images for unit tests.

Fixes #51228.



git-svn-id: https://develop.svn.wordpress.org/trunk@57525 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-02 18:48:03 +00:00
Adam Silverstein
575ce15b5d Media: enable AVIF support.
Add support for uploading, editing and saving AVIF images when supported by the server.

Add 'image/avif' to supported mime types. Correctly identify AVIF images and sizes even when PHP doesn't support AVIF. Resize uploaded AVIF files (when supported) and use for front end markup.

Props adamsilverstein, lukefiretoss, ayeshrajans, navjotjsingh, Tyrannous, jb510, gregbenz, nickpagz, JavierCasares, mukesh27, yguyon, swissspidy.
Fixes #51228.



git-svn-id: https://develop.svn.wordpress.org/trunk@57524 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-02 17:46:50 +00:00
Pascal Birchler
5e178ff9c9 I18N: Fix plural forms parsing in WP_Translation_File.
Ensures the plural expression from the translation file header is correctly parsed.
Prevents silent failures in the attempt to create the plural form function.

Adds additional tests.

Props Chouby.
See #59656.

git-svn-id: https://develop.svn.wordpress.org/trunk@57518 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-01 20:57:03 +00:00
Pascal Birchler
8d3e4a1eeb I18N: Support loading .l10n.php translation files on their own.
Adjusts the translation file lookup in `WP_Textdomain_Registry` so that just-in-time translation loading
works even if there is only a `.l10n.php` translation file without a corresponding `.mo` file.

While language packs continue to contain both file types, this makes it easier to use translations in a project
without having to deal with `.mo` or `.po` files.

Props Chrystl.
See #59656.

git-svn-id: https://develop.svn.wordpress.org/trunk@57516 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-01 19:03:55 +00:00
Pascal Birchler
5b46851f7c I18N: Improve singular lookup of pluralized strings.
Ensures that string lookup in MO files only uses the singular string.

This matches expected behavior with gettext files and improves compatibility for cases where for example both `__( 'Product' )` and `_n( 'Product', 'Products’, num )` are used in a project, where both will use the same translation for the singular version. Maintains backward compatibility and feature parity with the pomo library and the PHP translation file format.

Replaces [57386], which was reverted in [57505], with a more accurate and performant solution.

See #59656.

git-svn-id: https://develop.svn.wordpress.org/trunk@57513 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-01 11:43:21 +00:00
Greg Ziółkowski
1a5ff3fc6d Editor: Add viewStyle property to block.json for frontend-only block styles
Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/54491.

For block scripts there was already `script`, `viewScript` and `editorScript`. For block styles there was only `style` and `editorStyle`. This brings the parity.

Props gaambo.
Fixes #59673. 



git-svn-id: https://develop.svn.wordpress.org/trunk@57493 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-31 09:09:22 +00:00
Pascal Birchler
71b8dcb08c I18N: Improve singular lookup of pluralized strings.
Ensures that looking up a singular that is also used as a pluralized string works as expected.
This improves compatibility for cases where for example both `__( 'Product' )` and `_n( 'Product', 'Products’, num )` are used in a project, where both will use the same translation for the singular version.

Although such usage is not really recommended nor documented, it must continue to work in the new i18n library in order to maintain backward compatibility and maintain expected behavior.

See #59656.

git-svn-id: https://develop.svn.wordpress.org/trunk@57386 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-30 13:59:46 +00:00
Riad Benguella
cf8b74de16 Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress. 
This includes features like:

 - DataViews.
 - Customization tools like box shadow, background size and repeat.
 - UI improvements in the site editor. 
 - Preferences sharing between the post and site editors.
 - Unified panels and editors between post and site editors.
 - Improved template mode in the post editor.
 - Iterations to multiple interactive blocks.
 - Preparing the blocks and UI for pattern overrides.
 - and a lot more.

Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.

git-svn-id: https://develop.svn.wordpress.org/trunk@57377 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-29 21:04:18 +00:00
Pascal Birchler
e83f5a1a60 I18N: Introduce a more performant localization library.
This introduces a more lightweight library for loading `.mo` translation files which offers increased speed and lower memory usage.
It also supports loading multiple locales at the same time, which makes locale switching faster too.

For plugins interacting with the `$l10n` global variable in core, a shim is added to retain backward compatibility with the existing `pomo` library.

In addition to that, this library supports translations contained in PHP files, avoiding a binary file format and leveraging OPCache if available.
If an `.mo` translation file has a corresponding `.l10n.php` file, the latter will be loaded instead.
This behavior can be adjusted using the new `translation_file_format` and `load_translation_file` filters.

PHP translation files will be typically created by downloading language packs, but can also be generated by plugins.
See https://make.wordpress.org/core/2023/11/08/merging-performant-translations-into-core/ for more context.

Props dd32, swissspidy, flixos90, joemcgill, westonruter, akirk, SergeyBiryukov.
Fixes #59656.

git-svn-id: https://develop.svn.wordpress.org/trunk@57337 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-23 13:32:34 +00:00
bernhard-reiter
de0c4028c7 General: Add $schema property to block and theme JSON files.
Additionally, this changeset fixes some of the `block.json` and `theme.json` files in PHPUnit tests by adding missing `title` properties to satisfy the schema. Those changes have no impact on the runtime whatsoever and do not change the result of unit tests.

Note that some block and theme JSON files still aren't valid according to the schema. Fixing is underway; the required changes will be merged subsequently.

Props jonsurrell, dmsnell, gziolo.
Fixes #60255.

git-svn-id: https://develop.svn.wordpress.org/trunk@57336 602fd350-edb4-49c9-b593-d223f7449a82
2024-01-23 13:05:08 +00:00
Joe McGill
b6bf3553d9 Themes: Remove memoization from stylesheet and theme directories.
This fixes bugs introduced in [56635] whereby the template or stylesheet path could be memoized incorrectly if `get_template_directory()` or `get_stylesheet_directory()` were called before the theme has been fully initialized.

Props partyfrikadelle, coreyw, kdowns, rebasaurus, meta4, flixos90, mukesh27, joemcgill.
Fixes #59847.


git-svn-id: https://develop.svn.wordpress.org/trunk@57129 602fd350-edb4-49c9-b593-d223f7449a82
2023-11-20 22:27:17 +00:00
Jonny Harris
3ad20183b0 Editor: Improve performance of _register_theme_block_patterns function.
The `_register_theme_block_patterns` function imposed a significant resource overhead. This issue primarily stems from themes, such as TT4, that register a substantial number of block patterns. These patterns necessitate numerous file operations, including file lookups, file reading into memory, and related processes. To provide an overview, the _register_theme_block_patterns function performed the following file operations:

- is_dir
- is_readable
- file_exists
- glob
- file_get_contents (utilized via get_file_data)

To address these issues, caching using a transient has been added to a new function call `_wp_get_block_patterns`. If theme development mode is disabled and theme exists, the block patterns are saved in a transient cache. This cache is used all requests after that, saving file lookups and reading files into memory. Cache invalidation is done, when themes are switched, deleted or updated. Meaning that block patterns are not stored in the cache incorrectly. 

Props flixos90, joemcgill, peterwilsoncc, costdev, swissspidy, aristath, westonruter, spacedmonkey.
Fixes #59490

git-svn-id: https://develop.svn.wordpress.org/trunk@56765 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-03 15:16:55 +00:00
Greg Ziółkowski
d7c3092054 Tests: Cover Block Hooks integration with a custom block theme
Adds a simplified version of Twenty Twenty-Three theme that helps testing Block Hooks integration. The theme contains:

- The required index.html template.
- The optional single.html template used with tests.
- 3 template parts where two of them reference patterns.
- 3 patterns referenced in the templates and the template parts.

New tests automatically register 4 custom blocks with the test theme where each of them hooks into another block using all four target relative positions: `before`, `after`, `firstChild`, `lastChild`.

The tests verify that the block gets hooked into the correct positions when targeting:

- template
- template part
- pattern

Props ockham, costdev.
See #59313, #59383.
Follow-up [56610].


git-svn-id: https://develop.svn.wordpress.org/trunk@56759 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-03 08:27:51 +00:00
Colin Stewart
a099b9a19f Filesystem API: Add missing ZIP file for unzip tests.
In [56689], a ZIP file is needed in `tests/phpunit/data/filesystem/` but wasn't included in the changeset. This produced an error when attempting to create a subdirectory during the tests.

This adds the `tests/phpunit/data/filesystem/archive.zip` file.

Follow-up to [56689].

Props flixos90.
Fixes #37719.

git-svn-id: https://develop.svn.wordpress.org/trunk@56691 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-25 23:38:38 +00:00
Jonny Harris
a68650ef19 Editor: Introduce get_block_asset_url Utility Function.
This commit introduces a valuable utility function, get_block_asset_url, designed to simplify the retrieval of block asset URLs, such as those for CSS and JavaScript files. This utility eliminates redundancy in both register_block_script_handle and register_block_style_handle. Additionally, `get_block_asset_url` incorporates an early exit mechanism to optimize performance.

This update includes comprehensive unit tests, covering various scenarios, including asset registration from core (wp-includes), themes, child themes, plugins, and mu-plugins.

Props spacedmonkey, joemcgill, flixos90, gziolo.
Fixes #58525.

git-svn-id: https://develop.svn.wordpress.org/trunk@56683 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-25 17:47:27 +00:00
Isabel Brison
bee2dc4ba2 Editor: Fix post editor layout when Post Content has no attributes.
Changes output of `wp_get_post_content_block_attributes` to return null if Post Content block doesn’t exist or empty array if it has no attributes.

Props flixos90, mukesh27.
Fixes #59358.


git-svn-id: https://develop.svn.wordpress.org/trunk@56629 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-20 01:24:32 +00:00
Jonny Harris
9a734f3751 Themes: Improve performance of get_block_theme_folders function
This commit enhances the performance of the get_block_theme_folders function by introducing a new method called get_block_template_folders within the WP_Theme class. Previously, this function suffered from poor performance due to repeated file lookups using file_exists. The new method implements basic caching, storing the result in the theme's cache, similar to how block themes are cached in the block_theme property (see [55236]).

Additionally, this change improves error handling by checking if a theme exists before attempting to look up the file. It also enhances test coverage. 

Props spacedmonkey, thekt12, swissspidy, flixos90, costdev, mukesh27.
Fixes #58319.

git-svn-id: https://develop.svn.wordpress.org/trunk@56621 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-19 16:15:52 +00:00
Greg Ziółkowski
d47515c274 Tests: Add additional tests covering Block Hooks registration
Props ockham.
See #59346.
Follow-up [56587].



git-svn-id: https://develop.svn.wordpress.org/trunk@56607 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-18 10:33:24 +00:00
Bernie Reiter
7b90f22573 General: Add block_hooks field to block type registration, REST API.
In order to implement Block Hooks, we need to add a new `block_hooks` field to the `WP_Block_Type` class, as well as to block registration related functions, the block types REST API controller, etc.

Props gziolo.
Fixes #59346. See #59313.

git-svn-id: https://develop.svn.wordpress.org/trunk@56587 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-14 13:23:13 +00:00
Bernie Reiter
bbb85de12d Themes: Inject theme attribute during serialization.
Rather than using `_inject_theme_attribute_in_block_template_content` to inject the `theme` attribute into all Template Part blocks found in a given file-based Block Template, introduce a new function called `_inject_theme_attribute_in_template_part_block`, and use that as second argument to `serialize_blocks()` (introduced in [56557]) in order to inject said attribute during tree traversal for serialization.

This allows for a more modular approach that will eventually be extended to implement automatic insertion of hooked blocks.

Note that we're guarding `_build_block_template_result_from_file()` (i.e. the callsite of `_inject_theme_attribute_in_template_part_block` and previously of `_inject_theme_attribute_in_block_template_content`) against regressions through additional unit test coverage added in [56562].

Props @gziolo.
Fixes #59338. See #59313.

git-svn-id: https://develop.svn.wordpress.org/trunk@56578 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-14 08:50:43 +00:00
Bernie Reiter
8e4ff2a01d Themes: Add test for theme atttibute in file-based block template.
While we already have unit test coverage for `_inject_theme_attribute_in_block_template_content`, those tests only verify that ''that'' function does what is supposed to do; there's however no guarantee that `_build_block_template_result_from_file` uses that function (or whatever other technique) to actually inject the theme attribute.

This patch adds test coverage to verify that the theme attribute is correctly injected by `_build_block_template_result_from_file`.

Props costdev, gziolo, mukesh27, spacedmonkey.
Fixes #59325. See #59313.

git-svn-id: https://develop.svn.wordpress.org/trunk@56562 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-13 12:03:14 +00:00
Isabel Brison
362624176c Editor: add configurable viewport sizes for fluid typography.
Adds options to configure min and max viewport sizes for fluid typography in theme.json settings.

Props ramonopoly.
Fixes #59048.


git-svn-id: https://develop.svn.wordpress.org/trunk@56535 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-07 04:28:45 +00:00
Sergey Biryukov
d0deb5bc66 Upload: Correct duplicate MIME type for .xlsx files generated by Google Docs.
This expands the code block previously added for `.docx` files to include `.xlsx` files as well, which are known to have the same issue with `finfo_file()`.

Includes a unit test case for `wp_check_filetype_and_ext()`.

Reference: [https://bugs.php.net/bug.php?id=77784 PHP Bug #77784: mime_content_type() result gets doubled for .xlsx].

Follow-up to [56497].

See #57898.

git-svn-id: https://develop.svn.wordpress.org/trunk@56510 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-03 12:49:51 +00:00
Isabel Brison
0b40c80d0d Editor: Don't use fluid layout value in typography.
Changes fluid typography calculation to use fallback value if layout wide size is a fluid value.

Props ramonopoly, mukesh27, jastos, aurooba.
See #58754.


git-svn-id: https://develop.svn.wordpress.org/trunk@56503 602fd350-edb4-49c9-b593-d223f7449a82
2023-09-01 04:01:23 +00:00
Tonya Mork
c29b095e76 Introduce font-face styles generator and printer.
Introducing Font Face, a server-side `@font-face` styles generator and printer. 

tl;dr:
* Introduces Font Face.
* Deprecates `_wp_theme_json_webfonts_handler()`.

**Introduce Font Face**

From an array of fonts (i.e. each font-family and its font variations to be processed), it:

1. Validates each `font-face` declaration, i.e. the CSS property and value pairing. If validation fails, processing stops with no font-face styles printed.
3. Generates the `@font-face` CSS for each font-family.
4. Prints the CSS within a `<style id="wp-fonts-local">` element.

The entry point into Font Face is through a new global function called `wp_print_font_faces()`, which is automatically called:

* when the `'wp_head'` hook runs (for the front-end).
* when the `'admin_print_styles'` hook runs (for the back-end).
* when `_wp_get_iframed_editor_assets()` runs to inject the `@font-face` styles into the iframed editor.

Once called, it gets the fonts from Theme_JSON merged data layer, which includes theme defined fonts and user activated fonts (once the Font Library #59166 is introduced into Core).

For classic sites, themes and plugins can directly call `wp_print_font_faces()` and pass their fonts array to it for processing.

**Deprecates `_wp_theme_json_webfonts_handler()`.**

As Font Face is a direct replacement, the stopgap code in `_wp_theme_json_webfonts_handler()` (introduced in 6.0.0 via [53282]) is deprecated and unused in Core.

**Props note:**
There's a long multiple year history baked into Font Face, which dates back to the early versions of a web font API (see #46370 and [https://github.com/WordPress/gutenberg/issues/41479 roadmap]. The props list includes those who contributed from those early versions up to this commit.

**References:**
* #46370 original (Web)Fonts API proposal for registering and enqueuing web fonts.
* [https://github.com/WordPress/gutenberg/issues/41479 Gutenberg tracking issue] which includes the evolution from Webfonts API to Fonts API to Font Face.
* [53282] / #55567 Added the stopgap code `_wp_theme_json_webfonts_handler()` in 6.0.
* [https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face @font-face on mdn web docs]
* #59166 Font Library: Font manager for WordPress

Follow-up to [53282].

Props aristath, jonoaldersonwp, hellofromTonya, andraganescu, annezazu, antonvlasenko, arena, askdesign, azaozz, bph, bradley2083, colorful-tones, costdev, davidbaumwald, desrosj, dingo_d, djcowan, domainsupport, dryanpress, elmastudio, flixos90, francina, garrett-eclipse, gigitux, grantmkin, grapplerulrich, gziolo, ironprogrammer, jb510, jeffpaul, jeremyyip, jffng, joostdevalk, jorgefilipecosta, juanmaguitar, mamaduka, matveb, mburridge, mitogh, ndiego, ntsekouras, oandregal, ocean90, oglekler, paaljoachim, pagelab, peterwilsoncc, poena, priethor, scruffian, SergeyBiryukov, shiloey, simison, skorasaurus, soean, westonruter, wildworks, zaguiini.
Fixes #59165.

git-svn-id: https://develop.svn.wordpress.org/trunk@56500 602fd350-edb4-49c9-b593-d223f7449a82
2023-08-31 21:47:40 +00:00
Anthony Burchell
287fd501f2 Media: Adjust PDF upload handling to remove non-opaque alpha channels from previews.
Previously, Imagick uploads of PDF files with non-opaque alpha channels would result in a black background replacing alpha in the generated thumbnail. This patch adds a `remove_pdf_alpha_channel()` function in the Imagick classes to use a white background instead.

Props gitlost, joemcgill, joedolson, launchinteractive, emirpprime, mwtsn, ceer, maysi, madejackson, 6adminit, costdev, oglekler.
Fixes #39216.


git-svn-id: https://develop.svn.wordpress.org/trunk@56271 602fd350-edb4-49c9-b593-d223f7449a82
2023-07-19 22:33:47 +00:00
Felix Arntz
2b931da110 Editor: Fix bug where it was not possible to style custom block elements in theme.json.
This changeset resolves a bug where WordPress would only allow HTML elements within core's own blocks to be styled in `theme.json`. Prior to this change, any `theme.json` rules applying to elements in custom blocks were ignored. With this fix it is now possible to style third-party block elements in `theme.json`.

Props flixos90, azaozz, costdev, glendaviesnz, spacedmonkey, oandregal.
Fixes #57868.


git-svn-id: https://develop.svn.wordpress.org/trunk@56254 602fd350-edb4-49c9-b593-d223f7449a82
2023-07-18 00:00:49 +00:00
Bernie Reiter
a710b97e7c Editor: update Wordpress npm packages.
Updates the wordpress npm packages and their dependencies to the latest versions, as well as auto-updates to relevant core PHP files.

Props youknowriad, joemcgill, spacedmonkey, ramonopoly, peterwilsoncc, bernhard-reiter, tyxla, dmsnell.
Fixes #58623.

git-svn-id: https://develop.svn.wordpress.org/trunk@56065 602fd350-edb4-49c9-b593-d223f7449a82
2023-06-27 14:20:18 +00:00
Isabel Brison
cfe8ab9b20 Editor: update layout classnames and specificity.
Adds a compound layout classname and reduces layout spacing rule specificity.

Props ramonopoly, andrewserong, poena.
Fixes #58548.


git-svn-id: https://develop.svn.wordpress.org/trunk@55956 602fd350-edb4-49c9-b593-d223f7449a82
2023-06-21 05:30:24 +00:00
Isabel Brison
b35b1fcc86 Editor: add Post Content attributes to block editor settings.
Adds a new block editor setting containing the Post Content block attributes, if they exist.

Props audrasjb, spacedmonkey, jeremyfelt, mukesh27, flixos90, andrewserong.
Fixes #58534.


git-svn-id: https://develop.svn.wordpress.org/trunk@55955 602fd350-edb4-49c9-b593-d223f7449a82
2023-06-21 04:21:04 +00:00
Isabel Brison
c790ae481b Editor: use layout.wideSize as max viewport width.
Use the value of `layout.wideSize` as the maximum viewport width for fluid font size calculations.

Props ramonopoly.

Fixes #58522.



git-svn-id: https://develop.svn.wordpress.org/trunk@55946 602fd350-edb4-49c9-b593-d223f7449a82
2023-06-20 05:26:47 +00:00
Greg Ziółkowski
f047b94d71 Editor: Add selectors field to block type definition
Adds support for the new selectors property for block types. It adds it to the allowed metadata when registering a block type, makes the WP_Block_Type class aware of it, exposes it through the block types REST API, and the get_block_editor_server_block_settings function.

Corresponding work in the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/46496.

Fixes #57585.
Props aaronrobertshaw, hellofromTonya.



git-svn-id: https://develop.svn.wordpress.org/trunk@55673 602fd350-edb4-49c9-b593-d223f7449a82
2023-04-21 10:41:58 +00:00
Peter Wilson
4d3627fd2e Build/Tests Tools: Add unit tests for Gallery blocks.
Introduces unit tests for the following blocks

* Gallery block with caption
* Gallery block, deprecations 1 thru 7

Updates the unit tests for the following blocks to match the counterparts stored in the Gutenberg repository:

* Gallery block
* Gallery block with columns

Modifies `Tests_Blocks_Render::test_do_block_output()` to ignore white space at the end of lines to account for whitespace equivalence in HTML.

Props peterwilsoncc, isabel_brison, gziolo.
Fixes #55571.



git-svn-id: https://develop.svn.wordpress.org/trunk@55471 602fd350-edb4-49c9-b593-d223f7449a82
2023-03-07 05:46:16 +00:00
Jb Audras
0a422d3f4b Help/About: Use the new /documentation/ URLs for HelpHub links in WordPress Admin.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/article/*` links with `/documentation/article/*` to avoid an extra redirect.

This also updates links to Support Forums by replacing `https://wordpress.org/support/` URLs with `https://wordpress.org/support/forums/`.

Props SergeyBiryukov, audrasjb, dhrupo, hasanmisbah, sakibmd, sabernhardt.
See #57726.


git-svn-id: https://develop.svn.wordpress.org/trunk@55412 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-23 10:36:33 +00:00
Daniel Bachhuber
3d61e7ef6a REST API: Only use Latin characters in test filenames.
Non-Latin characters can break SVN checkout in some environments.

Follow up from [55294].

See #57329, #57761.


git-svn-id: https://develop.svn.wordpress.org/trunk@55362 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-17 18:37:24 +00:00
Daniel Bachhuber
b46b855070 REST API: Support non-Latin characters in template route regex.
Non-Latin characters are URL-encoded (e.g. `%cf%84%ce%b5%cf%83%cf%84`). Matching `%` in the route ensures templates with non-Latin titles can be properly saved.

Props antonyagrios, mburridge.
Fixes #57329.


git-svn-id: https://develop.svn.wordpress.org/trunk@55294 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 23:45:18 +00:00
Felix Arntz
05c1b0c6c8 Editor: Add layout controls to children of flex layout blocks.
Props isabel_brison, andrewserong, davidbaumwald, flixos90, mamaduka, ntsekouras, hellofromtonya.
Fixes #57584.


git-svn-id: https://develop.svn.wordpress.org/trunk@55282 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:41:11 +00:00