Commit Graph

49028 Commits

Author SHA1 Message Date
Sergey Biryukov
23d8d94d27 Coding Standards: Update PHPCS to version 3.8.1.
PHPCS has seen two new releases since the update to WPCS 3.0, with especially the 3.8.0 version containing a huge number of improvements.

References:
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.8.0 PHP_CodeSniffer 3.8.0 release notes]
* [https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/tag/3.8.1 PHP_CodeSniffer 3.8.1 release notes]

Follow-up to [56695].

Props jrf, swissspidy.
Fixes #60279.
Built from https://develop.svn.wordpress.org/trunk@57378


git-svn-id: http://core.svn.wordpress.org/trunk@56884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 21:31:13 +00:00
youknowriad
1de40f71be 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.
Built from https://develop.svn.wordpress.org/trunk@57377


git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 21:07:12 +00:00
desrosj
aba105c851 Build/Test Tools: Update third-party Slack action.
This updates the `slackapi/slack-github-action` from `1.24.0` to `1.25.0`. This fixes more GitHub Action deprecated notices.

Follow up to [57362].

See #59805.
Built from https://develop.svn.wordpress.org/trunk@57376


git-svn-id: http://core.svn.wordpress.org/trunk@56882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 15:06:16 +00:00
gziolo
81bb2d56e7 Editor: Add Block Bindings API helpers
It is part of the sync from the Gutenberg plugin that introduces the registry for block binding sources required for the new Block Bindings API: WordPress/gutenberg#54536.

See #60282.
Follow-up [57373].
Props czapla, artemiosans, santosguillamot, sc0ttkclark, lgladdy, talldanwp, swissspidy, youknowriad, fabiankaegy, mukesh27.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 13:08:16 +00:00
jorgefilipecosta
b3958d342b Coding Standards: Remove unnecessary access and internal annotations from two functions in WP_REST_Templates_Controller.
This commit removes unnecessary access and internal annotations from two functions that are private and as such don't require the annotation. It also adds the since annotation with the 6.5 release given that the annotation may be useful.

Props swissspidy.
See #60358.
Built from https://develop.svn.wordpress.org/trunk@57374


git-svn-id: http://core.svn.wordpress.org/trunk@56880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 12:34:18 +00:00
gziolo
f1a977e357 Editor: Add registry for block binding sources
It is part of the sync from the Gutenberg plugin that introduces the registry for block binding sources required for the new Block Bindings API: https://github.com/WordPress/gutenberg/issues/54536.

See #60282.
Props czapla, artemiosans, santosguillamot, sc0ttkclark, lgladdy, talldanwp, swissspidy, youknowriad, fabiankaegy.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 11:16:16 +00:00
Sergey Biryukov
0ef6e192cb Coding Standards: Use strict type check for in_array() in get_hooked_block_markup().
This aims to prevent type juggling causing incorrect results.

Follow-up to [57157].

Props jrf.
See #60279.
Built from https://develop.svn.wordpress.org/trunk@57372


git-svn-id: http://core.svn.wordpress.org/trunk@56878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-28 21:34:17 +00:00
audrasjb
16832e24b8 Docs: Typo correction in wp_internal_hosts docblock.
Follow-up to [55289].

Props shailu25.
Fixes #60363.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-28 16:40:17 +00:00
audrasjb
01f4eab4d5 Docs: Improve various globals documentation, as per docblock standards.
Props upadalavipul, audrasjb, shailu25, viralsampat.
Fixes #59255.
See #59651.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-28 08:19:17 +00:00
audrasjb
7a908d39ac Coding Standards: Add missing escaping functions to WP_Customize_Control and WP_Customize_Nav_Menu_Location_Control.
Follow-up to [20295], [32806].

Props nareshbheda, shailu25, sabernhardt, audrasjb.
Fixes #60324.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-28 07:50:18 +00:00
Sergey Biryukov
ea7a616041 Tests: Expand sanitize_text_field() tests.
This change ensures that the `sanitize_text_field` and `sanitize_textarea_field` filters are correctly invoked for the respective functions.

