Commit Graph

8817 Commits

Author SHA1 Message Date
Felix Arntz
59e8596941 Themes: Deprecate usage of TEMPLATEPATH and STYLESHEETPATH constants.
While generally the functions `get_template_directory()` and `get_stylesheet_directory()` were long recommended to use to get the parent or child theme directory, the `TEMPLATEPATH` and `STYLESHEETPATH` constants were still used in a few places in core, most importantly in template related logic.

The remaining usage was problematic as it prevented testability of certain key components of WordPress core.

This changeset replaces all remaining usage with the corresponding functions and effectively marks these constants as deprecated. It also adds test coverage accordingly and even unlocks some existing, previously commented out test coverage to work as expected.

Performance of the new approach has been benchmarked and shows no notable differences. Yet, given that the current theme directories are not expected to change within a regular WordPress page load, the `get_template_directory()` and `get_stylesheet_directory()` functions were amended with in-memory caching of the result, unless one of the defining values is being filtered.

Props thekt12, spacedmonkey, mukesh27, aaroncampbell, scribu, lloydbudd, cais, chipbennett, toscho, omarabid, CrazyJaco, DrewAPicture, obenland, wonderboymusic, nacin, helen, dd32, chriscct7, SergeyBiryukov, swissspidy, joemcgill, flixos90.
Fixes #18298.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 17:27:23 +00:00
audrasjb
25b109a0e5 Taxonomy: Restrict term edit link generation in WP_Terms_List_Table::handle_row_actions().
This changeset restricts edit term link generation if the user lacks the `edit_term` cap in order to prevent PHP 8.1+ deprecations shown when a user lacks this 
capability and `get_edit_term_link()` returns null.

Props thelovekesh, jrf.
Fixes #59336.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 08:10:16 +00:00
Sergey Biryukov
1b5fc476f8 Quick Edit: Allow Quick Edit to be disabled for custom post types or taxonomies.
Some custom post types or taxonomies may not need the Quick Edit functionality, in which case adding hidden fields and rendering the form with the data to edit would be redundant.

This commit introduces two filters for more granular control:

* `quick_edit_enabled_for_post_type`
* `quick_edit_enabled_for_taxonomy`

Follow-up to [8857], [9083], [9098].

Props garyc40, sabernhardt, mukesh27, costdev, oglekler, wyrfel, peterwilsoncc, faguni22, robinwpdeveloper, webcommsat, johnbillion, azaozz, hellofromTonya, GunGeekATX, Jick, mikeschinkel, jane, nacin, helen, wonderboymusic, DrewAPicture, SergeyBiryukov.
Fixes #16502, #19343, #57596.
Built from https://develop.svn.wordpress.org/trunk@56611


git-svn-id: http://core.svn.wordpress.org/trunk@56123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 13:19:19 +00:00
joedolson
a73260baf4 Administration: Add support for attributes in wp_admin_notice().
Allow admin notices to be created with additional attributes. Test attributes include `hidden`, `data-*`, and `role="*"` values, which are all in use in various admin notices across core. 

This commit adds `aria-live` and `hidden` to the KSES global attributes array to support core usages.

Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600], [56601], [56602].

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56603


git-svn-id: http://core.svn.wordpress.org/trunk@56115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 00:30:18 +00:00
joedolson
9922dfd54c Administration: Move tabindex="-1" from notice to JS.
In a handful of admin notices, a `tabindex` attribute is set so that JS can move focus to the notice `div`. Rather than adding `tabindex` to globally accepted attributes for `wp_kses_post()`, move the assignment of `tabindex` into the JS handlers that display those notices. The attribute is only relevant if JS is running, so there is no reason to add it in the original HTML notice.

Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600], [56601].

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56602


git-svn-id: http://core.svn.wordpress.org/trunk@56114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 22:51:24 +00:00
costdev
6cdd74585d Administration: Use wp_admin_notice() more in /wp-admin/includes/.
Adds further usages of `wp_admin_notice()` in `/wp-admin/includes/` on `.notice-error`, `.notice-warning`, `.error`, and `.updated`.

Ongoing task to implement new function across core.

Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597].

Props joedolson, mukesh27, costdev.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56599


git-svn-id: http://core.svn.wordpress.org/trunk@56111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 15:23:22 +00:00
Bernhard Reiter
0b79362805 General: Add block_hooks field to block type registration, REST API.
In order to implement Block Hooks, we need to add a new `block_hooks` field to the `WP_Block_Type` class, as well as to block registration related functions, the block types REST API controller, etc.

Props gziolo.
Fixes #59346. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56587


git-svn-id: http://core.svn.wordpress.org/trunk@56099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 13:25:18 +00:00
Sergey Biryukov
1aca5e48e5 Coding Standards: Restore more descriptive variable names in a few class methods.
When various methods parameters in child classes were renamed to `$item` to match the parent class for PHP 8 named parameter support, most of the methods restored the more descriptive, specific name at the beginning for better readability, with several exceptions for methods consisting only of a few lines.

To avoid confusion about why some methods do that and some don't, this commit aims to bring more consistency to the code, specifically in list tables' `::column_default()` methods.

Follow-up to [51728], [51737], [51786].

See #58831.
Built from https://develop.svn.wordpress.org/trunk@56586


git-svn-id: http://core.svn.wordpress.org/trunk@56098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 12:46:20 +00:00
joedolson
008a32110f Administration: Use wp_admin_notice() in /wp-admin/includes.
Add usages of `wp_admin_notice()` and `wp_get_admin_notice()` on `.notice-[type]` in the root level of `/wp-admin/includes`. Ongoing task to implement new function across core.

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56571


git-svn-id: http://core.svn.wordpress.org/trunk@56083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 01:13:20 +00:00
Sergey Biryukov
e5490118af Coding Standards: Include one space after function keyword for closures.
Note: This is enforced by WPCS 3.0.0.

