5255 Commits

Author SHA1 Message Date
Jb Audras
e3c2478ef2 Docs: Use correct 6.2.0 @since version in multiple docblocks.
Props kebbet, audrasjb, mukesh27.
See #56792.


git-svn-id: https://develop.svn.wordpress.org/trunk@55349 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-15 22:54:41 +00:00
Peter Wilson
4d772a52b6 Editor: Prevent KSES stripping global layout style properties.
Layout style properties are stored using indirect values, rather than direct CSS properties. 

Allow users without the `unfiltered_html` capability to modify global styles using the indirect block spacing properties `contentSize`, `wideSize`, and `blockGap`, using a mapping of the eventual CSS property to the indirect property stored in `theme.json`. The mapped CSS property is then used for CSS validation.

Props andrewserong, costdev, hellofromtonya, mamaduka, mmtr86.
Fixes #57321.




git-svn-id: https://develop.svn.wordpress.org/trunk@55345 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-15 03:55:12 +00:00
Tonya Mork
a223763e56 Build/Test Tools: Fix invalid styles data type PHP Warning in REST_Block_Type_Controller_Test::test_get_item_invalid().
Sets the `styles` block setting to an empty array in the `REST_Block_Type_Controller_Test::test_get_item_invalid()` test to resolve:

{{{
Warning: foreach() argument must be of type array|object, string given in wp-includes/class-wp-theme-json.php on line 835
}}}

Previously the test set the `styles` setting to a string value, which is incompatible. The problem surfaced after [55172] added a `foreach` to iterate the `styles`. The root cause was due to this test passing a string instead of an array.

Why?

`WP_Block_Type` `styles` property is documented as only accepting an array data type. At the time of this changeset, it does not validate before setting the property.

Code interacting with the property expects it to be an array data type. The PHP Warning alerts that of a doing it wrong when the incorrect data type is registered for the block type.

Follow-up to [55172], [48173].

Props tanjimtc71, hellofromTonya, kapilpaul.
Fixes #57706.

git-svn-id: https://develop.svn.wordpress.org/trunk@55342 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 19:08:54 +00:00
Tonya Mork
d8598e3d05 Build/Test Tools: Fix inaccurate coverage in Tests_Functions_wpListPluck::set_up().
The call stack for `WP_UnitTestCase_Base::set_up()` includes a call to `WP_List_Util::pluck()`, which creates an inaccurate coverage report for this method.

To resolve, `parent::set_up()` is removed from `Tests_Functions_wpListPluck::set_up()`.

To ensure that deprecation and incorrect usage notices continue to be detectable, `$this->expectDeprecated()` is added in the test's `set_up()` fixture.

Follow-up to [51663], [28900].

Props costdev, jrf, SergeyBiryukov, audrasjb.
Fixes #56706.