Follow-up to [38944].

Props pbearne, audrasjb.
Fixes #60357.
Built from https://develop.svn.wordpress.org/trunk@57368


git-svn-id: http://core.svn.wordpress.org/trunk@56874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-27 20:37:18 +00:00
Weston Ruter
3f2e254478 Script Loader: Clarify in docs that wp_get_inline_script_tag() and wp_print_inline_script_tag() can take non-JS data.
Props vladimiraus.
Fixes #60331.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-27 01:04:14 +00:00
jorgefilipecosta
5c928b8d0f Editor: Add original_source and author_text to the templates REST API.
For the new "All templates" UI to work properly we need the REST API to provide to additional fields original_source, and author_text.

Props ntsekouras, get_dave.
Fixes #60358.
Built from https://develop.svn.wordpress.org/trunk@57366


git-svn-id: http://core.svn.wordpress.org/trunk@56872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-27 00:07:18 +00:00
jorgefilipecosta
384f94d6ed Coding Standards: Fix some spaces on block-supports background.
When we run composer format these changes are applied so I guess we should just commit them to avoid seeing the changes again the future.
Built from https://develop.svn.wordpress.org/trunk@57365


git-svn-id: http://core.svn.wordpress.org/trunk@56871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-26 17:53:15 +00:00
Sergey Biryukov
cdbe6c71a5 Coding Standards: Add missing escaping in Custom_Image_Header::step_2().
Follow-up to [4673], [14907].

Props nareshbheda, audrasjb, kebbet.
Fixes #59278.
Built from https://develop.svn.wordpress.org/trunk@57364


git-svn-id: http://core.svn.wordpress.org/trunk@56870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-26 14:20:12 +00:00
desrosj
f3fe615b79 Build/Test Tools: Update the caniuse data.
This updates the `caniuse-lite` database and includes all resulting CSS and built file changes, which are all minor changes due to fluctuations in browser usage.

Props gziolo, jonsurrell.
See #59657.
Built from https://develop.svn.wordpress.org/trunk@57363


git-svn-id: http://core.svn.wordpress.org/trunk@56869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-26 14:04:12 +00:00
desrosj
4dfea53580 Build/Test Tools: Update third-party GitHub Actions.
This updates the following third-party GitHub Actions to their latest versions:

- `actions/setup-node` from `3.8.1` to `4.0.1`
- `actions/upload-artifact` from `3.1.2` to `4.3.0`
- `shivammathur/setup-php` from `2.28.0` to `2.29.0`
- `actions/cache` from `3.3.2` to `4.0.0`
- `codecov/codecov-action` from `3.1.4` to `3.1.5`

Most notably, these updates silence newly encountered notices as a result of GitHub beginning to transition away from Node.js 16 to Node.js 20 (see https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/).

Props swissspidy.
See #59805.
Built from https://develop.svn.wordpress.org/trunk@57362


git-svn-id: http://core.svn.wordpress.org/trunk@56868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-26 13:49:16 +00:00
Aaron Jorbin
5056d865f7 Build/Tests: Ensure set_error_handler is cleaned up.
Follow up to: [57332].

Fixes #60305.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-26 00:54:15 +00:00
Aaron Jorbin
793b30bc30 Media: Redirect inactive attachment pages for logged-out users.
Ensure logged out users are redirected to the media file when attachment pages are inactive. This removes the read_post capability check from the canonical redirects as anonymous users lack the permission.

This was previously committed in [57310] before being reverted in [57318]. This update includes a fix to cover instances where revealing a URL could be considered a data leak and greatly expands the unit tests to ensure that this is covered along with many other instances.

Follow-up to [56657], [56658], [56711], [57310], [57318].

