Commit Graph

36249 Commits

Author SHA1 Message Date
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
Pascal Birchler
646240956c Bundled Theme: Fix a couple of incorrect theme name references.
Corrects the theme name used in docblocks in two places in Twenty Nineteen and Twenty Seventeen.

Props shailu25, mukesh27.
Fixes #60310.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-22 12:20:12 +00:00
Pascal Birchler
fa96cdfee0 Build/Test Tools: Expand "imagemin" Grunt task to cover default themes.
Runs `npm run grunt precommit:image` to minify/compress images in the repository.

Props desrosj.
Fixes #58996.
Built from https://develop.svn.wordpress.org/trunk@57322


git-svn-id: http://core.svn.wordpress.org/trunk@56828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-22 11:43:18 +00:00
Sergey Biryukov
b2e9235b13 Plugins: Correct table layout on smaller screens.
This ensures that the message about deleting a plugin or having no plugins installed is displayed in full width.

Follow-up to [26134], [33016].

Props shailu25, mukesh27, passoniate, JavierCasares, sabernhardt.
Fixes #50069.
Built from https://develop.svn.wordpress.org/trunk@57321


git-svn-id: http://core.svn.wordpress.org/trunk@56827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-21 18:54:18 +00:00
Sergey Biryukov
d3bdd3911c Docs: Correct the placement of @global tags in wp-settings.php.
Props shailu25, mukesh27.
Fixes #60146.
Built from https://develop.svn.wordpress.org/trunk@57320


git-svn-id: http://core.svn.wordpress.org/trunk@56826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-20 16:08:17 +00:00
dmsnell
1d4b95336a HTML API: Cleanup tests and list of void elements.
This patch adds newly supported elements to tests that should have been updated
in recent PRs, but which were merged without that. Those PRs removed failing
tests showing that the elements were unsupported, but did not add the elements
to the list of supported ones.

It also removes some elements from the special-exclusion list of unsupported IN
BODY elements. These did not present in failing tests because earlier
conditions in the switch structure caught the tags before hitting the default
block.

Finally it adds some missing elements to the list of void elements. These
elements are not listed as void in the HTML specification because they are
deprecated. However, they are treated as void for the sake of HTML
serialization and the parsing rules indicate that they behave as void elements,
so it's safe to list them within the HTML API as void.

Developed in WordPress/wordpress-develop#5913

Fixes #60307


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


git-svn-id: http://core.svn.wordpress.org/trunk@56825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-20 00:15:13 +00:00
Peter Wilson
2ce808cc7f Media: Revert [57310].
This commit reintroduced a minor data exposure issue.

Props swissspidy.
See #59866, #57913.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-20 00:00:11 +00:00
dmsnell
cf88a3098c HTML API: Add support for PRE and LISTING elements.
Adds support for the following HTML elements to the HTML Processor:

 - PRE, LISTING

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.

Developed in WordPress/wordpress-develop#5903

Props jonsurrell, dmsnell
Fixes #60283


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


git-svn-id: http://core.svn.wordpress.org/trunk@56823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 22:07:09 +00:00
dmsnell
050c342a46 HTML API: Add support for BR, EMBED, & other tags.
Adds support for the following HTML elements to the HTML Processor:

 - AREA, BR, EMBED, KEYGEN, WBR
 - Only the opening BR tag is supported, as the invalid closer `</br>`
   involves more complicated rules, to be implemented later.

Previously, these elements were not supported and the HTML Processor
would bail when encountering them. With this patch it will proceed to
parse an HTML document when encountering those tags as long as other
normal conditions don't cause it to bail (such as complicated format
reconstruction rules).

Props jonsurrell, dmsnell
Fixes #60283


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


git-svn-id: http://core.svn.wordpress.org/trunk@56822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 21:41:12 +00:00
Joe McGill
5d2bccd66d Editor: Support deferred block variation initialization on the server.
When registering blocks on the server using `register_block_type()` or similar functions, a set of block type variations can also be registered. However, in some cases building this variation data during block registration can be an expensive process, which is not needed in most contexts. 

To address this problem, this adds support to the `WP_Block_Type` object for a new property, `variation_callback`, which can be used to register a callback for building variation data only when the block variations data is needed. The `WP_Block_Type::variations` property has been changed to a private property that is now accessed through the magic `__get()` method. The magic getter makes use of a new public method, `WP_Block_Type::get_variations` which will build variations from a registered callback if variations have not already been built.

Props spacedmonkey, thekt12, Mamaduka, gaambo, gziolo, mukesh27, joemcgill.
Fixes #59969.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 20:54:13 +00:00
dmsnell
141ba4ff59 HTML API: Add support for HR element.
Adds support for the following HTML elements to the HTML Processor:

 - HR

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

Developed in WordPress/wordpress-develop#5897

Props jonsurrell, dmsnell
Fixes #60283


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


git-svn-id: http://core.svn.wordpress.org/trunk@56820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 19:03:09 +00:00
Sergey Biryukov
64a499ab92 Twenty Twenty: Add missing comma in twentytwenty_classic_editor_styles().
This resolves a WPCS error:
{{{
There should be a comma after the last array item in a multi-line array.
}}}

Follow-up to [57311].

See #48630.
Built from https://develop.svn.wordpress.org/trunk@57313


git-svn-id: http://core.svn.wordpress.org/trunk@56819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 18:26:11 +00:00
Felix Arntz
e19c18cba9 Bootstrap/Load: Introduce functions to check whether WordPress is serving a REST API request.
This changeset introduces two functions:
* `wp_is_serving_rest_request()` returns a boolean for whether WordPress is serving an actual REST API request.
* `wp_is_rest_endpoint()` returns a boolean for whether a WordPress REST API endpoint is currently being used. While this is always the case if `wp_is_serving_rest_request()` returns `true`, the function additionally covers the scenario of internal REST API requests, i.e. where WordPress calls a REST API endpoint within the same request.

Both functions should only be used after the `parse_request` action.

All relevant manual checks have been adjusted to use one of the new functions, depending on the use-case. They were all using the same constant check so far, while in fact some of them were intending to check for an actual REST API request while others were intending to check for REST endpoint usage.

A new filter `wp_is_rest_endpoint` can be used to alter the return value of the `wp_is_rest_endpoint()` function.

Props lots.0.logs, TimothyBlynJacobs, flixos90, joehoyle, peterwilsoncc, swissspidy, SergeyBiryukov, pento, mikejolley, iandunn, hellofromTonya, Cybr, petitphp.
Fixes #42061.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 17:40:09 +00:00
Sergey Biryukov
9d8b474654 Twenty Twenty: Move the Inter font declaration to a separate file and enqueue the file.
This allows the font to be dequeued by a child theme or plugin.

Props poena, markhowellsmead, nielslange, Otto42, SGr33n, mukesh27, joemcgill.
Fixes #48630.
Built from https://develop.svn.wordpress.org/trunk@57311


git-svn-id: http://core.svn.wordpress.org/trunk@56817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 17:38:14 +00:00
Peter Wilson
3a36e92c88 Media: Redirect inactive attachement 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.

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

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


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


git-svn-id: http://core.svn.wordpress.org/trunk@56816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-19 00:44:13 +00:00
Sergey Biryukov
a6c37e6b50 Docs: Fix several typos in inline comments.
Follow-up to [7747], [27419], [55155].

Props shailu25, sabernhardt.
Fixes #60285.
Built from https://develop.svn.wordpress.org/trunk@57309


git-svn-id: http://core.svn.wordpress.org/trunk@56815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-18 22:13:16 +00:00
Felix Arntz
0e4eaa64b5 Build/Test Tools: Fix unstable query tests.
Three `WP_Query` tests could randomly fail due to an undefined order because two test posts were using the exact same `post_date`.

Props boonebgorges, flixos90.
Fixes #60288.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-18 18:40:13 +00:00
Aaron Jorbin
f4b5da2859 Embeds: Ensure the deprecated function print_emoji_styles isn't used
Ensure that the proper new function wp_enqueue_emoji_styles is used in embeds.

Follow-up to: [56194].

Props peterwilsoncc, bobbingwide, hellofromTonya.
Fixes #59892. See: #58775.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-17 21:36:16 +00:00
Pascal Birchler
e09d2034a6 I18N: Fix duplicate determine_locale() tests added in [57286].
Props johnbillion.
See #58696.
Built from https://develop.svn.wordpress.org/trunk@57305


git-svn-id: http://core.svn.wordpress.org/trunk@56811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-17 18:56:12 +00:00
Sergey Biryukov
2ba732f956 Twenty Twenty-Four: Remove extra tab character inside the text domain.
Follow-up to [57281].

Props sabernhardt.
Fixes #60245.
Built from https://develop.svn.wordpress.org/trunk@57304


git-svn-id: http://core.svn.wordpress.org/trunk@56810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-17 18:00:16 +00:00
Pascal Birchler
e6a10d45e7 I18N: Prevent PHP warning in WP_Textdomain_Registry.
Prevents a warning upon cache invalidation after language pack updates if the arguments don’t have the expected format.

Follow-up to [57287], [57290], [57298], [57299].

See #58919.
Built from https://develop.svn.wordpress.org/trunk@57303


git-svn-id: http://core.svn.wordpress.org/trunk@56809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-17 14:32:18 +00:00
audrasjb
b9638e6b00 Docs: Fix var types of parameters in sanitize_option() and sanitize_option_{$option}.
The related docblocks were previously defining `$value` and `$original_value` as if they were of type `string`, but they can also be of other types, like `array`.

Props gerardreches, crstauf, mukesh27.
Fixes #60214.
See #59651.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-17 09:09:15 +00:00
audrasjb
79e39943a5 Twenty Twenty: Replace wp_date() with date_i18n().
Since WordPress 5.3 it is recommended to use `wp_date()` instead of `date_i18n()`. This changeset replaces the function in Twenty Twenty, with a fallback to `date_i18n()` for old versions of WordPress.

For more info, see https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/.

Props sachyya-sachet, joyously, sabernhardt, poena.
Fixes #48589.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-17 09:01:16 +00:00
audrasjb
1866ae2cb3 Bundled Themes: Typo corrections in various themes docblocks.
Props shailu25.
Fixes #60268.
See #59651.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-17 08:53:15 +00:00
Sergey Biryukov
0a0b0e91cf I18N: Correctly invalidate language file paths in WP_Textdomain_Registry.
Since the cache key in `::get_language_files_from_path()` is based on a path that always includes a trailing slash, the path in `::invalidate_mo_files_cache()` should include the trailing slash as well.

Includes adjusting the test expectations accordingly.

Follow-up to [57287], [57290], [57298].

See #58919.
Built from https://develop.svn.wordpress.org/trunk@57299


git-svn-id: http://core.svn.wordpress.org/trunk@56805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-16 21:45:12 +00:00
Sergey Biryukov
fb3b7f59e3 Tests: Remove leftover trailingslashit() calls in WP_Textdomain_Registry tests.
Follow-up to [57287], [57290].

See #58919.
Built from https://develop.svn.wordpress.org/trunk@57298


git-svn-id: http://core.svn.wordpress.org/trunk@56804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-16 21:34:16 +00:00
desrosj
d76e220659 Bundled Themes: Version bump themes affected by #60241.
In order to release the fix for #60241, this bumps the version of the following themes:
- Twenty Seventeen: 3.5
- Twenty Twenty: 2.5
- Twenty Twenty-One: 2.2

Props sabernhardt, jorbin.
See #60267.
Built from https://develop.svn.wordpress.org/trunk@57296


git-svn-id: http://core.svn.wordpress.org/trunk@56802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-16 19:25:12 +00:00
joedolson
cb1e71aa25 Administration: Remove empty form action attributes.
Remove the `action` attribute in the login language selector, privacy forms, and classic widget forms.

An empty `action` attribute is invalid HTML4 and unsupported HTML5. The `action` attribute is optional, but must have a valid URL when provided.

Props Malae, audrasjb, bartkleinreesink, nicolefurlan, shubhamsedani, costdev, peterwilsoncc, rajinsharwar, joedolson.
Fixes #58226.
Built from https://develop.svn.wordpress.org/trunk@57295


git-svn-id: http://core.svn.wordpress.org/trunk@56801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-16 17:31:13 +00:00
Felix Arntz
14263ea394 Media: Consider inline image CSS width to backfill width and height attributes.
Prior to this changeset, WordPress core would use the original image size, which in the particular case of inline images would be severely off, as they are usually very small. This could lead to incorrect application of `fetchpriority="high"` and other performance optimizations.

Props westonruter, flixos90, joemcgill, mukesh27.
Fixes #59352.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-16 17:03:13 +00:00
Pascal Birchler
365a82ffeb I18N: Do not use trailingslashit in WP_Textdomain_Registry.
This usage of `trailingslashit()`, introduced in [57287], is not only redundant, but also discouraged in order to avoid `formatting.php` dependency (which might not always be loaded).

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


git-svn-id: http://core.svn.wordpress.org/trunk@56796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-16 12:12:17 +00:00
Peter Wilson
2590eeb14c Docs: Format new_admin_email_content placeholders as a list.
Format the email placeholders for the `new_admin_email_content` hook as a list for clarity and to avoid parsing errors in docblock consumers.

Props dd32, shooper, stevenlinx.
Fixes #60262.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-16 04:06:18 +00:00
Pascal Birchler
4d37fc7865 I18N: Cache list of language file paths in WP_Textdomain_Registry.
Loading a list of language file paths using `glob()` can be expensive if involving thousands of files.

Expands scope of `WP_Textdomain_Registry` to cache list of language file paths in object cache and provides a way to invalidate that cache upon translation updates. Plugins can clear the cache using calls such as `wp_cache_delete( 'cached_mo_files_' . md5( $path ), 'translations' );`

Props mreishus, swissspidy
Fixes #58919
Built from https://develop.svn.wordpress.org/trunk@57287


git-svn-id: http://core.svn.wordpress.org/trunk@56793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-15 19:05:14 +00:00
Pascal Birchler
b713c5eb9c Upgrade/Install: Fix JavaScript localization on install page.
Blocks registration causes scripts to be initialized and localized very early, before the current locale has been properly set on the installation page.

This changes `determine_locale()` so that the locale chosen during installation is recognized and loaded earlier, ensuring proper script localization.

Props sabernhardt, NekoJonez, jornp, costdev.
Fixes #58696
Built from https://develop.svn.wordpress.org/trunk@57286


git-svn-id: http://core.svn.wordpress.org/trunk@56792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-15 18:57:14 +00:00
Sergey Biryukov
50670cd102 Comments: Use post_password_required() for comment capability checks.
Follow-up to [56836], [57123].

Fixes #59929.
Built from https://develop.svn.wordpress.org/trunk@57285


git-svn-id: http://core.svn.wordpress.org/trunk@56791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-15 17:42:18 +00:00
Sergey Biryukov
368e2fc5cd Tests: Move wp_parse_list() tests to their own file.
This aims to make the tests more discoverable and easier to expand.

Follow-up to [44546].

See #59647.
Built from https://develop.svn.wordpress.org/trunk@57284


git-svn-id: http://core.svn.wordpress.org/trunk@56790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-14 17:17:15 +00:00
audrasjb
f16bd4cac4 Administration: Introduce new_admin_email_subject filter.
This changeset introduces the `new_admin_email_subject` hook which allow developers to filter the subject of the email sent when a change of site admin email address is attempted.

Props MadtownLems, johnbillion, alexanderkoledov, shooper, Marc_J, nikmeyer, xlthlx, devmuhib, nuhel, audrasjb.
Fixes #59250.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-14 11:01:17 +00:00
audrasjb
4d2c122564 Twenty Seventeen: Fix wrong text-domain introduced in [57281].
Follow-up to [57281].

Unprops audrasjb.
See #60245.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-14 10:48:09 +00:00
audrasjb
7502811c88 Bundled Themes: Add missing text domain to various block patterns.
This changeset adds missing text domain to block patterns in Twenty Sixteen, Twenty Seventeen and Twenty Twenty-Four.

Follow-up to [49583] (Twenty Sixteen), [49584] (Twenty Seventeen) and [56716] (Twenty Twenty-Four.)

Props shailu25, sabernhardt.
Fixes #60245.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-14 10:44:14 +00:00
audrasjb
b6d3cb0838 Docs: Fix wrong inline comment in delete_theme().
Props wildworks.
Fixes #60246.
See #59651.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-14 10:06:18 +00:00
audrasjb
855c1b55d6 Docs: Improve wp_admin_notice() function docblock.
This changeset adds a description for the `attributes` key of `$args` in `wp_admin_notice()`.

Props tmatsuur.
Fixes #59887.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-14 08:42:19 +00:00
Sergey Biryukov
41fe45ced7 Tests: Correct the @group annotation in some tests.
Follow-up to [56971], [57146].

See #59647.
Built from https://develop.svn.wordpress.org/trunk@57278


git-svn-id: http://core.svn.wordpress.org/trunk@56784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-13 16:33:18 +00:00
Sergey Biryukov
32bd6d1a8e Twenty Twenty-One: Revert usage of str_contains() in theme files.
The theme supports WordPress 5.3 or later, while the polyfill for `str_contains()` only exists in WordPress 5.9 or later.

Follow-up to [55988], [57275], [57276].