git-svn-id: https://develop.svn.wordpress.org/trunk@55341 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 18:19:34 +00:00
Sergey Biryukov
5f8758953f Tests: Merge file-level and class-level DocBlocks in various unit test files.
Per the [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#6-file-headers documentation standards], whenever possible, all WordPress files should contain a header DocBlock, regardless of the file’s contents – this includes files containing classes.

However, this recommendation makes less sense for unit test classes if not applied consistently, and the duplicate tags cause some confusion.

This commit aims to reduce confusion and avoid repeating information by combining the DocBlocks.

Follow-up to [40607], [43183], [43291], [43292], [43499], [43568], [44502], [44535], [44628], [44786], [44824], [44906], [44909], [46175].

Props wojtekn, antonvlasenko, arafatjamil01, hztyfoon, mukesh27, costdev, jamilbd07, robinwpdeveloper, SergeyBiryukov.
Fixes #57099.

git-svn-id: https://develop.svn.wordpress.org/trunk@55337 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 16:10:13 +00:00
Peter Wilson
c98ca19a20 Menus: Test creating parent after a child doesn't throw an error.
As menus are re-arranged, it's possible a menu item was created prior to its parent.

This introduces a test to ensure the order in which menu items are created relevant to their parents does not trigger errors.

Props costdev, peterwilsoncc.
Fixes #57122.



git-svn-id: https://develop.svn.wordpress.org/trunk@55328 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 03:30:58 +00:00
Sergey Biryukov
c07b57c693 Comments: Use correct orderby parameter name in personal data exporter and eraser.
This ensures that `get_comments()` is called with the correct parameter name in:
* `wp_comments_personal_data_exporter()`
* `wp_comments_personal_data_eraser()`

Follow-up to [42888], [42994].

Props smeunus, kapilpaul, SergeyBiryukov.
Fixes #57700.

git-svn-id: https://develop.svn.wordpress.org/trunk@55324 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 22:03:30 +00:00
Sergey Biryukov
0b38eb09db Tests: Declare the $post_id property in wp_comments_personal_data_exporter() tests.
Use the same approach in `wp_comments_personal_data_eraser()` for consistency and to minimize the number of fixtures created in each individual test.

Follow-up to [55319], [55321].

Props hellofromTonya.
See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@55322 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 19:35:13 +00:00
Sergey Biryukov
4e62497442 Tests: Move wp_comments_personal_data_exporter() tests to their own file.
This aims to make the tests more discoverable and easier to expand.

Follow-up to [42987], [55319].

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@55321 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 19:11:15 +00:00
Sergey Biryukov
f4de272818 Tests: Add missing @covers tag for a wp_update_comment() test.
Follow-up to [37609], [53863].

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@55320 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 19:01:46 +00:00
Sergey Biryukov
263d73a755 Tests: Move wp_comments_personal_data_eraser() tests to their own file.
This aims to make the tests more discoverable and easier to expand.

Follow-up to [42994].

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@55319 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 18:56:59 +00:00
Felix Arntz
87c575a9fc Media: Enhance logic to determine LCP image in block themes and avoid lazy-loading it.
[52065] originally introduced the logic to guess the LCP image based on certain heuristics and to not lazy-load that image. However, with the introduction of block themes, that logic was not functioning correctly, resulting in all featured images to be lazy-loaded, regardless of whether it was the LCP image or not.

Together with an update to the `core/post-featured-image` block included in [55079], this changeset fixes the logic to correctly handle featured images in block themes as well.

Additionally, in combination with an update to the `core/template-part` block from [55246], this changeset includes an enhancement which uses the benefits of block template parts to avoid lazy-loading images in the `header` block template part, making the lazy-loading heuristics even more accurate for sites using a block theme.

Props flixos90, adamsilverstein, mamaduka, antonvlasenko, shahidul95, reduanmasud, costdev, mukesh27, ironprogrammer, manfcarlo, robinwpdeveloper, spacedmonkey.
Fixes #56930.


git-svn-id: https://develop.svn.wordpress.org/trunk@55318 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 18:32:40 +00:00
Sergey Biryukov
83f3d9078d Tests: Rename the html tests directory to html-api.
This matches the `WP_HTML_Tag_Processor` class location in `wp-includes` and the `@group` name used in the tests.

Follow-up to [55203].

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@55315 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 14:38:31 +00:00
Tonya Mork
1261ced3bf Themes: Remove local() from @font-face styles in _wp_theme_json_webfonts_handler().
Removes adding `local()` as a `@font-face` `src` within `_wp_theme_json_webfonts_handler()`.

Why?

To fix font incompatibilities when a user has the font-family locally installed on their viewing computer or device. It's unknown if all of the font-face variations specified by theme.json and/or global styles are:

* installed on the user's computer/device.
* and in one file or multiple files.

The previous implementation used the `src` specified when registering the font with the API. That src will likely vary from user computer/device to user computer/device.

To avoid these unknowns which could cause incompatibilities or styling issues, this changeset removes adding `local()` to the generated font-face CSS styles.

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

Follow-up to [53282].

Props luehrsen, aristath, ehtmlu, hellofromTonya, wetah.
Fixes #57430.

git-svn-id: https://develop.svn.wordpress.org/trunk@55314 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 14:31:06 +00:00
Sergey Biryukov
86da994b9a Tests: Move PasswordHash test file to a more appropriate place.
While also used for post passwords and application passwords, the PasswordHash library appears to be initially introduced and primarily used for user passwords, so the test file can be moved to the `user` directory.

Follow-up to [6350], [55310].

See #56340.

git-svn-id: https://develop.svn.wordpress.org/trunk@55313 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 14:20:30 +00:00
Jb Audras
ea6c96fced External Libraries: Prevent a PHP 8.1 deprecation notice in PasswordHash::gensalt_blowfish().
This changeset uses an `(int)` cast to prevent a PHP 8.1 deprecation notice for "Implicit conversation from float to int loses precision" in `PasswordHash::gensalt_blowfish()`.

Props hanshenrik, jrf, desrosj, costdev.
Fixes #56340.


git-svn-id: https://develop.svn.wordpress.org/trunk@55310 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 09:06:50 +00:00
Sergey Biryukov
7104aa0a9c Login and Registration: Set correct default values in wp_signon().
The `$credentials['user_login']` and `$credentials['user_password']` parameters are passed by reference to the `wp_authenticate` action, and are at that point [https://www.php.net/manual/en/language.references.pass.php#124383 created as null] if they don't exist in the array.

This commit sets those values to an empty string, resolving two PHP 8.1 deprecation notices:
 * One from `preg_replace()` in `wp_strip_all_tags()` via `sanitize_user()` in `wp_authenticate()`:
{{{
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
}}}
 * One from `trim()` in `wp_authenticate()` itself:
{{{
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated
}}}

Includes documenting the `$credentials` parameter using hash notation.

Follow-up to [6643], [37697].

Props lenasterg, TobiasBg, ocean90, afragen, lkraav, SergeyBiryukov.
Fixes #56850.

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

Props antonyagrios, mburridge.
Fixes #57329.


git-svn-id: https://develop.svn.wordpress.org/trunk@55294 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 23:45:18 +00:00
Aaron Jorbin
ad2ba3ed0d Comments: Improve rel attribute usage in comments.
Internal links should be followed and it should be easier to modify other rel attributes on comments. This adds a helper function for determining if a URL is internal and also adds some new filters to make it easy to modify rel attributes in comments.

Props thomasplevy, desrosj, sabernhardt, benish74, samiamnot, galbaras, jorbin.

Fixes #53290, #56444.


git-svn-id: https://develop.svn.wordpress.org/trunk@55289 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 18:52:24 +00:00
David Baumwald
6ae5afcfaf Editor: svn add new files missed in [55285].
Follow-up to [55285].

See #57618.

git-svn-id: https://develop.svn.wordpress.org/trunk@55286 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 18:09:44 +00:00
David Baumwald
f7c2299a0e Editor: Introduce sticky position block support.
In the Gutenberg plugin, a position block support feature was introduced last year, that allows a Group block to be set to a "sticky" position, meaning that when the page scrolls, the block will stick to the top of the window.

This change merges the "sticky" position feature for blocks introduced in Gutenberg 15.0.

Props andrewserong, flixos90, mukesh27.
Fixes #57618.

git-svn-id: https://develop.svn.wordpress.org/trunk@55285 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:59:44 +00:00
John Blackbourn
6fc77d21d3 Application Passwords: Allow plain HTTP success and reject URLs when using a local environment type.
It's not uncommon for local environments to run over HTTP due to the relative complexity of configuring HTTPS for a local environment. This change allows HTTP URLs for application password responses when that is the case.

Props peterwilsoncc, wppunk, cadic, viralsampat

Fixes #52617


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


git-svn-id: https://develop.svn.wordpress.org/trunk@55282 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:41:11 +00:00
Daniel Bachhuber
d91fd84eb1 Media: Add test file missed in [55278].
See #57370.


git-svn-id: https://develop.svn.wordpress.org/trunk@55280 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:37:16 +00:00
Jb Audras
024946f9d1 I18N: Introduce word_count_type property to WP_Locale.
This changesets adds a `word_count_type` property, so that it does not need to be translated separately across multiple projects.

List of changes:
- New property: `WP_Locale::word_count_type`.
- New method: `WP_Locale::get_word_count_type()`.
- New function: `wp_get_word_count_type()` as a wrapper for `WP_Locale::get_word_count_type()`.
- All `_x( 'words', 'Word count type. Do not translate!' )` strings have been replaced with a call to `wp_get_word_count_type()`.

Props pedromendonca, desrosj, costdev, mukesh27, johnbillion.
Fixes #56698.


git-svn-id: https://develop.svn.wordpress.org/trunk@55279 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:26:14 +00:00
Daniel Bachhuber
d80c313c80 Media: Bail early if image is already the requested size.
In `WP_Image_Editor_Imagick`, bail early in `make_subsize()` if the image is already the requested size. Previously, `make_subsize()` would create another copy of the file. `WP_Image_Editor_GD` doesn't have the same problem.

Props wojtekn, danielbachhuber.
Fixes #57370.


git-svn-id: https://develop.svn.wordpress.org/trunk@55278 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:22:41 +00:00
David Baumwald
5b2a6ae7cc Themes: Revert appearance tools theme support.
The appearance tools theme support(merged in [55067]) includes block gap, a feature that was not intended for themes without a theme.json.

Until it has been determined if the feature can and should be enabled in these themes, and has been successfully tested, the appearance tools theme support should be reverted.

Reverts [55067].

Props poena, Mamaduka, audrasjb.
Fixes #57649.

git-svn-id: https://develop.svn.wordpress.org/trunk@55273 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 16:42:11 +00:00
Joe Dolson
67f101e791 Formatting: Treat math elements as block-level elements.
The `math` element can be displayed either as a block or inline element. If `wpautop` only treats it as an inline element, it will break multiline elements by inserting `br` elements. Treating the element as a block element means that the editor won't break common normative usages of the `math` element. 

Prevent `math` elements from having internal elements split up with `br` elements, disrupting formatting.

Props nicholaswilson, wojtek.szkutnik, hakre, conner_bw, ericlewis, hughie.molloy, SteelWagstaff, ryokuhi, joedolson, bgoewert, adamsilverstein, joedolson.
Fixes #13340.

git-svn-id: https://develop.svn.wordpress.org/trunk@55272 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 16:16:47 +00:00
Sergey Biryukov
73d8988e4d Tests: Use assertSameSets() in WP_Query tests for search_columns argument.
This aims to resolve intermittent test failures due to indeterminate sort order.

Follow-up to [55248].

Props petitphp, costdev, audrasjb, johnbillion.
Fixes #43867.

git-svn-id: https://develop.svn.wordpress.org/trunk@55264 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 14:58:08 +00:00
Jb Audras
67662cbe1b Media: Introduce wp_get_attachment_link_attributes filter.
This changeset introduces the `wp_get_attachment_link_attributes` hook to allow developers to filter the link attributes when getting the attachment link.

Props NathanAtmoz, aaroncampbell, antpb, costdev.
Fixes #41574.


git-svn-id: https://develop.svn.wordpress.org/trunk@55262 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 14:33:44 +00:00
Jb Audras
3ba96e225d Privacy: Add rel="privacy-policy" to the Privacy Policy link.
This changeset adds a `rel="privacy-policy"` attribute to user-facing links to the Privacy Policy of the website, when a privacy policy page is set and available. While this `rel` value is still a RFC of the Link Types HTML specification, this changeset helps to make Privacy Policy link more discoverable for user agents and HTML parsers. 

Props dshanske, audrasjb, bhavz-10, bookwyrm, faisal03, JeffPaul, peterwilsoncc, paapst, davidbaumwald, costdev, robinwpdeveloper, kawserz.
Fixes #56345.


git-svn-id: https://develop.svn.wordpress.org/trunk@55261 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 14:03:26 +00:00
Jonny Harris
dcd1ba9330 Options, Meta APIs: Add a filter to allow the shortcut return to wp_load_alloptions function.
Add a new filter `pre_wp_load_alloptions` in the `wp_load_alloptions` function to short circuit the return value. 

Props pbearne, spacedmonkey, joyously, SergeyBiryukov, mukesh27, costdev. 
Fixes #56045.

git-svn-id: https://develop.svn.wordpress.org/trunk@55256 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 12:47:30 +00:00
Jb Audras
6636a6979f Revisions: Add a way to filter the revisions considered for deletion.
This changeset introduces a new filter for `wp_save_post_revision()`. `wp_save_post_revision_revisions_before_deletion` passes the revisions to be considered for deletion, and the new revision's post ID.

This allows extenders to exclude specific revisions from being considered for deletion.

Props jhned, costdev, audrasjb, adamsilverstein, mukesh27.
Fixes #57320.


git-svn-id: https://develop.svn.wordpress.org/trunk@55254 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 12:38:01 +00:00
Jonny Harris
35a678b0e6 Taxonomy: Implement wp_cache_get_multiple in wp_queue_posts_for_term_meta_lazyload.
In [47938] the `wp_cache_get_multiple` function was added to core. This function allows for multiple cache keys to be received from cache in a single function call. `wp_queue_posts_for_term_meta_lazyload` function does many calls to cache. To get taxonomy relationship for multiple posts and get all terms. Replace calls to `get_object_term_cache` with calls to `wp_cache_get_multiple` and `_prime_term_caches`. This improves performance on sites that implement the `wp_cache_get_multiple` in their object caching drop-in. 

Props spacedmonkey, ocean90, SergeyBiryukov, costdev, flixos90, joemcgill, 10upsimon. 
Fixes #57150.

git-svn-id: https://develop.svn.wordpress.org/trunk@55252 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 12:07:46 +00:00
Jb Audras
face5a97dd Build/Test Tools: Add unit tests for wp_set_password hook.
Follow-up to [55056].

Props audrasjb, SergeyBiryukov, costdev.
Fixes #57436.


git-svn-id: https://develop.svn.wordpress.org/trunk@55250 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 09:24:00 +00:00
Jb Audras
4b6d7ebbc5 Query: Add a search_columns argument to control which fields are searched in a search query.
Previously, the `s` argument of the `WP_Query::parse_query()` method searched the `post_title`, `post_excerpt`, and `post_content` fields, with no way of controlling this apart from using the `posts_search` filter and adjusting the SQL manually. This changeset adds the ability to specify which fields are searched when performing a query, using the `search_columns` argument.

Props johnbillion, birgire, petitphp, audrasjb, costdev, mukesh27.
Fixes #43867.


git-svn-id: https://develop.svn.wordpress.org/trunk@55248 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 08:53:01 +00:00
Riad Benguella
07fc9b2d74 Block Editor: Updated the WordPress packages to include Gutenberg 15.1.0 changes.
In addition to all the packages being updated to the latest versions, 
this commit also includes some mandatory changes to avoid editor breakage:

 - Update React to to 18.2.0.
 - Add the right stylesheets to support iframed block editors.

Props ntsekouras, mamaduka, flixos90, desrosj, peterwilsoncc.
See #57471.


git-svn-id: https://develop.svn.wordpress.org/trunk@55246 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 07:01:56 +00:00
Peter Wilson
d46dc08342 Formatting: Guard wp_strip_all_tags() against fatal errors.
Check the input of `wp_strip_all_tags()` before passing it to `strip_tags()`. This protects against fatal errors introduced in PHP 8, retaining the `E_USER_WARNING` from PHP 7, and prevents a PHP 8.1 deprecation notice when passing null.

Props chocofc1, costdev, jrf, dd32, audrasjb, peterwilsoncc.
Fixes #56434.



git-svn-id: https://develop.svn.wordpress.org/trunk@55245 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 03:32:43 +00:00
Peter Wilson
9d8e1ae068 Filesystem API: Add test for uncovered WP_Error in move_dir().
Introduces a test for the `WP_Error` object `destination_not_deleted_move_dir` in the `move_dir()` function.

Follow up to [55226].

Props costdev, mukesh27.
Fixes #57375.



git-svn-id: https://develop.svn.wordpress.org/trunk@55244 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 03:15:49 +00:00
Felix Arntz
84a59fe5f7 Themes: Add caching to WP_Theme::is_block_theme().
This changeset adds a `block_theme` entry in the theme cache data, similar to the existing entries `headers`, `errors`, `stylesheet`, and `template`.

Props spacedmonkey, costdev, joemcgill, flixos90, mukesh27, adamsilverstein.
Fixes #57114.


git-svn-id: https://develop.svn.wordpress.org/trunk@55236 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 19:57:41 +00:00
Felix Arntz
195393fdbb Editor: Use WP_HTML_Tag_Processor in wp_render_elements_support().
Props ntsekouras.
Fixes #57642.


git-svn-id: https://develop.svn.wordpress.org/trunk@55235 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 19:41:25 +00:00
Felix Arntz
363ed92463 Editor: Support the block_types and viewport_width props for remote patterns fetched from Pattern Directory.
Props ntsekouras, ironprogrammer, hellofromtonya, flixos90.
Fixes #57611.


git-svn-id: https://develop.svn.wordpress.org/trunk@55234 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 19:38:08 +00:00
Jorge Costa
97a0b1e7f3 Block editor: Update WP_Theme_JSON_Resolver and improve its performance.
This commit includes the latest updates WP_Theme_JSON_Resolver class made in the block editor. Some of these updates improve the performance of the class.

Props Mamaduka, hellofromTonya, flixos90, jorgefilipecosta, oandregal, spacedmonkey, audrasjb, costdev, scruffian.
Closes #57545.

git-svn-id: https://develop.svn.wordpress.org/trunk@55231 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 15:31:50 +00:00
Pascal Birchler
81f31d6fd8 I18N: Improve method names in WP_Locale_Switcher().
This is a follow-up to [55161] to rename `::get_current_locale()` to `::get_switched_locale()` and `::get_current_user_id()` to `::get_switched_user_id()` for improved clarity.

Also:

* Fix docblock for `switch_locale` filter. The User ID is `false` if missing, not `null`.
* Add additional test involving `restore_previous_locale()` and improve test cleanup.

And most importantly: happy birthday ocean90! 🎂

Props johnjamesjacoby, ocean90.
See #57123.

git-svn-id: https://develop.svn.wordpress.org/trunk@55224 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-04 20:45:36 +00:00
Felix Arntz
8900fdfd76 Editor: Add missing WP_Theme_JSON::process_blocks_custom_css() method.
Follow up to [55192].

Props aristath, mamaduka, mukesh27, hellofromtonya.
Fixes #57621.


git-svn-id: https://develop.svn.wordpress.org/trunk@55216 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 18:23:55 +00:00
Jb Audras
5c840d93bb HTTP API: Fix a unit test failure found after [55210].
Follow-up to [55210].

See #54225.


git-svn-id: https://develop.svn.wordpress.org/trunk@55211 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 13:51:11 +00:00
Jb Audras
8fbe21a37a HTTP API: Fix request header inconsistencies.
This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes #54225.


git-svn-id: https://develop.svn.wordpress.org/trunk@55210 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 13:33:18 +00:00
Jb Audras
4b71b1565a Media: Replace consecutive periods in sanitize_file_name().
On some servers, consecutive periods in a filename can cause a 403 Forbidden response.
This changeset replaces consecutive periods with a single period, and adds related unit tests.

Props ArtZ91, costdev, SergeyBiryukov, arthurshlain, mukesh27.
Fixes #57242.


git-svn-id: https://develop.svn.wordpress.org/trunk@55209 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 12:46:18 +00:00
Peter Wilson
4833e2c06f Posts, Post Types: Add test coverage for _truncate_post_slug().
Props xknown, mukesh27, costdev, audrasjb.
Fixes #56868.
See #56793.


git-svn-id: https://develop.svn.wordpress.org/trunk@55208 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 04:03:00 +00:00
Peter Wilson
0138b0dcd6 Posts, Post Types: Deprecate get_page_by_title() in favour of WP_Query.
Formally deprecate `get_page_by_title()`. In its current form the function is unpredictable in that it may return a result that leads to a 404 error and will return different results depending on the database version/engine combination used.

It is recommended developers use `WP_Query` instead:

{{{
$query = new WP_Query(
 array(
  'post_type' => 'page',
  'title'     => 'Sample Page',
 )
);
}}}


Props TimothyBlynJacobs, costdev, mukesh27, spacedmonkey, peterwilsoncc.
Fixes #57041.


git-svn-id: https://develop.svn.wordpress.org/trunk@55207 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 03:56:10 +00:00