Props peterwilsoncc, jorbin, afercia, aristath, chesio, joppuyo, jorbin, lakshmananphp, poena, sergeybiryukov, swissspidy, johnbillion.
Fixes #59866.
See #57913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 17:36:15 +00:00
Sergey Biryukov
9f3a76079b Docs: Fix a few typos in wp-includes/pomo/po.php.
Props shailu25.
Fixes #60346.
Built from https://develop.svn.wordpress.org/trunk@57356


git-svn-id: http://core.svn.wordpress.org/trunk@56862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 17:08:17 +00:00
Bernhard Reiter
b22f506554 Block Hooks: Amend PHPDoc for hooked_block_{$hooked_block_type} filter.
Add missing explanation of the dynamic part of the hook name.

Follow-up [57354].
Props swissspidy.
See #59572, #60126.
Built from https://develop.svn.wordpress.org/trunk@57355


git-svn-id: http://core.svn.wordpress.org/trunk@56861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 14:20:17 +00:00
Bernhard Reiter
b4938efb13 Block Hooks: Introduce a new hooked_block_{$block_type} filter.
Add a new `hooked_block_{$block_type}` filter that allows modifying a hooked block (in parsed block format) prior to insertion, while providing read access to its anchor block (in the same format).

This allows block authors to e.g. set a hooked block's attributes, or its inner blocks; the filter can peruse information about the anchor block when doing so. As such, this filter provides a solution to both #59572 and #60126.

