47468 Commits

Author SHA1 Message Date
Sergey Biryukov
1e6ab88b6f I18N: Check that $wp_locale global is set before calling its methods.
This avoids a fatal error if these functions are called in a mu-plugin before `$wp_locale` is set:
* `wp_get_list_item_separator()`
* `wp_get_word_count_type()`

Follow-up to [52929], [52933], [55279], [55295].

Props kraftbj.
Fixes #56698.

git-svn-id: https://develop.svn.wordpress.org/trunk@55351 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-15 23:35:33 +00:00
Jb Audras
7a7cdde6ea I18N: Add new strings to about.php for use with end-of-life updates.
This changeset adds two additional translation strings in the changelog file, for use when releasing the final version of WordPress on a particular branch.

Props peterwilsoncc, audrasjb, mukesh27, mukesh27.
Fixes #57216.


git-svn-id: https://develop.svn.wordpress.org/trunk@55350 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-15 23:31:40 +00:00
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
Sergey Biryukov
239f73ce40 Docs: Update the wording for the Update Services link on Writing Settings screen.
The Codex URL was replaced with the corresponding HelpHub article a while ago.

Follow-up to [49912].

See #48987.

git-svn-id: https://develop.svn.wordpress.org/trunk@55347 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-15 19:16:07 +00:00
Sergey Biryukov
527255aea8 Docs: Improve code comments in some sanitizing functions.
This aims to clarify a few inline comments related to removing percent-encoded characters and HTML entities.

Affected functions:
* `sanitize_user()`
* `sanitize_title_with_dashes()`
* `sanitize_html_class()`
* `_sanitize_text_fields()`
* `get_comments_number_text()`

Follow-up to [465], [3454], [11433], [12503], [37987].

Props ace100, tanjimtc71, codemonksuvro, SergeyBiryukov.
Fixes #57712.

git-svn-id: https://develop.svn.wordpress.org/trunk@55346 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-15 13:04:06 +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
Peter Wilson
009a921351 Date/Time: Revert mysql2date changes in [55343].
These changes will be targeted to the 6.3 release.

See #57705.



git-svn-id: https://develop.svn.wordpress.org/trunk@55344 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-15 02:00:44 +00:00
Jonny Harris
9156163ca6 Date/Time: Save a call to wp_timezone in mysql2date.
Save a call to `wp_timezone` in `mysql2date` by saving the timezone to a variable and pass it into `wp_date` function call. 

Props spacedmonkey, costdev, SergeyBiryukov, audrasjb.
Fixes #57705.

git-svn-id: https://develop.svn.wordpress.org/trunk@55343 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 21:39:43 +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
Jb Audras
5bdc72d15c Post WordPress 6.2 Beta 2 version bump.
git-svn-id: https://develop.svn.wordpress.org/trunk@55340 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 18:03:36 +00:00
Jb Audras
ce57e9e94d WordPress 6.2 Beta 2.
git-svn-id: https://develop.svn.wordpress.org/trunk@55339 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 17:44:23 +00:00
Tonya Mork
81feb44d53 Editor: Remove missing postType and postId query args Site Editor redirect.
Removes the server-side redirection if missing `postType` and `postId` query args when visiting Site Editor. Why? This redirect is no longer needed as the routing is now handled client side (via [55333]).

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

Follow-up to [55333], [53413], [53093].

Props ntsekouras, youknowriad.
Fixes #57716.

git-svn-id: https://develop.svn.wordpress.org/trunk@55338 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 16:24:11 +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
Jb Audras
ba508bc74f Feeds: Fix various typos in MagpieRSS.
Props nithins53, desrosj, anantajitjg, mukesh27.
Fixes #57102.


git-svn-id: https://develop.svn.wordpress.org/trunk@55336 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 16:04:41 +00:00
David Baumwald
2730dfa902 Themes: Use add_action for pre_get_posts hook in _add_template_loader_filters().
Although `add_action` and `add_filter` are internally the same, `pre_get_posts` is an action hook.  This change updates the hook type to match what developers would expect when evaluating the code.

Follow-up to [52316].

Props swissspidy, riccardodicurti.
Fixes #57097.

git-svn-id: https://develop.svn.wordpress.org/trunk@55335 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 15:55:05 +00:00
Sergey Biryukov
c7e7a0b056 Coding Standards: Rename the remaining $cat_ID variables to $cat_id.
This resolves a few WPCS warnings:
{{{
Variable "$cat_ID" is not in valid snake_case format, try "$cat_i_d"
}}}

Affected functions:
* `wp_delete_category()`
* `get_category_rss_link()`
* `get_catname()`

Follow-up to [836], [2068], [2551], [2695], [6365], [10959], [52958], [55190].

Fixes #56754.