Props poena.
Fixes #60241.
Built from https://develop.svn.wordpress.org/trunk@57277


git-svn-id: http://core.svn.wordpress.org/trunk@56783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-12 19:16:07 +00:00
Sergey Biryukov
93a75784b7 Twenty Twenty: Revert usage of str_contains() in theme files.
The theme supports WordPress 4.7 or later, while the polyfill for `str_contains()` only exists in WordPress 5.9 or later.

Follow-up to [55988], [57275].

Props poena.
See #60241.
Built from https://develop.svn.wordpress.org/trunk@57276


git-svn-id: http://core.svn.wordpress.org/trunk@56782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-12 19:14:08 +00:00
Sergey Biryukov
91004791b9 Twenty Seventeen: Revert usage of str_contains() in theme files.
The theme supports WordPress 4.7 or later, while the polyfill for `str_contains()` only exists in WordPress 5.9 or later.

Follow-up to [55988].

Props poena.
See #60241.
Built from https://develop.svn.wordpress.org/trunk@57275


git-svn-id: http://core.svn.wordpress.org/trunk@56781 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-12 19:12:14 +00:00
joedolson
9ddc1f9761 Users: Remove periods in checkbox labels for consistency.
Remove periods at the ends of three checkbox labels on add new user screen.

Checkboxes in the WordPress admin generally do not have periods.

Props pratikthink, joedolson.
Fixes #43814.
Built from https://develop.svn.wordpress.org/trunk@57274


git-svn-id: http://core.svn.wordpress.org/trunk@56780 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-12 17:14:14 +00:00
joedolson
ea9bf63acc Media: Fix inaccurate docs for wp_attachment_is().
Correct the documentation for the `$type` parameter to accept file extensions as well as attachment type groups. Also fix the return description to reflect the change.

Props nirav7707, joedolson.
Fixes #59698.
Built from https://develop.svn.wordpress.org/trunk@57273


git-svn-id: http://core.svn.wordpress.org/trunk@56779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-12 16:49:16 +00:00
joedolson
1ee473633a Administration: Remove invalid attribute maxlength on number input.
Remove the `maxlength` attribute on screen options number of items per page input. Previously kept due to input inconsistencies in IE 11 and Edge, this invalid usage is no longer needed. IE 11 is no longer supported, and Edge now behaves according to specifications.

Props Arena94, afercia, joedolson.
Fixes #40610.
Built from https://develop.svn.wordpress.org/trunk@57272


git-svn-id: http://core.svn.wordpress.org/trunk@56778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-11 17:44:12 +00:00
Bernhard Reiter
ffcd954ef8 Modules API: Fix indentation.
Follow-up [57269].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-11 15:53:22 +00:00
Andrea Fercia
48a4a51b91 Administration: Accessibility: Improve color contrast of the Copy buttons success message.
Props sabernhardt.
Fixes #60140.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-11 15:52:14 +00:00
Bernhard Reiter
36f543f447 JavaScript: Add new Modules API.
This changeset adds a new API for WordPress, designed to work with native ES Modules and Import Maps. It introduces functions such as `wp_register_module`, and `wp_enqueue_module`.

The API aims to provide a familiar experience to the existing `WP_Scripts` class, offering similar functionality. However, **it's not intended to duplicate the exact functionality of `WP_Scripts`**; rather, it is carefully tailored to address the specific needs and capabilities of ES modules.

For this initial version, **the current proposal is intentionally simplistic**, covering only the essential features needed to work with ES modules. Other enhancements and optimizations can be added later as the community identifies additional requirements and use cases.

== Differences Between WP_Script_Modules and WP_Scripts

=== Dependency Specification

With `WP_Script_Modules`, the array of dependencies supports not only strings but also arrays that include the dependency import type (`static` or `dynamic`). This design choice allows for future extensions of dependency properties, such as adding a `version` property to support "scopes" within import maps.

=== Module Identifier

Instead of a handle, `WP_Script_Modules` utilizes the module identifier, aligning with the module identifiers used in JavaScript files and import maps.

=== Deregistration

There is no equivalent of `wp_deregister_script` at this stage.

== API

=== `wp_register_module( $module_identifier, $src, $deps, $version )`

Registers a module.

{{{
// Registers a module with dependencies and versioning.
wp_register_module(
  'my-module',
  '/path/to/my-module.js',
  array( 'static-dependency-1', 'static-dependency-2' ),
  '1.2.3'
);
}}}

{{{
// my-module.js
import { ... } from 'static-dependency-1';
import { ... } from 'static-dependency-2';

// ...
}}}

{{{
// Registers a module with a dynamic dependency.
wp_register_module(
  'my-module',
  '/path/to/my-module.js',
  array(
    'static-dependency',
    array(
      'id'     => 'dynamic-dependency',
      'import' => 'dynamic'
    ),
  )
);
}}}

{{{
// my-module.js
import { ... } from 'static-dependency';

// ...
const dynamicModule = await import('dynamic-dependency');
}}}

=== `wp_enqueue_module( $module_identifier, $src, $deps, $version )`

Enqueues a module. If a source is provided, it will also register the module.

{{{
wp_enqueue_module( 'my-module' );
}}}

=== `wp_dequeue_module( $module_identifier )`

Dequeues a module.

{{{
wp_dequeue_module( 'my-module' );
}}}

== Output

- When modules are enqueued, they are printed within script tags containing `type="module"` attributes.
- Additionally, static dependencies of enqueued modules utilize `link` tags with `rel="modulepreload"` attributes.
- Lastly, an import map is generated and inserted using a `<script type="importmap">` tag.

{{{
<script type="module" src="/path/to/my-module.js" id="my-module"></script>
<link rel="modulepreload" href="/path/to/static-dependency.js" id="static-dependency" />
<script type="importmap">
  {
    "imports": {
      "static-dependency": "/path/to/static-dependency.js",
      "dynamic-dependency": "/path/to/dynamic-dependency.js"
    }
  }
</script>
}}}

== Import Map Polyfill Requirement

Even though all major browsers already support import maps, an import map polyfill is required until the percentage of users using old browser versions without import map support drops significantly.

This work is ongoing and will be added once it's ready. Progress is tracked in #60232.

Props luisherranz, idad5, costdev, neffff, joemcgill, jorbin, swissspidy, jonsurrell, flixos90, gziolo, westonruter.
Fixes #56313.
Built from https://develop.svn.wordpress.org/trunk@57269


git-svn-id: http://core.svn.wordpress.org/trunk@56775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-11 14:47:14 +00:00
Sergey Biryukov
c9291ac596 Tests: Remove some leftover debugging in WP_REST_Revisions_Controller tests.
Follow-up to [57222].

See #59875.
Built from https://develop.svn.wordpress.org/trunk@57268


git-svn-id: http://core.svn.wordpress.org/trunk@56774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-11 13:18:17 +00:00
joedolson
bcb0f74678 Media: Fix handling of multibyte exif description metadata.
The exif standards expect the UserComment field to be used as a substitute for ImageDescription if multibyte characters are needed. WordPress media only mapped the ImageDescription field and did not correctly handle descriptions with multibyte characters.

Fix metadata saving to better handle media with multibyte characters in metadata and update unit tests.

Props fotodrachen, antpb, joedolson, mikinc860, azaozz, nicolefurlan.
Fixes #58082.
Built from https://develop.svn.wordpress.org/trunk@57267


git-svn-id: http://core.svn.wordpress.org/trunk@56773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 21:59:13 +00:00
joedolson
1d2e7fd49d Tests: Fix tests following r57265.
Update unit tests failing after r57265 changed strings in single post template descriptions. Follow up to [57265].

Props joedolson.
Fixes #60216.
Built from https://develop.svn.wordpress.org/trunk@57266


git-svn-id: http://core.svn.wordpress.org/trunk@56772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 21:14:16 +00:00
Sergey Biryukov
39f7f558d9 Editor: Clarify single post and page template descriptions.
Follow-up to [55500].

Props mikachan.
Fixes #60216.
Built from https://develop.svn.wordpress.org/trunk@57265


git-svn-id: http://core.svn.wordpress.org/trunk@56771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 17:08:11 +00:00
dmsnell
29dd837333 HTML API: Add support for list elements.
Adds support for the following HTML elements to the HTML Processor:

 - LI, OL, UL.
 - DD, DL, DT.

Previously, these elements were not supported and the HTML Processor would bail when encountering them.
With this patch it will proceed to parse an HTML document when encountering those tags as long as other normal conditions don't cause it to bail (such as complicated format reconstruction).

Props audrasjb, jonsurrell, bernhard-reiter.
Fixes #60215.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 14:05:17 +00:00
costdev
28331b7aae Docs: Correct some typos in docblocks and inline comments.
This corrects several typos in documentation, including:
- "imput" -> "input"
- "proessing" -> "processing"
- "instantating" -> "instantiating"
- "filtersing" -> "filtering"
- "officaly" -> "officially"

Follow-up to [8852], [25307], [26191], [37488], [54416].

Props benniledl, mukesh27, jayadevankbh, Presskopp.
Fixes #60069. See #59651.
Built from https://develop.svn.wordpress.org/trunk@57263


git-svn-id: http://core.svn.wordpress.org/trunk@56769 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 11:57:15 +00:00
costdev
cee1cd2789 Customize: Correct a typo in a console warning message.
This corrects a typo from "instantating" to "instantiating".

Follow-up to [41374].

Props benniledl, mukesh27, Presskopp.
Fixes #60222.
Built from https://develop.svn.wordpress.org/trunk@57262


git-svn-id: http://core.svn.wordpress.org/trunk@56768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 11:13:19 +00:00
isabel_brison
f2e220ffa2 Editor: fix inline comment formatting.
Correctly formats inline comment in `wp_get_global_stylesheet`.

Follow-up to [57259].

Props mukesh27.
See #60134.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 04:09:18 +00:00
isabel_brison
2588f90ab2 Editor: Allow default duotone styles if not explicitly disabled in theme.json.
Removes setting that disabled default duotone palette from being output in themes without theme.json.

Props andrewserong.
Fixes #60136.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-10 00:27:15 +00:00
isabel_brison
c8dc74b0bc Editor: output palette presets when appearance tools or border are enabled.
Adds color palette presets to global styles output if current theme supports either appearance tools or border.

Props andrewserong, noisysocks.
Fixes #60134.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 23:32:12 +00:00
Aaron Jorbin
c4c8ae426d Editor: update npm packages in trunk for 6.4.3.
Package Update includes fixes for:
- Image Block: Enable image block to be selected correctly when clicked.
- Reduce specificity of default Cover text color styles.
- Image Block: Fix deprecation when width/height attribute is number.
- Text selection: show CSS hack to Safari only.
- SlotFill: Allow contextual SlotFillProviders.

See: https://github.com/WordPress/wordpress-develop/pull/5696
See: bd6767b8a4
See: https://github.com/WordPress/gutenberg/pull/56043
See: https://github.com/WordPress/gutenberg/pull/56411
See: https://github.com/WordPress/gutenberg/pull/57063
See: https://github.com/WordPress/gutenberg/pull/57300
See: https://github.com/WordPress/gutenberg/pull/56779

Props mikachan, wildworks, alexstine, poena, isabel_brison, andrewserong, czapla, andraganescu, joen, ellatrix, youknowriad, ntsekouras.
Fixes #59943, #59943.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 20:17:30 +00:00
hellofromTonya
178deab664 Tests: Add hook priority call order tests.
Adds happy (integer) and unhappy (non-integer) tests for validating the priority call order for:

* `do_action()`
* `WP_Hook::do_action()`
* `apply_filters()`
* `WP_Hook::apply_filters()`

As each of these functions have differing code, the tests are added to each to ensure expected results and protect against future regressions.

Follow-up to [53804], [52010], [25002], [25/tests], [62/tests].

Props hellofromTonya, mukesh27, dd32, valendesigns, drrobotnik.
Fixes #60193.
Built from https://develop.svn.wordpress.org/trunk@57257


git-svn-id: http://core.svn.wordpress.org/trunk@56763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 16:34:17 +00:00
Sergey Biryukov
26099a407d Docs: Add a mention of appearance-tools as a possible value for add_theme_support().
Follow-up to [57255].

See #60118.
Built from https://develop.svn.wordpress.org/trunk@57256


git-svn-id: http://core.svn.wordpress.org/trunk@56762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 11:41:18 +00:00
isabel_brison
b0b64739ff Themes: Add theme support for appearance tools.
Reapplies the patch reverted in #57649 as the original patch was no longer applying cleanly. Adds theme support for appearance tools to `WP_Theme_JSON_Resolver`.

Props andrewserong, mukesh27, noisysocks.
Fixes #60118.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 06:26:16 +00:00
isabel_brison
90088c4c92 Editor: add size and repeat to background image support.
Adds background size and background repeat style processing to the background image block support and `WP_Style_Engine` definitions.

Props andrewserong, mukesh27.
Fixes #60175.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 06:12:18 +00:00
isabel_brison
6e67ad1701 Editor: add CSS var parsing for fontSize and fontFamily.
Adds capability to parse CSS custom properties for fontSize and fontFamily in `WP_Style_Engine`.

Props ramonopoly.
Fixes #59982.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 02:45:16 +00:00
Aaron Jorbin
c59c7d90c4 Upgrade/Install: Check theme compatibility during bulk upgrades.
Previously, bulk upgrades did not verify that a theme package was compatible with the site's WordPress version or the server's PHP version.

This was previusly done for plugins in #59198, but themes were missed.

Follow-up to: [56525].

Props salcode, lakshmananphp.
Fixes #59758.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 23:19:16 +00:00
Sergey Biryukov
a38245a657 Taxonomy: Check for empty term after DB sanitization in wp_insert_term().
When inserting a new term in the database, `wp_insert_term()` will check if the term is empty and return a corresponding error.

Afterwards the term is sanitized and inserted in the database. However, there is a chance the term is empty after the DB sanitization.

This commit adds a check for an empty term name after the term is sanitized, returning an error in that case.

Follow-up to [5726], [8393].

Props fgiannar, kraftbj.
Fixes #59995.
Built from https://develop.svn.wordpress.org/trunk@57251