The new filter is designed to strike a good balance and separation of concerns with regard to the existing [https://developer.wordpress.org/reference/hooks/hooked_block_types/ `hooked_block_types` filter], which allows addition or removal of a block to the list of hooked blocks for a given anchor block -- all of which are identified only by their block ''types''. This new filter, on the other hand, only applies to ''one'' hooked block at a time, and allows modifying the entire (parsed) hooked block; it also gives (read) access to the parsed anchor block.

Props gziolo, tomjcafferkey, andrewserong, isabel_brison, timbroddin, yansern.
Fixes #59572, #60126.
Built from https://develop.svn.wordpress.org/trunk@57354


git-svn-id: http://core.svn.wordpress.org/trunk@56860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 13:48:18 +00:00
youknowriad
493d73f5c0 Editor: Add video and audio pattern categories.
More categories, better organization for patterns
as they grow and power more WordPress websites.

Props aaronrobertshaw, get_dave.
Fixes #60342.
Built from https://develop.svn.wordpress.org/trunk@57353


git-svn-id: http://core.svn.wordpress.org/trunk@56859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 12:48:16 +00:00
youknowriad
02cdd7f047 Editor: Fix Theme.json application of custom root selector for styles.
Theme.json stylesheets attempting to use a custom root selector are generated with in correct styles.

Props aaronrobertshaw, get_dave, mukesh27.
Fixes #60343.
Built from https://develop.svn.wordpress.org/trunk@57352


git-svn-id: http://core.svn.wordpress.org/trunk@56858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 10:43:12 +00:00
Pascal Birchler
eafafcf518 Twenty Twenty-Four: Change font family slug to lowercase.
Ensures referencing the correct CSS custom property.

Props RavanH, poena, onemaggie, huzaifaalmesbah, mukesh27.
Fixes #60325.
Built from https://develop.svn.wordpress.org/trunk@57351


git-svn-id: http://core.svn.wordpress.org/trunk@56857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 09:27:16 +00:00
Pascal Birchler
64ca037991 I18N: Rename WP_Translation_Controller::instance() method to get_instance().
This improves consistency as `get_instance()` is more commonly used in core. 

See #59656.
Built from https://develop.svn.wordpress.org/trunk@57350


git-svn-id: http://core.svn.wordpress.org/trunk@56856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 07:53:17 +00:00
Sergey Biryukov
465d17a905 Docs: Fix typo in _get_block_template_file() DocBlock.
Follow-up to [55744].

See #59651.
Built from https://develop.svn.wordpress.org/trunk@57349


git-svn-id: http://core.svn.wordpress.org/trunk@56855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-24 23:41:06 +00:00
dmsnell
62e0ef411b HTML API: Scan all syntax tokens in a document, read modifiable text.
Since its introduction in WordPress 6.2 the HTML Tag Processor has
provided a way to scan through all of the HTML tags in a document and
then read and modify their attributes. In order to reliably do this, it
also needed to be aware of other kinds of HTML syntax, but it didn't
expose those syntax tokens to consumers of the API.

In this patch the Tag Processor introduces a new scanning method and a
few helper methods to read information about or from each token. Most
significantly, this introduces the ability to read `#text` nodes in the
document.

What's new in the Tag Processor?
================================

 - `next_token()` visits every distinct syntax token in a document.
 - `get_token_type()` indicates what kind of token it is.
 - `get_token_name()` returns something akin to `DOMNode.nodeName`.
 - `get_modifiable_text()` returns the text associated with a token.
 - `get_comment_type()` indicates why a token represents an HTML comment.

Example usage.
==============

{{{
<?php
function strip_all_tags( $html ) {
        $text_content = '';
        $processor    = new WP_HTML_Tag_Processor( $html );

        while ( $processor->next_token() ) {
                if ( '#text' !== $processor->get_token_type() ) {
                        continue;
                }

                $text_content .= $processor->get_modifiable_text();
        }

        return $text_content;
}
}}}

What changes in the Tag Processor?
==================================

Previously, the Tag Processor would scan the opening and closing tag of
every HTML element separately. Now, however, there are special tags
which it only visits once, as if those elements were void tags without
a closer.

These are special tags because their content contains no other HTML or
markup, only non-HTML content.

 - SCRIPT elements contain raw text which is isolated from the rest of
   the HTML document and fed separately into a JavaScript engine. There
   are complicated rules to avoid escaping the script context in the HTML.
   The contents are left verbatim, and character references are not decoded.

 - TEXTARA and TITLE elements contain plain text which is decoded
   before display, e.g. transforming `&amp;` into `&`. Any markup which
   resembles tags is treated as verbatim text and not a tag.

 - IFRAME, NOEMBED, NOFRAMES, STYLE, and XMP elements are similar to the
   textarea and title elements, but no character references are decoded.
   For example, `&amp;` inside a STYLE element is passed to the CSS engine
   as the literal string `&amp;` and _not_ as `&`.

Because it's important not treat this inner content separately from the
elements containing it, the Tag Processor combines them when scanning
into a single match and makes their content available as modifiable
text (see below).

This means that the Tag Processor will no longer visit a closing tag for
any of these elements unless that tag is unexpected.

{{{
    <title>There is only a single token in this line</title>
    <title>There are two tokens in this line></title></title>
    </title><title>There are still two tokens in this line></title>
}}}

What are tokens?
================

The term "token" here is a parsing term, which means a primitive unit in
HTML. There are only a few kinds of tokens in HTML:

 - a tag has a name, attributes, and a closing or self-closing flag.
 - a text node, or `#text` node contains plain text which is displayed
   in a browser and which is decoded before display.
 - a DOCTYPE declaration indicates how to parse the document.
 - a comment is hidden from the display on a page but present in the HTML.

There are a few more kinds of tokens that the HTML Tag Processor will
recognize, some of which don't exist as concepts in HTML. These mostly
comprise XML syntax elements that aren't part of HTML (such as CDATA and
processing instructions) and invalid HTML syntax that transforms into
comments.

What is a funky comment?
========================

This patch treats a specific kind of invalid comment in a special way.
A closing tag with an invalid name is considered a "funky comment." In
the browser these become HTML comments just like any other, but their
syntax is convenient for representing a variety of bits of information
in a well-defined way and which cannot be nested or recursive, given
the parsing rules handling this invalid syntax.

 - `</1>`
 - `</%avatar_url>`
 - `</{"wp_bit": {"type": "post-author"}}>`
 - `</[post-author]>`
 - `</__( 'Save Post' );>`

