6075 Commits

Author SHA1 Message Date
Sergey Biryukov
e3e7fdbf7c Code Modernization: Replace substr( PHP_OS, 0, 3 ) calls with PHP_OS_FAMILY.
The `PHP_OS_FAMILY` constant indicates the operating system family PHP was built for, and is available as of PHP 7.2.0.

Reference: [https://www.php.net/manual/en/reserved.constants.php#constant.php-os-family PHP Manual: Predefined Constants: PHP_OS_FAMILY].

Follow-up to [23255], [57753], [57985], [58678].

Props ayeshrajans, jrf.
See #61574.

git-svn-id: https://develop.svn.wordpress.org/trunk@58684 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-07 12:42:44 +00:00
Sergey Biryukov
55e0fafbbf Code Modernization: Simplify a conditional in wp_is_ini_value_changeable().
This commit reverts the code to the code from before the bug fix related to PHP 5.2.6–5.2.17.

As support for PHP 5.2 has been dropped, the workaround for the PHP 5.2 bug is no longer needed.

Follow-up to [38015], [38017], [44950], [45058], [57985], [58678], [58682].

Props jrf, ayeshrajans.
See #61574.

git-svn-id: https://develop.svn.wordpress.org/trunk@58683 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-06 15:05:37 +00:00
Sergey Biryukov
9de2177c4c Code Modernization: Remove obsolete comments about older PHP versions.
This commit:
* Removes various comments referencing PHP versions which are no longer supported.
* Removes various comments containing “hints” of things to do after a particular PHP version drop. These hints are incorrect/not actionable for various reasons, so have no value:
 * Even though a function could be turned into a closure, removing the function would be a backward compatibility break which is not acceptable, so this suggestion is not actionable.
 * Short ternaries are forbidden by the coding standard exactly to prevent the faulty code suggested in the comment from getting into the codebase.

Follow-up to [1243/tests], [6543], [11816], [29861], [29864], [34928], [35369], [36698], [38694], [50786], [58678].

Props jrf, ayeshrajans.
See #61574.

git-svn-id: https://develop.svn.wordpress.org/trunk@58682 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-06 14:52:05 +00:00
Dennis Snell
c1154f9d06 HTML API: Support SELECT insertion mode.
As part of work to add more spec support to the HTML API, this patch adds
support for the SELECT, OPTION, and OPTGROUP elements, including the
requisite support for the IN SELECT insertion mode.

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

Props dmsnell, jonsurrell.
See #61576.


git-svn-id: https://develop.svn.wordpress.org/trunk@58677 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-05 00:50:19 +00:00
Sergey Biryukov
70bad67ef1 Tests: Use assertSame() in WP_REST_Global_Styles_Revisions_Controller 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 [56082].

See #61573.

git-svn-id: https://develop.svn.wordpress.org/trunk@58673 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-04 15:09:15 +00:00
Sergey Biryukov
5466b9c826 Users: Pass the previous state of the user as context to the wp_set_password hook.
Follow-up to [55056], [55250].

Props dd32.
Fixes #61541.

git-svn-id: https://develop.svn.wordpress.org/trunk@58653 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-03 16:08:55 +00:00
bernhard-reiter
a2bb45dfad Block Hooks: Fix a number of multi-line comment openers.
Add the missing second asterisk to a number of multi-line comment openers, and remove a superfluous second asterisk from two others.

Follow-up to [58614].
Props mukesh27.
See #60854.

git-svn-id: https://develop.svn.wordpress.org/trunk@58615 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-02 10:41:33 +00:00
bernhard-reiter
fdebb53bfe Block Hooks: Allow child insertion into Template Part block.
The Block Hooks mechanism was previously extended to allow insertion of a block as a Navigation block's first or last child. This was implemented by storing the `ignoredHookedBlocks` array in the corresponding `wp_navigation` post's post meta (instead of a metadata attribute on the anchor block).

This changeset extends that mechanism to Template Part blocks, by storing said metadata in the corresponding `wp_template_part` post's post meta, thus allowing extenders to use Block Hooks to insert a block as a Template Part block's first or last child, respectively.

Props tomjcafferkey, bernhard-reiter.
Fixes #60854.

git-svn-id: https://develop.svn.wordpress.org/trunk@58614 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-02 10:01:17 +00:00
Sergey Biryukov
80409a2420 REST API: Correct image cropping tools in the block editor.
As of [58457], the width and height cropping values are cast to an integer before the comparison to see if the target width and height differ from the original width and height.

Since they are now integers, it exposes a bug where the `&&` of the `if` conditional meant that if you were only cropping in one dimension, the check wouldn't pass, and cropping would not occur.

In the block editor, the cropping tools are aspect ratio based, so one of the dimensions will always match that of the source image. Therefore, now that the values are cast as integers, the condition that allows a cropping to occur needs to be updated. If either width or height is different from the source image, then a crop should be allowed.

Follow-up to [50124], [58457].

Props andrewserong, jrf, kevin940726.
Fixes #61514. See #59782.

git-svn-id: https://develop.svn.wordpress.org/trunk@58612 602fd350-edb4-49c9-b593-d223f7449a82
2024-07-01 20:43:55 +00:00
Sergey Biryukov
57910f67dd Date/Time: Replace abbreviations for minutes in human_time_diff().
This ensures that relative times are formatted the same way in both JS and PHP.

Follow-up to [1976], [2124], [4658], [41018], [56496].

Props wildworks.
Fixes #61535.

git-svn-id: https://develop.svn.wordpress.org/trunk@58600 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-29 09:29:08 +00:00
Sergey Biryukov
80bd30e4c1 Tests: Use assertSame() in WP_Interactivity_API 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 [57563], [57649], [57822], [57826], [57835], [58159], [58327].

See #61530.

git-svn-id: https://develop.svn.wordpress.org/trunk@58594 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-28 15:45:08 +00:00
Greg Ziółkowski
5effffccd0 HTML API: Add tests for virtual node breadcrumbs and depth
Follow-up [58590].
See #61348.
Props jonsurrell, gziolo.



git-svn-id: https://develop.svn.wordpress.org/trunk@58592 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-28 09:20:10 +00:00
bernhard-reiter
2516e98974 Script Modules: Add new API to embed server data in HTML.
Add a new filter `script_module_data_{$module_id}` to associate data
with a Script Module. For example:

{{{#!php
add_filter(
	'script_module_data_MyScriptModuleID',
	function ( array $data ): array {
		$data['script-needs-this-data'] = 'ok';
		return $data;
	}
);
}}}

If the Script Module is included in the page, enqueued or as a
dependency, the associated data will be JSON-encoded and embedded in the
HTML in a `<script type="application/json">` tag with an ID of the form
`wp-script-module-data-{$module_id}` allowing the Script Module to
access the data on the client.

See the original proposal: https://make.wordpress.org/core/2024/05/06/proposal-server-to-client-data-sharing-for-script-modules/

Developed in https://github.com/WordPress/wordpress-develop/pull/6682.

Props jonsurrell, cbravobernal, westonruter, gziolo, bernhard-reiter, youknowriad, sergiomdgomes, czapla.
Fixes #61510. See #60647.

git-svn-id: https://develop.svn.wordpress.org/trunk@58579 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-26 13:19:47 +00:00
bernhard-reiter
df256e414c Block Hooks: Refactor controller filter to use meta_input.
Prior to this changeset, the function `update_ignored_hooked_blocks_postmeta()` used the core function `update_post_meta()` to write `_wp_ignored_hooked_blocks` data to the database during an operation that is preparing a post to be inserted.

Since we have access to the incoming changes that are being prepared we can remove this database operation in favour of writing the data to the post object provided under `meta_input`.

Doing this means two things:

1. It allows us to store postmeta for new posts that are about to be created since they don't have an `ID` yet (which is information `update_post_meta()` needs).
2. The core controller will take care of updating postmeta in a more predictable pattern.

Props tomjcafferkey, bernhard-reiter.
Fixes #61495.

git-svn-id: https://develop.svn.wordpress.org/trunk@58578 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-26 08:52:12 +00:00
Aaron Jorbin
3536182095 Filesystem: Normalize allowed_files so comparison is apples to apples.
In [58470] a change was made to normalize the filename in validate_file, however this leads to instances where the list of files that are allowed aren't normalized such as in the theme editor. By normalizing the array, the comparison is apples to apples.

Fixes #61488.
Props jorbin, hellofromtonya, swissspidy, misulicus, script2see, Presskopp, audrasjb, peterwilsoncc, siliconforks, littler.chicken, paulkevan,


git-svn-id: https://develop.svn.wordpress.org/trunk@58570 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-25 14:17:48 +00:00
Sergey Biryukov
8afc34a066 Tests: Use assertSame() in WP_Theme_JSON 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 [55959], [55986], [57547], [57716], [58244], [58422].

See #60706.

git-svn-id: https://develop.svn.wordpress.org/trunk@58478 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-24 15:12:53 +00:00
André
2b1057cae0 Section styles: improve performance and conceptual consistency.
These changes involve:

- Move shared variation definitions from styles.blocks.variations to styles.variations
- Remove blockTypes from styles.variations.
- Do not register shared variations from theme style variation or primary theme.json files.
- Move the merging of theme.json data into the WP_Theme_JSON_Resolver and WP_Theme_JSON classes.

These changes improve performance and are more future-proof API wise.
See conversation at https://github.com/WordPress/gutenberg/issues/62686

Props aaronrobertshaw, oandregal, andrewserong, joemcgill, talldanwp, andrewserong, ramonopoly, richtabor, youknowriad.

See #61312, #61451.


git-svn-id: https://develop.svn.wordpress.org/trunk@58466 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-24 08:49:52 +00:00
Sergey Biryukov
d7f98c7cdc Tests: Use assertSame() in wp_get_block_css_selector() 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 [56058].

See #60705.

git-svn-id: https://develop.svn.wordpress.org/trunk@58462 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-23 11:38:49 +00:00
Sergey Biryukov
9f7fcf1263 Tests: Use named data provider in iso8601_to_datetime() tests.
Follow-up to [54230], [58164].

See #60705.

git-svn-id: https://develop.svn.wordpress.org/trunk@58458 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-21 21:34:46 +00:00
Joe Dolson
4f175e167e Media: Fix implicit conversion from float to int in image cropping.
Cast crop values to integers to prevent PHP error caused by implicit conversion from `float` to `int` values when cropping images using ImageMagick.

Props skithund, mai21, nicomollet, amanias1977, joedolson.
Fixes #59782.

git-svn-id: https://develop.svn.wordpress.org/trunk@58457 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-21 20:35:25 +00:00
Jorge Costa
5d41bdae52 REST API: Add template and template_lock to post types endpoint.
Adds template and template_lock property of the post type to post types REST API endpoint.
This change allows us to fix a bug where the template of a page is not respected when creating a new page on the site editor.

Props jorgefilipecosta, oandregal, timothyblynjacobs, mukesh27.
Fixes #61477.

git-svn-id: https://develop.svn.wordpress.org/trunk@58452 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-21 13:04:47 +00:00
Adam Silverstein
2358de1767 Media: improve titles when inserting via REST API.
Match the naming behavior for uploaded media in the REST API to the way media is named when uploading in the media library. Fix an issue where dashes were replacing spaces unnecessarily. 

Props abitofmind, kadamwhite, spacedmonkey, adamsilverstein, audrasjb, hellofromTonya.
Fixes #57957.



git-svn-id: https://develop.svn.wordpress.org/trunk@58447 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-20 16:02:10 +00:00
Isabel Brison
c1c8d30398 Editor: fix root padding for children of alignfull flow layouts.
Updates the root padding CSS selectors so direct children of full width container blocks with flow layout receive padding.

Props isabel_brison, aaronrobertshaw.
Fixes #61464.


git-svn-id: https://develop.svn.wordpress.org/trunk@58444 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-20 08:01:10 +00:00
Tonya Mork
338f47b3c5 Code Modernization: Fix non-nullable deprecation in get_available_post_mime_types().
Fixes a PHP 8.1 and above "null to non-nullable" deprecation notice in `get_available_post_mime_types()`:

{{{
Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in ./wp-includes/post.php on line 3395
}}}

[https://developer.wordpress.org/reference/functions/get_available_post_mime_types/#return This function is documented] to:
* Return `An array of MIME types.`
* as an array of `string`s, i.e. `string[]`.

A `null` or empty element within the returned array is not a valid MIME type. If a `null` exists in the returned array, it is the root cause of PHP throwing the deprecation notice.

This commit removes the `null` and empty elements from the returned array of MIME types. It also adds a unit test.

Follow-up to [56623], [56452].

Props nosilver4u, jrf, ironprogrammer, antpb, antonvlasenko, rajinsharwar, hellofromTonya. 
Fixes #59195.

git-svn-id: https://develop.svn.wordpress.org/trunk@58437 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-18 14:44:23 +00:00
Tonya Mork
b15bb674b8 Site Health: Bump the recommended MariaDB version.
MariaDB 10.4 reaches EOL (“End of Life”) on 18 June 2024. The recommended minimum is bumped to 10.5 for now, whose EOL is 24 June 2025.

Also removes the skip in tests to allow the tests to run on all branches with this change.

References:
* [https://mariadb.org/about/#maintenance-policy MySQL Support Policies]
* [https://make.wordpress.org/hosting/handbook/server-environment/#database Hosting team handbook: Server Environment: Database]

Follow-up to [55665], [52420], [53435], [54069], [54076].

Props peterwilsoncc, dd32, costdev, mukesh27, hellofromTonya.
Fixes #61458.
See #meta7679.

git-svn-id: https://develop.svn.wordpress.org/trunk@58432 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-18 11:57:41 +00:00
Pascal Birchler
b0030c47e1 Build/Test Tools: add new end-to-end tests for edge cases such as maintenance mode.
Sometimes errors only occur in unusual code paths such as the maintenance mode or installation screens. Due to lack of tests for these scenarios in core, such errors are usually only noticed very late. This change adds new end-to-end (e2e) tests to prevent regressions in the following areas:

- Maintenance mode (presence of a `.maintenance` file)
- Fatal error handler (simulated with an mu-plugin that causes an error)
- Installation screen (verifying full installation flow & that there are no database errors)

Thanks to these tests, an issue was already found and addressed in the default `wp_die` handler, as `wp_robots_noindex_embeds` and `wp_robots_noindex_search` used to cause PHP warnings due to `$wp_query` not existing.

In the future, these tests can be extended to also test scenarios like localized error pages via `wp_load_translations_early()`.

Fixes #61240.

git-svn-id: https://develop.svn.wordpress.org/trunk@58430 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-18 08:18:51 +00:00
André
a3d82e0e6d Do not use init to register block style variations defined via theme.json.
Props oandregal, aaronrobertshaw, joemcgill, ramonopoly, andrewserong, swissspidy.
See #61451.
Fixes #61312.


git-svn-id: https://develop.svn.wordpress.org/trunk@58429 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-18 07:07:52 +00:00
Dennis Snell
b36ff6064a KSES: Fix tests and detection of HTML Bogus Comment spans.
In [58418] a test was added without the `test_` prefix in its function
name, and because of that, it wasn't run in the test suite.
The prefix has been added to ensure that it runs.

In the original patch, due to a logical bug, a recursive loop to
transform the inside contents of the bogus comments was never run
more than once. This has been fixed.

This patch also includes one more case where `kses` wasn't
properly detecting the bogus comment state, and adds a test case
to cover this. It limits itself to some but not all constructions
of invalid markup declaration so that it doesn't conflict with
existing behaviors around those and other kinds of invalid comments.

Props ellatrix, dmsnell.
See #61009.
Follow-up to [58418].


git-svn-id: https://develop.svn.wordpress.org/trunk@58424 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-17 12:02:50 +00:00
André
fb20072d95 Global styles: prevent duplicate CSS for block style variations.
Props aaronrobertshaw, mukesh27, ramonopoly, isabel_brison, oandregal.
Fixes #61443.


git-svn-id: https://develop.svn.wordpress.org/trunk@58422 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-17 09:42:57 +00:00
Sergey Biryukov
fa7902c8c8 Tests: Use more specific assertions in WP_Script_Modules tests.
Follow-up to [57269], [57327], [57593].

See #60705.

git-svn-id: https://develop.svn.wordpress.org/trunk@58420 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-16 10:15:33 +00:00
Dennis Snell
c756dfe8ca KSES: Preserve some additional invalid HTML comment syntaxes.
When `wp_kses_split` processes a document it attempts to leave HTML comments
alone. It makes minor adjustments, but leaves the comments in the document in
its output. Unfortunately it only recognizes one kind of HTML comment and
rejects many others.

This patch makes a minor adjustment to the algorithm in `wp_kses_split` to
recognize and preserve an additional kind of HTML comment: closing tags with
an invalid tag name, e.g. `</%dolly>`.

These invalid closing tags must be interpreted as comments by a browser.
This bug fix aligns the implementation of `wp_kses_split()` more closely
with its stated goal of leaving HTML comments as comments.

It doesn't attempt to fully fix the mis-parsed comments, but it does propose a
minor fix that hopefully won't break any existing code or projects.

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

Props ellatrix, dmsnell, joemcgill, jorbin, westonruter, zieladam.
See #61009.


git-svn-id: https://develop.svn.wordpress.org/trunk@58418 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-15 06:31:24 +00:00
André
5983b3c04b Section styles: add slug to override non-kebab-cased variations.
Props aaronrobertshaw, oandregal.
Fixes #61440.


git-svn-id: https://develop.svn.wordpress.org/trunk@58413 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-14 09:03:40 +00:00
Tonya Mork
4575c26a2c Code Modernization: Use wp_trigger_error() instead of trigger_error().
Replaces `trigger_error()` with `wp_trigger_error()`.

The usage of `wp_trigger_error()` avoids generating `E_USER` family errors unless `WP_DEBUG` is on. In doing so, users should not see these messages in normal production.

Notes:
* Removes `E_USER_NOTICE` when passed as an argumnent, as it's the default error level.
* An empty string is passed for the function name when its name is already in the error message or does not add value to the error message.
* Externally maintained libraries are not included.

Follow-up to [55204], [25956], [29630], [38883], [52062], [52049], [54272], [38883], [55245], [51599], [14452], [38883], [24976].

Props prasadkarmalkar, rajinsharwar, thelovekesh, hellofromTonya, swissspidy. 
Fixes #59652.

git-svn-id: https://develop.svn.wordpress.org/trunk@58409 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-13 20:48:33 +00:00
Adam Silverstein
7f70d68353 Networks and sites: use get_allowed_mime_types to populate multisite’s upload_filetypes.
Ensure new multisite installs are up to date with the current mime types supported in core.

Note that this will only affect newly created networks, since this is only used to populate the schema for new networks, not change the allowed mime types for existing networks

Props spacedmonkey, costdev, pavanpatil1, joemcgill, rajinsharwar, tb1909.
Fixes #53167.




git-svn-id: https://develop.svn.wordpress.org/trunk@58400 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-13 09:58:11 +00:00
Jb Audras
3806b25058 HTML API: Revert using regex in block bindings HTML replacement logic.
This changeset reverts part of the changes made in [58298] to avoid using regex that can cause potential bugs. It is indeed safer to revert these changes for now and do the refactoring once the HTML API supports CSS selectors and provides a way to set inner content.

It also adds a unit test to cover the regression experienced in https://github.com/WordPress/gutenberg/issues/62347.

Follow-up to [58298].

Props santosguillamot, gziolo.
Fixes #61385.
See #61351.




git-svn-id: https://develop.svn.wordpress.org/trunk@58398 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-13 08:55:47 +00:00
Tonya Mork
cf2b0eece5 Plugins: Ensure wp_get_plugin_action_button() returns a string.
[57545] introduced `wp_get_plugin_action_button()`. This function is documented to return a `string`. However, if the user does not have the appropriate capabilities, it returned `void`, which is unexpected.

Resolves the issue by moving the `return $button` to the bottom of the function to ensure it always returns a `string` type. On success, the button's HTML string is returned; else, an empty string is returned.

Unit tests are included.

Follow-up to [57545].

Props costdev, rajinsharwar, hellofromTonya.
Fixes #61400.

git-svn-id: https://develop.svn.wordpress.org/trunk@58396 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-12 18:15:33 +00:00
André
c2bf2eb24f Editor: register block style variations defined by the theme using the init action.
Props oandregal, aaronrobertshaw, annezazu.

Follow-up to [58264].
See #61312.



git-svn-id: https://develop.svn.wordpress.org/trunk@58394 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-12 07:15:06 +00:00
Sergey Biryukov
adeb3eca8e Administration: Remove redundant type casting in WP_List_Table::search_box().
Scalar values passed to `esc_attr()` are already converted internally to a string via both `wp_check_invalid_utf8()` and `_wp_specialchars()`.

Includes adding `@covers` tags for unit tests.

Follow-up to [58379].

See #58379.

git-svn-id: https://develop.svn.wordpress.org/trunk@58389 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-11 12:36:13 +00:00
Ella
7cf81d37b0 Editor: Update npm packages for WP 6.6 Beta 2.
See https://github.com/WordPress/wordpress-develop/pull/6773.

Fixes #61410.

Props vcanales.



git-svn-id: https://develop.svn.wordpress.org/trunk@58387 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-11 10:05:48 +00:00
Peter Wilson
8cd24bc12c Administration: Prevent an orderby array throwing a notice.
Prevent `WP_List_Table::search_box()` from throwing an array to string conversion notice when post list tables are loaded with an array of orderby parameters in the URL, eg: `/wp-admin/edit.php?post_type=page&orderby[menu_order]=ASC&orderby[title]=ASC`.

Follow up to [29027].

Props leonidasmilossis, rajinsharwar, swissspidy, NomNom99, pls78, SergeyBiryukov.
Fixes #59494.
See #17065.


git-svn-id: https://develop.svn.wordpress.org/trunk@58379 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-11 02:12:52 +00:00
Isabel Brison
90225fb7e6 Editor: Improve maintainability of class WP_Theme_JSON tests.
Updates tests calling `get_stylesheet` to not output layout styles if they’re not relevant to the test or to call `get_styles_for_block` instead where more appropriate.

Props isabel_brison, andrewserong, ramonopoly.
Fixes #61371.


git-svn-id: https://develop.svn.wordpress.org/trunk@58378 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-11 00:29:21 +00:00
Dennis Snell
0cad031a5a HTML API: Return subclass from ::create_fragment
When the `WP_HTML_Processor` was introduced with its `::create_fragment()`
static creator method, that method has been returning a `new self(...)`.
Unfortunately, this means that subclasses cannot use that method since it
will return the `WP_HTML_Processor` instead of the subclass.

With this patch, the static creator method returns `new static(...)` to preserve
the intended behavior. A new test asserts this behavior for future changes.

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

Props dmsnell, jonsurrell.
Follow-up to [56274].
Fixes #61374.


git-svn-id: https://develop.svn.wordpress.org/trunk@58363 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-08 10:55:55 +00:00
Weston Ruter
da1ad311c2 General: Fix array format for allowed HTML passed into wp_kses() for wp_trigger_error().
Kses requires an associative array of allowed HTML.

See #57686. Follow-up to [56707].

Props thelovekesh, westonruter.
Fixes #61318.


git-svn-id: https://develop.svn.wordpress.org/trunk@58361 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-07 16:48:42 +00:00
Sergey Biryukov
1c8733e6f2 Coding Standards: Use strict comparison in wp-admin/includes/post.php.
Follow-up to [2718], [7103], [7338], [8857], [9036], [9103], [11807], [11908], [15315], [16901], [17078], [23725], [23735], [44141], [45583].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.

git-svn-id: https://develop.svn.wordpress.org/trunk@58360 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-07 12:27:59 +00:00
Peter Wilson
a033cf15d2 Editor (Font Library): Store font subdirectory in post meta.
Stores the font file sub-directory in the `wp_font_face` post meta. Similar to attachments, only the portion of the path relative to the base directory is stored.

This ensures the files can be deleted alongside their post on sites using a plugin to store font files in sub-directories. Previously running such a plugin would result in the files remaining on the file system post delete.

Props costdev, grantmkin, peterwilsoncc.
Fixes #61297.



git-svn-id: https://develop.svn.wordpress.org/trunk@58353 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-05 23:17:18 +00:00
Sergey Biryukov
ac84bd53c6 Login and Registration: Declare globals at the top of wp_signon() for consistency.
Follow-up to [10437], [32637], [58333].

See #58901.

git-svn-id: https://develop.svn.wordpress.org/trunk@58341 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-05 12:21:46 +00:00
André
c4dd762c62 REST API: improve code quality for class_list field fixtures.
Follow-up to [58326], #61360.

Props antonvlasenko, oandregal.
Fixes #61369.


git-svn-id: https://develop.svn.wordpress.org/trunk@58340 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-05 11:53:31 +00:00
Sergey Biryukov
1e208fc053 Comments: Ensure the correct comment ID type is passed to get_comment_author.
The `$comment_id` parameter of the `get_comment_author` filter is documented as a numeric string, however in case a non-existing comment ID is passed to the `get_comment_author()` function, it could be an integer instead.

This commit resolves the issue and adds a PHPUnit test demonstrating the behavior.

Includes updating `get_comment_author_url()` unit tests for consistency.

Follow-up to [41127], [52818].

Props david.binda.
Fixes #60475.

git-svn-id: https://develop.svn.wordpress.org/trunk@58335 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-04 15:27:57 +00:00
Joe McGill
447f6d7bc9 Editor: Cache global styles for blocks.
This caches the generated CSS from block nodes in merged Theme JSON data to avoid repeated costly operations required to compute style properties for blocks. The generated CSS is saved to a transient that expires every hour.

Props thekt12, spacedmonkey, pereirinha, mukesh27, isabel_brison, oandregal, andrewserong, ramonjd.
Fixes #59595.


git-svn-id: https://develop.svn.wordpress.org/trunk@58334 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-04 14:50:24 +00:00
Jb Audras
ce6d1d632d Login and Registration: Flush user_activation_key after successfully login.
This changeset ensures the `user_activation_key` is flushed after successful login, so reset password links can not be used anymore after the user successfully log into their dashboard.

Props nsinelnikov, rajinsharwar, Rahmohn, oglekler, hellofromTonya.
Fixes #58901.
See #32429




git-svn-id: https://develop.svn.wordpress.org/trunk@58333 602fd350-edb4-49c9-b593-d223f7449a82
2024-06-04 14:42:29 +00:00