git-svn-id: http://core.svn.wordpress.org/trunk@56757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 22:44:17 +00:00
desrosj
854f43fdac Build/Test Tools: Increase the max old space size in Node.
The Test Build Processes workflow started failing recently on MacOS runners due to “JavaScript heap out of memory” errors (see https://github.com/WordPress/wordpress-develop/actions/runs/7421385568/job/20209241826#step:8:82).

This increases the maximum memory size of the old memory section in Node from the default of 4GB to 8GB (specified in megabytes) to avoid unnecessary failures while ways to optimize the Gutenberg build process are explored.

Props dmsnell, joemcgill, hellofromTonya, isabel_brison.
See #59805.
Built from https://develop.svn.wordpress.org/trunk@57250


git-svn-id: http://core.svn.wordpress.org/trunk@56756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 18:38:22 +00:00
desrosj
af166c4d98 Build/Test Tools: Remove svn debug command.
SVN support has officially been sunset by GitHub. While SVN was not has not been utilized in GitHub Action workflows, the version of SVN being used has been output for debugging purposes.

This removes those debug lines to prevent encountering failures as new versions of test runners are pushed out without `svn` installed.

See https://github.blog/changelog/2024-01-08-subversion-has-been-sunset/.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 15:51:26 +00:00
Bernhard Reiter
372e3c4b97 HTML API: Add explicit handling or failure for all tags.
The HTML API HTML processor does not yet support all tags. Many tags (e.g. list elements) have some complicated rules in the [https://html.spec.whatwg.org/#parsing-main-inbody "in body" insertion mode].

Implementing these special rules is blocking the implementation for a catch-all rule for "any other tag" because we need to prevent special rules from being handled by the catch-all.

  Any other start tag
  Reconstruct the active formatting elements, if any.

  Insert an HTML element for the token.

  …

This change ensures the HTML Processor fails when handling special tags. This is the same as existing behavior, but will allow us to implement the catch-all "any other tag" handling without unintentionally handling special elements.

Additionally, we add tests that assert the special elements are unhandled. As these tags are implemented, this should help to ensure they're removed from the unsupported tag list.

Props jonsurrell, dmsnell.
Fixes #60092.
Built from https://develop.svn.wordpress.org/trunk@57248


git-svn-id: http://core.svn.wordpress.org/trunk@56754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 14:05:24 +00:00
isabel_brison
d966a9f046 Editor: add setting to disable layout content and wide size controls.
Adds support for an `allowCustomContentAndWideSize` setting in `WP_Theme_JSON` valid settings.

Props andrewserong.
Fixes #60133.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 06:23:14 +00:00
isabel_brison
2b005a61ef Editor: add layout classes to legacy Group inner container.
Moves generated layout classes into the Group block inner container in classic themes, so that block gap support can work correctly.

Props flixos90, mukesh27.
Fixes #60130.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 06:13:20 +00:00
Sergey Biryukov
45df401868 Site Health: Include site ID in debug data on multisite installations.
Follow-up to [44986].

Props sebastienserre, mukesh27.
Fixes #60081.
Built from https://develop.svn.wordpress.org/trunk@57245


git-svn-id: http://core.svn.wordpress.org/trunk@56751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-07 16:09:21 +00:00
Sergey Biryukov
7670c25979 Tests: Use assertSame() in some newly introduced tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [55859], [56380], [56802], [57115], [57129], [57185].

See #59655.
Built from https://develop.svn.wordpress.org/trunk@57244


git-svn-id: http://core.svn.wordpress.org/trunk@56750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-06 13:01:20 +00:00
costdev
f86599ded1 Docs: Fix typo in twentyten_header_image_height filter's docblock.
This corrects a minor typo from "defaul" to "default" in the docblock of the `twentyten_header_image_height` filter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-06 09:47:24 +00:00
Sergey Biryukov
9398968765 Tests: Add a @ticket reference for WP_Customize_Manager::trash_changeset_post() test.
Follow-up to [56043], [57238], [57241].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-05 11:40:20 +00:00
Sergey Biryukov
e864ae4450 Tests: Add a unit test for post trash hooks executed when trashing a changeset.
The test ensures that the correct number of arguments is passed to post trash hooks in `WP_Customize_Manager::trash_changeset_post()`, which bypasses `wp_trash_post()`.

Follow-up to [56043], [57238].

See #60183.
Built from https://develop.svn.wordpress.org/trunk@57241


git-svn-id: http://core.svn.wordpress.org/trunk@56747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-04 11:47:18 +00:00
hellofromTonya
d913aebb4f Fonts: Fix font_style typo in wp_print_font_faces().
Changes `font_style` to `font-style` to reflect the CSS property.

Follow-up to [56540].

Props tmatsuur, rajinsharwar, audrasjb. 
Fixes #59858.
Built from https://develop.svn.wordpress.org/trunk@57240


git-svn-id: http://core.svn.wordpress.org/trunk@56746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-03 22:13:18 +00:00
hellofromTonya
d30fe43245 Docs: Replace "sanity" with "confidence" for inclusive language.
The phrase "sanity check" unnecessarily references mental health. It's an old phrase used to denote an extra step in verifying code works as expected.

“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

While "sanity check" is a well-known phrase with a specific meaning, "confidence check" is a direct replacement that is more clear of its intent while being more inclusive.

Words matter.

Follow-up to [49216], [46271], [40583], [38832], [38637], [37409], [33359], [32162], [30346], [30345], [30238], [30055], [29902], [28763], [26141], [25002], [22227], [13428], [12148], [11025], [8927].

Props dartiss, hellofromTonya.
Fixes #60187.
Built from https://develop.svn.wordpress.org/trunk@57239


git-svn-id: http://core.svn.wordpress.org/trunk@56745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-03 21:59:19 +00:00
Sergey Biryukov
87a8377de2 Customize: Pass the previous status to post trash hooks when trashing a changeset.
This ensures that the correct number of arguments is passed to post trash hooks in `WP_Customize_Manager::trash_changeset_post()`, which bypasses `wp_trash_post()`.

Follow-up to [56043].

Props joelcj91, mukesh27.
Fixes #60183.
Built from https://develop.svn.wordpress.org/trunk@57238


git-svn-id: http://core.svn.wordpress.org/trunk@56744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-03 16:22:20 +00:00
Sergey Biryukov
997e4bc41e Tests: Use more specific assertions in wp_scheduled_delete() tests.
Includes clarifying test method names and descriptions.

Follow-up to [57224].

See #59938.
Built from https://develop.svn.wordpress.org/trunk@57237


git-svn-id: http://core.svn.wordpress.org/trunk@56743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-02 15:59:19 +00:00
Sergey Biryukov
4a14689016 Docs: Remove a trailing period from a URL in a @see tag.
This ensures that the ticket link works as expected.

Follow-up to [55005].

Props mukesh27.
Fixes #60171.
Built from https://develop.svn.wordpress.org/trunk@57236


git-svn-id: http://core.svn.wordpress.org/trunk@56742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-01 14:17:16 +00:00
Gary Pendergast
7d7a52367d Happy New Year! 😘
Update copyright year to 2024 in `license.txt` and bundled themes.

Follow-up to [18201], [23306], [28064], [36855], [36856], [39659], [40241], [42424], [46719], [46720], [47025], [47026], [49915], [52427], [55024].


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


git-svn-id: http://core.svn.wordpress.org/trunk@56741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-01 00:02:19 +00:00
Sergey Biryukov
f06012264c Docs: Document the $wp_registered_sidebars global in wp_map_sidebars_widgets().
Follow-up to [41555].

Props shailu25.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57234


git-svn-id: http://core.svn.wordpress.org/trunk@56740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-31 13:34:20 +00:00
Sergey Biryukov
ced2ac5437 Docs: Correct the variable name passed to the determine_locale filter.
Follow-up to [43776], [44134].

Props truptikanzariya.
Fixes #60167.
Built from https://develop.svn.wordpress.org/trunk@57233


git-svn-id: http://core.svn.wordpress.org/trunk@56739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-30 11:46:24 +00:00
Sergey Biryukov
366d370d37 Canonical: Check if the author parameter is a string in redirect_canonical().
This avoids a PHP warning or error when viewing an author on the front end, while an array is passed as `$_GET['author']`.

Follow-up to [12034], [12040], [12202].

Props david.binda, antonvlasenko, azaozz, SergeyBiryukov.
Fixes #60059.
Built from https://develop.svn.wordpress.org/trunk@57232


git-svn-id: http://core.svn.wordpress.org/trunk@56738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-29 13:54:17 +00:00
Andrea Fercia
4388ba3a03 External Libraries: Accessibility: Clean up clipboard.js Copy buttons from focus management workaround.
`clipboard.js` used to suffer from a bug that triggered a focus loss when activating the Copy buttons. The bug was fixed a while ago with the `clipboard.js` 2.0.11 release so that the workaround implemented in WordPress is no longer necessary.

Props dhrumilk, paulkevan, afercia.
Fixes #60139.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-28 15:27:15 +00:00
Sergey Biryukov
a0b82585ab Docs: Document the $post global in REST API posts and revisions controllers.
Follow-up to [38832], [40601].

Props viralsampat.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57230


git-svn-id: http://core.svn.wordpress.org/trunk@56736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-28 15:19:20 +00:00
Sergey Biryukov
45aea1a36d Twenty Twenty-Four: Use consistent title case in custom template names.
Follow-up to [56716].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-27 11:01:22 +00:00
Sergey Biryukov
ae1c461ed5 KSES: Add background-repeat to the list of safe CSS properties.
Follow-up to [45242], [46235].

Props andrewserong, ramonopoly, mukesh27.
Fixes #60132.
Built from https://develop.svn.wordpress.org/trunk@57228


git-svn-id: http://core.svn.wordpress.org/trunk@56734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-26 14:24:21 +00:00
Sergey Biryukov
13f7ee3063 Coding Standards: Correct alignment in WP_HTML_Tag_Processor::apply_attributes_updates().
This fixes an `Equals sign not aligned correctly` WPCS warning.

Follow-up to [57179].

Props antonvlasenko, dmsnell, ironprogrammer.
Fixes #60078.
Built from https://develop.svn.wordpress.org/trunk@57227


git-svn-id: http://core.svn.wordpress.org/trunk@56733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-25 14:03:19 +00:00
Sergey Biryukov
356dd51612 Docs: Document the $wp_hasher global in wp_generate_user_request_key().
Includes adding a description for the global in a few other functions.

Follow-up to [42791], [42964], [43008].

Props viralsampat.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57226


git-svn-id: http://core.svn.wordpress.org/trunk@56732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-24 13:05:21 +00:00
Sergey Biryukov
9b09f2c239 Customize: Remove unused $wpdb global in _wp_customize_publish_changeset().
Follow-up to [38810], [39180], [41192], [41824].

Props viralsampat.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57225


git-svn-id: http://core.svn.wordpress.org/trunk@56731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-23 14:43:22 +00:00
Aaron Jorbin
5e201d4b5b Build/Test: Add Tests for wp_scheduled_delete.
Props pbearne.
Fixes #59938.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-22 15:22:24 +00:00
Sergey Biryukov
9b905f9573 Docs: Remove unused $posts global reference in get_attachment_template().
Follow-up to [32628], [32804].

Props viralsampat.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57223


git-svn-id: http://core.svn.wordpress.org/trunk@56729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-22 14:52:21 +00:00
isabel_brison
6e1fe93a1c REST API: check parent and revision ids match before retrieving revision.
Adds a condition to check that parent id matches revision parent id in `WP_REST_Revisions_Controller` `get_item` method.

Props ramonopoly, adamsilverstein, danielbachhuber, spacedmonkey, andrewserong.
Fixes #59875.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-22 02:12:21 +00:00
desrosj
45c67f7f11 Build/Test Tools: Add missing MySQL versions for WordPress 5.0.
Follow up to [57218], [57219], [57220].

See #58977.
Built from https://develop.svn.wordpress.org/trunk@57221


git-svn-id: http://core.svn.wordpress.org/trunk@56727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-22 01:38:23 +00:00
desrosj
8a4bef5bcb Build/Test Tools: Run installation tests when data files are updated.
When the JSON data files that supply the PHP/MySQL version support to the installation test workflow are changed, the workflow should be run to confirm the changes are correct. This updates the `path` filtering rules to ensure this happens.

Follow up to [57218], [57219].

See #58977.
Built from https://develop.svn.wordpress.org/trunk@57220


git-svn-id: http://core.svn.wordpress.org/trunk@56726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-22 01:23:21 +00:00
desrosj
d8d6bee968 Build/Test Tools: Add missing PHP versions for 6.5 and 6.4.
This adds 6.4 and 6.5 to the PHP version support JSON files used to build the test matrix in the Installation Testing workflow.

Also, WP 6.3 did not support PHP 8.3.

Follow up to [57218].

See #58977.
Built from https://develop.svn.wordpress.org/trunk@57219


git-svn-id: http://core.svn.wordpress.org/trunk@56725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-22 01:14:20 +00:00
desrosj
f692428328 Build/Test Tools: Make the install testing workflow more flexible.
In [56661], a new GitHub Actions workflow was introduced that focused on running some minimal installation tests for a version of WordPress for every PHP and MySQL combination.

This workflow has tested well, but lacks flexibility and possesses one flaw: tests are only ever performed with currently supported versions, even if the version being tested had a different support policy.

This updates the workflow to be more flexible, allowing all versions of WordPress currently receiving security fixes (back through 4.1) to be tested under the correct support policy.

Additionally, the workflow can now run against the `nightly` build of WordPress. This replaces `latest` as the new default. This allows the tests to be run at any point during a release cycle without the need for an officially tagged version.

Props jorbin, joemcgill, costdev.
See #58977.
Built from https://develop.svn.wordpress.org/trunk@57218


git-svn-id: http://core.svn.wordpress.org/trunk@56724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-22 01:00:20 +00:00
Aaron Jorbin
2aee859fbf Build/Test: Update Grunt Patch Wordpress for Node 20+.
Props jorbin, desrosj.
See #59658, #59663.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-21 20:03:26 +00:00
Sergey Biryukov
af1f54d6b3 Docs: Document some globals in wp-includes/widgets.php.
Follow-up to [41555], [50995].

Props upadalavipul.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57216


git-svn-id: http://core.svn.wordpress.org/trunk@56722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-21 18:36:23 +00:00
Joe McGill
5b5e874ed5 Themes: Improve the performance of _get_block_templates_paths.
This avoids redundant recursive lookups for block template paths in the same base directory by implementing a static cache. It also replaces an potentially expensive `file_exists` call in favor of doing recursive iteration of files inside a try/catch block. 

Props thekt12, spacedmonkey, flixos90, mukesh27, joemcgill.
Fixes #58196.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-20 20:02:16 +00:00
desrosj
f5e051855d Build/Test Tools: Add engines for default themes.
This adds the `engines` field to the `package.json` file for the three default themes with build processes in order to encourage consistent tooling for contributors.

Some minor dependency updates for these themes are also included in this change.

Props jorbin, joemcgill, swissspidy.
See #59663.
Built from https://develop.svn.wordpress.org/trunk@57213


git-svn-id: http://core.svn.wordpress.org/trunk@56719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-20 18:52:15 +00:00
desrosj
775f4c4416 Build/Test Tools: Raise minimum required version of Node.js/npm.
This bumps the minimum required version of Node.js/npm from 16.19.1 and 8.19.3 to 20.10.0 and 10.2.3.

Since 20.10.0 is the latest 20.x version of Node.js, the `check-latest` option has been enabled for `actions/setup-node` in GitHub Actions workflows. This performs an additional external call to the Node.js API confirming the latest version is installed on the runner for use. In testing, it seems that 20.10.0 was not consistently deployed to all runner machines in use. This should be removed in the near future when the version of Node.js is reliably above the new minimum requirement.

The Gutenberg repository has also been updated to use the same values for `engines`.

Props jorbin, joemcgill, swissspidy, benharri, dhrupo, flootr, gziolo, noahtallen.
See #59663.
Built from https://develop.svn.wordpress.org/trunk@57212


git-svn-id: http://core.svn.wordpress.org/trunk@56718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-20 18:46:20 +00:00
Bernhard Reiter
8e5db640de HTML API: Avoid processing incomplete tokens.
Currently the Tag Processor assumes that an input document is a ''full'' HTML document. Because of this, if there's lingering content after the last tag match it will treat that content as plaintext and skip over it. This is fine for the Tag Processor because if there is lingering content that isn't a valid tag then there's nothing for `next_tag()` to match.

However, in order to support a number of feature expansions it is important to recognize that the remaining content ''may'' involve partial syntax elements, such as incomplete tags, attributes, or comments.

In this patch we're adding a mode inside the Tag Processor which will flip when we start parsing HTML syntax but the document finishes before the token does. This will provide the ability to:

- extend the input document,
- avoid misinterpreting syntax as text, and
- guess if we have a complete document, know if we have an incomplete document.

In the process of building this patch a few fixes were identified and fixed in the Tag Processor, namely in the handling of incomplete syntax elements.

Props dmsnell, jonsurrell.
Fixes #60122, #60108.
Built from https://develop.svn.wordpress.org/trunk@57211


git-svn-id: http://core.svn.wordpress.org/trunk@56717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-20 17:52:30 +00:00
Pascal Birchler
ed17b41079 Build/Test Tools: Post message for testing on Playground only after build succeeds.
Uses the `workflow_run` trigger to only leave pull request comments after the build jobs finish.

Props zieladam, desrosj.
See #59416.
Built from https://develop.svn.wordpress.org/trunk@57210


git-svn-id: http://core.svn.wordpress.org/trunk@56716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-20 14:52:33 +00:00
Bernhard Reiter
a586b85d8e HTML API: Apply linting changes to @TODO comments.
Lowercase `@TODO` comments introduced by [57186], and remove spurious colons after them.

Props dmsnell, TobiasBg, mukesh27, sergeybiryukov, jonsurrell.
Fixes #60060.
Built from https://develop.svn.wordpress.org/trunk@57209


git-svn-id: http://core.svn.wordpress.org/trunk@56715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-20 12:36:31 +00:00
Sergey Biryukov
8dd4ce9fdb Tests: Correct the @group annotation for _wp_mysql_week() tests.
Includes updating the data provider name for consistency.

Follow-up to [57207].

See #59931.
Built from https://develop.svn.wordpress.org/trunk@57208


git-svn-id: http://core.svn.wordpress.org/trunk@56714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-20 10:03:35 +00:00
Aaron Jorbin
2f1335258f Build/Test: Add Tests for _wp_mysql_week.
Props pbearne.
Fixes #59931.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-19 23:13:32 +00:00
Sergey Biryukov
a559c54aef Docs: Document the $shortcode_tags global in wp_just_in_time_script_localization().
Follow-up to [41395], [41844].

Props upadalavipul.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57204


git-svn-id: http://core.svn.wordpress.org/trunk@56712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-19 13:12:27 +00:00
desrosj
0244f702f0 Build/Test Tools: Add more context to artifact names.
This adds a bit more context to the E2E workflow artifact names in order to avoid duplicates being uploaded.

With the update to v4 of `actions/upload-artifact` in [57197], artifacts are now uploaded on a per job basis. Multiple jobs cannot upload the same artifact.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-18 20:34:29 +00:00
desrosj
36adf3d10b Build/Test Tools: Update third-party GitHub Actions.
This updates the following GitHub Actions to their latest versions:
- `actions/checkout`
- `actions/setup-node`
- `actions/upload-artifact`
- `actions/cache`
- `actions/github-script`
- `shivammathur/setup-php`

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


git-svn-id: http://core.svn.wordpress.org/trunk@56708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-18 15:20:27 +00:00
Sergey Biryukov
b691849290 Docs: Document some globals in wp-includes/deprecated.php.
Includes removing `$allowed_options` global references from functions where it's not actually used.

Props viralsampat.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57196


git-svn-id: http://core.svn.wordpress.org/trunk@56707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-18 13:53:30 +00:00
Sergey Biryukov
a9b08b8e16 Docs: Correct $wp_the_query global reference in WP_Query::is_main_query().
Follow-up to [18699], [32620], [34337], [45739].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-17 02:48:29 +00:00
Sergey Biryukov
fac2864841 Docs: Document the $wp_locale global in WP_Fatal_Error_Handler::handle().
Follow-up to [45277].

Props viralsampat.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57194


git-svn-id: http://core.svn.wordpress.org/trunk@56705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-16 09:38:25 +00:00
Sergey Biryukov
5883e53bbf Docs: Document the $current_screen global in _WP_Editors::editor().
Follow-up to [32899].

Props viralsampat.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57193


git-svn-id: http://core.svn.wordpress.org/trunk@56704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-16 09:31:29 +00:00
Sergey Biryukov
f0e266fd62 General: Revert code changes from [57191].
The unit tests for `get_bookmark()` expect the function to modify the `$GLOBALS` array directly.

Follow-up to [57191].

See #60021.
Built from https://develop.svn.wordpress.org/trunk@57192


git-svn-id: http://core.svn.wordpress.org/trunk@56703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-15 14:33:25 +00:00
Sergey Biryukov
e162ffa2e9 Docs: Document the $link global in get_bookmark().
Follow-up to [8758].

Props upadalavipul, mukesh27.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57191


git-svn-id: http://core.svn.wordpress.org/trunk@56702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-15 12:59:23 +00:00
Sergey Biryukov
c07e1c4442 Docs: Document the $wpdb global in WP_User::__construct().
Follow-up to [19325].

Props upadalavipul.
See #60021.
Built from https://develop.svn.wordpress.org/trunk@57190


git-svn-id: http://core.svn.wordpress.org/trunk@56701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-15 12:37:29 +00:00
Sergey Biryukov
8361461aa0 Docs: Fix typo in WP_Date_Query::build_mysql_datetime() DocBlock.
Follow-up to [25139].

Props nithi22, benniledl, mukesh27.
Fixes #60067.
Built from https://develop.svn.wordpress.org/trunk@57189


git-svn-id: http://core.svn.wordpress.org/trunk@56700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-14 10:23:27 +00:00
Sergey Biryukov
8ed54ba817 Toolbar: Add a Plugins link to the admin bar menu.
Props colomet, Girishpanchal, afercia, danieltj, rishishah, sabernhardt, joedolson,  huzaifaalmesbah, shailu25, zunaid321, devmuhib, sumitbagthariya16, yuvrajsinh2211, SergeyBiryukov.
Fixes #40683.
Built from https://develop.svn.wordpress.org/trunk@57188


git-svn-id: http://core.svn.wordpress.org/trunk@56699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-13 21:18:19 +00:00
Aaron Jorbin
497844c45b Build/Test: Update name of test to show its breadth.
The test covers multiple libraries, not just lodash.

Follow up to [57185].

Props TobiasBg.
Fixes #60048.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-13 20:02:23 +00:00
Bernhard Reiter
511dcb7520 HTML API: Add support for H1-H6 elements in the HTML Processor.
Previously these have been unsupported, but in this patch, support is added for the tags so that the HTML Processor can process documents containing them.

There was a design discussion about introducing a constant to communicate "any of the H1 - H6 elements" but this posed a number of challenges that don't need to be answered in this patch. For the time being, because the HTML specification treats H1 - H6 specially as a single kind of element, the HTML Processor uses an internal hard-coded string to indicate this. By using a hard-coded string it's possible to avoid introducing a class constant which cannot be made private due to PHP's class design. In the future, this will probably appear as a special constant in a new constant-containing class.

Props dmsnell, jonsurrell.
Fixes #60060.
Built from https://develop.svn.wordpress.org/trunk@57186


git-svn-id: http://core.svn.wordpress.org/trunk@56697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-13 17:53:19 +00:00
Aaron Jorbin
d5b96bf00d External Libraries: For Lodash, sync the declared version number with the one that is loaded.
In [50941] the version of lodash was updated, however the version inside `wp_default_packages_vendor` was not updated at the same time. This updates the version to correctly reflect the version that is loaded.

Also adds some basic tests for the scripts in `wp_default_packages_vendor` that match the name of the package from package.json to help prevent errors like this in the future.

Props jadpm, jorbin, swissspidy.
Fixes #60048. See #52991.



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


git-svn-id: http://core.svn.wordpress.org/trunk@56696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-13 17:50:31 +00:00
Sergey Biryukov
e99a116006 Tests: Add unit tests for wp_checkdate().
Follow-up to [21922].

Props pbearne, ironprogrammer, antonvlasenko, SergeyBiryukov.
Fixes #59825.
Built from https://develop.svn.wordpress.org/trunk@57184


git-svn-id: http://core.svn.wordpress.org/trunk@56695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-12 12:21:24 +00:00
Sergey Biryukov
a2bcc36278 Docs: Consistently document the $body_id global as a string.
Includes declaring the global at the beginning of `wp_iframe()` and `iframe_header()`.

Follow-up to [32642], [32643].

Props mukesh27, upadalavipul.
Fixes #60032.
Built from https://develop.svn.wordpress.org/trunk@57181


git-svn-id: http://core.svn.wordpress.org/trunk@56692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-11 12:11:22 +00:00
desrosj
fb4428dd60 Build/Test Tools: Group GitHub Action Dependabot updates.
This updates the Dependabot configuration file to make use of `groups`, configuring all third-party GitHub Action updates available into a single pull request to help reduce noise.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-11 11:50:27 +00:00
zieladam
760fae6c43 HTML API: Track spans of text with (offset, length) instead of (start, end).
Updates the internal representation of the text span coordinates. The mixture of (offset, length) and (start, end) coordinates becomes confusing, this commit replaces it with a (offset, length) pair. There should be no functional or behavioral changes in this patch. For the internal helper classes this patch introduces breaking changes, but those classes are marked private and should not be used outside of the HTML API itself.

Props dmsnell.
Fixes #59993.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-10 13:19:28 +00:00
zieladam
6af9b0dcfe Build/Test Tools: Fix the workflow that posts a preview link on every Pull Request
Fixes a 403 error in the pull-request-comments.yml job by switching from a custom workflow dispatch call to the pull_request_target trigger.

Follow up to [57124], [57174].
Props ockham.
See #59416.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-10 10:36:39 +00:00
Sergey Biryukov
83ad6a8b86 Docs: Correct the order of steps in the WordPress Core build process workflow.
Follow up to [57124], [57174].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-10 00:21:31 +00:00
Sergey Biryukov
a192ed1ae1 REST API: Pass correct number of arguments to the comment_text filter.
This ensures that `WP_REST_Comments_Controller::prepare_item_for_response()` passes three arguments to the `comment_text` filter, for consistency with all the other instances in core.

Follow-up to [15957], [16357], [25555], [38832], [40664].

Props sjregan, SergeyBiryukov.
Fixes #58238.
Built from https://develop.svn.wordpress.org/trunk@57176


git-svn-id: http://core.svn.wordpress.org/trunk@56687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-09 22:13:34 +00:00
Sergey Biryukov
1c7d7a09aa Upload: Add missing escaping in upload_space_setting().
Follow-up to [https://mu.trac.wordpress.org/changeset/1088 mu:1088], [https://mu.trac.wordpress.org/changeset/1095 mu:1095], [12603].

Props utsav72640.
Fixes #58514.
Built from https://develop.svn.wordpress.org/trunk@57175


git-svn-id: http://core.svn.wordpress.org/trunk@56686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-08 21:26:29 +00:00
zieladam
afb55f3571 Build/Test Tools: Zip WordPress files before npm run clean
Fixes a problem in WordPress artifact upload pipeline. The callable-test-core-build-process.yml used to zip the WordPress dist directory after npm run grunt clean runs, producing an empty zip file. This commit moves the zip before the cleanup task.

Follow up to [57124].

Props ockham, dmsnell.
See #59416.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-08 16:07:28 +00:00
desrosj
362b15d400 Database: Raise the minimum required version of MySQL.
This raises the minimum version of MySQL required to run WordPress from 5.0 to 5.5.5.

MySQL 5.0 and 5.1 have long been unsupported and both reached end of life over 10 years ago. Combined usage for both versions sits at 0.4% of all WordPress sites.

Because 5.5 sits at just under 15% usage, 5.5 cannot be trimmed off at this time.

Of all sites running 5.5.x, 85% are running 5.5.5, and 100% are running 5.5.5 or higher. This makes it the logical landing spot.

Props johnbillion, sergeybiryukov, jorbin.
Fixes #60036.
Built from https://develop.svn.wordpress.org/trunk@57173


git-svn-id: http://core.svn.wordpress.org/trunk@56684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-08 14:13:27 +00:00
Bernhard Reiter
ed04994d13 Block Hooks: Fix @ticket references in tests, add missing ones.
Some tests that were added in [57157] erroneously set their `@ticket` reference to #59646, rather than #60008.
This changeset rectifies that mistake.

Additionally, it adds ticket references to #60008 to tests that were modified by [57157].

Follow-up to [57157].

See #60008.
Built from https://develop.svn.wordpress.org/trunk@57172


git-svn-id: http://core.svn.wordpress.org/trunk@56683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-08 11:46:27 +00:00
isabel_brison
cf50fd40f5 Themes: fix documentation link.
Removes a period from an inline comment of `wp_block_theme_activate_nonce` that broke a link in the comment.

Props stevenlinx, mukesh27.
Fixes #60034.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-08 06:32:24 +00:00
Felix Arntz
7926dbb4d5 General: Avoid early initialization of variable in get_bloginfo().
This is a very minor, yet simple performance optimization in a commonly called function, avoiding unnecessary initialization of the `$url` variable when it may not be needed. The conditional is simple enough to not use a variable altogether.

Props Cybr, swissspidy.
Fixes #59450.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-07 22:57:28 +00:00
Sergey Biryukov
f402ce754d Docs: Improve documentation for Custom_Image_Header and Custom_Background constructors.
Follow-up to [4673], [8656], [12890], [13041].

Props faisalahammad, cadic.
Fixes #58049.
Built from https://develop.svn.wordpress.org/trunk@57169


git-svn-id: http://core.svn.wordpress.org/trunk@56680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-07 15:14:27 +00:00
Joe McGill
46406afcc4 HTML-API: Prevent unintended behavior when WP_HTML_Token is unserialized.
Props dmsnell, peterwilsoncc, dd32, xknown, rawrly, johnbillion, barry, jeffpaul, vortfu, isabel_brison, mikeschroder, jorbin.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-06 16:05:19 +00:00
Sergey Biryukov
ebb9657bf7 Docs: Fix typo in Gettext_Translations::parenthesize_plural_exression() description.
Follow-up to [10584], [12079], [41722], [57161].

Props tohincoderex.
See #59347.
Built from https://develop.svn.wordpress.org/trunk@57162


git-svn-id: http://core.svn.wordpress.org/trunk@56673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-06 11:54:17 +00:00
Sergey Biryukov
e0d74dfb10 I18N: Deprecate Gettext_Translations::parenthesize_plural_exression().
Aside from having a typo in the name, the method is unused by core as of WordPress 4.9.

Follow-up to [10584], [12079], [41722].

Props tohincoderex, jrf.
Fixes #59347.
Built from https://develop.svn.wordpress.org/trunk@57161


git-svn-id: http://core.svn.wordpress.org/trunk@56672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-06 11:50:26 +00:00
Sergey Biryukov
7eec58966d Administration: Don't unnecessarily escape none or div in the admin menu.
This matches a similar conditional in `wp-admin/menu-header.php`, where these values are handled as special cases and don't output the default menu image so that an icon could be added to `div.wp-menu-image` as CSS background. 

Follow-up to [9578], [21877], [26664].

Props andrewleap, ironprogrammer, azaozz.
Fixes #58361.
Built from https://develop.svn.wordpress.org/trunk@57159


git-svn-id: http://core.svn.wordpress.org/trunk@56670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-05 13:39:28 +00:00
Sergey Biryukov
65bbe06a00 Coding Standards: Add missing escaping in wp-activate.php.
Follow-up to [13884].

Props dilipbheda, mukesh27, pitamdey, nareshbheda.
Fixes #59200.
Built from https://develop.svn.wordpress.org/trunk@57158


git-svn-id: http://core.svn.wordpress.org/trunk@56669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-04 22:07:27 +00:00
Bernhard Reiter
5e795b65ef Block Hooks: Store ignored hooked blocks metadata in anchor block.
The biggest tradeoff that was made in the implementation of Block Hooks was that they were limited to layouts (i.e. templates, template parts, and patterns) that ''didn't have any user modifications'' (see #59313 for the reason). This changeset is a preparatory step to remove this limitation, so they’ll eventually also work with user-modified layouts.

The crucial problem to solve is how to acknowledge that a user has opted to remove or persist a hooked block, so that the auto-insertion mechanism won't run again and inject an extraneous hooked block on the frontend when none is solicited.

This is achieved by storing all known blocks hooked to a given anchor block in the `metadata` attribute on that anchor block; specifically in a field called `ignoredHookedBlocks` inside of the `metadata`. Hooked blocks are only rendered on the frontend if they're absent from that field; OTOH, they're injected into that field (via the REST API) when first loaded in the editor.

This simple logic guarantees that once a user modifies a given layout, those changes are respected on the frontend; yet if a plugin that includes a hooked block is activated after those modifications have taken place, the hooked block will be rendered on the frontend. This new technique supplants the one previously used (i.e. rendering hooked blocks on the frontend only if a layout doesn't have any modifications) in a rather direct way.

Note that this changeset only introduces the new metadata field and relevant logic; it does not yet enable hooked block insertion into modified layouts. That will be done in a subsequent step (see #59646).

Props gziolo.
Closes #60008.
Built from https://develop.svn.wordpress.org/trunk@57157


git-svn-id: http://core.svn.wordpress.org/trunk@56668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-04 20:26:22 +00:00
Felix Arntz
04152c0b91 Themes: Clean up inactive themes' theme mods from being autoloaded as part of upcoming 6.5 upgrade routine.
Alongside [57153], this reduces unnecessarily autoloaded data from inactive themes, which can contribute to slow database performance as part of excessive autoloading. This changeset specifically resolves the issue for existing sites.

Props mukesh27, joemcgill, swissspidy, westonruter, flixos90.
Fixes #59975.
See #39537.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-04 19:51:23 +00:00
Felix Arntz
3a961371dc Themes: Avoid autoloading the previous theme's theme mods when switching to another theme.
This reduces unnecessarily autoloaded data from inactive themes, which can contribute to slow database performance as part of excessive autoloading.

Props mukesh27, rajinsharwar, igmoweb, joemcgill, swissspidy, westonruter, flixos90.
Fixes #59537.
See #59975.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-04 19:38:22 +00:00
desrosj
65d5985a7c Build/Test Tools: Update the MariaDB test strategy matrix.
This updates the test strategy matrix in the PHPUnit test GitHub Actions workflow to include the most recent MariaDB release, 11.2.

While 11.0 and 11.1 are still maintained, all three are short-term stable releases, which see support dropped after 1 year.

Until a larger discussion around how the project supports database software releases with shorter support windows takes place (short-term in MariaDB or “innovation” releases in MySQL), testing only against the latest short-term release should be sufficient.

Props johnbillion, l1nuxjedi.
See #59806.
Built from https://develop.svn.wordpress.org/trunk@57152


git-svn-id: http://core.svn.wordpress.org/trunk@56663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-04 18:52:22 +00:00
Aaron Jorbin
b5801411cf Help/About: Change CSS align-item for full browser support.
The values of `start` and `end` are not fully supported by Opera Mini which has 1.01% usage. There is no material change in functionality with this change.

Props kebbet, NekoJonez, luminuu, hellofromTonya.
Fixes #59819.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-04 18:07:26 +00:00
Sergey Biryukov
42c693e244 Docs: Add missing argument type for supports in register_post_type().
If set to `false`, no feature support is registered for the post type.

Follow-up to [12751], [20734], [29091], [37883].

Props jeremyfelt, swissspidy.
Fixes #59690.
Built from https://develop.svn.wordpress.org/trunk@57150


git-svn-id: http://core.svn.wordpress.org/trunk@56661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-03 20:01:29 +00:00
Sergey Biryukov
e47eb54945 Build/Test Tools: Allow overriding the WP_UnitTestCase_Base::factory() method.
This allows third-party plugins to write their own factory extending `WP_UnitTest_Factory` for testing purposes, as well as benefit from `WP_UnitTestCase_Base` features.

Follow-up to [35186], [35225], [35242].

Props hugod.
Fixes #59999.
Built from https://develop.svn.wordpress.org/trunk@57149


git-svn-id: http://core.svn.wordpress.org/trunk@56660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-02 11:58:27 +00:00
Sergey Biryukov
db7cb1dea2 Upgrade/Install: Add port number to target origin when decrementing update counts.
This ensures that the update counter bubble in the admin menu is properly decreased after a successful plugin or theme update from within the update iframe when the site uses a non-standard port number.

Follow-up to [27280], [29357].

Props TobiasBg.
Fixes #59987.
Built from https://develop.svn.wordpress.org/trunk@57148


git-svn-id: http://core.svn.wordpress.org/trunk@56659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-01 01:35:28 +00:00
hellofromTonya
ea6ccb240c REST API: Restore site logo and icon in index.
Restores setting the site's logo, icon, and wp-admin's back button image (which defaults to W).

Prior to [56566], the site logo and icon were unconditionally added to the index. [56566] changed this by conditionally adding them if either the `_links` or `_embedded` fields were included. However, these fields are not included when using the Site Logo block, as it uses the `site_logo`, `site_icon`, and `site_icon_url` fields instead.

This changeset restores the functionality by checking specifically for the `site_*` fields when neither of the `_links` or `_embedded` fields are present.

Follow up to [56566].

Props antonvlasenko, hellofromTonya, ironprogrammer, priethor, wildworks.
Fixes #59935.
Built from https://develop.svn.wordpress.org/trunk@57147


git-svn-id: http://core.svn.wordpress.org/trunk@56658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-30 14:54:24 +00:00
Sergey Biryukov
26cd5654fe Tests: Update _wp_timezone_choice_usort_callback() tests for consistency.
* Use the same `@group` annotation as the other tests.
* Use `assertSame()` to verify the type of the result.
* Use `data_` prefix for the data provider.
* Use named data set in the data provider. This makes the output when using the `--testdox` option more descriptive and is helpful when trying to debug which data set from a data provider failed the test.
* Other minor corrections.

Reference: [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#repetitive-tests Core Handbook: Writing PHP Tests: Repetitive Tests].

Follow-up to [57145].

See #59953, #59647.
Built from https://develop.svn.wordpress.org/trunk@57146


git-svn-id: http://core.svn.wordpress.org/trunk@56657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-30 11:17:27 +00:00
Aaron Jorbin
0a39322193 Add automated tests for _wp_timezone_choice_usort_callback
Props pbearne.
Fixes #59953.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-29 17:33:21 +00:00
hellofromTonya
064b90c078 Plugins: Fix Add Plugin search button pos when JS off.
When JavaScript is disabled, the Add Plugins screen's search button position was too high in comparison to the search text field. This fix reuses the CSS declaration to keep field and button aligned.

By targeting the `.no-js` class, the CSS specificity is not impacted when JavaScript is enabled.

Follow up to [48281], [30830].

Props devmuhib, sabernhardt, huzaifaalmesbah, hellofromTonya.
Fixes #59967.
Built from https://develop.svn.wordpress.org/trunk@57144


git-svn-id: http://core.svn.wordpress.org/trunk@56655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-29 16:45:26 +00:00
Pascal Birchler
b7a29ea18c Test: Run database upgrades between performance test steps.
Prevents pending upgrades from blocking tests when checking out previous builds.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-29 11:54:23 +00:00
Sergey Biryukov
09c9a0a892 Login and Registration: Use correct variable to display a single error message.
When the `wp_login_errors` filter is used to add an error message followed by an instructional message, the former was not displayed and the latter was errouneously displayed twice above the login form.

This commit ensures that the error message is displayed as expected.

Follow-up to [56654].

Props mapumba.
Fixes #59983.
Built from https://develop.svn.wordpress.org/trunk@57142


git-svn-id: http://core.svn.wordpress.org/trunk@56653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-29 09:34:28 +00:00
Sergey Biryukov
1df0bee7ec Site Health: Remove unused $wpdb global in utf8mb4 support test.
Follow-up to [44984], [56475].

Props upadalavipul, mukesh27.
Fixes #59977.
Built from https://develop.svn.wordpress.org/trunk@57141


git-svn-id: http://core.svn.wordpress.org/trunk@56652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-28 20:24:22 +00:00
John Blackbourn
de91474b4e Docs: Correct the documented type for the block_hooks argument when registering a block type.
This argument is an associative array of strings, not an array of arrays.

See #59313, 59651

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


git-svn-id: http://core.svn.wordpress.org/trunk@56651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-27 20:20:24 +00:00
Sergey Biryukov
2542aabe50 Coding Standards: Reorder conditionals in is_random_header_image().
This aims to slightly improve performance by checking the faster `empty()` language construct first and potentially avoiding an unnecessary function call. Additionally, this better matches a similar conditional a few lines below.

Follow-up to [17757], [17770].

Props Cybr.
See #59650.
Built from https://develop.svn.wordpress.org/trunk@57139


git-svn-id: http://core.svn.wordpress.org/trunk@56650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-27 09:17:21 +00:00
Sergey Biryukov
08d9937eb4 Twenty Twenty-One: Add "blog" and "portfolio" subject tags.
Follow-up to [49216], [49574].

Props sumisubedi, sabernhardt.
Fixes #59495.
Built from https://develop.svn.wordpress.org/trunk@57138


git-svn-id: http://core.svn.wordpress.org/trunk@56649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-27 08:46:28 +00:00
Sergey Biryukov
3fb7d346f3 External Libraries: Upgrade PHPMailer to version 6.9.1.
This is a maintenance and feature release, adding support for the official release of PHP 8.3, methods for removing and replacing custom headers, XCLIENT support, and links to a new way of implementing XOAUTH2 authentication.

The only change likely to have any impact on existing code is that PHPMailer previously attempted to use opportunistic STARTTLS encryption when connecting to `localhost`, which was unlikely to work. The workaround required setting `SMTPAutoTLS = false`, but that's no longer required. You may still need to use this setting when connecting to literal IPs.

References:
* [https://github.com/PHPMailer/PHPMailer/releases/tag/v6.9.1 PHPMailer 6.9.1 release notes]
* [https://github.com/PHPMailer/PHPMailer/compare/v6.8.1...v6.9.1 Full list of changes in PHPMailer 6.9.1]

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749], [52811], [53500], [53535], [53917], [54427], [54937], [55557], [56484].

Props jrf, Synchro.
Fixes #59966.
Built from https://develop.svn.wordpress.org/trunk@57137


git-svn-id: http://core.svn.wordpress.org/trunk@56648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-26 19:27:25 +00:00
Pascal Birchler
eb5c155700 I18N: Improve translator comments for strings containing date formats.
Adds translator comments where absent and changes code style so that
comments are attached to the right strings during string extraction.

Props NekoJonez.
Fixes #59947
Built from https://develop.svn.wordpress.org/trunk@57136


git-svn-id: http://core.svn.wordpress.org/trunk@56647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-26 16:43:30 +00:00
Sergey Biryukov
25a147845b I18N: Move code out of translatable strings in a few error messages.
Follow-up to [54272], [56101].

Props rabmalin, Presskopp.
Fixes #59563.
Built from https://develop.svn.wordpress.org/trunk@57135


git-svn-id: http://core.svn.wordpress.org/trunk@56646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-25 21:19:30 +00:00
Sergey Biryukov
55d1a62ed1 Build/Test Tools: Add a readme note on passing parameters into the PHPUnit tests.
Follow-up to [45745], [47743].

Props pbearne, costdev.
Fixes #59624.
Built from https://develop.svn.wordpress.org/trunk@57134


git-svn-id: http://core.svn.wordpress.org/trunk@56645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-24 14:08:29 +00:00
Sergey Biryukov
9eebad140c Tests: Avoid an infinite loop in Spy_REST_Server if a non-existing method is called.
Follow-up to [34928].

Props xknown, joemcgill.
Fixes #59601.
Built from https://develop.svn.wordpress.org/trunk@57133


git-svn-id: http://core.svn.wordpress.org/trunk@56644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-23 14:41:26 +00:00
desrosj
f275615a0b Build/Test Tools: Run unit tests using new MySQL versions.
The MySQL project has introduced a new versioning strategy with two types of releases: innovation and long-term support. While long-term support is a familiar concept, it’s not clear how innovation releases should be supported in various WordPress versions for a number of reasons.

Mainly, innovation releases are very short-lived. Each one is only supported until the next innovation version is released with a goal of one per quarter. Even though these versions will have a short lifespan they are described as producton-grade and generally available.

More discussion is needed to determine exactly how each WordPress release should support these new innovation releases. But while the parameters for proper support are determined, the PHPUnit tests can be run against these innovation releases to detect any potential problems or incompatibilities.

This change adds the `8.1` and `8.2` innovation releases to the testing matrix for the PHPUnit test worfklow.

Props johnbillion, jorbin.
See #59779.
Built from https://develop.svn.wordpress.org/trunk@57132


git-svn-id: http://core.svn.wordpress.org/trunk@56643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-22 19:40:30 +00:00
Sergey Biryukov
a0504e8091 Text Changes: Update mentions of “web site” to “website” for consistency.
While “web site” was the original spelling, this variant has become rarely used, and “website” is now the standard spelling, already used throughout most of the WordPress core.

Reference: [https://en.wikipedia.org/wiki/Website Wikipedia: Website].

Props LiamMcArthur, cafenoirdesign, sabbirshouvo, sabernhardt, ironprogrammer, mukesh27.
Fixes #59853, #54276.
Built from https://develop.svn.wordpress.org/trunk@57131


git-svn-id: http://core.svn.wordpress.org/trunk@56642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-22 17:44:24 +00:00
Sergey Biryukov
dd3b952a10 General: Rename wp_json_encode() parameters for parity with PHP Core.
`wp_json_encode()` is a wrapper for the PHP native `json_encode()` function with some extra safety checks.

This commit renames the `$data` parameter in the `wp_json_encode()` function and associated functions to `$value`, and the `$options` parameter to `$flags` for parity with the parameter names used in PHP Core.

Reference: [https://www.php.net/manual/en/function.json-encode.php PHP Manual: json_encode()].

Follow-up to [30055].

Props jrf, hellofromTonya.
Fixes #59630.
Built from https://develop.svn.wordpress.org/trunk@57130


git-svn-id: http://core.svn.wordpress.org/trunk@56641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-21 00:24:20 +00:00
Joe McGill
9b1479bc74 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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-20 22:29:24 +00:00
Sergey Biryukov
2f4ffff0fb Administration: Standardize default values in submit_button().
This commit updates the `submit_button()` function to standardize the default values of `$text` and `$other_attributes` parameters. Previously set to `null`, these defaults have now been changed to an empty string (`''`), bringing consistency with the `get_submit_button()` function, which `submit_button()` wraps.

The change maintains backward compatibility, as `get_submit_button()` does not perform strict type-checking on these parameters. This update aligns with the ongoing effort to standardize function parameters across the WordPress codebase, improving the readability and predictability of the core functions.

Follow-up to [31446].

Props andbalashov.
Fixes #59921.
Built from https://develop.svn.wordpress.org/trunk@57128


git-svn-id: http://core.svn.wordpress.org/trunk@56639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-20 00:08:25 +00:00
Sergey Biryukov
252d94b92d Twenty Twenty-Four: Add missing textdomain in pattern category description.
Follow-up to [56951].

Props gavande1, acosmin, afercia, huzaifaalmesbah, ironprogrammer.
Fixes #59840.
Built from https://develop.svn.wordpress.org/trunk@57127


git-svn-id: http://core.svn.wordpress.org/trunk@56638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-19 11:37:26 +00:00
Sergey Biryukov
c3d10ec052 Code Modernization: Use str_starts_with() in WP_REST_Server::serve_request().
Follow-up to [55703], [56834].

See #59650.
Built from https://develop.svn.wordpress.org/trunk@57126


git-svn-id: http://core.svn.wordpress.org/trunk@56637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-18 20:46:28 +00:00
desrosj
79794005b1 Build/Test Tools: Allow the playground-comment job to fail.
When this job fails, it should not fail the entire workflow. The next update to the pull request will attempt to dispatch the commenting workflow.

Follow up to [57124].

Props johnbillion.
See #59416.
Built from https://develop.svn.wordpress.org/trunk@57125


git-svn-id: http://core.svn.wordpress.org/trunk@56636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 20:11:19 +00:00
desrosj
2a1b659731 Build/Test Tools: Comment on PRs with WordPress Playground information.
After [56958], pull requests to `wordpress-develop` can be tested within a WordPress Playground instance. However this capability is not obvious.

This makes several updates to GitHub action workflows to avoid unnecessary extra runs/jobs while also commenting on pull requests with proper context for testing in Playground once a build is available for the PR.

Changes:
- The `build.yml` workflow has been deleted. The WordPress build process is already being tested within the `test-build-processes.yml` workflow. Now that workflow will produce and upload the built artifact for the given PR.
- A `pull-request-comments.yml` workflow has been added to handle the commenting. To avoid having multiple workflows that comment on PRs, the logic within the `welcome-new-contributors.yml` workflow has been merged into this one.
- The `pull_request` event trigger lacks the needed permission to comment on or update pull requests. Instead of using `pull_request_target` to navigate around this, the `test-build-processes.yml` workflow will now use `workflow_dispatch` to initiate a run of the commenting workflow. This adds the ability to only comment on the PR when a build has been successfully created and uploaded as an artifact.

Props swissspidy, zieladam, jeffpaul.
See #59416.
Built from https://develop.svn.wordpress.org/trunk@57124


git-svn-id: http://core.svn.wordpress.org/trunk@56635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 18:24:22 +00:00
Sergey Biryukov
8673b86258 Coding Standards: Rewrite a few capability checks for clarity and readability.
This aims to:
* Perform the checks as early as possible to avoid redundant function calls.
* Remove an empty conditiaonal branch and make the exit conditions clearer.
* Bring the formatting in line with other multi-line conditionals in core.

Follow-up to [56836].

See #59650.
Built from https://develop.svn.wordpress.org/trunk@57123


git-svn-id: http://core.svn.wordpress.org/trunk@56634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 17:11:21 +00:00
desrosj
586fab12bf Twenty Twenty-One: Update all dependencies.
In preparation for updating Core to use Node.js version 18.x, this updates the dependancies for the Twenty Twenty-One theme to the latest versions. This addresses an unsupported engine warning where packages within the dependency tree did not support Node.js > 16.x.

All changes to built files are included in this commit. These changes are a result of the following:

- Identical sets of properties for multiple selectors are now consolidated into one.
- The removal of a duplicate `--branding--description--font-family` definition.
- The addition of the `postcss-discard-empty` dependency, which removes empty CSS rules within IE stylesheets after the previous consolidation is performed.
- `stylelint` has only been updated to 14.x (15.x is the latest). This is because `@wordpres/stylelint-config` currently has a version constraint of `^14.2` and does not properly support 15.x.

The last change of note is the new configuration for the `value-keyword-case` rule in `.stylelint-css.json`. This was added as a way to prevent the `currentColor` from being changed to all lowercase.

Props jorbin, poena.
See #59663, #59658.
Built from https://develop.svn.wordpress.org/trunk@57122


git-svn-id: http://core.svn.wordpress.org/trunk@56633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 16:22:19 +00:00
Sergey Biryukov
09815e007d Docs: Fix typo in get_image_tag() DocBlock.
Follow-up to [54173].

Props kitchin.
See #55646, #59651.
Built from https://develop.svn.wordpress.org/trunk@57121


git-svn-id: http://core.svn.wordpress.org/trunk@56632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 15:33:21 +00:00
Sergey Biryukov
d7a1816bf1 Docs: Improve some DocBlocks and inline comments per the documentation standards.
Follow-up to [56834], [56836], [56837], [56838].

Props kebbet, costdev, mukesh27, SergeyBiryukov.
See #59651.
Built from https://develop.svn.wordpress.org/trunk@57120


git-svn-id: http://core.svn.wordpress.org/trunk@56631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 13:29:26 +00:00
Bernhard Reiter
382c01d848 Block Hooks: Expose serialized template content to filter.
The recently introduced Block Hooks API exposes a filter (`hooked_block_types`) which is given a `$context` argument, among others. If the filter is called on a block that's part of a template or template part, `$context` is set to the corresponding `WP_Block_Template` object.

However, that object's `$content` property is currently ''not'' exposed to the filter. This changeset amends that shortcoming.

This is useful for callbacks that might want to detect the presence of a serialized block instance (or potentially in the future utilize the HTML API) to restrict where the block is injected (before the template is rendered).

Addressing this also achieves parity with the structure of `$context` when it represents a pattern (where pattern serialized content is present).

Props nerrad.
Fixes #59882.
Built from https://develop.svn.wordpress.org/trunk@57118


git-svn-id: http://core.svn.wordpress.org/trunk@56629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 07:10:21 +00:00
Bernhard Reiter
b5ac702f60 HTML API: Fix typo in documentation example.
The example code in the PHPDoc comment for the HTML Tag Processor class
previously showed calling `next_tag()` with an array containing a `class`
key, which should have been `class_name`. This patch fixes this by using
the appropriate `class_name` key.

Props dmsnell, gaambo, crstauf, atachibana, audrasjb, krupalpanchal.
Fixes #59891.
Built from https://develop.svn.wordpress.org/trunk@57116


git-svn-id: http://core.svn.wordpress.org/trunk@56627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 06:40:24 +00:00
Bernhard Reiter
b86334b447 HTML API: Add support for containers elements, including ARTICLE.
There are a handful of elements which behave similarly and are generically container elements. These are the following elements:

    ADDRESS, ARTICLE, ASIDE, BLOCKQUOTE, CENTER, DETAILS, DIALOG, DIR,
    DL, DIV, FIELDSET, FIGCAPTION, FIGURE, FOOTER, HEADER, HGROUP, MAIN,
    MENU, NAV, SEARCH, SECTION, SUMMARY

This patch adds support to the HTML Processor for handling these elements. They do not require any additional logic in the rest of the class, and carry no specific semantic rules for parsing beyond what is listed in their group in the IN BODY section of the HTML5 specification.

Props dmsnell.
Fixes #59914.
Built from https://develop.svn.wordpress.org/trunk@57115


git-svn-id: http://core.svn.wordpress.org/trunk@56626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-17 06:13:25 +00:00
Sergey Biryukov
222813317f Docs: Replace tabindex example in submit button functions documentation.
Most of the `tabindex` attributes across the admin were removed in [21311].

This commit updates the example for the `$other_attributes` parameter to use the `id` attribute instead.

Includes synchronizing documentation between `submit_button()` and `get_submit_button()`.

Follow-up to [15810], [16061], [21311], [27136], [31599].

Props benjaminknox, sabernhardt, fushar, SergeyBiryukov.
Fixes #59768.
Built from https://develop.svn.wordpress.org/trunk@57114


git-svn-id: http://core.svn.wordpress.org/trunk@56625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-16 17:02:25 +00:00
Sergey Biryukov
812b1e296c Docs: Fix typo in the ms_user_list_site_class filter description.
Follow-up to [44977].

Props nithins53, shailu25, sabernhardt.
Fixes #59907.
Built from https://develop.svn.wordpress.org/trunk@57111


git-svn-id: http://core.svn.wordpress.org/trunk@56622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-15 09:33:26 +00:00
Sergey Biryukov
91334ba3ab Docs: Use typed array notation for the $options parameter in some new functions.
Follow-up to [56445], [56508], [57013].

Props tmatsuur.
Fixes #59904.
Built from https://develop.svn.wordpress.org/trunk@57110


git-svn-id: http://core.svn.wordpress.org/trunk@56621 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-14 12:44:27 +00:00
isabel_brison
078ed1a3a6 Editor: update npm packages for 6.4.2.
Package updates with bug fixes related to patterns, Query look interactivity, design tools UI and accessibility.

Props mikachan, jorbin, kebbet, artemiosans, talldanwp, ramonopoly, alexstine, andrewserong, mamaduka, cbravobernal, ajlende, luisherranz.
See #59828.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-14 00:12:23 +00:00
Sergey Biryukov
f3a843e952 Docs: Replace miscellaneous incorrect PHPDoc tags.
* `@contrib` is not a valid tag.
* `@origin` is not a valid tag.
* `@ref` is not a valid tag.
* `@blessed` is not a valid tag and doesn't convey any meaningful information.
* `@issue` is not a valid tag.

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#phpdoc-tags PHP Documentation Standards: PHPDoc Tags].

Follow-up to [8852], [34754], [38832], [43808].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-13 11:13:27 +00:00
Sergey Biryukov
b2dcecf188 Docs: Fix incorrect property doc in WP_Theme::get_allowed() tests.
The `@array` tag does not exist. This should be `@var array`.

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#2-1-class-members PHP Documentation Standards: Class Members].

Follow-up to [36350].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-12 09:21:24 +00:00
Sergey Biryukov
5896701b31 Docs: Include 'weekly' as a valid value in wp_schedule_event() description.
Follow-up to [47062].

Props crstauf, pacicio.
Fixes #59888.
Built from https://develop.svn.wordpress.org/trunk@57106


git-svn-id: http://core.svn.wordpress.org/trunk@56617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-11 09:28:30 +00:00
Sergey Biryukov
7a0036e448 Docs: Fix broken @covers tag in _wp_post_thumbnail_context_filter() tests.
Without the space between the tag and the "description", the tag will not be recognized and the test will not record coverage correctly.

Reference: [https://docs.phpunit.de/en/9.6/annotations.html#covers PHPUnit Manual: Annotations].

Follow-up to [55821].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-10 22:54:27 +00:00
Felix Arntz
50aa8fc45d Tests: Fix incorrect check for block themes in legacy PHPUnit test for themes.
Props mukesh27.
Fixes #59881.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-10 19:01:27 +00:00
Joe McGill
832dd52ade Themes: Correct docblock for _register_theme_block_patterns.
This updates the '@since 6.4.0' annotation in `_register_theme_block_patterns` to reference `WP_Theme::get_block_patterns` instead of `_wp_get_block_patterns`, which was changed in [56978].

Props audrasjb, mukesh27, joemcgill.
Fixes #59869.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-10 15:12:27 +00:00
Sergey Biryukov
9f81d01334 Docs: Fix incorrect @return tag in wp_check_filetype() tests.
`@return[]` is not a valid tag. Fixed now, though without further specification.

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#phpdoc-tags PHP Documentation Standards: PHPDoc Tags].

Follow-up to [55456].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-10 10:49:28 +00:00
Peter Wilson
2169e79e83 Coding Standards: Replace CRLF line breaks with LF.
Run `npm run grunt format:php:error` to correct the EOL sequence for:

* `tests/phpunit/tests/functions/wpAdminNotice.php`
* `tests/phpunit/tests/functions/wpGetAdminNotice.php`

See #59650.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-10 00:09:27 +00:00
Sergey Biryukov
fe69590e7c Docs: Fix various incorrect WP-flavored array specifications.
Tags like `@string` or `@array` do not exist and are not supported. The way these were used here, also meant duplicate information being documented.

Fixed now by using the `@type` tag as per the WP flavor of array documentation.

Includes some fixes to the documentation formatting.

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#1-1-parameters-that-are-arrays PHP Documentation Standards: Parameters That Are Arrays].

Follow-up to [33322], [42880], [42971], [44786].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-09 09:51:25 +00:00
Peter Wilson
c4b64359d6 Quick/Bulk Edit: Prevent assigning posts to default categories during bulk edit.
During a bulk edit of posts with different categories, the categories for the edited posts would be reset to the default category: uncategorized by default.

This reverts [56712] to resolve the issue.

Props peterwilsoncc, hellofromtonya, jorbin.
Fixes #59837.
See #11302.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-08 23:22:25 +00:00
hellofromTonya
77a83f38d9 Database: Reinstate wpdb::$use_mysqli property.
Partial revert of [56475] to reinstate the private `wpdb::$use_mysqli` property and set to its default to `true`. This private property was / is accessible through the magic methods. Though Core's usage of this property was removed by [56475], plugins are using the property. Reinstating it resolves the BC break.

Follow up to [56475].

Props jason_the_adams, joemcgill, johnbillion, johnjamesjacoby, jrf, rajinsharwar, renehermi.
Fixes #59846.
Built from https://develop.svn.wordpress.org/trunk@57089


git-svn-id: http://core.svn.wordpress.org/trunk@56600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-08 20:34:20 +00:00
desrosj
887ffe1995 External Libraries: Update Requests to 2.0.9.
This updates the Requests library from version `2.0.8` to `2.0.9`. This is a hotfix release.

Props jorbin, hellofromTonya, desrosj, barry, cenkdemir, nexflaszlo, schlessera, jrf, Clorith, tomsommer, azaozz, pbiron, afragen, howdy_mcgee.
Fixes #59842.
Built from https://develop.svn.wordpress.org/trunk@57086


git-svn-id: http://core.svn.wordpress.org/trunk@56597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-08 19:47:26 +00:00
desrosj
436d55fa51 Build/Test Tools: Use correct order of arguments for contains().
This corrects the order the arguments are passed to the `contains()` function in the Performance Testing workflow.

Because the arguments were passed incorrectly, the expression was not evaluating correctly.

Follow up to [56972].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-08 14:08:26 +00:00
Sergey Biryukov
ca4aed3083 Administration: Fix typos in wp_admin_notice() arguments in a few instances.
Follow-up to [56570], [56599].

Props dlh, mukesh27, sumitbagthariya16.
Fixes #59830.
Built from https://develop.svn.wordpress.org/trunk@57084


git-svn-id: http://core.svn.wordpress.org/trunk@56595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-08 11:06:22 +00:00
Pascal Birchler
ba0fd81822 Build/Test Tools: Expand performance test scenarios.
Adds new tests for localized sites as well as the dashboard.
Also amends Server-Timing output to measure memory usage in all scenarios.

Props swissspidy, joemcgill, flixos90, mukesh27, mamaduka.
See #59656.
Fixes #59815.
Built from https://develop.svn.wordpress.org/trunk@57083


git-svn-id: http://core.svn.wordpress.org/trunk@56594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-08 10:32:25 +00:00
desrosj
7208116a8c Build/Test Tools: Add 6.3 to the Upgrade Testing workflow.
This adds WordPress 6.3 to the Upgrade Testing GitHub Actions workflow.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-08 00:36:25 +00:00
Aaron Jorbin
33e3aff34f Help/About: Improve translation comment around release notes.
Props kharisblank, kebbet.
Fixes #59821.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-07 22:58:27 +00:00
Sergey Biryukov
7da5644617 Docs: Use proper case for @todo tags.
The correct tag is `@todo`, not `@TODO` or `@todo:` (note the trailing colon).

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#phpdoc-tags PHP Documentation Standards: PHPDoc tags].

Follow-up to [55203], [56274], [56565], [56698].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-07 00:14:23 +00:00
hellofromTonya
9c8d8c260a Upgrade/Install: Update $_old_files for 6.4.
Props davidbaumwald.
Fixes #59817.
Built from https://develop.svn.wordpress.org/trunk@57075


git-svn-id: http://core.svn.wordpress.org/trunk@56586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-06 17:49:25 +00:00
desrosj
10205bf0f3 Bundled Themes: Bump versions for WP 6.4 releases.
Since every default theme was updated during the 6.4 release cycle, this bumps the version of each one.

Twenty Ten: 4.0
Twenty Eleven: 4.5
Twenty Twelve: 4.1
Twenty Thirteen: 4.0
Twenty Fourteen: 3.8
Twenty Fifteen: 3.6
Twenty Sixteen: 3.1
Twenty Seventeen: 3.4
Twenty Nineteen: 2.7
Twenty Twenty: 2.4
Twenty Twenty-One: 2.0
Twenty Twenty-Two: 1.6
Twenty Twenty-Three: 1.3

Props sabernhardt, rajinsharwar, mukesh27.
Fixes #58832.
Built from https://develop.svn.wordpress.org/trunk@57069


git-svn-id: http://core.svn.wordpress.org/trunk@56580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-06 15:21:23 +00:00
Bernhard Reiter
388713f0ff Block Types: Add metadata global attribute.
Add a new global attribute (i.e. an attribute that can be added to all and any blocks) called `metadata`. This is required for use cases such as allowing the user to assign custom names to blocks, or for making Block Hooks work with user-modified templates/parts/patterns (#59646).

Props Mamaduka, gziolo, get_dave.
Fixes #59797.
Built from https://develop.svn.wordpress.org/trunk@57068


git-svn-id: http://core.svn.wordpress.org/trunk@56579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-06 14:47:18 +00:00
hellofromTonya
ea9d0c8dce Twenty Twenty-Four: Bugfixes and refinement for 6.4 RC4.
This update includes the following changes:

* [https://github.com/WordPress/twentytwentyfour/pull/723 Remove custom CSS for links].
* [https://github.com/WordPress/twentytwentyfour/pull/718 Fix the link to the theme's docs].
* [https://github.com/WordPress/twentytwentyfour/pull/719 Separate outline css to its own function] - which introduces `twentytwentyfour_block_stylesheets()` for enqueuing custom block stylesheets.
* [https://github.com/WordPress/twentytwentyfour/pull/720 Fix height of newsletter landing pattern].
* [https://github.com/WordPress/twentytwentyfour/pull/722/ Resolve border colors in variations].

Follow up to [57036], [56999], [56951], [56813], [56764], [56716].

Props onemaggie, richtabor, luminuu, huzaifaalmesbah, sabernhardt, poena, rajinsharwar.
Fixes #59812.
Built from https://develop.svn.wordpress.org/trunk@57067


git-svn-id: http://core.svn.wordpress.org/trunk@56578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-06 14:43:23 +00:00
hellofromTonya
faa928f218 Blocks: Document Block Hooks functions as private.
Documents the 4 new 6.4 Block Hooks global functions as private and for Core-only internal usage:

* `make_before_block_visitor()`
* `make_after_block_visitor()`
* `traverse_and_serialize_block()`
* `traverse_and_serialize_blocks()`

This is being done as the architectural design of these new functions may change in the next cycle. Further denoting them as private / Core only can help to avoid extender churn if any of these functions are deprecated.

Follow up to [56649], [56620].

Props azaozz, hellofromTonya, bernhard-reiter, gziolo, mikeschroder.
Fixes #59783.
See #59313.
Built from https://develop.svn.wordpress.org/trunk@57066


git-svn-id: http://core.svn.wordpress.org/trunk@56577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-06 13:37:24 +00:00
Sergey Biryukov
747b2c9f11 Docs: Replace incorrect @private tags.
The `@private` tag does not exist and is not supported. To indicate that something is private when in the global namespace, `@access private` should be used instead.

Reference: [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#phpdoc-tags PHP Documentation Standards: PHPDoc tags].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-06 09:27:23 +00:00
hellofromTonya
a95a0b32b5 Editor: Update of npm packages after 6.4 RC3.
This update includes the following fixes reported after RC3:

* Regression: [https://github.com/WordPress/gutenberg/pull/55858 Fixes patterns not working anymore as a post template for custom post types].

Scenario: When creating a new post for any custom post type registered with its "template" argument set to a pattern.

For this scenario, the pattern template no longer renders in the post editor or the frontend with 6.4, whereas it did render properly in 6.3.2.

This package update resolves the console error raised:
{{{
Uncaught TypeError: select(...).getCurrentTheme() is undefined 
}}}
which restores the rendering of the pattern template.

* Regression: [https://github.com/WordPress/gutenberg/pull/55859  Fixes positioning and styles for the new lightbox's trigger] introduced in 6.4.

Follow up to [57048], [57034], [56987], [56961], [56849], [56818], [56816].

Props renathoc, rajinsharwar, richtabor, joen, mikachan, hellofromTonya.
Fixes #59411.
Built from https://develop.svn.wordpress.org/trunk@57063


git-svn-id: http://core.svn.wordpress.org/trunk@56574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-05 17:16:25 +00:00
Sergey Biryukov
71dbb8f74b Docs: Fix typo in a function DocBlock in WP_Duotone tests.
Follow-up to [56101], [56981].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-05 16:22:24 +00:00
Sergey Biryukov
522656ed2b Coding Standards: Remove unnecessary ignore annotations in dbDelta().
It is perfectly possible to write a commented regex with layout for readability by using the `x` modifier.

As per the manual:
> x (`PCRE_EXTENDED`)
>
> If this modifier is set, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class, and characters between an unescaped # outside a character class and the next newline character, inclusive, are also ignored. This is equivalent to Perl's /x modifier, and makes it possible to include commentary inside complicated patterns.
>
> Note, however, that this applies only to data characters. Whitespace characters may never appear within special character sequences in a pattern, for example within the sequence (?( which introduces a conditional subpattern.

Reference: [https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php PHP Manual: Pattern Modifiers].

This commit rewrites these two regexes to use the `x` modifier and gets rid of the unnecessary `phpcs:disable` comments.

The tests in the `tests/phpunit/tests/db/dbDelta.php` file cover this change.

Follow-up to [42249].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-04 00:26:20 +00:00
Peter Wilson
d6aecc9d83 Build/Test Tools: Introduce tests for wp_cache_set_last_changed().
Props pbearne.
Fixes #59737.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-03 23:29:19 +00:00
Peter Wilson
8dfba9204d Build/Test Tools: Fix group for wp_unique_prefixed_id() tests.
Change the group from `functions.php` to `functions` to match other tests.

See #59647.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-03 21:55:21 +00:00
Sergey Biryukov
0768c65310 Coding Standards: Remove unnecessary ignore annotation in wp_kses_hair_parse().
It is perfectly possible to write a commented regex with layout for readability by using the `x` modifier.

As per the manual:
> x (`PCRE_EXTENDED`)
>
> If this modifier is set, whitespace data characters in the pattern are totally ignored except when escaped or inside a character class, and characters between an unescaped # outside a character class and the next newline character, inclusive, are also ignored. This is equivalent to Perl's /x modifier, and makes it possible to include commentary inside complicated patterns.
>
> Note, however, that this applies only to data characters. Whitespace characters may never appear within special character sequences in a pattern, for example within the sequence (?( which introduces a conditional subpattern.

Reference: [https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php PHP Manual: Pattern Modifiers].

This commit rewrites these two regexes to use the `x` modifier and gets rid of the unnecessary `phpcs:disable` comments.

The tests in the `tests/phpunit/tests/db/dbDelta.php` file cover this change.

Follow-up to [42249].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-03 15:33:22 +00:00
Aaron Jorbin
82935cf778 Help/About: Update link to field guide for 6.4.
Follow up to [56950].

Props afercia.
Fixes #59289.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-02 14:57:25 +00:00
Sergey Biryukov
b330629c53 Coding Standards: Correct equals sign alignment in various files.
This resolves a few WPCS warnings:
{{{
Equals sign not aligned with surrounding statements
}}}
so that the output of `composer format` is clean.

Follow-up to [56796], [56803], [56838], [56839], [56985].

See #59650.
Built from https://develop.svn.wordpress.org/trunk@57053


git-svn-id: http://core.svn.wordpress.org/trunk@56564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-02 00:04:24 +00:00
desrosj
6c91e1adfa Build/Test Tools: Increase the number of retries when restarting a workflow.
This increases the number of times to retry restarting a workflow from 10 to 15, and the `timeout-minutes` value to `30`.

For workflows with complex strategy matrix, the exponential backoff of 10 retries is still not enough to account for the GitHub Actions UI taking a long time to catch up.

Follow up to [56829] and [56830].
See #58867.
Built from https://develop.svn.wordpress.org/trunk@57052


git-svn-id: http://core.svn.wordpress.org/trunk@56563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-01 19:31:21 +00:00
hellofromTonya
8dfcdc8088 Editor: 2nd update of npm packages for 6.4 RC3.
This second update for RC3 includes the following fixes:

* [https://github.com/WordPress/gutenberg/pull/55724 Update label for lightbox editor UI] - string change.
* [https://github.com/WordPress/gutenberg/pull/55720 Query: Require queryId for enhanced pagination to prevent PHP notices] and warnings.
* [https://github.com/WordPress/gutenberg/pull/55714 Query block enhanced pagination: Detect inner plugin blocks during render] - which avoids turning off enhanced pagination in TT4, includes string changes.
* [https://github.com/WordPress/gutenberg/pull/55309 Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region].

Follow up to [57034], [56987], [56961], [56849], [56818], [56816].

Props afercia, aristath, artemiosans, czapla, darerodz, glendaviesnz, hellofromTonya, jameskoster, joen, luisherranz, mikachan, ocean90, peterwilsoncc, ramonopoly, rajinsharwar, swissspidy.
Fixes #59411.
Built from https://develop.svn.wordpress.org/trunk@57048


git-svn-id: http://core.svn.wordpress.org/trunk@56559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-01 17:49:17 +00:00
John Blackbourn
af66c304f8 Docs: Correct some docblock formatting errors.
Fixes #59784

See #12009, #52710

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


git-svn-id: http://core.svn.wordpress.org/trunk@56557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-01 15:10:20 +00:00
hellofromTonya
52a22941a5 Taxonomy: Set "public" to "false" for user pattern categories.
Changes the `'wp_pattern_category'` taxonomy's `'public'` argument to `false`.

Follow-up to [56642].

Props vrajadas, glendaviesnz, hellofromTonya, ramonopoly.
Fixes #59569.
Built from https://develop.svn.wordpress.org/trunk@57044


git-svn-id: http://core.svn.wordpress.org/trunk@56555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-01 14:50:24 +00:00
Sergey Biryukov
448bde29ad Docs: Correct the type for optional parameters in a few media functions.
This affects the `$image_src` and/or `$image_meta` parameters in:
* `wp_get_attachment_image_srcset()`
* `wp_get_attachment_image_sizes()`
* `wp_calculate_image_sizes()`

Follow-up to [35412], [35419], [35481], [35498], [35569], [35672].

Props dilipbheda.
Fixes #59745.
Built from https://develop.svn.wordpress.org/trunk@57042


git-svn-id: http://core.svn.wordpress.org/trunk@56553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-01 11:51:26 +00:00
Bernhard Reiter
798991a0ff Block Hooks: Allow traversal callbacks to modify parent block.
The callbacks returned by `make_before_block_visitor` and `make_after_block_visitor`, respectively, (which are passed as arguments to `traverse_and_serialize_block(s)`) currently accept three arguments, all of which are block arrays (i.e. with properties `blockName`, `attrs`, etc.):
- A ''reference'' to the block they're currently visiting, `&$block`;
- the block's `$parent_block`; and
- the `$prev`ious block (for `make_before_block_visitor`), or the `$next` block (for `make_after_block_visitor`), respectively.

Those arguments are passed to the "block visitor" callbacks by `traverse_and_serialize_block(s)` during traversal. The block that the callback is currently visiting is passed ''by reference'' to allow modifying it, which is e.g. used to inject the `theme` attribute into Template Part blocks.

One major limitation of Block Hooks is that they currently only work with templates, parts, and patterns that ''don't have any user modifications'' (i.e. that come straight from the corresponding theme files, rather than from the database). For WordPress 6.5, it is planned to change that to make Block Hooks work for templates, parts, and patterns that ''do'' have user modifications: #59646.

This will be implemented by storing an attribute on the "anchor" block. While working on that feature, it was found that the aforementioned callbacks will need to modify not only the currently visited `$block`, but also the `$parent_block` -- i.e. that the latter argument needs to be passed by reference as well. This is consistent with the requirement of adding an attribute to an anchor block, as it's not only the currently visited block that can serve as an anchor block (in the case of `before` or `after` sibling insertion), but also its parent (for `first_child` and `last_child` insertion).

If the `$parent_block` argument were to be changed to become a reference in a later WordPress version, this could be considered a backwards-compatibility breaking change. For this reason, this change is instead proposed for 6.4 already, which is the cycle during which the relevant functions were first introduced. This should have no impact on existing code, since nothing currently relies on `$parent_block` remaining unmodified by the respective callback, nor is anything currently modifying that argument.

Props hellofromTonya.
Fixes #59776.
Built from https://develop.svn.wordpress.org/trunk@57038


git-svn-id: http://core.svn.wordpress.org/trunk@56549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-31 19:25:19 +00:00
hellofromTonya
cb934c06db Twenty Twenty-Four: Bugfixes for 6.4 RC2.
This update includes the following bugfixes: 

- Fix: Added a new block pattern for the home template that inherits the page query and fits the design of the home page. (more context on the theme repo: https://github.com/WordPress/twentytwentyfour/pull/706)
- Fix: Rely on parent theme data for block style.
- Fix: Categories for some patterns.
- Fix: Minor labeling issues

Follow-up to [56999], [56951], [56813], [56764], [56716].

Props anlino, beafialho, desrosj, devmuhib, didierjm, fabiorubioglio, flixos90, hanneslsm, hellofromTonya, huzaifaalmesbah, ktaron, luminuu, mshowes, onemaggie, phillsav, poena, rajinsharwar, richtabor, shailu25.
Fixes #59770, #59759.
Built from https://develop.svn.wordpress.org/trunk@57036


git-svn-id: http://core.svn.wordpress.org/trunk@56547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-31 17:26:27 +00:00
Tammie Lister
6edefe60c0 Update editor related npm packages for 6.4 RC3.
The npm packages needed update for 6.4 RC3.

Patch: https://github.com/WordPress/wordpress-develop/pull/5587.
This PR includes the following changes:

- Regression: [https://github.com/WordPress/gutenberg/pull/55553 Patterns: fix bug with authors and contributors not seeing user pattern categories].
- Bugfix: [https://github.com/WordPress/gutenberg/pull/55539 Query Loop:Disallow "enhanced pagination" with core blocks that may contain third-party blocks].
- Regression: [https://github.com/WordPress/gutenberg/pull/55667 File: Fix embedded PDF files in Safari].
- Regression: [https://github.com/WordPress/gutenberg/pull/55669 Ensure Term Description block is registered in core]

Props DAreRodz, luisherranz, poena, afercia, danieldudzic, hellofromtonya, siobhyb, mikachan, get_dave, scruffian, wildworks, glendaviesnz, ramonopoly, aaronrobertshaw.

See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-31 15:14:05 +00:00
Sergey Biryukov
0abdf83aaf Coding Standards: Remove extra space in a comment in WP_REST_Blocks_Controller.
This fixes a WPCS error: `Whitespace found at end of line`.

Follow-up to [57032].

Props hellofromTonya.
See #59388.
Built from https://develop.svn.wordpress.org/trunk@57033


git-svn-id: http://core.svn.wordpress.org/trunk@56544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-31 14:23:21 +00:00
Sergey Biryukov
ac2b1a56d2 Docs: Update some reusable block references to synced patterns.
In WordPress 6.3, [https://wordpress.org/documentation/article/reusable-blocks/ Reusable Blocks were renamed to Patterns]. A synced pattern will behave in exactly the same way as a reusable block.

This commit updates some references in DocBlocks and inline comments to use the new name.

Follow-up to [56030].

Props benjaminknox, oglekler, hellofromTonya, marybaum, nicolefurlan.
Fixes #59388.
Built from https://develop.svn.wordpress.org/trunk@57032


git-svn-id: http://core.svn.wordpress.org/trunk@56543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-31 12:58:23 +00:00
Peter Wilson
cc0246c154 Options, Meta APIs: Fast follow fixes for option cache priming functions.
A collection of fixes for `wp_prime_option_caches()`:

* cache arrays and objects in their serialized form for consistency with `get_option()` and `wp_load_alloptions()`
* prevent repeat database queries for falsey and known non-existent options (notoptions)

Additional tests for `wp_prime_option_caches()` to ensure:

* additional database queries are not made repriming options (known, known-unknown and alloptions)
* cache is primed consistently
* `get_option()` returns a consistent value regardless of how it is primed
* database queries do not contain earlier primed options
* `get_option` does not prime the cache when testing the cache has been successfully primed

Fixes a test for `wp_prime_option_caches_by_group()` to ensure `get_option` does not prime the cache when testing the cache has been successfully primed.

Follow up to [56445],[56990],[57013].

Props peterwilsoncc, costdev, flixos90, hellofromTonya, mikeschroder, joemcgill.
Fixes #59738. See #58962.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-30 22:58:24 +00:00
Sergey Biryukov
bdfe4f53bc Editor: Correctly load RTL stylesheets in register_core_block_style_handles().
When setting an RTL language under Settings → General, some RTL stylesheets were not loaded, with LTR stylesheets being loaded instead, meaning that some blocks were not displayed correctly.

This commit ensures that all appropriate RTL stylesheets are loaded when selecting an RTL language.

Follow-up to [56524].

Props mukesh27, maahrokh, hellofromTonya, joemcgill, huzaifaalmesbah, rajinsharwar, devmuhib, swissspidy.
Fixes #59715.
Built from https://develop.svn.wordpress.org/trunk@57028


git-svn-id: http://core.svn.wordpress.org/trunk@56539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-30 12:54:22 +00:00
Sergey Biryukov
61296195f8 Docs: Improve documentation for wp_tempnam() and download_url().
Instead of mentioning the `unlink()` function specifically, the DocBlock should state that the calling function must delete or move the temporary file.

Follow-up to [6779], [12151].

Props bedas.
Fixes #59761.
Built from https://develop.svn.wordpress.org/trunk@57027


git-svn-id: http://core.svn.wordpress.org/trunk@56538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-29 00:16:26 +00:00
Sergey Biryukov
ac10fc6896 Blocks: Parse the arguments earlier in register_block_type_from_metadata().
This makes it possible to register a block by passing an array of arguments, without the presence of a `block.json` file.

Follow-up to [48141], [49948].

Props aristath, spacedmonkey, mukesh27, costdev, audrasjb, oglekler, felipeelia, hellofromTonya.
Fixes #56865.
Built from https://develop.svn.wordpress.org/trunk@57026


git-svn-id: http://core.svn.wordpress.org/trunk@56537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-28 01:02:26 +00:00
joedolson
32bf11b728 Plugins: Prevent ajaxComplete listener from observing all events.
Add a conditional to prevent the `prefers-reduced-motion` `ajaxComplete` listener from observing events not occurring in the plugin installation screen. Improve handling of settings data test.

The listener observing `ajaxComplete` in [56541] was intercepting all `ajaxComplete` events, creating potential for unexpected errors in unrelated functions.

Props bplv, afercia, rudlinkon, hellofromTonya, huzaifaalmesbah, joedolson, jorbin.
Fixes #59689.
Built from https://develop.svn.wordpress.org/trunk@57022


git-svn-id: http://core.svn.wordpress.org/trunk@56533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-27 19:25:20 +00:00
Joe McGill
b4a6b21986 Upgrade/Install: Skip registering theme block patterns during the upgrade process.
This fixes a bug during the database upgrade process where a theme's `functions.php` file may not be loaded, leading to potential exceptions if the theme's pattern files use symbols (classes, functions, constants, etc.) that are declared only when the `functions.php` file is loaded. To do so, a check for `wp_get_active_and_valid_themes()` is added early to `_register_theme_block_patterns()`, which returns early if no active or valid themes are returned.

Props fabiankaegy, rajinsharwar, pbiron, huzaifaalmesbah, hellofromTonya, peterwilsoncc, joemcgill.
Fixes #59723.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-27 19:04:22 +00:00
Felix Arntz
06237953dd Themes: Skip wrapping block template for singular content with a main query loop when the template was injected from outside the current theme.
As a follow up to [56507], this fixes a bug that could occur for instance when plugins hijack the block template detection process to inject their own block template with entirely custom logic.

Props afragen, hellofromTonya, costdev, mukesh27, huzaifaalmesbah, flixos90.
Fixes #59736.
See #58154.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-27 18:18:22 +00:00
Aaron Jorbin
50d5a07812 Help/About: Improve Accessibility, RTL, Internationalization, and Responsiveness of about pages.
Tweaks the 6.4 about pages in a couple of ways:
 - Decouples the background from the 6.4 logo so the logo can move for RTL.
 - Updates a color to improve color contrast.
 - Help prevent overlap of long text strings with 6.4 logo.
 - Ensure background isn't dark when no background is used on mobile.

Props nudge, jorbin, afercia, sumitsingh, sabernhardt.
See #59289, #59664.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-27 17:03:25 +00:00
Sergey Biryukov
02fe60ddab Coding Standards: Remove a redundant section in the phpcs.xml.dist ruleset.
The affected lines already have ignore annotations in the `wp-includes/class-wp-block-parser-block.php` file itself.

Follow-up to [56048], [56738], [56743], [56751], [56752], [56753].

Props jrf, SergeyBiryukov.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@57017


git-svn-id: http://core.svn.wordpress.org/trunk@56528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-27 08:29:27 +00:00
Peter Wilson
2aa3f8fbeb Options, Meta APIs: Rename option cache priming functions.
Rename the option cache priming functions to more closely follow the naming convention used by other cache priming functions.

* `wp_load_options()` becomes `wp_prime_option_caches()`
* `wp_load_options_by_group()` becomes `wp_prime_option_caches_by_group()`

The unit test files and classes are renamed accordingly.

Unlike the existing cache priming functions, these functions were introduced with the intention of being public so use the `wp_` prefix rather than the `_` prefix used by the functions initially introduced as private functions but since made public.

Follow up to [56445],[56990].

Props flixos90, peterwilsoncc, joemcgill, SergeyBiryukov, desrosj.
Fixes #58962.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-26 22:56:19 +00:00
Aaron Jorbin
a0d7172914 REST API: Move rest_pre_serve_request filter to after no cache headers are sent.
[56834] adjusted the order of activity inside the rest server responses. This lead to the `rest_pre_serve_request` filter potentially blocking the sending of the no cache headers. This moves that action back to being after the sending of no cache headers has finished to restore the pre 6.3.2 order of these two actions.

Props perrelet, SergeyBiryukov, peterwilsoncc.
Fixes #59722.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-26 22:36:25 +00:00
Sergey Biryukov
39ccc3798d Tests: Use a @requires annotation for readonly() function test.
The function is only defined by WordPress core on PHP < 8.1.

Follow-up to [51586].

See #59647.
Built from https://develop.svn.wordpress.org/trunk@57011


git-svn-id: http://core.svn.wordpress.org/trunk@56522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-26 20:33:22 +00:00
Felix Arntz
e5d1fca198 Themes: Fix block theme supports being added too early, leading to Customizer live preview bugs in 6.4.
The Customizer live preview broke because of [56635], however the root cause for the bug was a lower-level problem that had been present since WordPress 5.8: The block theme specific functions `_add_default_theme_supports()` and `wp_enable_block_templates()` were being hooked into the `setup_theme` action, which fires too early to initialize theme features. Because of that, theme functionality would be initialized before the current theme setup being completed. In the case of the Customizer, that includes overriding which theme is the current theme entirely, thus leading to an inconsistent experience.

This changeset fixes the bug by moving those two callbacks to the `after_setup_theme` action, which is the appropriate action to initialize theme features.

Props karl94, hellofromTonya, joemcgill, flixos90.
Fixes #59732.
See #18298, #53397, #54597.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-26 18:44:26 +00:00
Sergey Biryukov
9618b1e89b Tests: Remove some unnecessary multisite test skipping.
These checks are redundant, as the skipping already handled by the `ms-required` and `ms-excluded` groups.

Follow-up to [36740], [36741], [38705], [40520], [51415].

Props johnbillion.
See #59647.
Built from https://develop.svn.wordpress.org/trunk@57008


git-svn-id: http://core.svn.wordpress.org/trunk@56519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-25 11:22:24 +00:00
desrosj
955a0ec66b Twenty Twenty-Four: Include file renaming for RC2.
This includes a file renaming that was missed in [56999].

Follow-up to [56999], [56951], [56813], [56764], [56716].

Props hellofromTonya, huzaifaalmesbah.
See #59711.
Built from https://develop.svn.wordpress.org/trunk@57003


git-svn-id: http://core.svn.wordpress.org/trunk@56514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-24 14:35:23 +00:00
desrosj
d85bc099a0 Twenty Twenty-Four: Bug fixes for 6.4 RC2.
This update includes updates to patterns to correct color issues and some code quality fixes.

Follow-up to [56951], [56813], [56764], [56716].

Props luminuu, richtabor, onemaggie, kafleg, swissspidy, huzaifaalmesbah, neilorangepeel, shailu25, lada7042, mukesh27, nilovelez, jorbin.
Fixes #59711.
Built from https://develop.svn.wordpress.org/trunk@56999


git-svn-id: http://core.svn.wordpress.org/trunk@56510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-24 14:06:25 +00:00
Sergey Biryukov
e6a1e0059e Tests: Correct the WP_Test_Stream::mkdir() method.
The method attempted to check if there is already a file with the same name, however the conditional used an undefined variable.

This commit prevents directory creation if a file or directory with the same name already exists, bringing consistency with the PHP `mkdir()` implementation.

Includes adding missing documentation for the method.

Reference: [https://www.php.net/manual/en/streamwrapper.mkdir.php PHP Manual: streamWrapper::mkdir()].

Follow-up to [49230].

Props david.binda, sadizaman, rajinsharwar, SergeyBiryukov.
Fixes #59406.
Built from https://develop.svn.wordpress.org/trunk@56998


git-svn-id: http://core.svn.wordpress.org/trunk@56509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-24 11:34:40 +00:00
hellofromTonya
8a2a1f4b41 Tests: Fix static property handling in r56991.
Fixes static property handling for `WP_Duotone::$block_css_declarations` in the `Tests_Block_Supports_Duotone::test_css_declarations_are_generated_even_with_empty_block_content()`:

* Fixes `ReflectionProperty::setValue()` to use an instance of `WP_Duotone`.
* Adds an inline comment to explain why a static class (i.e. a class that is not intended to be an object by design as it only contains static properties and methods) needs an instance, i.e. needed for PHP 8.3 and higher.
* Resets the static property's value to its original value, i.e. before the test started.

Follow-up to [56991].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56507 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-24 10:59:27 +00:00
Bernhard Reiter
2e0baf4f79 Blocks: Fix layout support to be compatible with enhanced pagination.
Make layout support compatible with enhanced pagination by ensuring that generated class names are stable across pagination, even when the number of rendered posts is different.

With the previous implementation of enhanced pagination, the CSS corresponding to each block was not detected. Therefore, for enhanced pagination to work correctly, the CSS of the blocks present in the Post Template must be stable on all pages.

The number of posts rendered by the Query block is always the same, except in the last page, where it can be only a fraction. If any of the blocks rendered by the Post Template used the `wp_unique_id` function, the ID (which is incremental) would have been different than in the previous pages and the class names would have varied.

This is remediated by this changeset by replacing the usage of `wp_unique_id` in the layout support (which is used by the Query block) with an implementation that uses IDs that are incremental only for that block. That way, the generated class names are never affected by the number of times `wp_unique_id` runs.

Props luisherranz, andrewserong, isabel_brison, costdev, mukesh27, cbravobernal, hellofromTonya, jorbin.
Fixes #59681.
Built from https://develop.svn.wordpress.org/trunk@56994


git-svn-id: http://core.svn.wordpress.org/trunk@56505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-24 08:51:24 +00:00
Peter Wilson
24b0b5bf5f Build/Test tools: Introduce partial unit tests for WP_Upgrader.
Props jipmoors, karlijnbk, chaion07, cu121, martin.krcho, costdev, mukesh27, hellofromTonya, SergeyBiryukov, audrasjb, jrf.
Fixes #54245.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-24 01:40:21 +00:00
hellofromTonya
ab9c4659ae Editor: Fix render_duotone_support() to be compatible with enhanced pagination.
Some blocks do not have content. For duotone support, blocks without content still need to run through the `render_duotone_support()` to render their duotone CSS.

This fix makes the duotone compatible with the enhanced pagination (introduced in 6.4.0) by making sure that the CSS is always on the page, even when the posts have no featured image. It also prevents the duotone from interfering with other blocks using `wp_unique_id()`.


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

Follow-up to [56226].

Props cbravobernal, luisherranz, hellofromTonya, isabel_brison, jorbin.
Fixes #59694.
Built from https://develop.svn.wordpress.org/trunk@56991


git-svn-id: http://core.svn.wordpress.org/trunk@56502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-23 23:39:20 +00:00
Felix Arntz
cd27e64cef Options, Meta APIs: Rename prime_options() to wp_load_options().
This clearly separates these functions which are intended to be used by external developers from the existing `_prime_*_caches()` functions which are primarily intended for internal usage. The term "load" is additionally more accessible than "prime".

This changeset renames the above function, as well as the wrapper function `prime_options_by_group()` to `wp_load_options_by_group()`.

Props peterwilsoncc, joemcgill, hellofromTonya, poran766, flixos90.
Fixes #58962.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-23 21:29:27 +00:00
Tammie Lister
4312036aca Update editor related npm packages for 6.4 RC2.
The npm packages needed update for 6.4 RC2.

Props siobhyb, cbravobernal, DAreRodz, luisherranz, artemiosans, afercia, jameskoster, czapla, alexstine, SantosGuillamot, ramonopoly, isabel_brison, andrewserong, jeryj, joedolson

See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-23 17:08:31 +00:00
Pascal Birchler
1555e715f6 Sitemaps: add lastmod for individual posts and the homepage.
When the XML sitemaps feature was originally introduced, the `lastmod` field was omitted because guidance at the time indicated it was less important for search engines, plus for some entities it was computationally expensive to add. Now that the guidance has slightly changed, we are revisiting this and adding `lastmod` where easily possible.

- Adds `lastmod` to all individual post objects (of any post type) in the sitemap
- Adds `lastmod` to the homepage sitemap entry if the homepage is set to display the latest posts.

No `lastmod` is added for the individual sitemap pages in the sitemap index, nor for term archives or user archives. Those enhancements require additional changes, such as storing the modified date for a taxonomy term when something is added to that term. They can be revisited in separate follow-up tickets.

Props swissspidy, joemcgill.
Fixes #52099
Built from https://develop.svn.wordpress.org/trunk@56985


git-svn-id: http://core.svn.wordpress.org/trunk@56496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-23 15:42:22 +00:00
Sergey Biryukov
a2b495afa9 Docs: Improve documentation for meta revision functions.
Includes:

* Correcting the position of `@since 6.4.0` in a few places.
* Adding missing `@return` documentation.
* Adjusting parameter spacing.

Follow-up to [56714].

Props jeremyfelt, mukesh27.
Fixes #59666.
Built from https://develop.svn.wordpress.org/trunk@56984


git-svn-id: http://core.svn.wordpress.org/trunk@56495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-23 13:17:22 +00:00
gziolo
c7919d32db Tests: Improve code coverage for _build_block_template_result_from_file
Props costdev, bernhard-reiter.
See #54335, #59325.
Follow-up for [56562].


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


git-svn-id: http://core.svn.wordpress.org/trunk@56494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-23 05:38:35 +00:00
Sergey Biryukov
ad9048c923 General: Bump the recommended MySQL version in readme.html.
MySQL 5.7 reaches EOL (“End of Life”) in October 2023. The recommended minimum is bumped to 8.0 for now.

References:
* [https://www.mysql.com/support/ MySQL Support Policies]
* [https://make.wordpress.org/hosting/handbook/server-environment/#database Hosting team handbook: Server Environment: Database]

Follow-up to [31291], [33946], [35759], [52420], [52421], [54069].

Props swissspidy, SergeyBiryukov.
See #59701.
Built from https://develop.svn.wordpress.org/trunk@56982


git-svn-id: http://core.svn.wordpress.org/trunk@56493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-22 09:05:25 +00:00
Sergey Biryukov
8088dc8cec Tests: Correct test class name for WP_Duotone unit tests.
Follow-up to [56101].

Props cbravobernal.
Fixes #59696.
Built from https://develop.svn.wordpress.org/trunk@56981


git-svn-id: http://core.svn.wordpress.org/trunk@56492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-21 10:21:27 +00:00
Pascal Birchler
62d53d3ff9 Build/Test Tools: Remove now obsolete jest-image-snapshot dependency.
With the migration of visual regression tests to Playwright in [56926], this package is no longer needed and can be safely removed.

See #59517.
Built from https://develop.svn.wordpress.org/trunk@56980


git-svn-id: http://core.svn.wordpress.org/trunk@56491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-21 08:38:29 +00:00
Joe McGill
8d7ccf869d Themes: Make caches for block patterns clearable.
In [56765], theme block pattern files were cached to a transient as a performance enhancement. However, transients are not easily clearable when caches are flushed on environments not using a persistent cache, which can lead to errors if the theme files are renamed, edited, or moved.

This changes the caching mechanism to use `wp_cache_set()` instead, and caches these values to the global group so they are still persistent on environments using an object cache, and will be cleared by a cache flush.

In addition, the helper `_wp_get_block_patterns` has been moved `WP_Theme::get_block_patterns` for consistency with other block related theme methods and cache helpers for these values, `WP_Theme::get_pattern_cache` and `WP_Theme::set_pattern_cache`, have been made private.

Relevant unit tests updated.

Props: afercia, flixos90, mukesh27, joemcgill.
Fixes #59633. See #59591, #59490.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-20 19:08:21 +00:00
desrosj
915f28e18e Build/Test Tools: Use the correct path to build process test workflows.
Follow up to [56976].

See #59632.
Built from https://develop.svn.wordpress.org/trunk@56977


git-svn-id: http://core.svn.wordpress.org/trunk@56488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-20 17:13:23 +00:00
desrosj
deb2462101 Build/Test Tools: Test the Gutenberg plugin build process.
A very common contributor setup is having a copy of the `gutenberg` development repository within a checkout of the `wordpress-develop` repository. On occasion, there are some strange incompatibilities that come up when using this setup. A few examples can be seen in #58671 and #59634.

This changeset helps ensure that these edge cases are not introduced by testing the Gutenberg plugin’s build process within WordPress configured to run from both the `src` and `build` directories.

This also renames the “Test npm” workflow to a more general “Test Build Processes”, which more accurately describes what is actually being tested within it and allows these new test jobs to be grouped in.

And finally, the logic within the workflow has been split out into two callable workflows. This helps avoid code duplication within the workflow, and allows for better grouping on the workflow run screen.

Props swissspidy, aferica, SergeyBiryukov, antonvlasenko, desrosj.
Fixes #59632. See #58671, #59634.
Built from https://develop.svn.wordpress.org/trunk@56976


git-svn-id: http://core.svn.wordpress.org/trunk@56487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-20 14:56:21 +00:00
Sergey Biryukov
6fae0d706a External Libraries: Update getID3 to version 1.9.23.
The latest version includes numerous bug fixes, a few new features, as well as various improvements for PHP 8.1 and PHP 8.2 support.

This commit also includes PHPCS adjustments previously made for a passing PHP Compatibility scan.

References:
* [https://github.com/JamesHeinrich/getID3/releases/tag/v1.9.23 getID3 1.9.23 release notes]
* [https://github.com/JamesHeinrich/getID3/compare/v1.9.22...v1.9.23 Full list of changes in getID3 1.9.23]

Follow-up to [47601], [48278], [52254], [54376].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-20 13:29:27 +00:00
Felix Arntz
bbe67a0147 Multisite: Ensure that switching sites resets the current theme directory globals.
The globals introduced in [56635] to cache the current theme directories in memory were not considering switching sites in a multisite network. This changeset addresses the bug including test coverage.

Props codex-m, jeremyfelt.
Fixes #59677.
See #18298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-19 19:09:21 +00:00
desrosj
9b66ebdf48 Build/Test Tools: Skip Puppeteer download in build workflow.
This adds the `PUPPETEER_SKIP_DOWNLOAD` environment variable to the Build WordPress workflow to skip downloading Puppeteer browser binaries unnecessarily.

Follow up to [56958].

See #59416, #59517, #58863.
Built from https://develop.svn.wordpress.org/trunk@56973


git-svn-id: http://core.svn.wordpress.org/trunk@56484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-19 15:05:24 +00:00
desrosj
207fe0533e Build/Test Tools: Don’t run the performance workflow when branching.
When a branch is created, there is no previous commit to reference in the `github.event.before` context, which causes the performance workflow to fail because there is no previous commit to perform a comparison with.

This adds a condition to check that `github.event.before` is not set to `0000000000000000000000000000000000000000`, which is the default value when there are no previous commits.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-19 14:00:22 +00:00
Sergey Biryukov
73a3875f2b Tests: Improve the @group annotation accuracy and consistency.
Includes removing `.php` from some older group names, because most of the groups are no longer named based on the file containing the function, and sometimes functions move around, making the file-based group name inaccurate.

Props afercia, aristath, poena, SergeyBiryukov.
See #59647.
Built from https://develop.svn.wordpress.org/trunk@56971


git-svn-id: http://core.svn.wordpress.org/trunk@56482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-19 13:53:24 +00:00
Bernhard Reiter
b0da2934b9 Blocks: During traversal, allow post callback to modify block.
Both the `$pre_callback` and `$post_callback` functions that are given as arguments to `traverse_and_serialize_block(s)` receive a reference to the current block as their first argument. However, while any changes that the "pre" callback makes to the block are reflected by the serialized markup, the same wasn't true for the "post" callback: Any changes that it made were only applied ''after'' the block had already been serialized.

This commit changes the behavior such that `$post_callback`'s changes to the current block are also reflected in the serialized markup.

See #59646.
Props gziolo.
Fixes #59669.
Built from https://develop.svn.wordpress.org/trunk@56970


git-svn-id: http://core.svn.wordpress.org/trunk@56481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-18 19:32:23 +00:00
Sergey Biryukov
1470782029 Tests: Remove some unnecessary function_exists() checks for compat functions.
Each of these functions already has a separate test for availability.

If any of them are unavailable, then the test should fail rather than be skipped.

Follow-up to [52038], [52039], [52040].

Props johnbillion.
See #59647.
Built from https://develop.svn.wordpress.org/trunk@56969


git-svn-id: http://core.svn.wordpress.org/trunk@56480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-18 10:41:29 +00:00
hellofromTonya
afa66e5fa0 Build/Test Tools: Fix WP version in package-lock.json.
After [56966], CI jobs that check the `package-lock.json` failed on the "Ensure version-controlled files are not modified or deleted" task.

There are 2 version fields that need to be updated for the new WP version. This changeset updates the "packages" > "version" for 6.5.0.

Follow-up to [56966].

Props swissspidy, benharri.
Unprops hellofromTonya.
Fixes #59665.
Built from https://develop.svn.wordpress.org/trunk@56968


git-svn-id: http://core.svn.wordpress.org/trunk@56479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 20:36:26 +00:00
hellofromTonya
da2e6dc4e3 Fix version number for 6.5-alpha.
Fixes the version number from [56966] to include its number in the version, as it is the commit that opened trunk for 6.5-alpha.

Follow-up to [56966].
Built from https://develop.svn.wordpress.org/trunk@56967


git-svn-id: http://core.svn.wordpress.org/trunk@56478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 18:50:19 +00:00
hellofromTonya
891a9ecdaf Trunk is now 6.5 alpha.
Built from https://develop.svn.wordpress.org/trunk@56966


git-svn-id: http://core.svn.wordpress.org/trunk@56477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 18:41:24 +00:00
hellofromTonya
bfe933241e Post WordPress 6.4 RC1 version bump.
Built from https://develop.svn.wordpress.org/trunk@56964


git-svn-id: http://core.svn.wordpress.org/trunk@56475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 17:46:44 +00:00
hellofromTonya
77df68f144 WordPress 6.4 RC1 - capitalize RC in version.
Capitalize RC in the version, i.e. just in case the build requires it.

Unprops hellofromTonya.
Built from https://develop.svn.wordpress.org/trunk@56963


git-svn-id: http://core.svn.wordpress.org/trunk@56474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 17:27:20 +00:00
hellofromTonya
fc3d3cf491 WordPress 6.4 RC1.
Built from https://develop.svn.wordpress.org/trunk@56962


git-svn-id: http://core.svn.wordpress.org/trunk@56473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 17:19:23 +00:00
hellofromTonya
e395ce0cf6 Editor: Bugfixes npm packages updates for 6.4 RC1.
Updates for needed bugfixes in RC1:

* [https://github.com/WordPress/gutenberg/pull/55212 Image: Reimplement lightbox trigger as a minimal button in corner of image]

* [https://github.com/WordPress/gutenberg/pull/55403 [Edit Widgets] Only suppress admin notices when JS enabled.]

Follow-up to [56849], [56818], [56816].

Props artemiosans, jameskoster, SantosGuillamot, aristath, czapla, joen, afercia, richtabor, peterwilsoncc, andraganescu, hellofromTonya, siobhyb.
See #59411.
Built from https://develop.svn.wordpress.org/trunk@56961


git-svn-id: http://core.svn.wordpress.org/trunk@56472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 16:08:23 +00:00
Bernhard Reiter
c054eef096 Patterns, Templates: Inject theme attr into Template Part blocks.
It was found that Template Part blocks were broken in the Site Editor, showing the `Template part has been deleted or is unavailable` message, due to a missing `theme` attribute.

This bug seems to have been introduced by [56896], whose goal was to only inject that attribute into the markup returned by the templates and patterns REST API endpoints but not on the frontend, in order to improve performance. It has been demonstrated locally that reverting that changeset fixes the bug.

Reverts [56896].
Props mmcalister, swisspidy, thelovelist, hellofromTonya, pbiron, Pauthake015, richtabor, nicolefurlan, huzaifaalmesbah, annezazu, kafleg, aegkr, sunitarai, shresthaaman, andraganescu, onemaggie, gziolo.
Fixes #59629.
Built from https://develop.svn.wordpress.org/trunk@56960


git-svn-id: http://core.svn.wordpress.org/trunk@56471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 15:48:23 +00:00