git-svn-id: https://develop.svn.wordpress.org/trunk@55334 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 15:44:41 +00:00
Tonya Mork
852042e4a7 Editor: Update @wordpress packages for 6.2 Beta 2.
Updates the `@wordpress` packages to include the following changes:

- Add missing period in keyboard shortcut descriptions
- Site Editor: Append template type and name to the site editor page title
- Specify active color state for template navigation button
- Global Styles: Move more link about custom CSS to part of description
- ToolsPanel: Display optional items when values are updated externally
- File block: Re-add editor styles for classic themes
- Enable undo after creating a new menu
- Style Book: Exclude blocks that are not allowed to insert
- Add basic tsconfig.json validation
- Fix Experiments native variant breakage
- Update moment and moment-timezone packages to fix timezone issues
- NavigatorButton: Reuse Button types
- ToolsPanel: Ensure display of optional items when panel id is null
- ColorPalette: Ensure text label contrast checking works with CSS variables
- Components: Add support for named arguments in the navigator components
- Rename experiments package to private-apis
- Cherry-pick CLI: Fix the default label to match the documentation
- Handle block metadata attribute and related experimental APIs
- Fix: Remove browser default border for iframe in the editor
- [Layout]: Fix align controls for hybrid themes
- Visual Regression tests: use default playwright utils
- SelectControl: Fix multiple prop styling
- Fix clicking on the toggle button not closing the block inserter
- Update deps for the useEffect that creates navigation menus
- Minor updates in Private APIs docs
- Site Editor: Fix custom Template Parts rename action
- [Block Library - Cover]: Ensure url is not malformed due to sanitization through wp_kses
- Revert "Prevent the image from being resized larger than its container"
- Lodash: Remove from @wordpress/keycodes package
- Distraction free mode: Fix keyboard shortcut not working
- Popover: lock the __experimentalPopoverPositionToPlacement function
- Rename the "experiments" export to "privateApis"
- Add an aria label to the site save dialog
- Navigator: add more pattern matching tests, refine existing tests
- Add parent navigation support for the navigator component
- Add back link to Design heading in site editor navigation to return to Dashboard
- Add a nested level when selecting templates or template parts
- Move site editor 6.2 specific code to the right file
- Fix site editor navigation