All of these examples become HTML comments in the browser. The content
inside the funky content is easily parsable, whereby the only rule is
that it starts at the `<` and continues until the nearest `>`. There
can be no funky comment inside another, because that would imply having
a `>` inside of one, which would actually terminate the first one.

What is modifiable text?
========================

Modifiable text is similar to the `innerText` property of a DOM node.
It represents the span of text for a given token which may be modified
without changing the structure of the HTML document or the token.

There is currently no mechanism to change the modifiable text, but this
is planned to arrive in a later patch.

Tags
====

Most tags have no modifiable text because they have child nodes where
text nodes are found. Only the special tags mentioned above have
modifiable text.

{{{
    <div class="post">Another day in HTML</div>
    └─ tag ──────────┘└─ text node ─────┘└────┴─ tag
}}}

{{{
    <title>Is <img> &gt; <image>?</title>
    │      └ modifiable text ───┘       │ "Is <img> > <image>?"
    └─ tag ─────────────────────────────┘
}}}

Text nodes
==========

Text nodes are entirely modifiable text.

{{{
    This HTML document has no tags.
    └─ modifiable text ───────────┘
}}}

Comments
========

The modifiable text inside a comment is the portion of the comment that
doesn't form its syntax. This applies for a number of invalid comments.

{{{
    <!-- this is inside a comment -->
    │   └─ modifiable text ──────┘  │
    └─ comment token ───────────────┘
}}}

{{{
    <!-->
    This invalid comment has no modifiable text.
}}}

{{{
    <? this is an invalid comment -->
    │ └─ modifiable text ────────┘  │
    └─ comment token ───────────────┘
}}}

{{{
    <[CDATA[this is an invalid comment]]>
    │       └─ modifiable text ───────┘ │
    └─ comment token ───────────────────┘
}}}

Other token types also have modifiable text. Consult the code or tests
for further information.

Developed in https://github.com/WordPress/wordpress-develop/pull/5683
Discussed in https://core.trac.wordpress.org/ticket/60170

Follows [57575]

Props bernhard-reiter, dlh, dmsnell, jonsurrell, zieladam
Fixes #60170


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


git-svn-id: http://core.svn.wordpress.org/trunk@56854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-24 23:37:16 +00:00
youknowriad
ba6ae923b5 Script Loader: Load the modules to the footer in classic themes
Incremental import maps fail if the import map is printed after the module scripts.
This means, we should always render import maps first. This means that for classic themes, we need to move the import map and modules to the footer because we can't know before that which modules are needed.

Props luisherranz, cbravobernal.
Fixes #60240.
Built from https://develop.svn.wordpress.org/trunk@57345


git-svn-id: http://core.svn.wordpress.org/trunk@56851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-24 10:39:18 +00:00
Pascal Birchler
417bf8d365 I18N: Improve docblocks after [57337].
Props mukesh27.
See #59656.
Built from https://develop.svn.wordpress.org/trunk@57344


git-svn-id: http://core.svn.wordpress.org/trunk@56850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-24 07:57:14 +00:00
dmsnell
7f22c4d4ea HTML API: Support INPUT tags.
Adds support for the following HTML elements to the HTML Processor:

 - INPUT

Previously this element was not supported and the HTML Processor would bail when encountering one. Now, with this patch applied, it will proceed to parse the HTML document.

Developed in https://github.com/WordPress/wordpress-develop/pull/5907
Discussed in https://core.trac.wordpress.org/ticket/60283

Props jonsurrell
See #60283


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


git-svn-id: http://core.svn.wordpress.org/trunk@56849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-24 03:30:14 +00:00
Sergey Biryukov
e7865d0001 Docs: Add missing full stop in WP_Comment_Query::parse_query() DocBlock.
Props hardik2221.
Fixes #60323.
Built from https://develop.svn.wordpress.org/trunk@57342