Reference: [https://github.com/WordPress/WordPress-Coding-Standards/pull/2328 WPCS: PR #2328 Core: properly check formatting of function declaration statements].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-12 15:23:18 +00:00
Sergey Biryukov
c41829ea95 Code Modernization: Use dirname() with the $levels parameter.
PHP 7.0 introduced the `$levels` parameter to the `dirname()` function, which means nested calls to `dirname()` are no longer needed.

Note: This is enforced by WPCS 3.0.0.

Reference: [https://www.php.net/manual/en/function.dirname.php PHP Manual: dirname()].

Follow-up to [56141].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-11 04:53:22 +00:00
costdev
c170fd62f4 Upgrade/Install: Fix broken sprintf() call when deleting a backup.
In `WP_Upgrader::delete_temp_backup()`, a malformed `sprintf()` call did not pass the value, triggering a Warning in PHP 7 and a Fatal Error in PHP 8.

This fixes the malformed `sprintf()` call by correctly passing the value.

Follow-up to [55720].

Props akihiroharai, afragen.
Fixes #59320.
Built from https://develop.svn.wordpress.org/trunk@56550


git-svn-id: http://core.svn.wordpress.org/trunk@56062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-10 07:33:22 +00:00
Sergey Biryukov
b80ce60f70 Coding Standards: Use pre-increment/decrement for stand-alone statements.
Note: This is enforced by WPCS 3.0.0:

1. There should be no space between an increment/decrement operator and the variable it applies to.
2. Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements. “Pre” will in/decrement and then return, “post” will return and then in/decrement. Using the “pre” version is slightly more performant and can prevent future bugs when code gets moved around.

References:
* [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#increment-decrement-operators WordPress PHP Coding Standards: Increment/decrement operators]
* [https://github.com/WordPress/WordPress-Coding-Standards/pull/2130 WPCS: PR #2130 Core: add sniffs to check formatting of increment/decrement operators]

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


git-svn-id: http://core.svn.wordpress.org/trunk@56061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-09 09:28:26 +00:00
Sergey Biryukov
d8936a9fe7 Coding Standards: Remove superfluous blank lines at the end of various functions.
Note: This is enforced by WPCS 3.0.0.

Follow-up to [56536], [56547].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 10:03:21 +00:00
Sergey Biryukov
9a49b70239 Coding Standards: Remove superfluous blank lines at the end of various classes.
Note: This is enforced by WPCS 3.0.0.

Follow-up to [56536].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 09:32:23 +00:00
hellofromTonya
3356628935 Code Modernization: Use wp_trigger_error() in WP_List_Table magic methods.
Replaces `trigger_error()` with `wp_trigger_error()` in each of the `WP_List_Table` magic methods.

[56349] added the dynamic properties deprecation messages to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods. Since that commit, `wp_trigger_error()` was introduced (see [56530]) as a wrapper for `trigger_error()`.

Follow-up to [56349], [56356], [56530].

See #58896, #57686.
Built from https://develop.svn.wordpress.org/trunk@56542


git-svn-id: http://core.svn.wordpress.org/trunk@56054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 20:41:11 +00:00
costdev
9ebcbfae5c Upgrade/Install: Check plugin compatibility during bulk upgrades.
Previously, bulk upgrades did not verify that a plugin package was compatible with the site's WordPress version or the server's PHP version. This could lead to incompatible updates being installed, causing various compatibility issues and errors.

This change implements the following checks:
- If available, the API response's `requires` and `requires_php` values are checked for compatibility. This saves time, diskspace, memory and file operations by failing the upgrade before the package is downloaded and unpacked.
- If the API check passes, the downloaded and unpacked package is verified using `Plugin_Upgrader::check_package()` to ensure a plugin file is present, and the plugin's "RequiresWP" and "RequiresPHP" headers are compatible, if present. This ensures that a mismatch between the API response and the plugin file's headers does not cause an incompatible plugin to be installed.

Props salcode, afragen, mukesh27, iammehedi1, zunaid321, johnbillion, SergeyBiryukov, costdev.
Fixes #59198.
Built from https://develop.svn.wordpress.org/trunk@56525


git-svn-id: http://core.svn.wordpress.org/trunk@56037 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 18:30:19 +00:00
Sergey Biryukov
541fdbceb2 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 [56276], [56302].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 09:33:21 +00:00
joedolson
1141b9fee2 Administration: Use admin notice functions in nav menu admin.
Use `wp_get_admin_notice` and `wp_admin_notice` to handle settings notices on the nav menu admin screens.

Props joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56518


git-svn-id: http://core.svn.wordpress.org/trunk@56030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-05 20:50:24 +00:00
joedolson
0aa0c763e2 Administration: Add improved context for add new links.
Consistently expand `Add New` links to include the type of content to add. Improve consistency of text casing to use initial caps throughout.

Props afercia, gonzomir, alexstine, swissspidy, joedolson.
Fixes #47125.
Built from https://develop.svn.wordpress.org/trunk@56515


git-svn-id: http://core.svn.wordpress.org/trunk@56027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-05 19:26:26 +00:00
Sergey Biryukov
c5a0103fb5 Site Health: Show correct debug value for file uploads.
Follow-up to [48535].

Props Michi91, Presskopp.
Fixes #58737.
Built from https://develop.svn.wordpress.org/trunk@56509


git-svn-id: http://core.svn.wordpress.org/trunk@56021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-02 18:36:24 +00:00
Sergey Biryukov
e7475d16ba Media: Remove unused $is_IE and $is_opera globals in media_upload_form().
Follow-up to [27316].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56016 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 11:03:23 +00:00
hellofromTonya
8c4c35311b Introduce font-face styles generator and printer.
Introducing Font Face, a server-side `@font-face` styles generator and printer. 

tl;dr:
* Introduces Font Face.
* Deprecates `_wp_theme_json_webfonts_handler()`.

**Introduce Font Face**

From an array of fonts (i.e. each font-family and its font variations to be processed), it:

1. Validates each `font-face` declaration, i.e. the CSS property and value pairing. If validation fails, processing stops with no font-face styles printed.
3. Generates the `@font-face` CSS for each font-family.
4. Prints the CSS within a `<style id="wp-fonts-local">` element.

The entry point into Font Face is through a new global function called `wp_print_font_faces()`, which is automatically called:

* when the `'wp_head'` hook runs (for the front-end).
* when the `'admin_print_styles'` hook runs (for the back-end).
* when `_wp_get_iframed_editor_assets()` runs to inject the `@font-face` styles into the iframed editor.

Once called, it gets the fonts from Theme_JSON merged data layer, which includes theme defined fonts and user activated fonts (once the Font Library #59166 is introduced into Core).

For classic sites, themes and plugins can directly call `wp_print_font_faces()` and pass their fonts array to it for processing.

**Deprecates `_wp_theme_json_webfonts_handler()`.**

As Font Face is a direct replacement, the stopgap code in `_wp_theme_json_webfonts_handler()` (introduced in 6.0.0 via [53282]) is deprecated and unused in Core.

**Props note:**
There's a long multiple year history baked into Font Face, which dates back to the early versions of a web font API (see #46370 and [https://github.com/WordPress/gutenberg/issues/41479 roadmap]. The props list includes those who contributed from those early versions up to this commit.

**References:**
* #46370 original (Web)Fonts API proposal for registering and enqueuing web fonts.
* [https://github.com/WordPress/gutenberg/issues/41479 Gutenberg tracking issue] which includes the evolution from Webfonts API to Fonts API to Font Face.
* [53282] / #55567 Added the stopgap code `_wp_theme_json_webfonts_handler()` in 6.0.
* [https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face @font-face on mdn web docs]
* #59166 Font Library: Font manager for WordPress

Follow-up to [53282].

Props aristath, jonoaldersonwp, hellofromTonya, andraganescu, annezazu, antonvlasenko, arena, askdesign, azaozz, bph, bradley2083, colorful-tones, costdev, davidbaumwald, desrosj, dingo_d, djcowan, domainsupport, dryanpress, elmastudio, flixos90, francina, garrett-eclipse, gigitux, grantmkin, grapplerulrich, gziolo, ironprogrammer, jb510, jeffpaul, jeremyyip, jffng, joostdevalk, jorgefilipecosta, juanmaguitar, mamaduka, matveb, mburridge, mitogh, ndiego, ntsekouras, oandregal, ocean90, oglekler, paaljoachim, pagelab, peterwilsoncc, poena, priethor, scruffian, SergeyBiryukov, shiloey, simison, skorasaurus, soean, westonruter, wildworks, zaguiini.
Fixes #59165.
Built from https://develop.svn.wordpress.org/trunk@56500


git-svn-id: http://core.svn.wordpress.org/trunk@56012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-31 21:49:20 +00:00
audrasjb
92dcec465a Coding Standards: Remove unused global variables in various /wp-admin/includes/ files.
Props upadalavipul.
Fixes #59254.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-31 14:45:20 +00:00
John Blackbourn
46fda1912c Privacy: Improve docblocks for hooks and functions related to personal data export and erasure.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-28 21:53:21 +00:00
John Blackbourn
75a487bf43 Database: Remove support for the mysql extension.
The `mysql` extension is no longer used in PHP 7 or above. There's a good amount of conditional code in `wpdb` and the health checks that can be removed now that only the `mysqli` functions are used.

Fixes #59118

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


git-svn-id: http://core.svn.wordpress.org/trunk@55987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-26 13:03:24 +00:00
Drew Jaynes
d2b2957bcb Properly deprecate both constructors in WP_User_Search.
- `__construct()` gets the new `_deprecated_class()` function
- `WP_User_Search` PHP4 style constructor is changed from `_deprecated_function()` to `_deprecated_constructor()`

Adds a test to confirm `WP_User_Search` class is testable as deprecated.

Props jrf, DrewAPicture.
Fixes #41125.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55981 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 03:37:12 +00:00
joedolson
0bce794a37 Menus: Revert unintentional changes in [56449].
Accidentally committed two simultaneous patches; reverting unintended list table changes.

Unprops joedolson.
See #56594.
Built from https://develop.svn.wordpress.org/trunk@56450


git-svn-id: http://core.svn.wordpress.org/trunk@55962 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 16:14:18 +00:00
joedolson
ad66de2933 Menus: Fix proximity of controls to Save and Delete menus.
Move the position of the Save and Delete buttons in menu editing so they are immediate neighbors, improving the proximity of related controls. 

Props 90lines, sabernhardt, costdev.
See #56594.
Built from https://develop.svn.wordpress.org/trunk@56449


git-svn-id: http://core.svn.wordpress.org/trunk@55961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 15:59:12 +00:00
Pascal Birchler
4a763f90ac Plugins: Correctly display spaces in new plugins search results.
Ensures the encoded search term in the input field is correctly decoded again.

Follow-up to [53844] and [54904].

Props adhun, nithi22, huzaifaalmesbah, deepakvijayan, zunaid321, iammehedi1.
Fixes #59143.
Built from https://develop.svn.wordpress.org/trunk@56446


git-svn-id: http://core.svn.wordpress.org/trunk@55958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 15:27:16 +00:00
audrasjb
86323b7f59 Docs: Correct default post type in page_template_dropdown() docblock.
The default post type used by `page_template_dropdown()` is `page`, not `post`.

Props maxinacube.
Fixes #58972.
See #58833.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 13:41:23 +00:00
audrasjb
0b772b84ca Docs: Clarify post_date_column_time filter description.
Props crstauf, mukesh27.
Fixes #59029.
See #58833.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 09:12:12 +00:00
audrasjb
f668df3cec Docs: Wrap inline @see tags in curly braces.
Props costdev, mukesh27.
Fixes #58858.
See #58833.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 09:01:16 +00:00
Sergey Biryukov
3280c340cd Coding Standards: Use strict comparison in wp-admin/includes/meta-boxes.php.
Follow-up to [38], [647], [2890], [3570], [11815], [11816], [31550], [52620].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-20 00:10:22 +00:00
Andrew Ozz
7715c78c85 Revert the last use of str_starts_with() in update-core.php.
Fixes updating WordPress from 5.7 and earlier versions. When doing the update this file runs first in the old version where the polifills may not be available.

Porps: frankit.
Fixes: #59145.
Built from https://develop.svn.wordpress.org/trunk@56417


git-svn-id: http://core.svn.wordpress.org/trunk@55929 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 23:25:24 +00:00
John Blackbourn
4667b9323f Docs: Miscellaneous docblock corrections and improvements.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 17:29:20 +00:00
Sergey Biryukov
3fa176f4fe Coding Standards: Improve variable names in wp_save_image().
This resolves a few WPCS warnings:
{{{
Variable "$sX" is not in valid snake_case format, try "$s_x"
Variable "$sY" is not in valid snake_case format, try "$s_y"
}}}

The `$sX` and `$sY` variables are renamed to `$original_width` and `$original_height`, respectively.

Additionally, the `$fwidth` and `$fheight` variables are renamed to `$full_width` and `$full_height`, for clarity.

Follow-up to [11965], [22094], [56400].

See #58831.
Built from https://develop.svn.wordpress.org/trunk@56411


git-svn-id: http://core.svn.wordpress.org/trunk@55923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 10:09:23 +00:00
joedolson
3e1db7f59d Administration: Invalid argument passed in additional_classes.
Fix `additional_classes` argument passed as a string instead of an array. Follow up to [56409].

Props joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56410


git-svn-id: http://core.svn.wordpress.org/trunk@55922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 21:36:21 +00:00
joedolson
82417a694f Administration: Apply admin notice functions in multisite.
Use `wp_get_admin_notice` and `wp_admin_notice` to handle multisite settings notices.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 21:03:19 +00:00
joedolson
d5f3b7feab Administration: Add function to standardize admin notices.
Add functions `wp_get_admin_notice()` and `wp_admin_notice()` to create and output admin notices & tests for usage. New functions accept a message and array of optional arguments. This commit does not implement the functions. Include new filters: `wp_admin_notice_args`, `wp_admin_notice_markup` and action: `wp_admin_notice`. 

Props joedolson, costdev, sakibmd, dasnitesh780, sabernhardt.
Fixes #57791.
Built from https://develop.svn.wordpress.org/trunk@56408


git-svn-id: http://core.svn.wordpress.org/trunk@55920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 20:29:21 +00:00
Sergey Biryukov
a26771b347 Site Health: Correct the check for disk space available to safely perform updates.
If the available disk space exceeds the `PHP_INT_MAX` value, i.e. a 32-bit PHP version is in use with more than 2 GB free, the type casting to `(int)` could cause an overflow, and the Site Health test would then erroneously report that there is not enough free space. 

This commit removes the unnecessary type casting and uses the result from `disk_free_space()` directly.

Includes optimizing the logic to skip further checks if the available disk space could not be determined.

Follow-up to [55720].

Props mathsgrinds, Presskopp, rajinsharwar, SergeyBiryukov.
Fixes #59116.
Built from https://develop.svn.wordpress.org/trunk@56401


git-svn-id: http://core.svn.wordpress.org/trunk@55913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 11:18:21 +00:00
Sergey Biryukov
caddf7e3dc Coding Standards: Use strict comparison in wp-admin/includes/image-edit.php.
Follow-up to [11911], [11965], [11984], [12155], [12163], [22094].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55912 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-16 14:05:20 +00:00
Sergey Biryukov
832b4660fd Docs: Fix typo in duplicate hook references for views_{$this->screen->id}.
Follow-up to [29218], [29625].

Props nithins53, NekoJonez, mukesh27.
Fixes #59102. See #58833.
Built from https://develop.svn.wordpress.org/trunk@56397


git-svn-id: http://core.svn.wordpress.org/trunk@55909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-15 10:09:24 +00:00
Sergey Biryukov
356e6cac57 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-importer.php.
Follow-up to [14760], [50658].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-14 09:59:20 +00:00
davidbaumwald
2ecfc4f9a0 Upgrade/Install: Update $_old_files for 6.3.
Props SergeyBiryukov.
Fixes #58994.
Built from https://develop.svn.wordpress.org/trunk@56365


git-svn-id: http://core.svn.wordpress.org/trunk@55877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-07 17:21:29 +00:00
hellofromTonya
65da089d96 Code Modernization: Use "declare" in WP_List_Table magic methods deprecation message
Changes "define" to "declare" in the deprecation message in `WP_List_Table` magic methods.

Why is "declare" better?
It aligns well to:

* the topic of and published information about dynamic properties.
* the act of explicitly listing the variable as a property on the class.

The goal of this message is guide developers to change their code. Changing the term to "declare" hopefully will aid in the understanding of what is being asked of developers when this deprecation is thrown.

Follow-up [56349].

Props hellofromTonya, antonvlasenko.
Fixes #58896.
Built from https://develop.svn.wordpress.org/trunk@56356


git-svn-id: http://core.svn.wordpress.org/trunk@55868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 19:52:22 +00:00
hellofromTonya
50274fbc2b Code Modernization: Deprecate dynamic properties in WP_List_Table magic methods.
The unknown use of unknown dynamic property within the `WP_List_Table` property magic methods is now deprecated. A descriptive deprecation notice is provided to alert developers to declare the property on the child class extending `WP_List_Table`.

Changes in this commit:
* Adds a deprecation notice to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods, i.e. to alert and inform developers when attempting to get/set/isset/unset a dynamic property.
* Fixes `__get()` to explicitly returns `null` when attempting to get a dynamic property.
* Removes returning the value when setting a declared property, as (a) unnecessary and (b) `__set()` should return `void` [https://www.php.net/manual/en/language.oop5.overloading.php#object.set per the PHP handbook].
* Adds unit tests for happy and unhappy paths.

For backward compatibility, no changes are made to the internal declared properties listed in `$compat_fields` and accessed through the magic methods. 

For example:
A child class uses a property named `$data` that is not declared / defined as a property on the child class. When getting its value, e.g. `$list_table->data`, the `WP_List_Table::__get()` magic method is invoked, the following deprecation notice thrown, and `null` returned:

>The property `data` is not defined. Setting a dynamic (undefined) property is deprecated since version 6.4.0! Instead, define the property on the class.

=== Why not remove the magic methods, remove the `$compat_fields` property, and restore the properties `public`?

tl;dr Backward compatibility.

Several plugins, one of which has over 5M installs, add a property to the `$compat_fields` array. Removing the property would cause an `Undefined property` `Warning` (PHP 8) | `Notice` (PHP 7) to be thrown. Removing the associated code would change the functionality.

=== Why not limit the deprecation for PHP versions >= 8.2?

tl;dr original design intent and inform

The magic methods and `$compat_fields` property were added for one purpose: to continue providing external access to internal properties declared on `WP_List_Table`. They were not intended to be used for dynamic properties.

Deprecating that unintended usage both alerts developers a change is needed in their child class and informs them what to change.

References: 
* Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
* A [https://www.youtube.com/live/vDZWepDQQVE?feature=share&t=10097 live open public working session] where these changes were discussed and agreed to.
* [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties.]

Related to #14579, #22234, #30891.

Follow-up to [15491], [28493], [28521], [28524], [31146].

Props antonvlasenko, jrf, markjaquith, hellofromTonya, SergeyBiryukov, desrosj, peterwilsoncc, audrasjb, costdev, oglekler, jeffpaul.
Fixes #58896.
See #56034.
Built from https://develop.svn.wordpress.org/trunk@56349


git-svn-id: http://core.svn.wordpress.org/trunk@55861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-02 18:37:21 +00:00
Sergey Biryukov
9dc13e98d7 Site Health: Use PHP_SAPI constant instead of the php_sapi_name() function.
This is a micro-optimization that removes an unnecessary function call.

Follow-up to [44986], [45156].

Props ayeshrajans, jrf, mukesh27, rmccue.
Fixes #58942.
Built from https://develop.svn.wordpress.org/trunk@56346


git-svn-id: http://core.svn.wordpress.org/trunk@55858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-02 10:59:25 +00:00
Sergey Biryukov
1364db92bb Upgrade/Install: Pass stored credentials to WP_Filesystem() where appropriate.
With the introduction of temporary backups of plugins and themes before updating, a new Site Health test was added to verify that plugin and theme temporary backup directories are writable or can be created.

When using a non-direct filesystem, the Site Health test did not include the required credentials, leading to a fatal error as the connection was not initialized properly.

This commit attemps to use the stored credentials if available, and displays a message otherwise.

Includes a similar fix in a function that performs a cleanup of the temporary backup directory.

Follow-up to [55720].

Props utsav72640, rajinsharwar, costdev, mukesh27, peterwilsoncc, audrasjb, SergeyBiryukov.
See #58940.
Built from https://develop.svn.wordpress.org/trunk@56341


git-svn-id: http://core.svn.wordpress.org/trunk@55853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 16:07:25 +00:00
ryelle
f5730be053 Administration: Update dashboard welcome panel for 6.3.
Update the background image and styles for the Welcome Panel. This iteration does not use different colors on the admin color schemes, so the CSS for that has been removed. This also adds back in a working "Edit styles" link, which was removed in 6.2 because the link was broken.

Props richtabor, markoserb.
Fixes #58545.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-24 23:15:23 +00:00
joedolson
c619a3d450 Media: Fix height max value in image scaling.
Set the `max` attribute in the height input for image scaling to reference the image height, instead of the width. Follow up to [55919].

Props costdev, joedolson, joemcgill.
Fixes #50523.
Built from https://develop.svn.wordpress.org/trunk@56277


git-svn-id: http://core.svn.wordpress.org/trunk@55789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-21 14:33:22 +00:00
Sergey Biryukov
55ab72cf12 I18N: Add missing translator comment in WP_Upgrader::generic_strings().
This resolves a WPCS warning:
> A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.

Includes moving `wp-content` out of the translatable string in a similar message in `_wp_delete_all_temp_backups()`.

Follow-up to [55720], [56117].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-21 13:33:27 +00:00
Sergey Biryukov
3a065bfb2c 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 [55971], [56033], [56056], [56143], [56214].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-20 00:06:21 +00:00
Sergey Biryukov
c0f28e113c Docs: Add a missing word in maybe_create_table() description.
Follow-up to [31246].

Props crstauf, james0r.
Fixes #58841.
Built from https://develop.svn.wordpress.org/trunk@56270


git-svn-id: http://core.svn.wordpress.org/trunk@55782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-19 11:33:26 +00:00
Sergey Biryukov
45cf0edf28 Administration: Add a missing closing </span> tag for column sorting indicators.
Includes wrapping a few other long markup lines for better readability.

Follow-up to [55971], [56004], [56260].

See #32170, #57839.
Built from https://develop.svn.wordpress.org/trunk@56261


git-svn-id: http://core.svn.wordpress.org/trunk@55773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-18 14:09:21 +00:00
Sergey Biryukov
c0adc40452 Coding Standards: Use strict comparison for static strings in wp-admin/includes/class-wp-list-table.php.
Follow-up to [55971], [56004].

See #32170, #57839.
Built from https://develop.svn.wordpress.org/trunk@56260


git-svn-id: http://core.svn.wordpress.org/trunk@55772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-18 14:05:29 +00:00
spacedmonkey
e0eaffdd3c Upgrade/Install: Add correct parameters to add_option in upgrade_630
Introduced in [55854], `upgrade_630` function was introduced to update `can_compress_scripts` option to autoload. However the function `add_option` was invoked incorrectly, passing 3 parameters and not 4. The third parameter, which is deprecated, triggers a  deprecated argument warning. In this change, pass 4 parameters instead of 3. 

Props gudmdharalds, spacedmonkey, costdev, mukesh27.
Fixes #58821.
Built from https://develop.svn.wordpress.org/trunk@56258


git-svn-id: http://core.svn.wordpress.org/trunk@55770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-18 10:09:29 +00:00
Sergey Biryukov
59f1c9c205 Code Modernization: Use str_contains() in a few more places.
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [55988], [55990], [56014], [56021], [56031], [56032], [56065], [56241].

See #58206.
Built from https://develop.svn.wordpress.org/trunk@56245


git-svn-id: http://core.svn.wordpress.org/trunk@55757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-17 13:18:27 +00:00
Andrew Ozz
fe0920e0a3 Menus: Fix critical errors when the page_on_front and/or page_for_posts options contain references to non-existing posts.
props: hbhalodia, wplindavantol, josklever, audrasjb.
Fixes: #58345.
Built from https://develop.svn.wordpress.org/trunk@56236


git-svn-id: http://core.svn.wordpress.org/trunk@55748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-14 21:47:22 +00:00
joedolson
61c7af563a Media: Set default state for image rotation button.
Adds `aria-expanded="false"` as default state for image rotation toggle in admin image editor. See #50523.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-13 16:42:27 +00:00
audrasjb
897d9c221e I18n: Improve the use of dashicons-external icon for external links.
This changeset modifies how the `dashicons-external` icon is used in external links by editing its styles and adding a space between the text and the icon 
for better accessibility.

Props SergeyBiryukov, afercia, isabel_brison, mukesh27, sabernhardt, oglekler, audrasjb.
Fixes #47303.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-11 12:59:25 +00:00
isabel_brison
bf41190659 General: fix botched file move in r56199.
Moves `src/wp-admin/includes/theme-previews.php` to `src/wp-includes/theme-previews.php`.

Props peterwilsoncc.
See #58712.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-11 05:19:23 +00:00
isabel_brison
1ee477dbe4 General: add nonce for block theme preview activation.
Adds a nonce so that activation works for block theme previews. Temporary fix until there is a REST API endpoint for activating themes.

Props scruffian, peterwilsoncc, nithins53, nithi22, jomonthomaslobo1, poena, syamraj24, vivekawsm, mrinal013.
Fixes #58712.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-11 05:03:23 +00:00
Andrew Ozz
c319239bc3 Filesystem API: Ensure wp_tempnam() does not produce file names longer than 255 characters as this is the limit on most filesystems.
Props: costdev, doems, mikeschroder, oglekler, mrinal013.
Fixes: #35755.
Built from https://develop.svn.wordpress.org/trunk@56186


git-svn-id: http://core.svn.wordpress.org/trunk@55698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-10 20:33:23 +00:00
audrasjb
145060e3c0 Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175].

Props costdev, audrasjb.
See #58459.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 20:07:22 +00:00
audrasjb
7b853d4b69 Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Props costdev, audrasjb.
See #58459.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 19:52:24 +00:00
John Blackbourn
974d2e18ec Docs: Correct the formatting of various filter documentation.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-07 00:36:22 +00:00
audrasjb
e952b31145 Users: Remove password reset links when the feature is not allowed for a specific user.
This also introduces `wp_is_password_reset_allowed_for_user()` which returns `false` when password reset is not allowed for a specific user. This can be 
filtered by developers using the existing `allow_password_reset` hook.

Props ocean90, cshark, robinwpdeveloper, tahmina1du, kraftbj.
Fixes #58194.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-06 12:47:23 +00:00
Sergey Biryukov
8695849124 Docs: Document the return value of wp_check_php_version() using hash notation.
Follow-up to [42832].

See #57840.
Built from https://develop.svn.wordpress.org/trunk@56144


git-svn-id: http://core.svn.wordpress.org/trunk@55656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-06 00:16:23 +00:00
Sergey Biryukov
3ff68df981 Upgrade/Install: Initialize the local $checkout variable in WP_Automatic_Updater::is_vcs_checkout().
This avoids an `Undefined variable $checkout` PHP warning if all of the directories checked for access are disallowed due to the PHP `open_basedir` restrictions.

Follow-up to [55425].

Props jqz, costdev, audrasjb.
Fixes #58563.
Built from https://develop.svn.wordpress.org/trunk@56124


git-svn-id: http://core.svn.wordpress.org/trunk@55636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-02 10:35:23 +00:00
audrasjb
9e1170351e Quick/Bulk Edit: Ensure scheduled posts are published when using Bulk Edit.
This changeset ensures scheduled posts are actually published when changing their status to "Published" using bulk edit. Also adds related unit tests.

Props siobhan, Clorith, webcommsat, cadic, oglekler, audrasjb, pavanpatil1.
Fixes #31635.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-02 08:04:21 +00:00
Sergey Biryukov
7992c49b5f Site Health: Correct the label for wp-content directory check.
This removes HTML tags from the label, which were not displayed as expected due to escaping. Including the directory name in the label is also redundant, as it is already mentioned in the check result description directly below.

Includes:
* Adjusting a few other labels for consistency.
* Moving `wp-content` out of the translatable string in a similar message in `WP_Upgrader::generic_strings()`.

Follow-up to [55720].

Props dlh, mukesh27, audrasjb, SergeyBiryukov.
See #58678.
Built from https://develop.svn.wordpress.org/trunk@56117


git-svn-id: http://core.svn.wordpress.org/trunk@55629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-30 11:13:27 +00:00
Sergey Biryukov
86d28672fe Filesystem API: Define password as null if not set when using SSH2 with public/private keys.
This resolves an `Undefined array key "password"` PHP warning in `WP_Filesystem_SSH2::connect()` when using public/private key authentication, in which case providing a password is optional.

Follow-up to [8865].

Props J-Dill, costdev, ehsanakhgari, dd32.
Fixes #33196.
Built from https://develop.svn.wordpress.org/trunk@56111


git-svn-id: http://core.svn.wordpress.org/trunk@55623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-29 17:05:30 +00:00
Sergey Biryukov
d33f37603e Quick/Bulk Edit: Add an action hook to bulk_edit_posts() function.
This changeset introduces the `bulk_edit_posts` action hook, triggered after processing the post data for bulk edit and before the function returns its results. For example, it allows developers to save additional data without having to perform any `.ajax()` calls.

Follow-up to [8973].

Props helgatheviking, helen, Mte90, afercia, mrasharirfan, desrosj, itowhid06, pento, mensmaximus, audrasjb, costdev, webcommsat, marybaum, oglekler, mukesh27, SergeyBiryukov.
Fixes #28112.
Built from https://develop.svn.wordpress.org/trunk@56091


git-svn-id: http://core.svn.wordpress.org/trunk@55603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-28 13:19:31 +00:00
Andrew Ozz
0a265883b9 Revert use of str_starts_with() and str_contains() in update-core.php.
Fixes updating WordPress from 5.7 and earlier versions. When updating this file runs first in the old version where the polifills may not be available.

Props: ironprogrammer, SergeyBiryukov, dd32, azaozz.
See: #58206.
Built from https://develop.svn.wordpress.org/trunk@56088


git-svn-id: http://core.svn.wordpress.org/trunk@55600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-28 10:09:29 +00:00
Felix Arntz
905cff1733 Site Health: Include new WP_DEVELOPMENT_MODE in the list of constants.
Follow-up to [56042].

Props kebbet.
Fixes #58646.
See #57487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 22:03:29 +00:00
Sergey Biryukov
26a0bf0049 Media: Only show “Copy” and “Download” actions when an attachment URL is available.
Includes unit tests to verify the logic for displaying row actions in the Media Library in certain scenarios, e.g. with and without the “Trash” or “Unattached” filter.

Follow-up to [55949].

Props costdev, kebbet, mukesh27, oglekler.
Fixes #57893.
Built from https://develop.svn.wordpress.org/trunk@56072


git-svn-id: http://core.svn.wordpress.org/trunk@55584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 16:29:28 +00:00
Mike Schroder
58fd744433 Filesystem API: Allow optional inclusion of hidden files in list_files().
Adds a new optional `$include_hidden` parameter to allow the inclusion of hidden (`.` prefixed) files.
Defaults to false for backward compatibility.

Props yani.iliev, sabernhardt, costdev, rutviksavsani, zunaid321, azaozz.
Fixes #53659.
Built from https://develop.svn.wordpress.org/trunk@56069


git-svn-id: http://core.svn.wordpress.org/trunk@55581 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 16:08:27 +00:00
audrasjb
c11e87fbb8 Plugins: Introduce the plugins_list filter.
This changeset adds the `plugins_list` hook, which can be use to filter the list of plugin displayed on WP Admin Plugins screen.

Props nateallen, fischfood, mukesh27, peterwilsoncc, SergeyBiryukov, audrasjb, costdev, ecorica, zunaid321.
Fixes #57278.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55580 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 16:01:27 +00:00
isabel_brison
fbbe0f0a76 General: add block theme previews.
Adds a preview link to block themes in the themes screen, opening the previews in the site editor.

Props onemaggie, andraganescu, audrasjb, flixos90, peterwilsoncc, spacedmonkey, scruffian.
Fixes #58561.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 09:36:21 +00:00
audrasjb
37ebdb8fa1 Site Health: Add server time debug data.
This changeset adds "Current time, "Current UTC time" and "Current Server time" under the "Server" section of Site Health debug infos. This provides the 
current time, the server time, and allow for comparison if there's some time-related issues.

Props sebastienserre, Clorith, audrasjb, kebbet, robinwpdeveloper, hrrarya, mukesh27, hareesh-pillai, costdev.
Fixes #56378.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 08:04:20 +00:00
spacedmonkey
6adb9be81f Editor: Register core block styles in one place.
Register all core blocks in a new function called `register_core_block_style_handles`. This mirrors the function `wp_default_styles` where all core styles are registered in one place. This improves block registration performance, as it avoids expensive file lookups, like realpath in `register_block_style_handle`. The new function `register_core_block_style_handles` uses `glob` to get all css files in the blocks directory. This glob is cached in a transient to save lookups on subsequent requests. The function `register_block_style_handle` now checks to see if the style handle is already registered before trying to register it again. 

Props mukesh27, westonruter, flixos90, joemcgill, spacedmonkey.
Fixes #58528.
Built from https://develop.svn.wordpress.org/trunk@56044


git-svn-id: http://core.svn.wordpress.org/trunk@55556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 21:17:22 +00:00
Sergey Biryukov
ad16732d27 Code Modernization: Use str_contains() in a few more places.
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

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

See #58206.
Built from https://develop.svn.wordpress.org/trunk@56031


git-svn-id: http://core.svn.wordpress.org/trunk@55543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 10:17:25 +00:00
joedolson
c4a22d5a34 Upgrade/Install: Update 'show details' button change.
Add a up/down arrow for visual affordance about the purpose of the button link; change button text from "Show details" to "More details".

Props krupajnanda, subrataemfluence, audrasjb, afercia, nrqsnchz, joedolson.
Fixes #44714.
Built from https://develop.svn.wordpress.org/trunk@56027


git-svn-id: http://core.svn.wordpress.org/trunk@55539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-25 22:57:26 +00:00
joedolson
abc3ea5422 Administration: Consistent positioning and size of search form.
Move the visual positioning of the posts search form into it's DOM position. Fixes an accessibility bug where the keyboard focus sequence did not match the visual order. Change the media search form in list view to match the format of other post views. Give search forms a consistent layout on mobile.

Props oglekler, sabernhardt, joedolson.
Fixes #57949.
Built from https://develop.svn.wordpress.org/trunk@56023


git-svn-id: http://core.svn.wordpress.org/trunk@55535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-25 17:21:28 +00:00
joedolson
69692d50cb Quick/Bulk Edit: Don't set publish date when editing drafts.
Ensure that quick edit does not define a publish date if the post status is one of 'draft', 'pending', or 'auto-draft'.

Props uxtremist, SergeyBiryukov, Denis-de-Bernardy, jane, rfischmann, mista-flo, rutviksavsani, oglekler, joedolson.
Fixes #19907.
Built from https://develop.svn.wordpress.org/trunk@56022


git-svn-id: http://core.svn.wordpress.org/trunk@55534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-25 15:20:22 +00:00
joedolson
b3eb7b301c Editor: Improve accessibility of new custom field UI.
Add labels; change Enter new/Cancel link to a button; move focus to input when creating new field; move Add Custom Field out of fields table. 

Props jane, batmoo, karmatosed, franrosa, sabernhardt, annashopina, oglekler, joedolson.
Fixes #15631.
Built from https://develop.svn.wordpress.org/trunk@56018


git-svn-id: http://core.svn.wordpress.org/trunk@55530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-24 14:32:20 +00:00
joedolson
d1717e60b9 Administration: Backwards compatibility for new sortable keys.
Replace use of `list` to parse array keys into variables. `list` throws errors if the keys don't exist, and many extenders will not define the new array keys. The code path already falls back effectively for empty values.

Also add translator comments to screen reader hidden text, fix a docblock, and fix an HTML error.

Follow up to [r55971].

Props kebbet, chouby, joedolson.
Fixes #32170.
Built from https://develop.svn.wordpress.org/trunk@56004


git-svn-id: http://core.svn.wordpress.org/trunk@55516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-23 17:49:28 +00:00
Sergey Biryukov
84e9601e5a Code Modernization: Replace usage of substr() with str_starts_with() and str_ends_with().
`str_starts_with()` and `str_ends_with()` were introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins or ends with the given substring (needle).

WordPress core includes a polyfill for these functions on PHP < 8.0 as of WordPress 5.9.

This commit uses `str_starts_with()` and `str_ends_with()` in core files where appropriate:
* `$needle === substr( $string, 0, $length )`, where `$length` is the length of `$needle`, is replaced with `str_starts_with( $haystack, $needle )`.
* `$needle === substr( $string, $offset )`, where `$offset` is negative and the absolute value of `$offset` is the length of `$needle`, is replaced with `str_ends_with( $haystack, $needle )`.

This aims to make the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [52039], [52040], [52326], [55703], [55710], [55987], [55988].

Props Soean, spacedmonkey, Clorith, ocean90, azaozz, sabernhardt, SergeyBiryukov.
Fixes #58220.
Built from https://develop.svn.wordpress.org/trunk@55990


git-svn-id: http://core.svn.wordpress.org/trunk@55502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:57:24 +00:00
Sergey Biryukov
1ce5dc7444 Code Modernization: Replace usage of strpos() with str_contains().
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].

Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #58206.
Built from https://develop.svn.wordpress.org/trunk@55988


git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:36:26 +00:00
audrasjb
a8efd010bd Help/About: Improve Dashboard screen options behavior on small screens.
This changeset improve Dashboard screen options by stacking them vertically on small screens.

Props dhrumilk, prashantbhivsane, marybaum, dhruvishah2203, ababir, mukesh27, chiragrathod103, oglekler, tb1909, jahidcse, audrasjb.
Fixes #57977.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 07:54:23 +00:00
audrasjb
017d2df5d0 Administration: Replace contracted verb forms for better consistency.
Previously: [52979], [52978].
Props sabernhardt.
See #30796.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 05:25:29 +00:00
joedolson
fd17918a8a Administration: Set accessible state for list table headers.
Implement `aria-sort` and change icon states to indicate current sort for list tables. Allow screen reader users to get context about the current sort and allow sighted users to know how the table is currently sorted.

Props afercia, rianrietveld, joedolson, alexstine, johnjamesjacoby.
Fixes #32170.
Built from https://develop.svn.wordpress.org/trunk@55971


git-svn-id: http://core.svn.wordpress.org/trunk@55483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 21:47:23 +00:00
joedolson
7a4251fae4 Administration: Make checkbox column clickable.
Change the `label` for `.check-column` inside list tables to a block filling the entire cell. Improves accessibility by increasing the target area for the control.

Props mitchoyoshitaka, lessbloat, sabernhardt, ogleker, tacoverdo, joostdevalk, karmatosed.

Fixes #21516.
Built from https://develop.svn.wordpress.org/trunk@55954


git-svn-id: http://core.svn.wordpress.org/trunk@55466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 01:54:19 +00:00
Sergey Biryukov
b1fed29f55 Media: Display the “Copy URL” and “Download file” row actions when the “Unattached” filter is applied.
Due to partially duplicated logic for displaying row actions in the Media Library with and without the “Unattached” filter, the “Copy URL” and “Download file” row actions were unintentionally missing with the filter applied.

This commit aims to simplify the logic and bring more consistency to the code.

Includes displaying the “Download file” row action even when the “Trash” filter is applied, giving the user one more chance to download the media file before they delete it.

Follow-up to [8901], [13100], [16227], [16229], [52842], [55198], [55221].

Props kebbet, costdev, pbiron, oglekler, SergeyBiryukov.
Fixes #57890, #57893.
Built from https://develop.svn.wordpress.org/trunk@55949


git-svn-id: http://core.svn.wordpress.org/trunk@55461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-20 15:47:21 +00:00
John Blackbourn
acc6e5d685 General: Replace some instances of "blog" with "site" in documentation, translator comments, and user-facing text strings.
This is not an exhaustive change, but it gets us closer to using "site" in place of "blog" in as many places as possible.

Props NekoJonez, audrasjb, oglekler

Fixes #58117

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


git-svn-id: http://core.svn.wordpress.org/trunk@55454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-19 18:27:27 +00:00
Peter Wilson
3d94d17402 Filesystem API: Attempt to create directory in copy_dir().
Adds a check to the start of `copy_dir()` that the destination directory exists and attempts to create it if it does not.

An error is returned if the directory can not be created, either due to a permissions error or the parent directory not existing.

Props caraffande, costdev, zunaid321.
Fixes #41855.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-19 02:00:19 +00:00
joedolson
888f082871 Media: Remove duplicate div containers.
Follow-up to [55919]. Remove two hidden divs accidentally duplicated in patch refreshing.

Props azaozz.
Fixes #50523.
Built from https://develop.svn.wordpress.org/trunk@55936


git-svn-id: http://core.svn.wordpress.org/trunk@55448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-18 16:11:18 +00:00
Andrew Ozz
5c10f75f9e Media: Deprecate the 'edit_custom_thumbnail_sizes' filter and disable the "Apply changes to [Thumbnail|All|All except thumbnail]" UI in the image editor. Add a (boolean) filter to reenable that UI.
Props peterwilsoncc, costdev, azaozz.
See: #57685.
Built from https://develop.svn.wordpress.org/trunk@55935


git-svn-id: http://core.svn.wordpress.org/trunk@55447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-18 14:24:20 +00:00
joedolson
9b15db20d3 Media: Update admin image editor design.
Significant restructure of the admin image editor interface, but no new functionality. Reorganize editing buttons into a common region at the top of the editor. Move image rotation tools into a pop-out menu. Add 180 degree rotation option. Add scale button to control group. Move sidebar tools next to the editing canvas to improve visual proximity between action and result. Enlarge editing canvas and crop handles. Separate activating crop functions from applying crop. Add numeric inputs for crop & scale values. 

A long term goal is to move undo/redo and cancel/save into the modal title bar, but that is not feasible without significant updates to the modal framework.

Props afercia, karmatosed, nrqsnchz, antpb, chaion07, costdev, peterwilsoncc, antpb, sabernhardt, prashantbhivsane, joedolson.
Fixes #50523.
Built from https://develop.svn.wordpress.org/trunk@55919


git-svn-id: http://core.svn.wordpress.org/trunk@55431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-14 20:42:27 +00:00
audrasjb
3ce7c7e435 Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards.
Follow-up to [55911].

Props costdev, audrasjb.
See #57840.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-14 12:57:20 +00:00
audrasjb
5be9311067 Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards.
Props costdev, audrasjb.
See #57840.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-14 06:34:27 +00:00
audrasjb
116d5d03c3 Plugins: Display Auto-updates filters when the current view is "Must Use" or "Drop-in".
This changeset fixes a bug where the "Auto-updates Enabled/Disabled" filters were not showing when the current view is "Must Use" or "Drop-in".

Props NekoJonez, pbiron, costdev, audrasjb.
Fixes #54309.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-10 05:30:22 +00:00
audrasjb
b05a629f8b Upgrade/Install: Improve WP_Upgrader strings rendering on small screens.
This changeset adds a `pre` class to "Downloading update from…" user facing strings located in `Core_Upgrader`, `Language_Pack_Upgrader`, `Plugin_Upgrader` and 
`Theme_Upgrader` classes.

Follow-up to [11295].

Props sumitsingh, costdev.
Fixes #58477.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-08 14:18:21 +00:00
Dominik Schilling
dbf0e1bf9e Query: Allow queries by wp_dashboard_recent_posts() to be cached.
Set the `cache_results` argument to `true` for `WP_Query` to ensure the posts queries on the dashboard can also be cached.

Props benjgrolleau.
Fixes #57055.
Built from https://develop.svn.wordpress.org/trunk@55895


git-svn-id: http://core.svn.wordpress.org/trunk@55407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-08 10:02:24 +00:00
audrasjb
8c533a8442 Docs: Various docblock improvements in Custom Header Image related functions, as per docblocks standards.
See #57840.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55394 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-05 21:35:20 +00:00
audrasjb
6279dc749b I18N: Provide gettext context to disambiguate various translation strings.
This changeset adds context to various strings:
- `'Background'` string when referring to Custom Background appearance screens
- `'Header'` string when referring to Custom Header appearance screens
- `'General'`, `'Header'` and `'Footer'` strings when referring to template part areas

Props gonzomir, SergeyBiryukov, mukesh27, costdev, ankitmaru.
Fixes #58424.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-05 21:05:22 +00:00
Sergey Biryukov
eaafce587e Coding Standards: Use strict comparison in wp-admin/includes/update.php.
Includes minor code layout fixes for better readability.

Follow-up to [9441], [25540].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-01 15:14:27 +00:00
Sergey Biryukov
3d1140c898 Coding Standards: Use strict comparison in wp-admin/includes/menu.php.
Includes minor code layout fixes for better readability.

Follow-up to [3536], [4093], [9578], [11092], [18034].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-31 14:53:26 +00:00
John Blackbourn
f3b93e6b3a Media: Correct the fallback value passed to the $mimes parameter of wp_check_filetype_and_ext() from _wp_handle_upload(), and update corresponding documentation.
Previously when the `mimes` element was not specified in the overrides array passed to `_wp_handle_upload()` it resulted in boolean false being passed to this parameter, which is incorrect. The fallback value should be `null`.

Props platonkristinin, pkbhatt

Fixes #58349

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


git-svn-id: http://core.svn.wordpress.org/trunk@55384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-30 19:46:22 +00:00
Sergey Biryukov
37e599fb3e Upgrade/Install: Avoid an extra database query in populate_network().
This moves the query for user ID of the new network's administrator closer to where the value is actually used.

Includes removing unnecessary `get_userdata()` call, as user ID is the only data needed here.

Follow-up to [12756], [35575], [43628].

Props nihar007, sakibmd, mukesh27, costdev, SergeyBiryukov.
Fixes #58423.
Built from https://develop.svn.wordpress.org/trunk@55869


git-svn-id: http://core.svn.wordpress.org/trunk@55381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-30 14:34:22 +00:00
Sergey Biryukov
f4b232f74c Coding Standards: Use strict comparison in wp-admin/includes/schema.php.
Follow-up to [12756], [12862], [12880], [13070], [14485], [17928], [18899], [41348], [43628].

Props faisalahammad, aristath, poena, afercia, SergeyBiryukov.
Fixes #58042, #58047. See #57839.
Built from https://develop.svn.wordpress.org/trunk@55866


git-svn-id: http://core.svn.wordpress.org/trunk@55378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-29 16:26:22 +00:00
Sergey Biryukov
4581452e2b Users: Make sure bulk actions are only executed with the Apply button, not Change.
The Change button is supposed to perform the “Change role to...” action only, but could unintentionally be used for other bulk actions if the role was not selected.

This commit removes an extra check and ensures the correct error message is displayed in that case:

 Sorry, you are not allowed to give users that role.

Follow-up to [6990], [8691], [9028], [15576], [15642], [34636], [49944].

Props haritpanchal, costdev, ankit-k-gupta, SergeyBiryukov.
Fixes #57952.
Built from https://develop.svn.wordpress.org/trunk@55864


git-svn-id: http://core.svn.wordpress.org/trunk@55376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-28 11:46:24 +00:00
antpb
d4c39df308 Media: Prevent scaling up of images in the Image Editor.
Previously, when scaling an image larger than the source size in the image edit states the image would silently fail the scaling action. This patch provides an error when someone attempts to scale an image larger than the source size while also disabling the button to initiate the action. 

Props brookedot, joedolson, markoheijnen, mikeschroder, desrosj, Mista-Flo, costdev.
Fixes #26381.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-25 15:17:19 +00:00
Sergey Biryukov
956be813b6 Coding Standards: Improve formatting of some SQL queries for better readability.
This corrects the placement of double quotes around the query and makes sure the alignment is consistent.

Props umeshmcakadi, mukesh27, krupalpanchal, dhrumilk, SergeyBiryukov.
Fixes #58372.
Built from https://develop.svn.wordpress.org/trunk@55857


git-svn-id: http://core.svn.wordpress.org/trunk@55369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-25 12:55:19 +00:00
spacedmonkey
d8c4000c53 Comments: Move wp_queue_comments_for_comment_meta_lazyload function to the correct file.
As of [55855] wp_queue_comments_for_comment_meta_lazyload was deprecated. But deprecate to wp-admin/deprecated.php and not wp-includes/deprecated.php.This is incorrect, as this is a public function and not an admin function. 

Props SergeyBiryukov, spacedmonkey.
See #58301.
Built from https://develop.svn.wordpress.org/trunk@55856


git-svn-id: http://core.svn.wordpress.org/trunk@55368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-25 10:55:19 +00:00
spacedmonkey
3c5d179fc9 Comments: Deprecate wp_queue_comments_for_comment_meta_lazyload function.
As of [55749] wp_queue_comments_for_comment_meta_lazyload is no longer used in core. This commit, deprecates this function. Update docs and tests accordingly.

Props sh4lin, spacedmonkey, costdev, peterwilsoncc.
Fixes #58301.
Built from https://develop.svn.wordpress.org/trunk@55855


git-svn-id: http://core.svn.wordpress.org/trunk@55367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-25 10:31:23 +00:00
spacedmonkey
2cd27b2349 Options, Meta APIs: Change the option can_compress_scripts to be autoloaded.
Ensure that the option `can_compress_scripts` is autoloaded on single sites, as this option is used in all requests. This change saves one database query per page request. 

Props RavanH, spacedmonkey, costdev, azaozz, flixos90.
Fixes #55270.
Built from https://develop.svn.wordpress.org/trunk@55854


git-svn-id: http://core.svn.wordpress.org/trunk@55366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-24 17:35:18 +00:00
Sergey Biryukov
e182459c6d Administration: Add missing escaping for CSS classes on the body tag in the admin.
Follow-up to [5892], [10823], [10868], [18882], [21014], [22000], [48060].

Propos rafiem, costdev, dd32, audrasjb, westonruter, SergeyBiryukov.
Fixes #58336.
Built from https://develop.svn.wordpress.org/trunk@55846


git-svn-id: http://core.svn.wordpress.org/trunk@55358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-22 14:16:19 +00:00
Sergey Biryukov
046b9afcb7 Docs: Fix a few more typos in DocBlocks and inline comments.
Follow-up to [6779], [10565], [12023], [25224], [27533], [32806], [34777], [45262], [46594], [55823], [55824].

Props Presskopp.
See #57840.
Built from https://develop.svn.wordpress.org/trunk@55827


git-svn-id: http://core.svn.wordpress.org/trunk@55339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-19 13:27:20 +00:00
Sergey Biryukov
be4b739a49 Docs: Fix a few more typos in inline comments.
Follow-up to [9117], [11005], [12097], [18632], [26192], [55823].

Props Presskopp.
See #58334, #57840.
Built from https://develop.svn.wordpress.org/trunk@55824


git-svn-id: http://core.svn.wordpress.org/trunk@55336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-18 12:36:24 +00:00
Sergey Biryukov
5f054d2079 Docs: Fix typo in a comment in Bulk_Upgrader_Skin::header() and ::footer().
Follow-up to [13602].

Props kamplugins, costdev, mukesh27, afragen.
Fixes #58334.
Built from https://develop.svn.wordpress.org/trunk@55823


git-svn-id: http://core.svn.wordpress.org/trunk@55335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-18 11:37:27 +00:00
Weston Ruter
4c2394eed5 General: Use static on closures whenever $this is not used to avoid memory leaks.
Props westonruter, jrf, spacedmonkey.
Fixes #58323.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-17 22:46:24 +00:00
audrasjb
d9d303f812 Media: Prevent CSRF setting attachment thumbnails.
Props martinkrcho, paulkevan, peterwilsoncc, xknown, peterwilsoncc.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-16 14:27:21 +00:00
audrasjb
a0bcd7d56a Docs: Clarify @param types on get_sample_permalink_html filter.
`$new_title` and `$new_slug` can be null if `get_sample_permalink_html()` 
was called with default parameters, and they are documented as 
`string|null` in the function DocBlock.

Follow-up to [34347].

Props Enchiridion, audrasjb, SergeyBiryukov.
Fixes #58322.
See #33927. --Cette ligne, et les 
suivantes 
ci-dessous, seront ignorées--

M    trunk/src/wp-admin/includes/post.php

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


git-svn-id: http://core.svn.wordpress.org/trunk@55270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-16 05:25:23 +00:00
Sergey Biryukov
fe928b2e9a General: Remove a few is_object() checks followed by instanceof operator.
This is a minor performance enhancement:

* If an object is passed, the call to `is_object()` will be redundant.
* If a non-object is passed, the `instanceof` operator (a variant of `is_a()`) will first [https://github.com/php/php-src/blob/f42992f/Zend/zend_builtin_functions.c#L630-L631 check if it is an object] before doing any further processing.

Therefore, no additional processing cycles should be wasted in both cases.

Follow-up to [6779], [48798], [48905], [49194], [55748].

Props Presskopp, costdev.
Fixes #58309.
Built from https://develop.svn.wordpress.org/trunk@55757


git-svn-id: http://core.svn.wordpress.org/trunk@55269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-15 10:28:23 +00:00
John Blackbourn
a714bc03ee Docs: Various corrections and improvements to inline docs and docblocks.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-12 21:35:21 +00:00
audrasjb
ad55717715 I18N: Replace "Roll back" with "Restore" in user facing strings.
The terms "roll back" and "rolled back" are used in user facing strings since [55720]. These termes are not that clear for novice users and may be difficult to translate in some locales. This changeset replaces "roll back" with "restore" and "rolled back" with "restored" or "not applied" depending of the context of the screen.

Follow-up to [55720].

Props kebbet, costdev, NekoJonez, audrasjb, SergeyBiryukov, davidbaumwald.
Fixes #58282.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-11 14:50:20 +00:00
spacedmonkey
fda9000c7b Comments: Always lazily load comment meta.
In [34270] introduced lazy loading of comment meta. However, this was only in the context of `WP_Query`. Other parts of the codebase, like `WP_Comment_Query` did not lazily load comment meta. In this change, calls to `update_meta_cache` are now replaced with `wp_lazyload_comment_meta`, that instead of priming comment meta caches, just adds them to the queue to be primed it ever called. This results in far less database queries, as there a number of places where comment meta is being primed unnecessarily and never used. Adding everything to the comment meta queue, also means that if comment meta is used, that is all loaded in a single database / cache call.

Follow on from [55671], [55747].

Props spacedmonkey, peterwilsoncc, flixos90, mukesh27.
Fixes #57801.
Built from https://develop.svn.wordpress.org/trunk@55749


git-svn-id: http://core.svn.wordpress.org/trunk@55261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-11 12:27:22 +00:00
John Blackbourn
5ef972680a Docs: A host of corrections and improvements to inline documentation.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-08 22:37:24 +00:00
Sergey Biryukov
7e9421e4d0 Upgrade/Install: Create a temporary backup of plugins and themes before updating.
This aims to make the update process more reliable and ensures that if a plugin or theme update fails, the previous version can be safely restored.

* When updating a plugin or theme, the old version is moved to a temporary backup directory:
 * `wp-content/upgrade-temp-backup/plugins/[plugin-slug]` for plugins
 * `wp-content/upgrade-temp-backup/themes/[theme-slug]` for themes.

* If the update fails, then the backup kept in the temporary backup directory is restored to its original location.
* If the update succeeds, the temporary backup is deleted.

To further help troubleshoot plugin and theme updates, two new checks were added to the Site Health screen:
* A check to make sure that the `upgrade-temp-backup` directory is writable.
* A check that there is enough disk space available to safely perform updates.

To avoid confusion: The temporary backup directory will NOT be used to “roll back” a plugin to a previous version after a completed update. This directory will simply contain a transient backup of the previous version of a plugin or theme being updated, and as soon as the update process finishes, the directory will be empty.

Follow-up to [55204], [55220].

Props afragen, costdev, pbiron, azaozz, hellofromTonya, aristath, peterwilsoncc, TJNowell, bronsonquick, Clorith, dd32, poena, TimothyBlynJacobs, audrasjb, mikeschroder, a2hosting, KZeni, galbaras, richards1052, Boniu91, mai21, francina, TobiasBg, desrosj, noisysocks, johnbillion, dlh, chaion07, davidbaumwald, jrf, thisisyeasin, ignatggeorgiev, SergeyBiryukov.
Fixes #51857.
Built from https://develop.svn.wordpress.org/trunk@55720


git-svn-id: http://core.svn.wordpress.org/trunk@55232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-04 02:36:23 +00:00
John Blackbourn
bd393654cc Filesystem API: Correct and improve the return type documentation for the dirlist() method in WP_Filesystem_Base and its extending classes.
Props mat-lipe, szepeviktor, costdev, audrasjb, johnbillion

Fixes #58229
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-03 21:30:19 +00:00
audrasjb
59e90bba48 Docs: Various improvements in Bookmark Administration API function descriptions, as per docblocks standards.
Follow-up to [55704].

See #57840.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-03 10:03:21 +00:00
audrasjb
66016f2c12 Coding Standards: Remove unnecessary variable escapement in Bookmark Administration API.
This changeset removes an unnecessary `esc_html()` escapement for `link_url`, as `esc_url()` already does the job.

Follow-up to [11383].

Props utsav72640, audrasjb.
Fixes #58239.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-03 09:58:25 +00:00
Sergey Biryukov
2ec23a82ed Code Modernization: Replace usage of strpos() with str_starts_with().
`str_starts_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins with the given substring (needle).

WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `0 === strpos( ... )` with `str_starts_with()` in core files, making the code more readable and consistent, as well as improving performance.

While `strpos()` is slightly faster than the polyfill on PHP < 8.0, `str_starts_with()` is noticeably faster on PHP 8.0+, as it is optimized to avoid unnecessarily searching along the whole haystack if it does not find the needle.

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

Props spacedmonkey, costdev, sabernhardt, mukesh27, desrosj, jorbin, TobiasBg, ayeshrajans, lgadzhev, SergeyBiryukov.
Fixes #58012.
Built from https://develop.svn.wordpress.org/trunk@55703


git-svn-id: http://core.svn.wordpress.org/trunk@55215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-02 15:45:22 +00:00
Sergey Biryukov
9954d0a927 Coding Standards: Break out of the inner loop in make_site_theme_from_default().
This more closely matches the previous behavior with multiple `if`/`elseif` statements.

Follow-up to [55688].

See #56982.
Built from https://develop.svn.wordpress.org/trunk@55698


git-svn-id: http://core.svn.wordpress.org/trunk@55210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-29 18:30:23 +00:00
John Blackbourn
f14f3ba995 Docs: All sorts of improvements and corrections to function and hook docs.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-27 23:15:17 +00:00
John Blackbourn
cc24b047eb Docs: Correct and improve various documented types for properties, functions, and hooks.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-27 22:29:18 +00:00
Sergey Biryukov
ddc749868c Coding Standards: Remove an empty else statement in dbDelta().
Use `continue` to help separate each case for better readability, instead of having a wall of `if`/`elseif`.

Includes simplifying a similar fragment in `make_site_theme_from_default()`.

Follow-up to [1575], [2037], [2040], [2044], [2346], [7999], [14080], [14485].

Props costdev, krunal265, hellofromTonya, brookedot, SergeyBiryukov.
Fixes #56982.
Built from https://develop.svn.wordpress.org/trunk@55688


git-svn-id: http://core.svn.wordpress.org/trunk@55200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-26 15:10:23 +00:00
audrasjb
5afe551668 I18N: Use correct translation function in wp-admin/includes/media.php.
This changeset replaces `echo __()` with the appropriate `_e()` function. It also ensures the punctuation is included in the translation string.

Props mujuonly, audrasjb, vladytimy, krupalpanchal, mukesh27.
Fixes #58138.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-24 21:28:18 +00:00
Sergey Biryukov
4f73468485 Coding Standards: Update code layout in default_password_nag() for readability.
This aims to better match similar fragments in other core functions.

Follow-up to [11162], [13844], [14170], [55682].

See #57839.
Built from https://develop.svn.wordpress.org/trunk@55683


git-svn-id: http://core.svn.wordpress.org/trunk@55195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-24 16:57:20 +00:00
audrasjb
0192ff842c Coding Standards: Escape edit profile URL in default_password_nag().
Props utsav72640, mukesh27.
Fixes #58182.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-24 16:44:19 +00:00
audrasjb
b556c3aa25 Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards.
Props laurentmagnin, pouicpouic, jbcouton, audrasjb.
See #57840.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-24 16:37:22 +00:00
Sergey Biryukov
6f745b9fca Coding Standards: Use strict comparison in wp-admin/includes/class-wp-site-icon.php.
Follow-up to [32994], [35299].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-23 04:02:18 +00:00
Sergey Biryukov
0c5a04d541 Coding Standards: Use strict comparison where strtolower() is involved.
Follow-up to [649], [7736], [18821], [19444], [20886], [20893], [23303], [55642], [55652], [55653], [55654].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-22 15:19:22 +00:00
gziolo
56145f874a Editor: Add selectors field to block type definition
Adds support for the new selectors property for block types. It adds it to the allowed metadata when registering a block type, makes the WP_Block_Type class aware of it, exposes it through the block types REST API, and the get_block_editor_server_block_settings function.

Corresponding work in the Gutenberg plugin: https://github.com/WordPress/gutenberg/pull/46496.

Fixes #57585.
Props aaronrobertshaw, hellofromTonya.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-21 10:43:25 +00:00
Sergey Biryukov
19d36bfdd2 Networks and Sites: Simplify the check for main site on Network Admin → Sites screen.
This replaces a site ID comparison when displaying action links in `WP_MS_Sites_List_Table::handle_row_actions()` with a dedicated function call, `is_main_site()`, for clarity.

Follow-up to [13918], [25125], [26120], [32644], [38814].

Props ecorica, spacedmonkey, SergeyBiryukov.
Fixes #58150.
Built from https://develop.svn.wordpress.org/trunk@55666


git-svn-id: http://core.svn.wordpress.org/trunk@55178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-20 14:30:19 +00:00
Sergey Biryukov
150781cb41 Site Health: Bump the recommended MariaDB version to 10.4.
MariaDB 10.3 reaches EOL (“End of Life”) in May 2023. The recommended minimum is bumped to 10.4 for now.

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

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

Props JavierCasares.
See #58158.
Built from https://develop.svn.wordpress.org/trunk@55665


git-svn-id: http://core.svn.wordpress.org/trunk@55177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-20 13:54:18 +00:00
audrasjb
d52a8492ea Docs: Use third-person singular verbs for WP_Importer related function descriptions, as per docblocks standards.
Props pouicpouic.
See #57840.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-20 10:41:20 +00:00
Sergey Biryukov
cc03c195c1 Coding Standards: Use strict comparison in wp-admin/includes/class-wp-ms-sites-list-table.php.
Includes minor code layout fixes for better readability.

Follow-up to [12603], [32630], [32755], [46441].

Props mujuonly, audrasjb, jankyz, krupalpanchal, SergeyBiryukov.
Fixes #58139.
Built from https://develop.svn.wordpress.org/trunk@55656


git-svn-id: http://core.svn.wordpress.org/trunk@55168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-18 08:37:19 +00:00