Commit Graph

8855 Commits

Author SHA1 Message Date
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
Sergey Biryukov 800b2b4261 Coding Standards: Use strict comparison where `substr()` is involved.
Follow-up to [3606], [10738], [33359], [55642], [55652].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-16 10:48:22 +00:00
Sergey Biryukov bdfe3d5a46 Coding Standards: Use strict comparison where `count()` is involved.
Follow-up to [1636], [6974], [8114], [10322], [13326], [14760], [18006], [18541], [19743], [23249], [24115], [33359].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-10 12:56:21 +00:00
Sergey Biryukov 0008d8df06 Coding Standards: Replace `include_once` with `require_once` for required files.
Per [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#writing-include-require-statements WordPress PHP coding standards], it is ''strongly recommended'' to use `require[_once]` for unconditional includes. When using `include[_once]`, PHP will throw a warning when the file is not found but will continue execution, which will almost certainly lead to other errors/warnings/notices being thrown if your application depends on the file loaded, potentially leading to security leaks. For that reason, `require[_once]` is generally the better choice as it will throw a `Fatal Error` if the file cannot be found.

Follow-up to [1674], [1812], [1964], [6779], [8540], [10521], [11005], [11911], [16065], [16149], [25421], [25466], [25823], [37714], [42981], [45448], [47198], [54276], [55633].

Props kausaralm, SergeyBiryukov.
See #57839.
Built from https://develop.svn.wordpress.org/trunk@55641


git-svn-id: http://core.svn.wordpress.org/trunk@55153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-09 11:57:22 +00:00
audrasjb e63019817f Help/About: Fix the Support Forums URL in `wp-admin/includes/class-wp-site-health.php`.
This updates a link to Support Forums by replacing `https://wordpress.org/support/` URL with `https://wordpress.org/support/forums/`.

Follow-up to [55412], [55413], [55414], [55624], [55625], [55626].

Props sabernhardt, audrasjb.
See #58052, #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-04 23:01:23 +00:00
audrasjb 9fe7d42f6a Help/About: Use the new `/documentation/` URLs for links about WordPress version.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/*` links with `/documentation/*` to avoid extra redirects.

Follow-up to [55412], [55413], [55414].

Props wildworks.
See #58052, #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-04 22:38:22 +00:00
Sergey Biryukov 24f3ba70f5 Upgrade/Install: Include the removed Windows Live Writer manifest in `$_old_files`.
This ensures that the file and a few related images are also removed from existing installations on update.

Follow-up to [55620].

Props ocean90.
Fixes #41404.
Built from https://develop.svn.wordpress.org/trunk@55621


git-svn-id: http://core.svn.wordpress.org/trunk@55133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-04 17:37:25 +00:00
Sergey Biryukov df4ed4015a Coding Standards: Escape the whole attributes in `wp-admin/includes/nav-menu.php`.
It is best to always escape the complete value of an attribute, not a partial value, as otherwise the escaping could be (partially) undone when the values are joined together.

While the hardcoded prefix/suffix values in this case don't necessarily create that risk, those may change to values which could be problematic, so making it a habit to escape the value in one go is best practice.

Includes:
* Moving a few `esc_url()` calls closer to the actual output and escaping the hash parts too.
* Wrapping a few long lines for better readability.

Follow-up to [14248], [23707], [42217], [55615].

Props jrf, SergeyBiryukov.
Fixes #57110.
Built from https://develop.svn.wordpress.org/trunk@55616


git-svn-id: http://core.svn.wordpress.org/trunk@55128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-01 08:37:20 +00:00
Sergey Biryukov 6ccbf0e9bc Coding Standards: Escape some variables in `wp-admin/includes/nav-menu.php`.
This ensures that post type or taxonomy name is consistently escaped in:
* `wp_nav_menu_item_post_type_meta_box()`
* `wp_nav_menu_item_taxonomy_meta_box()`

Follow-up to [14248], [23707].

Props zenaulislam, SergeyBiryukov.
Fixes #57110.
Built from https://develop.svn.wordpress.org/trunk@55615


git-svn-id: http://core.svn.wordpress.org/trunk@55127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-31 16:00:25 +00:00
Dion Hulse 5ce81844a8 Coding Standards: Use the correct variable.
Follow-up to [55593].

See #57318.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-28 05:34:21 +00:00
Sergey Biryukov 79d6ac7fd7 Docs: Clarify the `::hide_process_failed()` return value in plugin and theme installer.
Follow-up to [48390].

Props sakibmd, jrf, patelmohip, akmelias.
Fixes #57680.
Built from https://develop.svn.wordpress.org/trunk@55595


git-svn-id: http://core.svn.wordpress.org/trunk@55107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-27 15:11:20 +00:00
Sergey Biryukov b7ef3ffdd3 Docs: Add missing `@return` tag for `WP_Automatic_Updater::is_disabled()`.
Follow-up to [25421], [25823], [25859].

Props sakibmd, jrf, patelmohip, akmelias.
See #57680.
Built from https://develop.svn.wordpress.org/trunk@55594


git-svn-id: http://core.svn.wordpress.org/trunk@55106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-27 14:13:22 +00:00
Sergey Biryukov 7127052046 Coding Standards: Use strict comparison in `wp-admin/includes/nav-menu.php`.
Follow-up to [14248], [15008], [37748].

Props jenilk, johnbillion.
Fixes #57318.
Built from https://develop.svn.wordpress.org/trunk@55593


git-svn-id: http://core.svn.wordpress.org/trunk@55105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-26 10:06:18 +00:00
Sergey Biryukov 95a52be05d Coding Standards: Use strict comparison in `wp-admin/includes/user.php`.
Follow-up to [10990], [11162], [11217], [37059].

Props jenilk.
Fixes #57317.
Built from https://develop.svn.wordpress.org/trunk@55592


git-svn-id: http://core.svn.wordpress.org/trunk@55104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-25 15:25:26 +00:00
ryelle cee125e1f4 Administration: Update dashboard welcome panel colors, remove broken link
Remove the green background from the "dot" accent, to prevent low contrast for the dismiss button. Use menu colors for the background on alternate color schemes. Remove the "Edit styles" link as there is no longer a direct link to the global styles section of the site editor.

Follow-up to [55451].

Props sabernhardt, ryokuhi, laurlittle, richtabor.
Fixes #57759.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-21 15:37:21 +00:00
Sergey Biryukov 94a1aed064 Coding Standards: Remove unused variable in `WP_Plugins_List_Table::single_row()`.
Follow-up to [47835], [48669].

Props azouamauriac.
Fixes #55132.
Built from https://develop.svn.wordpress.org/trunk@55571


git-svn-id: http://core.svn.wordpress.org/trunk@55083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-21 13:27:21 +00:00
Sergey Biryukov 07b35de70a Filesystem API: Return `false` for empty paths in FTP `::exists()` methods.
When `ftp_nlist()` receives an empty path, it checks the current working directory and may return `true`.

This affects:
* `WP_Filesystem_FTPext::exists()`
* `WP_Filesystem_ftpsockets::exists()`

As the purpose of the API is to provide a consistent interface for various filesystem implementations, this commit updates the affected methods to returns `false` when an empty path is provided, bringing consistency with the other filesystem abstraction classes, specifically `WP_Filesystem_Direct` and `WP_Filesystem_SSH2`.

Follow-up to [6779], [11821], [25274], [31815].

Props mkox, costdev, Zdrobau, dd32, pbiron, azaozz, mukesh27, SergeyBiryukov.
Fixes #33058.
Built from https://develop.svn.wordpress.org/trunk@55556


git-svn-id: http://core.svn.wordpress.org/trunk@55068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-16 16:14:22 +00:00
Sergey Biryukov 8d7d99289d Filesystem API: Return correct error data from `copy_dir()` if the directory listing failed.
The `::dirlist()` method is run on the `$from` directory, so `basename( $from )` is the correct thing to pass to the `WP_Error` object.

Follow-up to [50149].

Props afragen, costdev, pravinparmar2404.
Fixes #57907.
Built from https://develop.svn.wordpress.org/trunk@55538


git-svn-id: http://core.svn.wordpress.org/trunk@55050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-11 11:34:24 +00:00
spacedmonkey 39e6d6d348 Comments: Prime post caches in WP_Comments_List_Table.
In the `WP_Comments_List_Table` class, when the function `get_comments` is called, pass the parameter `update_comment_post_cache` set to true. This primes all the related posts for the displayed comments. This improves performance, as all posts are primed at once. 

Props spacedmonkey, adarshposimyth.
Fixes #57802.
Built from https://develop.svn.wordpress.org/trunk@55513


git-svn-id: http://core.svn.wordpress.org/trunk@55045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-10 15:26:22 +00:00
Sergey Biryukov e636fcd30c Coding Standards: Use strict comparison in `wp-admin/includes/taxonomy.php`.
Follow-up to [4490], [9481], [55190].

Props ankitmaru, costdev, dhrumilk.
Fixes #57859.
Built from https://develop.svn.wordpress.org/trunk@55511


git-svn-id: http://core.svn.wordpress.org/trunk@55043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-10 07:04:20 +00:00
audrasjb c41d5e69d3 Media: Revert `wp_ajax_save_attachment_updated` hook.
This changeset removes the `wp_ajax_save_attachment_updated` hook by reverting [55106], [55111], and [55450], to give it more time for further discussions as there are still concerns about whether this hook is necessary.

Follow-up to [55106], [55111], [55450].

Props costdev, SergeyBiryukov, peterwilsoncc, azaozz.
See #23148.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-07 13:13:22 +00:00
ryelle 774a23c3c0 Administration: Update the Dashboard welcome banner for 6.2.
Props richtabor, markoserb, laurlittle.
See #57759.


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


git-svn-id: http://core.svn.wordpress.org/trunk@54984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 16:42:18 +00:00
audrasjb 3fdc61552e Media: Rename the `wp_ajax_save_attachment` action hook to `wp_ajax_save_attachment_updated`.
This changeset renames the `wp_ajax_save_attachment` action to `wp_ajax_save_attachment_updated` to avoid confusion with the similarly named `wp_ajax_save-attachment` action. This also add a dockblock note to indicate that when checking if an action is being done, `doing_action( 'wp_ajax_save-attachment' )` may be used if that is more convenient.

Follow-up to [55106].

Props azaozz, sc0ttkclark, costdev.
Fixes #23148

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


git-svn-id: http://core.svn.wordpress.org/trunk@54983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-01 16:32:20 +00:00
Sergey Biryukov 04967a68b6 Upgrade/Install: Introduce `WP_Automatic_Updater::is_allowed_dir()` method.
As part of determining whether to perform automatic updates, WordPress checks if it is running within a version-controlled environment, recursively looking up the filesystem to the top of the drive, looking for a Subversion, Git, Mercurial, or Bazaar directory, erring on the side of detecting a VCS checkout somewhere.

This commit avoids a PHP warning if the `open_basedir` directive is in use and any of the directories checked in the process are not allowed:
{{{
is_dir(): open_basedir restriction in effect. File(/.git) is not within the allowed path(s)
}}}

Follow-up to [25421], [25700], [25764], [25835], [25859].

Props costdev, markjaquith, meyegui, dd32, arnolp, robin-labadie, hellofromTonya, afragen, pbiron, SergeyBiryukov.
Fixes #42619.
Built from https://develop.svn.wordpress.org/trunk@55425


git-svn-id: http://core.svn.wordpress.org/trunk@54958 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-26 15:19:21 +00:00
audrasjb 54dd6eda90 Help/About: Use a consistent capitalization for "Support forums" links across WP Admin.
Follow-up to [55412], [55413].

See #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 11:13:22 +00:00
audrasjb 34229a4286 Help/About: Avoid extra redirections on HelpHub Links.
This changeset replaces various HelpHub links that have changed to avoid extra 301 redirections.

Props sabernhardt, audrasjb.
See #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 11:06:19 +00:00
audrasjb 418a21fdbc Help/About: Use the new `/documentation/` URLs for HelpHub links in WordPress Admin.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/article/*` links with `/documentation/article/*` to avoid an extra redirect.

This also updates links to Support Forums by replacing `https://wordpress.org/support/` URLs with `https://wordpress.org/support/forums/`.

Props SergeyBiryukov, audrasjb, dhrupo, hasanmisbah, sakibmd, sabernhardt.
See #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:38:21 +00:00
audrasjb 8771b175cd Mail: Fix character encoding issues in Plugin/Theme background update emails.
This changeset fixes encoding issues in background update emails by applying `html_entity_decode()` on Plugin/Theme names in `send_plugin_theme_email()`.

Props paulschreiber, audrasjb, benjgrolleau, sanketchodavadiya, robinwpdeveloper, paulamit.
Fixes #56964.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:07:26 +00:00
Sergey Biryukov 3533ec3159 Media: Add `WP_Image_Editor_Imagick::set_imagick_time_limit()` method.
This aims to avoid timeout in Imagick operations.

Previously, Imagick operations could silently error by timeout and produce unexpected results. The new `::set_imagick_time_limit()` method, now used in `::resize()` and `::crop()`, will better handle garbage collection in these cases as well as better align Imagick's timeout with PHP timeout, assuming it is set.

Props drzraf, audrasjb, costdev, antpb, SergeyBiryukov.
Fixes #52569.
Built from https://develop.svn.wordpress.org/trunk@55404


git-svn-id: http://core.svn.wordpress.org/trunk@54937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 14:25:25 +00:00
Sergey Biryukov 1553e3fa00 Coding Standards: Rename `$post_ID` variable to `$post_id` in various files.
The `$post_ID` variable is [546f59c678/WordPress/Sniffs/NamingConventions/ValidVariableNameSniff.php (L54) technically allowed in WPCS], as there is a global of the same name that needs to remain for backward compatibility. However, this name is mostly a remnant of legacy code, and switching to `$post_id` where appropriate brings more consistency with the rest of core.

Additionally, this commit resolves a few WPCS warnings in core:
{{{
Variable "$post_IDs" is not in valid snake_case format
}}}

This affects:
* Function parameters in:
 * `add_meta()`
 * `post_preview()`
 * `WP_Embed::delete_oembed_caches()`
 * `WP_Embed::cache_oembed()`
 * `wp_get_post_cats()`
 * `wp_set_post_cats()`
 * `wp_unique_post_slug()`
 * `wp_set_post_categories()`
 * `wp_check_post_hierarchy_for_loops()`
 * `wp_add_trashed_suffix_to_post_name_for_trashed_posts()`
 * `wp_filter_wp_template_unique_post_slug()`
 * `wp_xmlrpc_server::add_enclosure_if_new()`
 * `wp_xmlrpc_server::attach_uploads()`
 * `wp_xmlrpc_server::mt_getTrackbackPings()`
* Internal variables in:
 * `wp_ajax_inline_save()`
 * `wp_ajax_set_post_thumbnail()`
 * `wp_ajax_get_post_thumbnail_html()`
 * `edit_post()`
 * `bulk_edit_posts()`
 * `wp_write_post()`
 * `WP_Embed::shortcode()`
 * `wp_insert_post()`
 * `wp_xmlrpc_server::_insert_post()`
 * `wp_xmlrpc_server::blogger_getPost()`
 * `wp_xmlrpc_server::blogger_newPost()`
 * `wp_xmlrpc_server::blogger_editPost()`
 * `wp_xmlrpc_server::blogger_deletePost()`
 * `wp_xmlrpc_server::mw_getPost()`
 * `wp_xmlrpc_server::mw_newPost()`
 * `wp_xmlrpc_server::mw_editPost()`
 * `wp_xmlrpc_server::mt_getPostCategories()`
 * `wp_xmlrpc_server::mt_setPostCategories()`
 * `wp_xmlrpc_server::mt_publishPost()`
 * `wp_xmlrpc_server::pingback_ping()`
* Hook parameters in:
 * `oembed_ttl`
 * `embed_oembed_html`
 * `wp_insert_post_parent`
 * `add_trashed_suffix_to_trashed_posts`
 * `pre_post_update`
 * `edit_attachment`
 * `attachment_updated`
 * `add_attachment`
 * `edit_post_{$post->post_type}`
 * `edit_post`
 * `post_updated`
 * `save_post_{$post->post_type}`
 * `save_post`
 * `wp_insert_post`
 * `pre_wp_unique_post_slug`
 * `wp_unique_post_slug`
 * `xmlrpc_call_success_blogger_newPost`
 * `xmlrpc_call_success_blogger_editPost`
 * `xmlrpc_call_success_blogger_deletePost`
 * `xmlrpc_call_success_mw_newPost`
 * `xmlrpc_call_success_mw_editPost`

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

The change does not affect the `$post_ID` global still used in a few places.

Follow-up to [51399], [52958], [53723], [53729], [55190], [55308], [55334].

Props mahekkalola, tanjimtc71, SergeyBiryukov.
Fixes #57692.
Built from https://develop.svn.wordpress.org/trunk@55365


git-svn-id: http://core.svn.wordpress.org/trunk@54898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-19 15:05:22 +00:00
Sergey Biryukov 89bb47e4e1 Docs: Add `www.` prefix to some PHP manual links in code comments.
This avoids an extra redirect and brings more consistency with other links to the PHP website in core.

Follow-up to [42980], [50914], [55355].

See #56792.
Built from https://develop.svn.wordpress.org/trunk@55363


git-svn-id: http://core.svn.wordpress.org/trunk@54896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-18 14:23:21 +00:00
audrasjb f0789b6423 Docs: Replace HTTP with HTTPS in PHP Manual links located in `WP_Privacy_Policy_Content` class.
Follow-up to [55355].

See #56792, #57017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-16 23:11:28 +00:00
Andrew Ozz e3d1a1291f Filesystem API: Use `trailingslashit( $path )` instead of `$path . '/'`. Fixes a warning when `$path` already ends with a slash.
Props: costdev, afragen, mukesh27.
Fixes: #57516.
Built from https://develop.svn.wordpress.org/trunk@55354


git-svn-id: http://core.svn.wordpress.org/trunk@54887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-16 22:13:28 +00:00
Sergey Biryukov 5826e74499 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.
Built from https://develop.svn.wordpress.org/trunk@55306


git-svn-id: http://core.svn.wordpress.org/trunk@54839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-11 13:12:19 +00:00
hellofromTonya ecb9325014 Upgrade/Install: Skip preloading Requests for WordPress versions before 4.6.
Skip preloading Requests files in `_preload_old_requests_classes_and_interfaces()` when updating from a WordPress version older than 4.6.

Why?

Requests library was first introduced into WordPress 4.6 via #33055 / [37428]. If a user is upgrading from a version older than 4.6, this changeset prevents the Requests preloading to prevent a fatal error of attempting to load files that do not exist in their current WordPress version.

Follow-up to [54997], [37428].

Props afragen, costdev, ironprogrammer, antonvlasenko.
Fixes #57662.
Built from https://develop.svn.wordpress.org/trunk@55296


git-svn-id: http://core.svn.wordpress.org/trunk@54829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-08 15:03:19 +00:00
John Blackbourn 270a3d009d Docs: Miscellaneous improvements and corrections to docblocks.
See #56792

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


git-svn-id: http://core.svn.wordpress.org/trunk@54826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 21:21:18 +00:00
John Blackbourn e374552961 Application Passwords: Allow plain HTTP success and reject URLs when using a local environment type.
It's not uncommon for local environments to run over HTTP due to the relative complexity of configuring HTTPS for a local environment. This change allows HTTP URLs for application password responses when that is the case.

Props peterwilsoncc, wppunk, cadic, viralsampat

Fixes #52617

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


git-svn-id: http://core.svn.wordpress.org/trunk@54816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 17:46:20 +00:00
Sergey Biryukov 9c5d4ca8d1 I18N: Mark screen reader strings as such with translator comments.
This aims to provide better context for translators and make it easier to determine that some strings contain hidden accessibility text and are not displayed in the UI.

Props kebbet, mercime, pavelevap, ocean90, swissspidy, Chouby, jipmoors, afercia, desrosj, costdev, audrasjb, SergeyBiryukov.
Fixes #29748.
Built from https://develop.svn.wordpress.org/trunk@55276


git-svn-id: http://core.svn.wordpress.org/trunk@54809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 17:10:21 +00:00
Sergey Biryukov 6a22b9c21c Quick/Bulk Edit: Remove the `bulk_edit_posts` action for now.
This reverts [55108] pending confirmation that this hook is still needed, that the right variable is passed, and that the docs are correct.

The necessity and implementation of this hook will be reconsidered in a future release.

See #28112.
Built from https://develop.svn.wordpress.org/trunk@55265


git-svn-id: http://core.svn.wordpress.org/trunk@54798 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 15:25:24 +00:00
Sergey Biryukov b29536b060 General: Check that `set_time_limit()` function is available before using it in core.
This avoids a fatal error if the function is disabled on certain environments.

Props theode, jokerrs, johnbillion, hellofromTonya, costdev, jrf, azaozz, SergeyBiryukov.
Fixes #55711.
Built from https://develop.svn.wordpress.org/trunk@55258


git-svn-id: http://core.svn.wordpress.org/trunk@54791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 13:28:18 +00:00
audrasjb e00a90c571 Media: Maintain the functionnality of the deprecated `WP_Media_List_Table::column_desc()` method.
Follow-up to [55159].

Props peterwilsoncc, costdev, mukesh27.
Fixes #39710.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 09:08:20 +00:00
audrasjb a816a24b9c Coding Standards: Add missing escaping function in `Custom_Image_Header::show_header_selector()`.
Props chintan1896, SergeyBiryukov.
Fixes #57638.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 21:36:17 +00:00
Sergey Biryukov ba4ed5f86c Upgrade/Install: Send language pack updates to `copy_dir()`.
If the `clear_working` flag in `WP_Upgrader::install_package()` is false, the source should not be removed, so `copy_dir()` should be used instead.

Partial updates, like language packs, may want to retain the destination. If the destination exists or has contents, this may be a partial update, and the destination should not be removed, so `copy_dir()` should be used instead.

Follow-up to [55204], [55219], [55220], [55223], [55226].

Props afragen, costdev, swissspidy.
See #57557.
Built from https://develop.svn.wordpress.org/trunk@55229


git-svn-id: http://core.svn.wordpress.org/trunk@54762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 14:48:16 +00:00
Peter Wilson be3d8fdcc3 Filesystem API: Prevent fatal error in `move_dir()`.
Correctly instantiate `WP_Error()` within `move_dir()` to prevent a fatal error when unable to delete an existing directory that is intended to be replaced.

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

Props swissspidy, costdev, afragen.
Fixes #57375.


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


git-svn-id: http://core.svn.wordpress.org/trunk@54759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 04:21:20 +00:00
Sergey Biryukov cd0d67c8b2 Upgrade/Install: Silence Requests deprecations before preloading.
Intentional preloading of Requests 2.x classes and interfaces using their old (Requests 1.x) names should not produce deprecation notices.

This commit defines `REQUESTS_SILENCE_PSR0_DEPRECATIONS` as `true` in `_preload_old_requests_classes_and_interfaces()`.

Follow-up to [54997], [55007], [55046].

Props costdev, afragen, jrf.
Fixes #54504.
Built from https://develop.svn.wordpress.org/trunk@55225


git-svn-id: http://core.svn.wordpress.org/trunk@54758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-05 00:20:15 +00:00
Sergey Biryukov 4b790e3483 Filesystem API: Simplify two conditionals in `move_dir()`.
This updates the check whether the destination directory already exists to only call `$wp_filesystem->exists()` once.

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

Props azaozz, afragen, SergeyBiryukov.
Fixes #57375.
Built from https://develop.svn.wordpress.org/trunk@55223


git-svn-id: http://core.svn.wordpress.org/trunk@54756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 15:37:16 +00:00
audrasjb ba5324e2bd Media: Properly escape Download row action link in Media List Table.
Props joedolson, pbiron, audrasjb.
Fixes #57574.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 07:10:18 +00:00
Andrew Ozz 552a0c71a8 Upgrade/Install: Use `move_dir()` instead of `copy_dir()` in `WP_Upgrader::install_package()` when possible. This would make the filesystem operations a lot faster in most cases, and potentially reduce failures.
Props: afragen, costdev, peterwilsoncc, pbiron, mukesh27, SergeyBiryukov, azaozz.
Fixes: #57557.
Built from https://develop.svn.wordpress.org/trunk@55220


git-svn-id: http://core.svn.wordpress.org/trunk@54753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 03:31:16 +00:00
Andrew Ozz 8cf4b7557f Filesystem API: Update `move_dir()` to better handle the differences in the `WP_Filesystem::move()` methods.
Changes `move_dir()` to attempt to delete the destination when overwriting, before calling `WP_Filesystem::move()`.

Props: afragen, costdev, azaozz.
Fixes: #57375.
Built from https://develop.svn.wordpress.org/trunk@55219


git-svn-id: http://core.svn.wordpress.org/trunk@54752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-04 01:08:17 +00:00
joedolson e7a506c636 Media: Hide 'view' link if empty string passed to attachment_link.
Fix empty href attribute on 'View' link when the `attachment_link` filter is used to hide attachment pages.

Props oh_hello, iqbalrony.
Fixes #54824.
Built from https://develop.svn.wordpress.org/trunk@55218


git-svn-id: http://core.svn.wordpress.org/trunk@54751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 22:25:16 +00:00
Sergey Biryukov e235883c4d HTTP API: Restore one instance of the `X-Pingback` header capitalization.
The revert in the previous commit appears to be accidental.

Follow-up to [55210], [55211].

See #54225.
Built from https://develop.svn.wordpress.org/trunk@55212


git-svn-id: http://core.svn.wordpress.org/trunk@54745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 14:41:26 +00:00
audrasjb 897eefe2e3 HTTP API: Fix a unit test failure found after [55210].
Follow-up to [55210].

See #54225.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 13:53:18 +00:00
audrasjb 28358ab213 HTTP API: Fix request header inconsistencies.
This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

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

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


git-svn-id: http://core.svn.wordpress.org/trunk@54743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 13:35:20 +00:00
Andrew Ozz d5f8d02445 Docs: Document directory support in `FTP/SSH2` filesystem `::move()` methods.
Props: costdev, flixos90, audrasjb.
Fixes: #57604.
Built from https://develop.svn.wordpress.org/trunk@55205


git-svn-id: http://core.svn.wordpress.org/trunk@54738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 01:59:15 +00:00
Andrew Ozz 47172a2c65 Filesystem API: Add directory support to `WP_Filesystem_Direct::move()`.
Introduces:
- New function: `wp_opcache_invalidate_directory()`, to recursively call `wp_opcache_invalidate()` after overwriting .php files.
- New function: `move_dir()`, similar to `copy_dir()` that uses `WP_Filesystem::move()` followed by `wp_opcache_invalidate_directory()`, and has a fallback to `copy_dir()`.

Props: costdev, afragen, peterwilsoncc, sergeybiryukov, ironprogrammer, flixos90, bronsonquick, mukesh27, azaozz.
Fixes #57375.
Built from https://develop.svn.wordpress.org/trunk@55204


git-svn-id: http://core.svn.wordpress.org/trunk@54737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 01:50:16 +00:00
audrasjb 93234049f2 Media: Add a Download row action to the Media List Table.
This changeset makes it easier for users to download their uploaded media by providing a Download row action to the Media List Table. It also rephrases the Copy URL row action for better consistency and to give room for the new Download action.

Follow-up to [55156].

Props pbiron, joedolson, kebbet, Mista-Flo, costdev, amin7, mukesh27.
Fixes #57574.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 22:48:16 +00:00
audrasjb 0874553f76 Plugins: Rephrase Add Plugins screen description for better clarity.
This changeset rephrases the Add Plugins screen description to clarify the purpose of the two available options for installing plugins.

Props tahmidulkarim, audrasjb, costdev, ryokuhi, krupalpanchal, SergeyBiryukov.
Fixes #57155.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 21:50:16 +00:00
Sergey Biryukov 12aba159d9 Coding Standards: Rename the `$cat_ID` variable to `$cat_id` in `wp_update_category()`.
This resolves a few WPCS warnings:
{{{
Variable "$cat_ID" is not in valid snake_case format, try "$cat_i_d"
}}}

Follow-up to [2695], [4490], [52958].

Props hilayt24, viralsampat, desrosj, robinwpdeveloper, tanazmasaba, costdev, SergeyBiryukov.
See #56754.
Built from https://develop.svn.wordpress.org/trunk@55190


git-svn-id: http://core.svn.wordpress.org/trunk@54723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 13:59:18 +00:00
audrasjb 7e3b08c8af Themes: Increase HTTP timeout for Theme API requests.
This changeset modifies the HTTP request in `themes_api()` to use the same HTTP request timeout as in `plugins_api()`, which is 15 seconds, instead of a default value of 5 seconds.

Props ahortin, peterwilsoncc, dd32, costdev.
Fixes #57315.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 09:14:17 +00:00
joedolson 01236f5948 Media: Fix inconsistent font weight in media detail views.
Make font weight consistent between different screens and different parts of media views.
 
Props szaqal21, sabernhardt.
Fixes #54509.
Built from https://develop.svn.wordpress.org/trunk@55187


git-svn-id: http://core.svn.wordpress.org/trunk@54720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 02:16:12 +00:00
joedolson 237cb1da8f Media: Remove meta data after restoring w/IMAGE_EDIT_OVERWRITE.
When IMAGE_EDIT_OVERWRITE is defined as true the meta field `_wp_attachment_backup_sizes` is deleted after an image is restored.
 
Props mitogh, jeawhanlee, robinwpdeveloper, iapial.
Fixes #55150.
Built from https://develop.svn.wordpress.org/trunk@55180


git-svn-id: http://core.svn.wordpress.org/trunk@54713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 20:31:14 +00:00
Pascal Birchler 5edb22187d I18N: Introduce `switch_to_user_locale()`.
This new function makes it easier to switch to a specific user’s locale by reducing duplicate code and storing the user’s ID as additional context for plugins to consume. Existing usage of `switch_to_locale()` in core has been replaced with `switch_to_user_locale()` where appropriate.

Also, this change ensures `WP_Locale_Switcher` properly filters `determine_locale` so that anyyone using the `determine_locale()` function will get the correct locale information when switching is in effect.

Props costdev.
Fixes #57123.
See #26511.
Built from https://develop.svn.wordpress.org/trunk@55161


git-svn-id: http://core.svn.wordpress.org/trunk@54694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-30 10:27:16 +00:00
audrasjb 9c04271f60 Media: Deprecate unused method `WP_Media_List_Table::column_desc()`.
This changeset formally deprecates the `column_desc()` method from `WP_Media_List_Table`, as it was never used anywhere in core.

Props iandunn, JeffMatson, antpb, costdev, audrasjb.
Fixes #39710.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-28 22:17:16 +00:00