git-svn-id: http://core.svn.wordpress.org/trunk@56848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 22:28:15 +00:00
Weston Ruter
a3abf9c89f Script Loader: Only emit CDATA wrapper comments in wp_get_inline_script_tag() for JavaScript.
This avoids erroneously adding CDATA wrapper comments for non-JavaScript scripts, including those for JSON such as the `importmap` for script modules in #56313.

Props westonruter, flixos90, mukesh27, dmsnell.
See #56313.
Fixes #60320.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 17:56:12 +00:00
youknowriad
7343352744 Editor: Unset reference used in foreach statement.
In PHP it is a good practice to unset $value if it was created by reference in a foreach loop, as the reference is still valid outside the loop, and this avoids accidental bugs.

Props get_dave.
Fixes #60326.
Built from https://develop.svn.wordpress.org/trunk@57340


git-svn-id: http://core.svn.wordpress.org/trunk@56846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 17:11:11 +00:00
Pascal Birchler
97518917dd I18N: Improve edge case handling in WP_Translation_Controller.
Prevents PHP warnings for possibly undefined array keys.
Also fixes incorrect `@covers` annotations.

Follow-up to [57337].
See #59656.
Built from https://develop.svn.wordpress.org/trunk@57339


git-svn-id: http://core.svn.wordpress.org/trunk@56845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 15:15:14 +00:00
Pascal Birchler
a40f2f7555 I18N: Add missing variable in string replacement.
Ensures the preferred file name for lookup has the correct extension.

Follow-up to [57337].
See #59656.
Built from https://develop.svn.wordpress.org/trunk@57338


git-svn-id: http://core.svn.wordpress.org/trunk@56844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 14:03:10 +00:00
Pascal Birchler
c6ccfb1242 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.
Built from https://develop.svn.wordpress.org/trunk@57337


git-svn-id: http://core.svn.wordpress.org/trunk@56843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 13:34:11 +00:00
Bernhard Reiter
a63a6ae7ee 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.
Built from https://develop.svn.wordpress.org/trunk@57336


git-svn-id: http://core.svn.wordpress.org/trunk@56842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 13:07:16 +00:00
youknowriad
7cd277d6dc Editor: Fix back to items label capitalization for the pattern categories.
This uses the same capitalization used in Tags or Link Categories taxonomies.

Props mukesh27.
See #60322.
Built from https://develop.svn.wordpress.org/trunk@57335


git-svn-id: http://core.svn.wordpress.org/trunk@56841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 10:10:18 +00:00
youknowriad
728299f24a Editor: Define the labels of the pattern category taxonomy.
In WordPress 6.5, the taxonomy is going to be rendered using a standard UI
in the editor, this means that all the labels need to be defined properly.

Props ntsekouras.
Fixes #60322.
Built from https://develop.svn.wordpress.org/trunk@57334


git-svn-id: http://core.svn.wordpress.org/trunk@56840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 09:16:11 +00:00
youknowriad
3a3982b3cc Editor: Update the ThemeJson unit test to cover custom CSS feature.
In #59499 a fix have been shipped to theme.json custom CSS
when applied to blocks with multiple CSS selectors.
This commit covers that fix with a unit test.

Props wildworks.
Fixes #60294.
Built from https://develop.svn.wordpress.org/trunk@57333


git-svn-id: http://core.svn.wordpress.org/trunk@56839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 09:06:15 +00:00
youknowriad
4f65a6d337 Editor: Ensure PHPUnit10 compatibility for ThemeJson unit test.
Expecting E_STRICT, E_NOTICE, and E_USER_NOTICE errors is deprecated in PHPUnit 10.
This updates the test to rely on an exception instead.

Props antonvlasenko.
Fixes #60305.
Built from https://develop.svn.wordpress.org/trunk@57332


git-svn-id: http://core.svn.wordpress.org/trunk@56838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 08:59:14 +00:00
youknowriad
20d1625207 Editor: Set show_tagcloud to false for Pattern Categories.
Pattern Categories is a taxonomy used to categories the patterns in the site editor.
It is not meant to be shown in the frontend and show tag clouds.

