summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/data
Commit message (Collapse)AuthorAge
* Editor: Fix layout support classes to be generated with a stable ID.Joe McGill2025-03-18
| | | | | | | | | | This fixes a bug reported in https://github.com/WordPress/gutenberg/issues/67308 related to the Interactivity API's client-side navigation feature by replacing the incrementally generated IDs with stable hashes derived from the block's layout style definition. Fixes #62985. Props darerodz. git-svn-id: https://develop.svn.wordpress.org/trunk@60038 602fd350-edb4-49c9-b593-d223f7449a82
* Media: fix full size image generation for PNG uploads.Adam Silverstein2025-02-20
| | | | | | | | | | | | | Remove a limitation that prevented PNG uploads from generating the full sized image. Fixes a bug where using the image_editor_output_format filter would not generate full sized images as expected. The removed code was present to prevent overly large PNG image output, however this issue was resolved separately in #36477. Props: adamsilverstein, pixlpirate, flixos90, mukesh27, azaozz. Fixes #62900. git-svn-id: https://develop.svn.wordpress.org/trunk@59844 602fd350-edb4-49c9-b593-d223f7449a82
* Administration: Replace "Add New {Item}" wording with "Add {Item}" across ↵Jb Audras2025-02-08
| | | | | | | | | | | | | | the administration. This changeset replaces each occurrence of "Add New {Item}" label with "Add {Item}" in WordPress administration, to make the interface more consistent and simplify the translation effort. Props jameskoster, audrasjb, ntsekouras, afercia, peterwilsoncc, youknowriad, joedolson, sukhendu2002, jdy68, beryldlg, fxbenard. See #61219. git-svn-id: https://develop.svn.wordpress.org/trunk@59784 602fd350-edb4-49c9-b593-d223f7449a82
* I18N: Mail: Make PHPMailer messages translatable.Pascal Birchler2025-01-08
| | | | | | | | | Adds a new `WP_PHPMailer` class to leverage the WordPress i18n system with PHPMailer, so that any user-visible error messages can be properly translated. Props sukhendu2002, swissspidy, audrasjb, iandunn, nacin, mark-k. Fixes #23311. git-svn-id: https://develop.svn.wordpress.org/trunk@59592 602fd350-edb4-49c9-b593-d223f7449a82
* Media: improve Imagick handling of colors and alpha channel for PNG image ↵Adam Silverstein2025-01-07
| | | | | | | | | | | | | | | uploads. Fix an issue where index color (8 bit) PNG uploads were output as true color (24 bit) PNGs, significantly increasing their size. When using Imagick, PNG output images will now match the colors of the uploaded image. Also, correct handling of PNG alpha channel information so it is preserved in output images. Props adamsilverstein, pbearne, nosilver4u, peterdavehello, joemcgill, azaozz, codex-m, kirasong, justlevine, jokanane, sallyruchman, wpfed, tgsrvrs, antpb, tb1909. Fixes #36477. git-svn-id: https://develop.svn.wordpress.org/trunk@59589 602fd350-edb4-49c9-b593-d223f7449a82
* i18n: Account for `load_*_textdomain()` after JIT loading.Jonathan Desrosiers2024-11-20
| | | | | | | | | | | | | | | When `load_*_textdomain()` functions are called after WordPress has already attempted just-in-time loading of translations, nothing happens. This updates the related logic to retry translation loading when a custom path is set to ensure all translations are available. Additionally, this also fixes cases where an `en_US.mo` file is provided with non-English strings to override the default language. Follow up to [59157]. Props swissspidy, peterwilsoncc, desrosj, apermo, sergeybiryukov, wildworks, tigriweb, twvania, looswebstudio, stimul, audrasjb, finntown, bluantinoo, timwhitlock, albigdd. See #62337. git-svn-id: https://develop.svn.wordpress.org/trunk@59430 602fd350-edb4-49c9-b593-d223f7449a82
* Media: Include image update missed in [59379].Peter Wilson2024-11-10
| | | | | | | | | | | "We missed you", hissed the lovecats. -- The Cure. See #62359. git-svn-id: https://develop.svn.wordpress.org/trunk@59380 602fd350-edb4-49c9-b593-d223f7449a82
* HTML API: Improve private method name used by `WP_HTML_Processor::next_token()`.Weston Ruter2024-11-06
| | | | | | | | | | | | This renames the private `_next_token` method to `next_visitable_token`. It also removes irrelevant assertions from the unit test. Follow-up to [59285]. Props dmsnell, jonsurrell, westonruter. See #62269. git-svn-id: https://develop.svn.wordpress.org/trunk@59364 602fd350-edb4-49c9-b593-d223f7449a82
* HTML API: Fix extensibility of `WP_HTML_Processor::next_token()`.Weston Ruter2024-10-23
| | | | | | | | | | Break out logic from the `next_token()` method into a private method which may call itself recursively. This allows for subclasses to override the `next_token()` method and be assured that each call to `next_token()` corresponds with the consumption of one single token. This also parallels how `WP_HTML_Tag_Processor::next_token()` wraps a private `base_class_next_token()` method. Props westonruter, jonsurrell. Fixes #62269. git-svn-id: https://develop.svn.wordpress.org/trunk@59285 602fd350-edb4-49c9-b593-d223f7449a82
* Code Modernization: Remove xml_set_object() in AtomParser::parse().Tonya Mork2024-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The XML Parser extension still supports a quite dated mechanism for method based callbacks, where the object is first set via `xml_set_object()` and the callbacks are then set by passing only the name of the method to the relevant parameters on any of the `xml_set_*_handler()` functions. {{{ xml_set_object( $parser, $my_obj ); xml_set_character_data_handler( $parser, 'method_name_on_my_obj' ); }}} Passing proper callables to the `xml_set_*_handler()` functions has been supported for the longest time and is cross-version compatible. So the above code is 100% equivalent to: {{{ xml_set_character_data_handler( $parser, [$my_obj, 'method_name_on_my_obj'] ); }}} The mechanism of setting the callbacks with `xml_set_object()` has now been deprecated as of PHP 8.4, in favour of passing proper callables to the `xml_set_*_handler()` functions. This is also means that calling the `xml_set_object()` function is deprecated as well. This commit fixes this deprecation for the `AtomParser::parse()` method. This change is safeguarded via the new `AtomParser_Parse_Test` class. Notes: * Though this is "officially" an external library, this package is no longer externally maintained. The code style of the fix in the source file is in line with the existing code style for the file. * It appears that this class is not actually used by WP Core itself, so it could be considered to deprecate the class. However, as the class is not currently deprecated, safeguarding the change with a test seemed prudent. * The fixture used for the test reuses a fixture from the original package: https://code.google.com/archive/p/phpatomlib/source/default/source * The new test class follows the recommended test format (naming convention of the class, `@covers` tag at class level, only testing one method) as per Trac tickets 62004 / 53010. Refs: * https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names * https://www.php.net/manual/en/function.xml-set-object.php * https://www.php.net/manual/en/ref.xml.php Follow-up to [5951]. Props jrf. See #62061. git-svn-id: https://develop.svn.wordpress.org/trunk@59062 602fd350-edb4-49c9-b593-d223f7449a82
* Media: Automatically convert HEIC images to JPEGRobert Anderson2024-08-05
| | | | | | | | | | | | | | | | | | | Automatically create a JPEG version of uploaded HEIC images if the server has a version of Imagick that supports HEIC. Conversion is done silently through the existing `WP_Image_Editor` infrastructure that creates multiple sizes of uploaded images. This allows users to view HEIC images in WP Admin and use them in their posts and pages regardless of whether their browser supports HEIC. Browser support for HEIC is relatively low (only Safari) while the occurrence of HEIC images is relatively common. The original HEIC image can be downloaded via a link on the attachment page. Props adamsilverstein, noisysocks, swissspidy, spacedmonkey, peterwilsoncc. Fixes #53645. git-svn-id: https://develop.svn.wordpress.org/trunk@58849 602fd350-edb4-49c9-b593-d223f7449a82
* block.json: Allow passing PHP filename as `variations` field.bernhard-reiter2024-07-24
| | | | | | | | | | | | | Previously, the `variations` field in a block.json file could be used to provide a static list of the block's variations (i.e., an array). Alternatively, the block's `variation_callback` could be set during server-side block registration to point to a PHP function to generate those variations. This changeset makes it so that the block.json `variations` field can be alternatively set to a string, which will be interpreted as the filename of a PHP file that generates the variations. It is loosely modeled after [54132], which introduced the `render` field for `block.json`, as a way to point to a PHP file instead of providing a `render_callback`. Props bernhard-reiter, gziolo. Fixes #61280. git-svn-id: https://develop.svn.wordpress.org/trunk@58801 602fd350-edb4-49c9-b593-d223f7449a82
* Section styles: improve performance and conceptual consistency.André2024-06-24
| | | | | | | | | | | | | | | | | | | These changes involve: - Move shared variation definitions from styles.blocks.variations to styles.variations - Remove blockTypes from styles.variations. - Do not register shared variations from theme style variation or primary theme.json files. - Move the merging of theme.json data into the WP_Theme_JSON_Resolver and WP_Theme_JSON classes. These changes improve performance and are more future-proof API wise. See conversation at https://github.com/WordPress/gutenberg/issues/62686 Props aaronrobertshaw, oandregal, andrewserong, joemcgill, talldanwp, andrewserong, ramonopoly, richtabor, youknowriad. See #61312, #61451. git-svn-id: https://develop.svn.wordpress.org/trunk@58466 602fd350-edb4-49c9-b593-d223f7449a82
* Section styles: add slug to override non-kebab-cased variations.André2024-06-14
| | | | | | | | Props aaronrobertshaw, oandregal. Fixes #61440. git-svn-id: https://develop.svn.wordpress.org/trunk@58413 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: Add theme.json v3 migrations.Ella2024-06-04
| | | | | | | | | | | | | | | | | | See https://github.com/WordPress/wordpress-develop/pull/6616. See also the original Gutenberg PRs: * https://github.com/WordPress/gutenberg/pull/58409 * https://github.com/WordPress/gutenberg/pull/61328 * https://github.com/WordPress/gutenberg/pull/61842 * https://github.com/WordPress/gutenberg/pull/62199 * https://github.com/WordPress/gutenberg/pull/62252 Fixes #61282. Props ajlende, talldanwp, ramonopoly, ellatrix. git-svn-id: https://develop.svn.wordpress.org/trunk@58328 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: add missing test template file.Ella2024-06-04
| | | | | | | | | | | Add a missing file for r58323. See https://github.com/WordPress/wordpress-develop/pull/6468. See #61110. git-svn-id: https://develop.svn.wordpress.org/trunk@58324 602fd350-edb4-49c9-b593-d223f7449a82
* Block Themes: Add section styling via extended block style variationsRobert Anderson2024-05-31
| | | | | | | | | | | | | | | Provide users with the ability to style entire sections of a page without having to tediously reapply the same sets of styles. This is done by extending block style variations to apply to nested blocks. See https://github.com/WordPress/gutenberg/pull/57908. Fixes #61312. Props aaronrobertshaw, talldanwp, ramonopoly, isabel_brison, andrewserong. git-svn-id: https://develop.svn.wordpress.org/trunk@58264 602fd350-edb4-49c9-b593-d223f7449a82
* Block Themes: Add support for relative URLs in top-level theme.json stylesRobert Anderson2024-05-31
| | | | | | | | | | | | | Allow using relative `file:` URLs in top-level theme.json properties such as `styles.background`, and modify the REST API to provide clients with the absolute URLs via a 'https://api.w.org/theme-file' attribute in the `_links` array. Props ramonopoly. Fixes #61273. git-svn-id: https://develop.svn.wordpress.org/trunk@58262 602fd350-edb4-49c9-b593-d223f7449a82
* Introduce Token Map: An optimized static translation class.Dennis Snell2024-05-23
| | | | | | | | | | | | | | | | | | | This patch introduces a new class: `WP_Token_Map`, designed for efficient lookup and translation of static mappings between string keys or tokens, and string replacements (for example, HTML character references). The Token Map imposes certain restrictions on the byte length of the lookup tokens and their replacements, but is a highly-optimized data structure for mappings with a very high number of tokens. Developed in https://github.com/WordPress/wordpress-develop/pull/5373 Discussed in https://core.trac.wordpress.org/ticket/60698 Fixes #60698. Props: dmsnell, gziolo, jonsurrell, jorbin. git-svn-id: https://develop.svn.wordpress.org/trunk@58188 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: Update npm packages.Ella2024-05-23
| | | | | | | | | | | | Updates the editor npm packages to latest versions. See https://github.com/WordPress/wordpress-develop/pull/6612. Props ellatrix, mukesh27, youknowriad, mamaduka. git-svn-id: https://develop.svn.wordpress.org/trunk@58187 602fd350-edb4-49c9-b593-d223f7449a82
* I18N: Improve support for using only PHP translation files.Pascal Birchler2024-04-30
| | | | | | | | | | | | | 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
* Media: fix potential error in class-avif-info.php::get_item_features().Adam Silverstein2024-04-26
| | | | | | | | | | | 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
* HTML API: Validate HTML Processor against external test suite from html5lib.Dennis Snell2024-04-16
| | | | | | | | | | | | | | | | | | | | | | | 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
* Docs: Fix various typos and spelling mistakes.Pascal Birchler2024-04-12
| | | | | | | Props swissspidy, jucaduca, sergeybiryukov. See #60699. git-svn-id: https://develop.svn.wordpress.org/trunk@57987 602fd350-edb4-49c9-b593-d223f7449a82
* Editor: disable `shadow.defaultPresets` for classic themes.Pascal Birchler2024-03-27
| | | | | | | | | | 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
* Build/Test Tools: Fix typo in `variation-new-font-family.json` fixture file.Pascal Birchler2024-03-07
| | | | | | | Props huzaifaalmesbah, mukesh27. Fixes #60712. git-svn-id: https://develop.svn.wordpress.org/trunk@57788 602fd350-edb4-49c9-b593-d223f7449a82
* Tests: Synchronize Theme.JSON unit test between Core and Gutenberg.Riad Benguella2024-02-20
| | | | | | | | | | | | | | | | 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
* I18N: Prevent incorrect language dropdown entries when there are `.l10n.php` ↵Pascal Birchler2024-02-16
| | | | | | | | | | | | | 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
* Blocks: Allow reading the script handle from asset filesGreg Ziółkowski2024-02-12
| | | | | | | | | | | | 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
* Editor: Add `viewScriptModule` handling to `block.json` metadataGreg Ziółkowski2024-02-08
| | | | | | | | | | | | | 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
* Editor: Fix Font Library PHP unit tests.Riad Benguella2024-02-06
| | | | | | | | | 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
* Upload: Fallback to `PclZip` to validate ZIP file uploads.Peter Wilson2024-02-05
| | | | | | | | | | | | | | `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
* Build/Test Tools: Mock plugin API response in `WP_REST_Plugins_Controller_Test`.Peter Wilson2024-02-04
| | | | | | | | | | | 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
* Media: fix AVIF tests.Adam Silverstein2024-02-02
| | | | | | | | | | 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
* Media: enable AVIF support.Adam Silverstein2024-02-02
| | | | | | | | | | | | | 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
* I18N: Fix plural forms parsing in `WP_Translation_File`.Pascal Birchler2024-02-01
| | | | | | | | | | | | 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
* I18N: Support loading `.l10n.php` translation files on their own.Pascal Birchler2024-02-01
| | | | | | | | | | | | | 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
* I18N: Improve singular lookup of pluralized strings.Pascal Birchler2024-02-01
| | | | | | | | | | | | 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
* Editor: Add `viewStyle` property to `block.json` for frontend-only block stylesGreg Ziółkowski2024-01-31
| | | | | | | | | | | | | 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
* I18N: Improve singular lookup of pluralized strings.Pascal Birchler2024-01-30
| | | | | | | | | | | 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
* Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.Riad Benguella2024-01-29
| | | | | | | | | | | | | | | | | | | | 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
* I18N: Introduce a more performant localization library.Pascal Birchler2024-01-23
| | | | | | | | | | | | | | | | | | | 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
* General: Add $schema property to block and theme JSON files.bernhard-reiter2024-01-23
| | | | | | | | | | | 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
* Themes: Remove memoization from stylesheet and theme directories.Joe McGill2023-11-20
| | | | | | | | | | 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
* Editor: Improve performance of _register_theme_block_patterns function. Jonny Harris2023-10-03
| | | | | | | | | | | | | | | | | 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
* Tests: Cover Block Hooks integration with a custom block themeGreg Ziółkowski2023-10-03
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Filesystem API: Add missing ZIP file for unzip tests.Colin Stewart2023-09-25
| | | | | | | | | | | | | 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
* Editor: Introduce get_block_asset_url Utility Function.Jonny Harris2023-09-25
| | | | | | | | | | | 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
* Editor: Fix post editor layout when Post Content has no attributes.Isabel Brison2023-09-20
| | | | | | | | | | 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
* Themes: Improve performance of get_block_theme_folders functionJonny Harris2023-09-19
| | | | | | | | | | | 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