References:
* [1bf01c01a8 Gutenberg's commit for publishing the packages]

Follow-up to [55257].

Props ntsekouras.
See #57471.

git-svn-id: https://develop.svn.wordpress.org/trunk@55333 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 15:41:49 +00:00
Sergey Biryukov
98c0d03132 Docs: Add a @since note about Twenty Twenty-Three for WP_Theme::$default_themes.
Follow-up to [51328], [52941], [54236].

Props petitphp.
Fixes #57714.

git-svn-id: https://develop.svn.wordpress.org/trunk@55332 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 14:36:06 +00:00
Jb Audras
2bd9037718 Permalinks: Properly escape strings in Permalinks Settings screen.
Props jaedm97, audrasjb, robinwpdeveloper, shraboni.
Fixes #57143.


git-svn-id: https://develop.svn.wordpress.org/trunk@55331 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 11:32:59 +00:00
Peter Wilson
917064a764 Bundled themes: Recommit generated files following [55329].
See #56226.



git-svn-id: https://develop.svn.wordpress.org/trunk@55330 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 04:20:11 +00:00
Peter Wilson
ae09551f41 Bundled themes: Fix row variation nested in group block.
Remove the `display` property from the custom group block styles to prevent the flex layout in the row variation from been removed.

Props abirhasandipu, poena, robinwpdeveloper.
Fixes #56226.



git-svn-id: https://develop.svn.wordpress.org/trunk@55329 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 04:01:32 +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
Joe Dolson
2840f17081 Administration: Fix JavaScript test failure.
Remove unused variable `e` that I removed from Github, but failed to remove before committing. Follow up to [55326].

Unprops joedolson.
Fixes #53587.

git-svn-id: https://develop.svn.wordpress.org/trunk@55327 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 00:39:41 +00:00
Joe Dolson
a9fc43e79c Administration: Close admin menu when focus moves to body.
User should not have to reach the admin menu toggle in order to close the menu. This can be a problem for one-handed mobile use, users with small hands, and numerous other situational usages.

Close the admin menu when focus moves anywhere other than the menu or the menu toggle and the current document is active.

Props kaneva, sabernhardt, costdev, ryokuhi, hellofromtonya, dhusakovic, thelovekesh, joedolson.
Fixes #53587.

git-svn-id: https://develop.svn.wordpress.org/trunk@55326 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-14 00:36:32 +00:00
Tonya Mork
ef4e893faf REST API: Remove 'Invalid user ID' error in WP_REST_Users_Controller::update_item().
Removes the `WP_Error` code for `'Invalid user ID.'`. Why?

tl;dr
This branch will never be entered as the `$user` will never be falsey.

Longer reasoning:

[39954] introduced `WP_REST_Users_Controller::get_user()` method to encapsulate getting the user and handling the `'Invalid user ID.'` `WP_Error`. It replaced `get_userdata()` in `WP_REST_Users_Controller::update_item()` but left the existing `'Invalid user ID.'` `WP_Error` introduced in [38832].

The code removed in this changeset will never be reached because `$user` will never be falsey. Rather, `WP_REST_Users_Controller::get_user()` will always return an instance of `WP_Error` or `WP_User`. 

Could the user's ID be falsey?
No. Why? `WP_REST_Users_Controller::get_user()` checks that the user exists, which checks if the ID is falsey.

Therefore, the code can safely be removed.

Follow-up to [39954], [38832].

Props jrf, costdev, hellofromTonya, SergeyBiryukov.
Fixes #56662.

git-svn-id: https://develop.svn.wordpress.org/trunk@55325 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 23:08:23 +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
Tonya Mork
b487e4c611 Editor: Restores file block button styles for classic themes.
Adds styles into `wp-includes/css/classic-themes.css` to restore file block button element styling for classic themes.

Why?

In [54257] and [54118], button element styles were moved from each block to `theme.json`. For the file block, the download button styles were removed from the block's stylesheet. These changes impacted themes without a `theme.json` file (i.e. classic themes).

This changeset restores the styles for backwards-compatibility.

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

Follow-up to [54257], [54118].

Props wildworks, scruffian, mamaduka, ntsekouras.
Fixes #57688.

git-svn-id: https://develop.svn.wordpress.org/trunk@55323 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 20:48:53 +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
Jb Audras
ea57bf06ea Twenty Twenty: Properly reflect text color changes in Quote and Pullquote block.
This changeset ensures that text color for citation are inherited when the user specifies color for the Pullquote or Quote block, or if one of those blocks is inside a block with a background.

Props nithins53, kajalgohel, kmadhak, sabernhardt, devtanbir, james-roberts, sapayth, rafinkhan, robinwpdeveloper, poena.
Fixes #55990.


git-svn-id: https://develop.svn.wordpress.org/trunk@55317 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 15:18:19 +00:00
Jb Audras
87ca0e14fa Docs: Various improvements in XML-RPC Class function descriptions, as per docblocks standards.
See #56792.


git-svn-id: https://develop.svn.wordpress.org/trunk@55316 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 15:16:55 +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
428705ba1f Twenty Twelve: Properly reflect text color changes in Table block.
This changeset makes the table header cells also inherit text colors, when the user selects a text color.

Props nidhidhandhukiya, sabernhardt, poena, faguni22.
Fixes #56466.


git-svn-id: https://develop.svn.wordpress.org/trunk@55312 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 09:21:59 +00:00
Jb Audras
4cbeef75a9 Docs: Use third-person singular verbs for WP_Meta_Query related function descriptions, as per docblocks standards.
See #56792.


git-svn-id: https://develop.svn.wordpress.org/trunk@55311 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 09:19:43 +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
Jb Audras
e0a9b1f4c5 Formatting: Add aspect-ratio as valid CSS property in KSES.
This changeset adds support for the `aspect-ratio` CSS property, which is considered safe for inline CSS.

Props ajlende, peterwilsoncc.
Fixes #57664.


git-svn-id: https://develop.svn.wordpress.org/trunk@55309 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-13 08:45:48 +00:00
Sergey Biryukov
08160032ef Coding Standards: Rename $comment_ID variable to $comment_id in various files.
This resolves 80+ WPCS warnings in core:
{{{
Variable "$comment_ID" is not in valid snake_case format
}}}

While matching the database field of the same name, the `$comment_ID` variable did not follow the WordPress coding standards, and is now renamed to address that.

This affects:
* Function parameters in:
 * `get_comment_author()`
 * `comment_author()`
 * `get_comment_author_email()`
 * `comment_author_email()`
 * `get_comment_author_link()`
 * `comment_author_link()`
 * `get_comment_author_IP()`
 * `comment_author_IP()`
 * `get_comment_author_rl()`
 * `comment_author_url()`
 * `get_comment_date()`
 * `comment_date()`
 * `get_comment_excerpt()`
 * `comment_excerpt()`
 * `get_comment_text()`
 * `comment_text()`
 * `get_comment_time()`
 * `comment_time()`
 * `get_comment_type()`
 * `get_page_of_comment()`
 * `wp_new_comment_notify_moderator()`
 * `wp_new_comment_notify_postauthor()`
 * `get_commentdata()`

* Internal variables in:
 * `get_comment_ID()`
 * `wp_new_comment()`
 * `wp_xmlrpc_server::wp_deleteComment()`
 * `wp_xmlrpc_server::wp_editComment()`
 * `wp_xmlrpc_server::wp_newComment()`
 * `wp_xmlrpc_server::pingback_ping()`

* Hook parameters in:
 * `get_comment_author`
 * `comment_author`
 * `get_comment_author_email`
 * `author_email`
 * `get_comment_author_link`
 * `get_comment_author_IP`
 * `get_comment_author_url`
 * `comment_url`
 * `get_comment_excerpt`
 * `comment_excerpt`
 * `get_comment_ID`
 * `get_comment_type`
 * `get_page_of_comment`
 * `comment_{$new_status}_{$comment->comment_type}`
 * `comment_post`
 * `notify_moderator`
 * `notify_post_author`
 * `commentrss2_item`
 * `xmlrpc_call_success_wp_deleteComment`
 * `xmlrpc_call_success_wp_editComment`
 * `xmlrpc_call_success_wp_newComment`
 * `pingback_post`

Note: The name change only affects variable names and DocBlocks.

The change does not affect:

* `comment_ID` as the `$orderby` value in `WP_Comment_Query::__construct()`
* `comment_ID` as the `$orderby` value in `WP_Comment::get_children()`
* `comment_ID` as part of `$commentarr` parameter in `wp_update_comment()`

The associated array keys still match the database field.

Follow-up to [53723].

Props krunal265, costdev, SergeyBiryukov.
Fixes #57671. See #56791.

git-svn-id: https://develop.svn.wordpress.org/trunk@55308 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-12 18:06:33 +00:00
Joe Dolson
14bb2d7784 Toolbar: Prevent false positive on automated contrast testing.
The non-focused state of the `.screen-reader-shortcut` element in the admin bar fails contrast tests. This has no real-world consequences, but raises false positives in some automated testing tools. This fix is largely so people using automated testing will not raise false positives.

Props sabernhardt, afercia, robinwpdeveloper, re_enter_rupok.
Fixes #56789.

git-svn-id: https://develop.svn.wordpress.org/trunk@55307 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-11 17:37:30 +00:00
Sergey Biryukov
cd5955bceb Coding Standards: Pass correct value to get_delete_post_link() in attachment_submit_meta_box().
The `$deprecated` parameter of `get_delete_post_link()` is documented to accept a string, not `null`.

Follow-up to [14099], [21948].

Props krunal265, jrf.
Fixes #57690.

git-svn-id: https://develop.svn.wordpress.org/trunk@55306 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-11 13:10:22 +00:00
Sergey Biryukov
aa325d4005 Mail: Check that set_time_limit() function is available before using it in class-pop3.php.
This avoids a fatal error if the function is disabled on certain environments.

Follow-up to [55258].

Props mujuonly.
Fixes #57659.

git-svn-id: https://develop.svn.wordpress.org/trunk@55305 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-11 12:41:34 +00:00
Sergey Biryukov
099ff6c5fe Docs: Replace short array syntax in WP_HTML_Tag_Processor documentation.
Per [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#declaring-arrays WordPress PHP Coding Standards]:
> Using long array syntax ( `array( 1, 2, 3 )` ) for declaring arrays is generally more readable than short array syntax ( `[ 1, 2, 3 ]` ), particularly for those with vision difficulties. Additionally, it’s much more descriptive for beginners.
> 
> Arrays must be declared using long array syntax.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/47958 #47958 Docs: Don't recommend using short array syntax in WP_HTML_Tag_Processor]

Follow-up to [55203], [55206].

Props aristath, poena.
Fixes #57691.

git-svn-id: https://develop.svn.wordpress.org/trunk@55304 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-10 10:57:20 +00:00
Helen Hou-Sandi
2654756a03 Build/Test Tools: Add a devcontainer for Codespaces support.
This adds a devcontainer configuration tested for use with GitHub Codespaces. It is currently built on top of the Docker `wordpress` image for initial trial purposes. We should eventually be using our own containers to fully own the environment.

This should be considered a beta run to get a sense of how well cloud dev containers work for core contributors, in particular at contributor day events with limited bandwidth and mobile devices.

Props samruddhikhandale, dinhtungdu, helen, craiglpeters, sam1el, wirecat.
See #57187.



git-svn-id: https://develop.svn.wordpress.org/trunk@55303 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-10 02:59:04 +00:00
Pascal Birchler
f3707b2135 I18N: Prevent fatal error in WP_Textdomain_Registry.
Use `rtrim` instead of `untrailingslashit` and `trailingslashit` directly.

Avoids `formatting.php` dependency and thus prevents an error when called via `wp_load_translations_early()`, which happens e.g. when in maintenance mode.

Props grl570810, ocean90.
Fixes #57218.

git-svn-id: https://develop.svn.wordpress.org/trunk@55302 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-09 16:33:36 +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