Props wildworks, mukesh27.
Fixes #60119.
Built from https://develop.svn.wordpress.org/trunk@57331


git-svn-id: http://core.svn.wordpress.org/trunk@56837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 08:30:11 +00:00
youknowriad
4ed526c748 Build Tools: Configure prettier properly.
Allows tools like prettier or VSCode to auto-format JS files propertly.
It pulls the prettier config that is used in the Gutenberg repository.

Props gziolo.
Fixes #60316.
Built from https://develop.svn.wordpress.org/trunk@57330


git-svn-id: http://core.svn.wordpress.org/trunk@56836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 08:01:19 +00:00
isabel_brison
06a098f174 Editor: fix fluid font division by zero error when min and max viewport widths are equal.
Fixes a division error by returning null when `minViewportWidth` - `maxViewportWidth` is zero in `wp_get_computed_fluid_typography_value`.

Props ramonopoly, mukesh27, andrewserong, audrasjb.
Fixes #60263.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 05:57:15 +00:00
isabel_brison
b884ecf21e Editor: fix classname output on blocks without layout.
Prevents layout classnames from being output on blocks with no layout support and no child layout classnames by returning early from `wp_render_layout_support_flag`.

Props andrewserong.
Fixes #60292.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 05:38:13 +00:00
dmsnell
82d1434124 Script Modules API: Rename wp_module to wp_script_module
Renames all mentions to "module" with "script module", including function names, comments, and tests.

Follow up to [57269]

The list of functions renamed are:

 - `wp_module()`          -> `wp_script_module()`.
 - `wp_register_module()` -> `wp_register_script_module()`.
 - `wp_enqueue_module()`  -> `wp_enqueue_script_module()`.
 - `wp_dequeue_module()`  -> `wp_dequeue_script_module()`.
 - `WP_Script_Modules::print_enqueued_modules()` -> `WP_Script_Modules::print_enqueued_script_modules()`.
 - `WP_Script_Modules::print_module_preloads()`  -> `WP_Script_Modules::print_script_module_preloads()`.

It also adds PHP 7 typing to all the functions and improves the types of the `$deps` argument of `wp_register_script_module()` and `wp_enqueue_script_module()` using `@type`.

Props luisherranz, idad5, costdev, nefff, joemcgill, jorbin, swisspidy, jonsurrel, flixos90, gziolo, westonruter, bernhard-reiter, kamranzafar4343
See #56313


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


git-svn-id: http://core.svn.wordpress.org/trunk@56833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 03:34:14 +00:00
dmsnell
3efed38163 HTML API: Support PARAM, SOURCE, and TRACK tags.
Adds support for the following HTML elements to the HTML Processor:

 - PARAM, SOURCE, TRACK

Previously these elements were not supported and the HTML Processor would bail when encountering them. Now, with this patch applied, it will proceed to parse an HTML document when encountering those tags.

Props jonsurrell, dmsnell
Fixes #60283


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


git-svn-id: http://core.svn.wordpress.org/trunk@56832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 01:51:16 +00:00
Sergey Biryukov
8c3354e6ac Docs: Correct the WP_User Query location reference in query cache tests.
Follow-up to [1047/tests], [33749], [55657].

See #59651.
Built from https://develop.svn.wordpress.org/trunk@57325


git-svn-id: http://core.svn.wordpress.org/trunk@56831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-22 19:42:16 +00:00
Pascal Birchler
4ca84cc0ee Twenty Twenty-Four: Update license information in readme.
Adds missing license information for bundled fonts.

Props acosmin, shailu25, poena, sabernhardt.
Fixes #59838
Built from https://develop.svn.wordpress.org/trunk@57324


git-svn-id: http://core.svn.wordpress.org/trunk@56830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-22 12:24:09 +00:00