Commit Graph

22041 Commits

Author SHA1 Message Date
Weston Ruter
ceb151029c Bundled Themes: Use defer loading strategy for theme scripts.
* Add `defer` loading strategy for all frontend end-user theme scripts (excluding Customizer preview).
* Move scripts to the `head` which relate to the initial page viewport to ensure they start loading earlier and execute sooner while still not blocking rendering.
* Update Twenty Twenty's script loader (`TwentyTwenty_Script_Loader`) to support core's built-in script loading strategies (#12009), while also retaining backwards-compatibility for child themes that may set `async` and `defer` script data.
* Update the main script loading strategy in Twenty Twenty from `async` to `defer` for better performance on repeat page views, since when an `async` script is cached it will block rendering.

Props westonruter, flixos90, sabernhardt.
Fixes #59316.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-12 00:06:19 +00:00
spacedmonkey
de170c0c2e Taxonomy: Cache term objects in WP_Term_Query if query is filtered.
When utilizing the `terms_clauses` or `get_terms_fields` filters within `WP_Term_Query` and the selected fields are modified, the entire term object is now cached. This adjustment is necessary because filters can broaden the selected fields beyond just the term ID. Fields linked to the term object, such as the count or parent, may undergo modifications when queried. Caching the complete object ensures the accurate storage of these modified fields within the cache.

Props spacedmonkey, tnolte, peterwilsoncc.
Fixes #58116.
Built from https://develop.svn.wordpress.org/trunk@56555


git-svn-id: http://core.svn.wordpress.org/trunk@56067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-11 11:37:19 +00:00
costdev
4920adb477 External Libraries: Update the Requests library to version 2.0.8.
This is a maintenance release with minor changes:
- Only force close cURL connection when needed (cURL < 7.22).

References:
- [https://github.com/WordPress/Requests/releases/tag/v2.0.8 Requests 2.0.8 release notes]
- [https://github.com/WordPress/Requests/compare/v2.0.6...v2.0.8 Full list of changes in Requests 2.0.8]

Follow-up to [54997], [55007], [55046], [55225], [55296], [55629].

Props jrf, mukesh27, spacedmonkey, costdev.
Fixes #59322.
Built from https://develop.svn.wordpress.org/trunk@56554


git-svn-id: http://core.svn.wordpress.org/trunk@56066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-11 10:33:19 +00:00
Peter Wilson
e41f176a63 Cron: Cast doing_cron transient to a float.
Cast the `doing_cron` transient value to a float to prevent type errors if the transient is not set (in which case it returns `false`) or another unexpected type.

Props fzhantw, ankitmaru.
Fixes #58471.


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


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

Note: This is enforced by WPCS 3.0.0.

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

Follow-up to [56141].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-11 04:53:22 +00:00
Sergey Biryukov
d399e57a1f Coding Standards: Correct spacing for spread operators.
No space allowed between the operator and the variable it applies to.

Note: This is enforced by WPCS 3.0.0.

Follow-up to [46133].

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


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

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

Follow-up to [55720].

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


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

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

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

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


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

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

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


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

Follow-up to [56536].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 09:32:23 +00:00
isabel_brison
b7439d5712 Editor: tweak root padding styles.
Removes root padding from children of flex and grid layout blocks when root padding aware alignments are set.

Props andrewserong, ramonopoly.
Fixes #59295.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 00:51:18 +00:00
isabel_brison
43a50913d6 Editor: performance enhancements to class-wp-theme-json.
Removes unnecessary sanitisation of hardcoded strings and avoids looping over style presets without classes or variables.

Props flixos90.
Fixes #59304.

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


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

[56354] 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 [56354], [56530].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 20:48:12 +00:00
hellofromTonya
6b0b3eb6a1 Code Modernization: Use wp_trigger_error() in WP_User_Query magic methods.
Replaces `trigger_error()` with `wp_trigger_error()` in each of the `WP_User_Query` magic methods.

[56353] 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 [56353], [56530].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 20:45:16 +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
joedolson
eb635e4796 Plugins: Respect prefers-reduced-motion on plugin thumbnails.
Pause animated plugin thumbnails when a user has reduced motion preferences configured in their device or operating system.

Props Travel_girl, audrasjb, bordoni, stevejonesdev, joedolson.
Fixes #55723.
Built from https://develop.svn.wordpress.org/trunk@56541


git-svn-id: http://core.svn.wordpress.org/trunk@56053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 20:37:15 +00:00
hellofromTonya
aaec843875 Fonts: Removes static instance in wp_print_font_faces().
The static instance of `WP_Font_Face` is not needed. It was an unnecessary carryover from the experimental Fonts API (which was not introduced into Core).

Whereas the Fonts API needed to persist its data (i.e. to maintain the registered and enqueued fonts throughout the web request), Font Face does not have data to persist.

Font Face processes the fonts it receives when `WP_Font_Face::generate_and_print( $fonts )` is invoked. Thus, a singleton is not needed.

Removing the static reduces the amount of the code in the function and eliminates running its tests in separate processes to ensure a different instance is always used.

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

Follow-up to [56500].

Props hellofromTonya, costdev.
Fixes #59165.
Built from https://develop.svn.wordpress.org/trunk@56540


git-svn-id: http://core.svn.wordpress.org/trunk@56052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 17:30:17 +00:00
desrosj
dedb9c6d5a Build/Test Tools: Update a few more 3rd-party GitHub Action occurrences.
Follow up to [56537].

See #58867.
Built from https://develop.svn.wordpress.org/trunk@56538


git-svn-id: http://core.svn.wordpress.org/trunk@56050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 16:56:21 +00:00
desrosj
0bd85f3b77 Build/Test Tools: Update 3rd-party GitHub Actions.
This updates all 3rd-party GitHub actions to their latest versions. The following actions were updated:
- `actions/cache`
- `actions/checkout`
- `actions/setup-node`
- `codecov/codecov-action`
- `shivammathur/setup-php`
- `slackapi/slack-github-action`

In the latest version of `actions/checkout` (`4.0.0`), a new input was introduced to control the output of command progress. This change uses this new `show-progress` input to turn off displaying progress by default. Progress will be shown when a workflow is run with debug mode enabled, just in case it contains helpful information.

Props johnbillion, desrosj.
See #58867.
Built from https://develop.svn.wordpress.org/trunk@56537


git-svn-id: http://core.svn.wordpress.org/trunk@56049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 16:51:16 +00:00
Sergey Biryukov
2484b193b4 Coding Standards: Remove superfluous blank lines at the end of various files.
Note: This is enforced by WPCS 3.0.0.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 14:59:21 +00:00
isabel_brison
337a910076 Editor: add configurable viewport sizes for fluid typography.
Adds options to configure min and max viewport sizes for fluid typography in theme.json settings.

Props ramonopoly.
Fixes #59048.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 04:30:21 +00:00
isabel_brison
4b87f197f4 Editor: allow disabling layout controls.
Adds the ability to disable layout controls on a per-block level from theme.json.

Props mukesh27.
Fixes #59294.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 01:05:19 +00:00
desrosj
1037cc24d7 Bundled Themes: Update npm dependencies for Twenty Nineteen and Twenty Twenty.
This updates the npm dependencies for Twenty Nineteen and Twenty Twenty to their latest versions. This also includes the results of running `npm audit fix`.

There are no changes in any built files as a result.

See #58863.
Built from https://develop.svn.wordpress.org/trunk@56533


git-svn-id: http://core.svn.wordpress.org/trunk@56045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 00:59:18 +00:00
desrosj
d812270755 Bundled Themes: Set legacy-peer-deps to true.
While `npm install` was working without issue after [56531], `npm ci` was not. The latter expects dependencies in the `package-lock.json` to match those in `package.json` exactly.

Follow up to [56378], [56387], [56442], [56531[.

Fixes #59187. See #56658.
Built from https://develop.svn.wordpress.org/trunk@56532


git-svn-id: http://core.svn.wordpress.org/trunk@56044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 00:09:18 +00:00
desrosj
9fae0aac37 Bundled Themes: Use Node.js 16.x in themes with a build process.
This results in a new `package-lock.json` file being generated that uses `lockfileVersion` 2.x.

There are no changes to built files as a result of this update.

Follow up to [56378], [56387], [56442].

Props mikestraw, whyisjake, jivygraphics.
Fixes #59187. See #56658.
Built from https://develop.svn.wordpress.org/trunk@56531


git-svn-id: http://core.svn.wordpress.org/trunk@56043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 23:44:20 +00:00
hellofromTonya
2653e93e09 General: Introduce wp_trigger_error().
Introduces `wp_trigger_error()` as a wrapper around PHP's native `trigger_error()`. As a wrapper, it's lean and not opinionated about the message. It accepts an E_USER family error level, meaning it is not limited to only notices.

Where `_doing_it_wrong()` intends to loudly alert developers "Hey you're doing it wrong - fix it", `wp_trigger_error()` is not opinionated and does not add wording. Rather, it passes the given message to `trigger_error()`.

`wp_trigger_error()` is meant for every `trigger_error()` instance. It can be used:
* in `_doing_it_wrong()` and each `_deprecated_*()` function.
* for PHP 8.x deprecations.
* for PHP error parity.
* for less severe "doing it wrong" instance that do not require bailing out.
* when a component or extension is not available on the server
* for instances where it's not clear if a plugin's or theme's code is the root cause.
* and more.

Technical details:

* Does not trigger the error if `WP_DEBUG` is not `true`.

* Includes `wp_trigger_error_run` action to allow hooking in for backtracing and deeper debug.

* Accepts an E_USER error level, but defaults to `E_USER_NOTICE`.

* Requires a function name, though can be an empty string. As the output message generated by `trigger_error()` references the file and line number where it was invoked, passing the function's name provides more information where the error/warning/notice/deprecation happened. It's intended to help with debug.

* A WordPress version number is not included.

* As messages can appear in the browser, the message is escaped using `esc_html()`. As noted in [https://www.php.net/manual/en/function.trigger-error.php the PHP manual]: "HTML entities in message are not escaped. Use htmlentities() on the message if the error is to be displayed in a browser."

References:
* [https://www.php.net/manual/en/function.trigger-error.php PHP manual for `trigger_error()`].
* [https://www.php.net/manual/en/errorfunc.constants.php E_USER constants (error level) in the PHP manual].

Props azaozz, hellofromTonya, flixos90, costdev, peterwilsoncc, oglekler, mukesh27.
See #57686.
Built from https://develop.svn.wordpress.org/trunk@56530


git-svn-id: http://core.svn.wordpress.org/trunk@56042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 22:08:18 +00:00
Andrew Ozz
91167c488d Editor: Prevent possibility of a fatal error when previewing block themes.
Ensures that preview callbacks attached to the `stylesheet` and `template` filters do not run before `pluggable.php` has been included. These callbacks need functionality from `pluggable.php`.

Props: scruffian, johnbillion, SergeyBiryukov, okat, okat.
Fixes: #59000.
Built from https://develop.svn.wordpress.org/trunk@56529


git-svn-id: http://core.svn.wordpress.org/trunk@56041 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 21:48:17 +00:00
Andrew Ozz
a5a870cb4c Editor: Fix loading of assets in blocks in child themes where the directory name starts with the parent theme's directory name. Example: twentyseventeen and twentyseventeen-child.
Props: lgladdy, masteradhoc, audrasjb, rajinsharwar, azaozz.
Fixes: #59018.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 21:25:15 +00:00
Felix Arntz
615996176a Bundled Theme: Update default themes to use new script function signature.
In WordPress 6.3, the last parameter of `wp_register_script()` and `wp_enqueue_script()` was changed to an array rather than a boolean. While a boolean is still supported for backward compatibility, it makes sense to update the codebase to use the new signature.

The updates are fully backward compatible:
* In places where `true` was provided, `array( 'in_footer' => true )` will still be interpreted as a boolean true in WordPress versions prior to 6.3.
* In places where `false` was provided, the parameter is omitted which will work correctly throughout all WordPress versions given that is and has been the default value anyway.

Props mrinal013, huzaifaalmesbah, niravsherasiya7707, joemcgill.
Fixes #59302.
See #58634.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 21:23:20 +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
Joe McGill
be1b61326b Themes: Avoid stale caches for core block styles.
This fixes an issue introduced in [56044] in which the path to core block styles are cached to avoid expensive file operations on every page load. The original caching strategy is now modified so that only the path relative to the blocks location are stored, rather than the full path, since the path to the `wp-includes` folder can change after the value is generated. The new cached value also includes the current WordPress version value to ensure it is rebuilt when the version changes.

Props lhe2012, coreyw, colorful tones, petitphp, mukesh27, spacedmonkey, joemcgill, flixos90, kimannwall, desmith.
Fixes #59111.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56036 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 18:08:17 +00:00
spacedmonkey
80245f0791 Themes: Remove unnecessary check if file exists in the theme functions.
Previously, several functions and methods in themes api were designed to check for the existence of files in a child theme before falling back to the parent theme. However, these checks did not consider whether the current theme was a child theme or not, resulting in unnecessary file existence checks for non-child themes. Check to see if stylesheet directory matches the template directory before doing the file exists. This optimization helps reduce unnecessary file system access, as file existence checks can be resource-intensive in PHP. 

The following functions and methods have been updated as part of this enhancement: 
- `WP_Theme::get_file_path`
- `get_theme_file_path`
- `get_theme_file_uri`

Props spacedmonkey, flixos90, sabernhardt, 10upsimon, mukesh27.
Fixes #59279.
Built from https://develop.svn.wordpress.org/trunk@56523


git-svn-id: http://core.svn.wordpress.org/trunk@56035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 13:00:22 +00:00
spacedmonkey
eb7094465d Database: Add expiration for dirsize_cache to transient to improve performance.
The transient `dirsize_cache` stores an array of directory sizes. This transient can grow very large, if the plugin directory has lots of sub directories in it. For example, a site with 30 plugins, the transient was around 2MB. For sites without a persistent object cache, transients without an expiration, are stored in autoloaded options. This means this option would load on every page request. Loading this option on every page request when it is not used it wasteful. Adding a expiration to this transient means it will not autoload. To ensure there is no degradation in performance, the expiration was set to a generous 10-year timeframe, making it highly unlikely to expire before it's refreshed.

Props nicomollet, spacedmonkey, flixos90, wpgurudev.
Fixes #54221.
Built from https://develop.svn.wordpress.org/trunk@56522


git-svn-id: http://core.svn.wordpress.org/trunk@56034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 10:03:20 +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
isabel_brison
aac1b7c487 Editor: update packages with bug fixes for 6.3.2
Updates editor npm packages to latest patch versions for the 6.3.x branch.

Props ramonopoly.
See #59293.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 03:19:44 +00:00
Sergey Biryukov
f69316e8a5 Docs: Add a @since note for add_new labels change in get_post_type_labels().
Includes removing an obsolete recommendation to use a gettext context matching the post type for disambiguation, which would be redundant with the new labels, as they already include the type of content.

Follow-up [14571], [56515].

See #47125.
Built from https://develop.svn.wordpress.org/trunk@56519


git-svn-id: http://core.svn.wordpress.org/trunk@56031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-06 00:46:24 +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
70d853b9cd Code Modernization: Rename parameters that use reserved keywords in wp-includes/functions.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$class` parameter to `$class_name` in `_deprecated_class()`.

Follow-up to [54929], [56467].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-05 12:25:13 +00:00
spacedmonkey
ed6e84c280 Query: Use split queries in WP_Query if persistent object caching is enabled.
Prior to this commit, the `WP_Query` class split the query for posts into two database queries. First, it initiated an ID-based query to retrieve post IDs, followed by a call to _prime_post_caches to fetch post objects if they weren't already in memory. This splitting of queries was limited to cases where fewer than 500 posts were being requested, to prevent a potentially large database query within the IN statement in _prime_post_caches.

However, this limitation becomes unnecessary when a persistent object cache is enabled, as the post objects can be efficiently retrieved from the fast object cache. This commit transfers the responsibility of fetching posts to the object cache, which not only speeds up the process but also reduces the strain on the database server.

Props peterwilsoncc, spacedmonkey, SergeyBiryukov.
Fixes #57296.
Built from https://develop.svn.wordpress.org/trunk@56513


git-svn-id: http://core.svn.wordpress.org/trunk@56025 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-05 12:23:21 +00:00
spacedmonkey
5e21330e7d Widgets: Improve performance of has_content method in WP_Widget_Media_Gallery class.
In the method `WP_Widget_Media_Gallery::has_content` call `_prime_post_caches` before the foreach loop. This ensures that the post objects are primed in memory before trying to access the post object in `get_post_type`.

Props niravsherasiya7707, spacedmonkey, mukesh27.
Fixes #58757.
Built from https://develop.svn.wordpress.org/trunk@56512


git-svn-id: http://core.svn.wordpress.org/trunk@56024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-04 16:33:17 +00:00
Sergey Biryukov
d2a504e6cb Coding Standards: Use strict comparison in wp-includes/class-wp-hook.php.
Follow-up to [4955], [38571].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-04 11:40:22 +00:00
Sergey Biryukov
dc9517a3e0 Upload: Correct duplicate MIME type for .xlsx files generated by Google Docs.
This expands the code block previously added for `.docx` files to include `.xlsx` files as well, which are known to have the same issue with `finfo_file()`.

Includes a unit test case for `wp_check_filetype_and_ext()`.

Reference: [https://bugs.php.net/bug.php?id=77784 PHP Bug #77784: mime_content_type() result gets doubled for .xlsx].

Follow-up to [56497].

See #57898.
Built from https://develop.svn.wordpress.org/trunk@56510


git-svn-id: http://core.svn.wordpress.org/trunk@56022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-03 12:51:20 +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
Felix Arntz
b58ed80f20 Options, Meta APIs: Introduce wp_set_option_autoload_values().
This function accepts an associative array of option names and their autoload values to set, and it will update those values in the database in bulk, only for those options where the autoload field is not already set to the given value.

Two wrapper functions for ease of use accompany the new main function:
* `wp_set_options_autoload( $options, $autoload )` can be used to set multiple options to the same autoload value.
* `wp_set_option_autoload( $option, $autoload )` can be used to set the autoload value for a single option.

All of these functions allow changing the autoload value of an option, which previously has only been possible in combination with updating the value. This limitation prevented some relevant use-cases: For example, a plugin deactivation hook could set all of its options to not autoload, as a cleanup routine, while not actually deleting any data. The plugin's activation hook could then implement the reverse, resetting those options' autoload values to the originally intended ones for when using the plugin.

Props boonebgorges, joemcgill, costdev, mukesh27, SergeyBiryukov, tabrisrp, flixos90.
Fixes #58964.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 19:57:20 +00:00
Felix Arntz
5b6555a384 Editor: Ensure main query loop is entered for singular content in block themes.
Block themes currently lack the means to trigger the main query loop for singular content, since they cannot reasonably use the `core/query` and `core/post-template` blocks which are intended only for displaying a list of posts. So far, the missing main query loop on singular block templates has been worked around by enforcing the loop in certain `core/post-*` blocks, which however causes other bugs.

This changeset ensures that the main query loop is still started for singular block theme templates, by wrapping the entire template into the loop, which will by definition only have a single cycle as it only encompasses a single post. This is currently the most reliable solution, since even if there were blocks to properly trigger the main query loop on singular content, it would be unrealistic to expect all existing block themes to update their templates accordingly. It may be revisited in the future.

Props gziolo, youknowriad, joemcgill, costdev, mukesh27, flixos90.
Fixes #58154.
See #59225, #58027.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 17:32:16 +00:00
Pascal Birchler
371b940439 Build/Test Tools: Compare results in performance measurement workflow.
This extends the performance test workflow added in [55459] to also run tests against the target branch (if running on a pull request) or the previous commit (if running on trunk).

Those results are then compared with the ones from the current commit, and the difference is displayed as a GitHub Actions workflow summary for convenience.

Props mukesh27, flixos90, desrosj, joemcgill, swissspidy.
Fixes #58358, #58359.
See #56150.
Built from https://develop.svn.wordpress.org/trunk@56506


git-svn-id: http://core.svn.wordpress.org/trunk@56018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 17:26:16 +00:00
Sergey Biryukov
023f4f860b Upgrade/Install: Remove unused globals in core_upgrade_preamble().
Follow-up to [49638].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 11:07:13 +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
isabel_brison
e770b922c7 Editor: Don't use fluid layout value in typography.
Changes fluid typography calculation to use fallback value if layout wide size is a fluid value.

Props ramonopoly, mukesh27, jastos, aurooba.
See #58754.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 04:03:21 +00:00
isabel_brison
5db3477859 Editor: Preserve block style variations when securing theme.
Adds the ability to process block style variations to the `remove_insecure_properties` function of theme json class.

Props dsas, ramonopoly.
Fixes #59108.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 02:53:19 +00:00
hellofromTonya
f9f0b6246b Tests: Remove webfonts tests.
Removes the test file and `webfonts` directory for the stopgap code that was deprecated by [56500].

Follow-up to [56500], [53282].

Fixes #59165.
Built from https://develop.svn.wordpress.org/trunk@56501


git-svn-id: http://core.svn.wordpress.org/trunk@56013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-31 22:18:21 +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
Sergey Biryukov
21011a6ebb Build/Test Tools: Enable running the tests on PHP 8.3.
PHP 8.3 is expected to be released at the end of November 2023.

Enabling the tests to run in CI on PHP 8.3 allows WordPress core to start getting ready.

Note: Xdebug-related tests will not be run on PHP 8.3 at this time as the Docker image for PHP 8.3 does not contain Xdebug yet. Once a stable release of Xdebug 3.3.0 is available, it can be added to the Docker image and the test step can then be enabled for PHP 8.3.

Follow-up to [53922], [56492], [56495].

Props jrf, costdev.
See #59231.
Built from https://develop.svn.wordpress.org/trunk@56498


git-svn-id: http://core.svn.wordpress.org/trunk@56010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-31 10:17:22 +00:00
audrasjb
f6bd4ab08e Upload: Add a MIME type exception for .docx generated by Google Docs.
This changeset adds an exception to prevent permission issues on `.docx` generated by Google Docs. This is a temporary fix for an upstream bug on the `finfo_file()` 
PHP function which returns a redundant MIME type for these documents.

Props winterstreet, jakariaistauk, mujuonly, mi5t4n, annashopina, audrasjb, azaozz, mikeschroder, oglekler.
Fixes #57898.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-30 22:32:19 +00:00
audrasjb
6687c0ec8f Editor: Add relative time strings for the wp-date inline script output.
This changeset updates `wp_default_packages_inline_scripts()` to add relative time strings to the `wp-date` inline script, so the JS version of `human_time_diff` 
can output translated strings.

Props ramonopoly, oandregal, swissspidy, manzoorwanijk, adrianduffell, Presskopp.
Fixes #59219, #47373.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-30 22:11:12 +00:00
audrasjb
42648581c7 HTTP API: Update WP_Http class to avoid PHP deprecation warnings.
This changeset prevents a PHP 8.3 deprecation shown when enabling debug and calling `get_class()` without arguments.

For more info about this deprecation, see https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#get_class_and_get_parent_class.

Props ipajen, rajinsharwar, SergeyBiryukov, jrf.
Fixes #58876.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-30 22:09:17 +00:00
costdev
b5789d72c3 General: Replace two esc_url_raw() calls in core with sanitize_url().
This aims to improve performance by calling `sanitize_url()` directly, instead of the `esc_url_raw()` wrapper. As of WordPress 6.1, `sanitize_url()` is the recommended function for sanitizing a URL for database or redirect usage.

This replaces the two remaining instances of `esc_url_raw()` with `sanitize_url()` in WordPress core.

Follow-up to [53455], [53933], [54522].

Props rajinsharwar, SergeyBiryukov.
Fixes #59247.
Built from https://develop.svn.wordpress.org/trunk@56494


git-svn-id: http://core.svn.wordpress.org/trunk@56006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-30 20:25:18 +00:00
Bernhard Reiter
c67fe4b6e5 HTML API: Stop processing HTML when encountering unsupported markup.
It was a design goal of the HTML Processor to abort processing its input document when encountering unsupported markup. Unfortunately there was no test for this and so-far, the HTML Processor has paused, but continued processing in these situations.

In this patch a new test ensures that the HTML Processor stops and refuses to move forward after encountering any unsupported markup. It also ensures that it doesn't report any current tag names since unsupported markup could imply that the read tag name is different than the parsed tag name.

Props dmsnell.
Fixes #59167.
Built from https://develop.svn.wordpress.org/trunk@56493


git-svn-id: http://core.svn.wordpress.org/trunk@56005 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-30 15:39:16 +00:00
Sergey Biryukov
8429956b09 Tests: Correct uses of ReflectionProperty::setValue() for static properties.
The single parameter signature, which was used for setting the value on a static property, is deprecated since PHP 8.3. A cross-version solution is to pass `null` as the first parameter.

This commit updates all the instances that use the deprecated signature in WordPress core.

Reference: [https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue PHP RFC: Deprecate functions with overloaded signatures: ReflectionProperty::setValue()].

Follow-up to [53152], [54493], [54799].

Props jrf, costdev, Tests: Correct uses of `ReflectionProperty::setValue()` for static properties.

The single parameter signature, which was used for setting the value on a static property, is deprecated since PHP 8.3. A cross-version solution is to pass `null` as the first parameter.

This commit updates all the instances that use the deprecated signature in WordPress core.

Reference: [https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue PHP RFC: Deprecate functions with overloaded signatures: ReflectionProperty::setValue()].

Follow-up to [53152], [54493], [54799].

Props jrf, costdev, sc0ttkclark.
See #59231.
Built from https://develop.svn.wordpress.org/trunk@56492


git-svn-id: http://core.svn.wordpress.org/trunk@56004 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-30 10:51:21 +00:00
Joe McGill
3087927a5f Posts, Post Types: Avoid redundant SQL query in get_pages().
This avoids an additional query by passing the query args directly to the `WP_Query::query()` method, rather than to the constructor and calling get_posts(), following [55569].

Props david.binda, azaozz, spacedmonkey, mukesh27, flixos90, SergeyBiryukov, joemcgill.
Fixes #59224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-29 22:13:18 +00:00
Joe McGill
c15220ee49 Posts, Post Types: Reinstate missing sort_column options in get_pages().
This fixes an issue introduced in [55569] that broke sort ordering by `post_modified_gmt` or `modified_gmt`.

Props david.binda, azaozz, spacedmonkey, flixos90, joemcgill.
Fixes #59226.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-29 22:05:23 +00:00
Pascal Birchler
a4ee712d0d Site Health: fix check name used for REST API permission checks.
Updates the calls to permission validation calls for the `directory-sizes` and `page-cache` routes to actually match the route names.

Follow-up to r54043 and r49154.

Props szepeviktor.
Fixes #59236
Built from https://develop.svn.wordpress.org/trunk@56489


git-svn-id: http://core.svn.wordpress.org/trunk@56001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-29 15:41:17 +00:00
Pascal Birchler
e07e95e232 Media: Prevent warning if [caption] shortcode is used without attributes.
Props maltfield, aslamdoctor.
Fixes #59206.
Built from https://develop.svn.wordpress.org/trunk@56488


git-svn-id: http://core.svn.wordpress.org/trunk@56000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-29 15:35:21 +00:00
Sergey Biryukov
cf6042fa3a External Libraries: Upgrade PHPMailer to version 6.8.1.
This is a minor maintenance release.

Note: WordPress core does not include PHPMailer's DSN class, as it is not particularly relevant for WP.

References:
* [https://github.com/PHPMailer/PHPMailer/releases/tag/v6.8.1 PHPMailer 6.8.1 release notes]
* [https://github.com/PHPMailer/PHPMailer/compare/v6.8.0...v6.8.1 Full list of changes in PHPMailer 6.8.1]

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749], [52811], [53500], [53535], [53917], [54427], [54937], [55557].

Props jrf, Synchro.
Fixes #59238.
Built from https://develop.svn.wordpress.org/trunk@56484


git-svn-id: http://core.svn.wordpress.org/trunk@55996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-29 13:46:23 +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
Aaron Jorbin
2213e52fd8 External Libraries: Update jQuery to version 3.7.1.
This release fixes a regression from jQuery 3.6.0 that resulted in rounded dimensions for `<tr />` elements in Chrome and Safari. Also, a (mostly) internal Sizzle method, `jQuery.find.tokenize` that was on the jQuery object was accidentally removed when they removed Sizzle in jQuery 3.7.0. That method has been restored.

References:
- https://blog.jquery.com/2023/08/28/jquery-3-7-1-released-reliable-table-row-dimensions/
- https://github.com/jquery/jquery/compare/3.7.0...3.7.1

Follow-up to [49101], [50445], [50520], [54202], [55012], [55491], [55860].

Props TobiasBg, jorbin.
Fixes #59227.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-28 17:14:23 +00:00
Sergey Biryukov
1d7eb16bc7 XML-RPC: Remove unused wpdb global in wp_xmlrpc_server::mw_newMediaObject().
Follow-up to [2676], [4961], [5008], [24716], [34578].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-28 14:37:20 +00:00
John Blackbourn
6a216a567c Editor: Replace some accidental double setting up of tests with proper tearing down.
See #55505, #58955

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


git-svn-id: http://core.svn.wordpress.org/trunk@55991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-27 20:34:21 +00:00
John Blackbourn
9bb4defc3e Users: Call add_user_meta() instead of update_user_meta() when adding metadata to a new user.
This improves the performance of inserting users as it removes one unnecessary `SELECT` query for every row of metadata inserted.

Props swissspidy, spacedmonkey, johnbillion

Fixes #59212

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


git-svn-id: http://core.svn.wordpress.org/trunk@55990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-27 12:23:23 +00:00
Sergey Biryukov
c9c4cf7b02 Users: Remove unused wpdb global in check_password_reset_key().
Follow-up to [45716].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-27 04:49:23 +00:00
John Blackbourn
fb7c6f3df9 Database: Improve the documentation for various methods in the wpdb class.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-26 18:11:20 +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
Sergey Biryukov
b79e69ba3b Docs: Fix typo in a translator comment in _deprecated_class().
Includes a few other formatting adjustments for consistency.

Follow-up to [48327], [56467], [56471].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56474


git-svn-id: http://core.svn.wordpress.org/trunk@55986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-26 04:49:21 +00:00
audrasjb
108b9f8ddb Upgrade/Install: Add missing escaping function for get_option( 'home' ) in upgrade.php.
Props dilipbheda.
Fixes #59199.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 05:44:16 +00:00
audrasjb
1b245d9568 Docs: Improve PHPCS comments general consistency.
Props nekojonez.
See #58833.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 05:11:17 +00:00
audrasjb
510c3e9628 Docs: Docblock improvements in _deprecated_class() function, as per docblocks standards.
Follow-up to [56467].

See #58833.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 05:04:19 +00:00
Drew Jaynes
24ac6595a6 Fix coding standards for Tests_Admin_wpUserSearch
See #41125.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 03:44:19 +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
Drew Jaynes
55d1c71d56 Fix coding standards for translatable _deprecated_class() message strings
See #41125

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


git-svn-id: http://core.svn.wordpress.org/trunk@55980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 03:35:17 +00:00
Drew Jaynes
668dceb31c Introduce a _deprecated_class() function.
Similar to other function in the `_deprecated_*` series, `_deprecated_class()` comes with two new hooks: `deprecated_class_run` and `deprecated_class_trigger_error`.

Support has also been added for setting class deprecation expectations in tests.

Props jrf, wvega, ohryan.
See #41125.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 03:25:21 +00:00
Sergey Biryukov
320d5873f7 Coding Standards: Use strict comparison in wp-includes/class-wp-widget.php.
Follow-up to [10764], [10912], [11427].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-25 01:28:16 +00:00
desrosj
39c6a67c0a Build/Test Tools: Ensure database containers are prepared for commands.
By default, Docker waits for a container to be started before considering it “ready”. But this does not necessarily mean that it’s ready to receive commands.

This adds a check that ensures the database container is ready to receive commands before proceeding with running commands.

Follow up to [56439], [56440], [56443].

Props rmccue, desrosj.
See #30462, #58867.
Built from https://develop.svn.wordpress.org/trunk@56464


git-svn-id: http://core.svn.wordpress.org/trunk@55976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 21:04:14 +00:00
Peter Wilson
e227b5e758 Block Editor: Update SVN props to ignore new asset files.
Update svn props to ignore additional CSS files added to WordPress 6.3.

Fixes #59197.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 21:02:18 +00:00
Adam Silverstein
553f886d61 Customizer: use the correct X-Robots-Tag header.
Fix an issue where the `X-Robots` header was used instead of the `X-Robots-Tag` header.  Using `X-Robots-Tag` yields the correct behavior that the original code intended to add. `X-Robots` is left in place for backward compatibility.

Props michelleblanchette, dhruvishah2203, rajinsharwar, jorbin, hztyfoon, elrae. 

Fixes #58865.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 20:50:17 +00:00
Weston Ruter
ee4230d5f8 Build Tools: Avoid doing copy:dynamic when running grunt watch when using --dev option.
This prevents erroneously copying a file from source onto itself in source.

Props westonruter, jorbin.
Fixes #59196.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 20:42:18 +00:00
joedolson
1791f613f4 Help/About: Match icon and text in Help for bulk edit button.
Change the 'x' in the Help message that instructs a user how to remove an item from a group of bulk edit items to use the dashicon and text equivalent that matches the visual and accessible control name.

Props Presskopp, costdev, sabernhardt, matthewfarlymn, bvreeman22.
Fixes #58785.
Built from https://develop.svn.wordpress.org/trunk@56460


git-svn-id: http://core.svn.wordpress.org/trunk@55972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 20:27:12 +00:00
K. Adam White
96cd4c4224 REST API: Remove misleading comment in WP_REST_Blocks_Controller->get_item_schema.
In r56093 schema caching was added above a comment instructing developers not to cache that controller's schema. However, there is no obvious penalty for re-caching schema that is partially derived from a parent.

Caching schema in the same way in every controller is beneficial consistency, and discussion at WCUS2023 contributor day concluded we could remove this comment.

Props ahardyjpl, davidbinda, johnjamesjacoby, TimothyBlynJacobs.

Fixes #59193. See #58657.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 20:23:16 +00:00
TimothyBlynJacobs
9af3c92a4e General: Use regular core button styles for page header actions.
Props emailjoey, melchoyce, afercia, michaelarestad, danieltj, helen.
Fixes #41986.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 20:16:18 +00:00
davidbaumwald
8bd5d74be2 Editor: Optimize wp_get_block_css_selector to remove array_merge calls for better performance.
Some block themes like TT3 use `wp_get_block_css_selector` to determine a CSS selector based on block type and other parameters.  However, recent performance profiling indicated a bottleneck in `wp_get_block_css_selector`, particularly sections that utilize `array_merge`.  By slightly refactoring these sections, `array_merge` calls can be avoided which increases performance.

Props mukesh27, joemcgill, daxelrod, tabrisrp.
Fixes #59178.
Built from https://develop.svn.wordpress.org/trunk@56457


git-svn-id: http://core.svn.wordpress.org/trunk@55969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 19:59:17 +00:00
Peter Wilson
099ec7eec8 Administration: Escape post type output as field attribute.
Props viralsampat.
Fixes #59190.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 19:43:12 +00:00
antpb
b6368060a5 Performance: Add fallback for $script_uri to prevent firing plugins_url() unnecessarily.
Previously, in `register_block_script_handle()` the `$script_uri` variable initialized with a `plugins_url()` call that was reported to invoke four times. In this patch the var is initialized as a blank string with a fallback to use the `plugins_url()` if the other intended conditions are not met.

Props mukesh27, daxelrod, adamsilverstein, davidbaumwald.
Fixes #59181.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 19:38:19 +00:00
Aaron Jorbin
c8aa89e42d Login and Registration: Improve test coverage for sign on related functions
Adds new tests to ensure that `wp_authenticate_email_password`, `wp_authenticate_username_password`, and `wp_authenticate_cookie` are better tested. This also unsets cookies properly between tests.

Props JordanPak, johnregan3.
Fixes #36476.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 19:14:21 +00:00
joedolson
30ffb247b7 Build/Test: Revert unintentional .env change in [56449].
Also committed a change to .env. Sigh.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 17:35:17 +00:00
John Blackbourn
aa8ba65a34 Media: Add a filter to the get_available_post_mime_types() function to allow overriding its database query.
This introduces the `get_available_post_mime_types` filter so this query can be skipped or cached by plugins.

Props maciejmackowiak, archon810, rcorrales

Fixes #52759

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


git-svn-id: http://core.svn.wordpress.org/trunk@55964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 16:55:18 +00:00
whyisjake
7a497b9c2f Bundled Themes: Ensure that pull quotes are able to use the correct font
size.

Pull quote bodies weren't inheriting the correct styling from the block 
editor. This ensure that will happen. 

Props nidhidhandhukiya, poena, varjodesigns, jivygraphics, whyisjake.
Fixes #57854.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 16:16: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
Joe McGill
64e114f233 Rewrite Rules: Prevent stampedes when flush_rewrite_rules() is called
This ensures that the `rewrite_rules` option is not emptied until the new value has been recalculated and the option is updated. The logic for refreshing the option value is moved to a new private method named `WP_Rewrite::refresh_rewrite_rules` which is used by both the `flush_rules` and `refresh_rewrite_rules` methods.

Props iCaleb, joemcgill, flixos90, mukesh27.
Fixes #58998.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 15:57:17 +00:00
Peter Wilson
1840a5550a Bundled Theme: Twenty Nineteen: Improve social media icon dimension attributes.
Set the default width and height attributes of the SVG social icons to match the dimensions used within the CSS. This increases the attributes to 32px x 32 px.

Props crunnells, mukesh27, laurelfulford, tahmidulkarim, jordanpak.
Fixes #45950.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 15:34:17 +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
Felix Arntz
cba2612b9e Options, Meta APIs: Introduce prime_options() to load multiple options with a single database request.
WordPress's `get_option()` function generally relies on making individual database requests for each option, however with the majority of options (in most cases) being autoloaded, i.e. fetched once with a single database request and then stored in (memory) cache.

As part of a greater effort to reduce the amount of options that are unnecessarily autoloaded, this changeset introduces an alternative way to retrieve multiple options in a performant manner, with a single database request. This provides a reasonable alternative for e.g. plugins that use several options which only need to be loaded in a few specific screens.

Specifically, this changeset introduces the following functions:
* `prime_options( $options )` is the foundation to load multiple specific options with a single database request. Only options that aren't already cached (in `alloptions` or an individual cache) are retrieved from the database.
* `prime_options_by_group( $option_group )` is a convenience wrapper function for the above which allows to prime all options of a specific option group (as configured via `register_setting()`).
* `get_options( $options )` is another wrapper function which first primes the requested options and then returns them in an associative array, calling `get_option()` for each of them.

Props mukesh27, joemcgill, costdev, olliejones.
Fixes #58962.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 14:42:17 +00:00
Aaron Jorbin
6296d14857 Build/Tests: Tests_Formatting_MakeClickable should use data providors
Removes the foreach loops from the tests by moving the in-test data sets into data providers and combines the URL data sets into one data provider to test with one test method. By using a data providor, all the tests run rather than stopping at the first failure in this group.

Fixes #57660.
Props hellofromTonya.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 14:35:16 +00:00
desrosj
f4ee013cc2 Build/Test Tools: Implicitly pass secrets to the called workflow.
This ensures the Hosting Test results API key is present for reporting results.

Follow up to [56439] and [56440].

See #30462.
Built from https://develop.svn.wordpress.org/trunk@56443


git-svn-id: http://core.svn.wordpress.org/trunk@55955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 14:23:16 +00:00
desrosj
bf18785366 Build/Test Tools: Change the version of Node.js in the Codespaces container.
Follow up to [56378] and [56387].

Props jeffpaul.
See #56658.
Built from https://develop.svn.wordpress.org/trunk@56442


git-svn-id: http://core.svn.wordpress.org/trunk@55954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 14:09:18 +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
desrosj
5342e7defe Build/Test Tools: Merge pre-commit changes missed in [56439].
Props l1nuxjedi.
See #30462.
Built from https://develop.svn.wordpress.org/trunk@56440


git-svn-id: http://core.svn.wordpress.org/trunk@55952 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 13:30:16 +00:00
desrosj
67b7960b06 Build/Test Tools: Expand database testing to account for all supported versions and types.
This modifies the PHPUnit workflow to add MySQL version 8.0 to the strategy matrix. It also adds an additional strategy matrix to expand testing to include several supported MariaDB versions.

To prevent repeating code, the business logic of the PHPUnit testing has been moved to a new, callable workflow.

Because callable workflows target a specific branch, branches created in the future will continue to benefit from improvements made to the workflow in `trunk` without requiring backports. If a breaking change is required, older branches will need to be updated to target the commit SHA representing the final commit of the previous state.

Props johnbillion, pento, boonebgorges, netweb, nacin, desrosj.
Fixes #30462.
Built from https://develop.svn.wordpress.org/trunk@56439


git-svn-id: http://core.svn.wordpress.org/trunk@55951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 13:10:15 +00:00
Sergey Biryukov
71ed5a6b53 Coding Standards: Use strict comparison in wp-includes/ms-site.php.
Follow-up to [12603], [43548], [43654], [44472].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 11:19:16 +00:00
audrasjb
42c9882b46 Revisions: Add missing escaping function for $post_edit_link in wp-admin/revision.php.
Props nidhidhandhukiya, Presskopp, mukesh27, rajinsharwar, costdev.
Fixes #59141.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 09:32:21 +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
f10d37dfe9 Docs: Use third-person singular verbs in various function descriptions, as per docblocks standards.
See #58833.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 09:08:15 +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
audrasjb
ac9381b7c2 Docs: Add missing @param description in WP_Comment class.
Props armondal, hztyfoon, SergeyBiryukov.
Fixes #58890.
See #58833.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-24 08:44:24 +00:00
Sergey Biryukov
a278aa2ac0 Coding Standards: Use strict comparison in wp-includes/ms-files.php.
Follow-up to [12603], [12936], [56395].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-23 15:53:24 +00:00
Sergey Biryukov
106404bcbd Posts, Post Types: Remove redundant function calls in get_body_class().
As part of a previous change to add support for post type templates, the `$wp_query->get_queried_object_id()` method ended up being called twice, in both the `is_singular()` and `is_page()` conditional branches.

The `get_post()` function call was also unnecessary, as `$wp_query->get_queried_object()` is already called in the `is_singular()` branch above, which includes the `is_page()` branch too.

This commit removes the redundant calls. The first `$wp_query->get_queried_object_id()` call is removed as well, since the post ID is already available via `$wp_query->get_queried_object()`.

Follow-up to [10485], [10877], [12877], [13032], [21597], [38951].

Props mattkeys, spacedmonkey, oglekler.
Fixes #43661.
Built from https://develop.svn.wordpress.org/trunk@56424


git-svn-id: http://core.svn.wordpress.org/trunk@55936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-22 12:30:29 +00:00
hellofromTonya
87aa505a94 Editor: Fix error handling of converting classic to block menus.
Fixes the error handling for when `WP_Classic_To_Block_Menu_Converter::convert()` returns an instance of `WP_Error`. `WP_Navigation_Fallback::create_classic_menu_fallback()` now checks for `is_wp_error()` and if `true`, returns the error. And the `@return` type is updated to `string|WP_Error`.

Also includes a fix in the return type in `WP_Classic_To_Block_Menu_Converter::convert()` to return an empty string instead of an array instead, i.e. when bailing out for no menu items returned by `wp_get_nav_menu_items()`. The return type is clearly documented as a `string`.

Follow-up to [56052].

Props dlh, get_dave, antonvlasenko, hellofromTonya.
Fixes #58823.
Built from https://develop.svn.wordpress.org/trunk@56422


git-svn-id: http://core.svn.wordpress.org/trunk@55934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-21 17:51:19 +00:00
Sergey Biryukov
7ac58a13b4 Build/Test Tools: Update PHPUnit Polyfills to version 1.1.0.
[https://github.com/sebastianbergmann/phpunit/blob/9.6/ChangeLog-9.6.md#961---2023-02-03 PHPUnit 9.6.1] deprecated the `assertObjectHasAttribute()` and `assertObjectNotHasAttribute()` methods, leading to deprecation notices in a number of tests.

[https://github.com/sebastianbergmann/phpunit/blob/10.1.3/ChangeLog-10.1.md#1010---2023-04-14 PHPUnit 10.1.0] brought the methods back by popular request, though renamed as `assertObjectHasProperty()` and `assertObjectNotHasProperty()`, to prevent confusion with PHP 8.0 attributes.

This meant that users which cannot (yet) upgrade to PHPUnit 10.1+ would always have deprecation notices for these methods without recourse. So, after much discussion, the new methods have been backported to [https://github.com/sebastianbergmann/phpunit/blob/9.6/ChangeLog-9.6.md#9611---2023-08-19 PHPUnit 9.6.11], leaving just the 10.0.x series with a deprecation notice and no recourse.

What does this mean for WordPress?

WordPress uses the [https://github.com/Yoast/PHPUnit-Polyfills PHPUnit Polyfills] to be able to write tests for the most recent versions of PHPUnit, with the Polyfills taking care of polyfilling any new PHPUnit methods on older PHPUnit versions.

* The PHPUnit Polyfills 1.x series supports PHPUnit 4.x to 9.x.
* The PHPUnit Polyfills 2.x series supports PHPUnit 5.x to 10.x.

WordPress currently runs against PHPUnit 6.x to 9.x with PHPUnit Polyfills 1.x, while the new methods were previously only included in PHPUnit Polyfills 2.0.0+, as they were introduced in PHPUnit 10.x.

Since the `assertObjectHasProperty()` and `assertObjectNotHasProperty()` methods have been backported to PHPUnit 9.x, the PHPUnit Polyfills will now include these methods in the 1.x series as well.

By upgrading to the latest [https://github.com/Yoast/PHPUnit-Polyfills/releases/tag/1.1.0 PHPUnit Polyfills 1.1.0] release, we can get rid of the deprecation notices related to the use of the `assertObjectHasAttribute()` and `assertObjectNotHasAttribute()` methods.

This could have implications for plugins or themes running integration tests with WordPress if they have set their PHPUnit Polyfills dependency to a fixed version or have a too strict version constraint (limiting the PHPUnit Polyfills to the 1.0.x series). The solution for those plugins or themes is to update their version constraints for the PHPUnit Polyfills to allow for the 1.1.x series.

Follow-up to [51559], [51598].

Props jrf, ayeshrajans.
Fixes #59150.
Built from https://develop.svn.wordpress.org/trunk@56421


git-svn-id: http://core.svn.wordpress.org/trunk@55933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-21 15:55:20 +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
isabel_brison
69e0187d65 Editor: update npm packages with critical bug fixes for 6.3.1.
Includes fixes for footnotes and editor styles related crashes, as well as a cut and paste-related crash.

Props ramonopoly.
See #59151.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-19 23:22:38 +00:00
Sergey Biryukov
efdebb621b Docs: Correct punctuation in some instances of the $crop parameter description.
Follow-up to [56416].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56418


git-svn-id: http://core.svn.wordpress.org/trunk@55930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-19 00:10:23 +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
b5e754ee35 Media: Standardise documentation of the $crop parameter for various media functions and methods.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 17:56:17 +00:00
John Blackbourn
3d796edc68 REST API: Correct the docblocks for various permission related methods.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 17:46:18 +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
oandregal
66e0592185 Themes: add wp_get_theme_data_custom_templates function.
Adds a new public function, `wp_get_theme_data_custom_templates` that returns the `customTemplates` defined by the active theme from `theme.json`. It also substitutes the usage of private APIs by this new 
API.

Props johnbillion, audrasjb.
Fixes #59137


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


git-svn-id: http://core.svn.wordpress.org/trunk@55925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 13:22:13 +00:00
oandregal
6f42888d5e Add missing @ to the return tag in the wp_get_theme_data_template_parts function.
Props audrasjb, johnbillion.
Fixes #59003


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


git-svn-id: http://core.svn.wordpress.org/trunk@55924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 13:18:17 +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
desrosj
aa9955e926 Build/Test Tools: Revert Slack messaging changes.
This reverts [56404], [56405], [56406].

More testing is needed to ensure multiple messages are not sent unintentionally.

Unprops desrosj.
See #58867.
Built from https://develop.svn.wordpress.org/trunk@56407


git-svn-id: http://core.svn.wordpress.org/trunk@55919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 17:58:15 +00:00
desrosj
3b88a37e6e Build/Test Tools: Send a failure notice in Slack when a run fails to start.
This adds `startup_failure` to the list of conclusions that the Slack workflow looks for when determining whether to send a failure notice.

See #58867.
Built from https://develop.svn.wordpress.org/trunk@56406


git-svn-id: http://core.svn.wordpress.org/trunk@55918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 17:36:16 +00:00
desrosj
47a06aed12 Build/Test Tools: Use the correct variable for checking the previous conclusion.
Follow up to [56404].
See #58867.
Built from https://develop.svn.wordpress.org/trunk@56405


git-svn-id: http://core.svn.wordpress.org/trunk@55917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 17:19:17 +00:00
desrosj
c165f9d301 Build/Test Tools: Don’t send a Slack notice when a workflow fails once.
[53947] introduced a callable workflow that allowed a workflow run to be retried automatic. By default all workflows are retried once.

Since a run is not considered “failed” until after the automatic retry, the first Slack message is unnecessary and can cause a lot of noise when there are network hiccups.

This alters the logic to skip a failure notice in Slack until the second failure.

See #58867.
Built from https://develop.svn.wordpress.org/trunk@56404


git-svn-id: http://core.svn.wordpress.org/trunk@55916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 17:01:18 +00:00
Weston Ruter
36d24b511a Editor: Ensure defer loading strategy is only applied to a block's viewScript.
Amends [56398].
Props gziolo, westonruter.
Fixes #59115.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 16:39:18 +00:00
desrosj
a8ab676b36 Build/Test Tools: Simplify the required prerequisite jobs for the failed-workflow job.
Because `slack-notifications` job requires all preceding jobs in each workflow to complete, there’s no need to include the same jobs in the `needs` configuration for the `failed-workflow` one.

See #58867.
Built from https://develop.svn.wordpress.org/trunk@56402


git-svn-id: http://core.svn.wordpress.org/trunk@55914 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-17 14:44:16 +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
Pascal Birchler
e30f7901a5 Build/Test Tools: Measure additional load time metrics in performance tests.
Three new metrics are being collected and reported as part of this change:

- Time To First Byte (TTFB) - the time between the request for a resource and when the first byte of a response begins to arrive
- Largest Contentful Paint (LCP) — the render time of the largest image or text block visible within the viewport
- The difference between the two (LCP minus TTFB)

Props joemcgill, flixos90, oandregal, mukesh27, youknowriad, swissspidy.
Fixes #58360.
Built from https://develop.svn.wordpress.org/trunk@56399


git-svn-id: http://core.svn.wordpress.org/trunk@55911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-16 08:48:23 +00:00
Weston Ruter
467c7de24d Editor: Use defer loading strategy for block view scripts.
Props westonruter, joemcgill.
Fixes #59115.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-16 00:15:23 +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
Sergey Biryukov
11aa9b4da5 Coding Standards: Bring more consistency to Last-Modified and ETag checks.
This updates two fragments for sending a `304 Not Modified` header to better align with each other by using consistent variable names and formatting. 

Follow-up to [1036], [1037], [1043], [2534], [2584], [2627], [12603], [12936], [56362].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-13 10:31:23 +00:00
Sergey Biryukov
22f80e9382 Coding Standards: Use strict comparison in wp-includes/cron.php.
Includes minor code layout fixes for better readability.

Follow-up to [3634], [4189].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-12 12:02:24 +00:00
desrosj
0c05aa75e8 External Libraries: Update imagesLoaded to version 5.0.0.
This release drops support for IE and moves to using ES6.

A full list of changes can be found on GitHub: https://github.com/desandro/imagesloaded/compare/v4.1.4...v5.0.0.

Props nazsabuz, arnedb, costdev, audrasjb, ahmedgeek , valmedia2023 , hareesh-pillai.
Fixes #56731.
Built from https://develop.svn.wordpress.org/trunk@56393


git-svn-id: http://core.svn.wordpress.org/trunk@55905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 18:18:26 +00:00
John Blackbourn
a240a161b9 Editor: Only exclude auto-generated block files from coding standards checks.
Prior to this change, all block files were excluded from coding standards checks, but there's no reason these files shouldn't adhere to core's coding standards.

Props lopo, Rahe, adamsilverstein 

Fixes #50010

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


git-svn-id: http://core.svn.wordpress.org/trunk@55904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 17:03:17 +00:00
desrosj
43e676dedb External Libraries: Update Backbone.js to version 1.5.0.
This release contains bug fixes and documentation improvements.

A full list of changes can be found on GitHub: https://github.com/jashkenas/backbone/compare/1.4.1...1.5.0.

Props rajinsharwar, hareesh-pillai.
Fixes #58930.
Built from https://develop.svn.wordpress.org/trunk@56391


git-svn-id: http://core.svn.wordpress.org/trunk@55903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 16:12:21 +00:00
desrosj
afd36de0b5 Build/Test Tools: Update all build tool related dependencies.
This updates the following dependencies to their latest versions:
- `chalk`
- `cssnano`
- `dotenv`
- `grunt-contrib-cssmin`
- `grunt-contrib-qunit`
- `grunt-webpack`
- `jest-image-snapshot`
- `postcss`
- `sass`
- `sinon`
- `webpack`

Additionally, `npm audit fix` has been run to automatically fix as many issues as possible.

See #58863.
Built from https://develop.svn.wordpress.org/trunk@56390


git-svn-id: http://core.svn.wordpress.org/trunk@55902 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 16:04:29 +00:00
desrosj
dbb1d98290 External Libraries: Update the whatwg-fetch polyfill library.
This updates the `whatwg-fetch` library from version `3.6.2` to `3.6.17`, the latest current version.

This library is included and registered within WordPress as the `wp-polyfill-fetch` script and is no longer used by WordPress itself.

Props rajinsharwar, hareesh-pillai.
Fixes #59066.
Built from https://develop.svn.wordpress.org/trunk@56389


git-svn-id: http://core.svn.wordpress.org/trunk@55901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 14:44:18 +00:00
desrosj
c392de6215 Build/Test Tools: Update 3rd-party GitHub Actions.
This updates all 3rd-party GitHub Actions to their latest versions.

See #58867.
Built from https://develop.svn.wordpress.org/trunk@56388


git-svn-id: http://core.svn.wordpress.org/trunk@55900 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 13:05:17 +00:00
desrosj
1fca49bfda Build/Test Tools: Update the README file to reflect new Node.js/npm versions.
Follow up to [56378].

Props dantovbein, hbhalodia.
Fixes #59071. See #56658.
Built from https://develop.svn.wordpress.org/trunk@56387


git-svn-id: http://core.svn.wordpress.org/trunk@55899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 12:49:15 +00:00
Sergey Biryukov
93bf4a6d6f Docs: Correct duplicate hook reference for wp_min_priority_img_pixels.
The original filter location is `wp_maybe_add_fetchpriority_high_attr()` in `wp-includes/media.php`.

This commit updates the instance in `wp_get_loading_optimization_attributes()` to point to the correct file.

Follow-up to [56037], [56143], [56347].

Props tmatsuur, rajinsharwar, khokansardar.
Fixes #59067.
Built from https://develop.svn.wordpress.org/trunk@56386


git-svn-id: http://core.svn.wordpress.org/trunk@55898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 11:35:19 +00:00
oandregal
96c6c273dd Themes: add wp_get_theme_data_template_parts function.
Adds a new public function, `wp_get_theme_data_template_parts` that returns the `templateParts` defined by the active theme from `theme.json`. It also substitutes the usage of private APIs by this new API.

Props felixarntz.
Fixes #59003

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


git-svn-id: http://core.svn.wordpress.org/trunk@55897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 11:24:11 +00:00
Sergey Biryukov
77a55d839e Tests: Correct two @covers annotations to use the recommended pattern.
When global functions are covered, they need to be prefixed with `::` (double colon) to distinguish them from class name.

Reference: [https://docs.phpunit.de/en/10.3/annotations.html#covers PHPUnit Manual: @covers annotation].

Follow-up to [48848], [49305], [53741], [56296].

Props ayeshrajans.
Fixes #59069.
Built from https://develop.svn.wordpress.org/trunk@56384


git-svn-id: http://core.svn.wordpress.org/trunk@55896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-11 11:19:20 +00:00
Weston Ruter
a2cdce6c82 Embeds: Modernize wp-embed script with removal of obsolete IE10/IE11 code and support for WP<4.4.
* Remove obsolete `load` event handler in `wp-embed` since IE10+ support `DOMContentLoaded`.
* Replace obsolete use of `document.createElement('a')` in favor of the newer `URL` class (supported in all browsers but obsolete IE11).
* Remove obsolete IE10/IE11 code.
* Combine conditionals.
* Use `substring()` instead of deprecated `substr()` method.
* Eliminate the stipulation that `wp-embed.js` not include ampersands, considering this was put in place for WP<4.3 which now accounts for only 1.43% of sites. This includes the elimination of the `verify:wp-embed` grunt task.

Props westonruter, swissspidy.
Fixes #58974.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 19:49:17 +00:00
Felix Arntz
268203f8aa Editor: Simplify usage of block_has_support() function by supporting a string.
Most block feature checks are for a single feature string, and for such cases it is not intuitive to require an array for the `$feature` parameter of the `block_has_support()` function.

This changeset brings it in line with other functions like `post_type_supports()`, allowing to pass a string for the `$feature`. An array is still supported for more complex cases where support for sub-features needs to be determined. This change furthermore includes a very minor performance tweak by avoiding calls to the `_wp_array_get()` function if a single feature string is being checked for.

Props thekt12, nihar007, mukesh27, swissspidy.
Fixes #58532.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 16:48:19 +00:00
Sergey Biryukov
f106155bf8 Users: Correct the logic for switch_to_blog() in WP_User_Query::generate_cache_key().
If `$blog_id` equals `0`, it should be treated as the current site ID, and there is no need to switch to a different site.

This commit prevents an unnecessary call to `switch_to_blog()` on single site to avoid a fatal error when using `'orderby' => 'post_count'` and the deprecated `'who' => 'authors'` parameter:
{{{
Uncaught Error: Call to undefined function switch_to_blog() in wp-includes/class-wp-user-query.php:1077
}}}

Follow-up to [55657].

Props dd32, austinginder, RavanH, mukesh27.
Fixes #59011.
Built from https://develop.svn.wordpress.org/trunk@56381


git-svn-id: http://core.svn.wordpress.org/trunk@55893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 10:26:19 +00:00
Bernhard Reiter
12884f0361 HTML API: Add support for BUTTON element.
This patch adds support to process the BUTTON element. This requires adding some additional semantic rules to handle situations where a BUTTON element is already in scope.

Also included is a fixup to enforce that `WP_HTML_Processor::next_tag()` never returns for a tag closer. This is useful with the Tag Processor, but not for the HTML Processor. There were tests relying on this behavior to assert that internal processes were working as they should, but those tests have been updated to use the semi-private `step()` function, which does stop on tag closers.

This patch is one in a series of changes to expand support within the HTML API, moving gradually to allow for more focused changes that are easier to review and test. The HTML Processor is a work in progress with a certain set of features slated to be ready and tested by 6.4.0, but it will only contain partial support of the HTML5 specification even after that. Whenever it cannot positively recognize and process its input it bails, and certain function stubs and logical stubs exist to structure future expansions of support.

Props dmsnell.
Fixes #58961.
Built from https://develop.svn.wordpress.org/trunk@56380


git-svn-id: http://core.svn.wordpress.org/trunk@55892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 08:37:20 +00:00
Sergey Biryukov
5ac6ad6e2e Docs: Remove @see references for SimplePie classes.
As SimplePie is an external library, these classes are not parsed for the WordPress Code Reference, so the `@see` tags were linking to non-existing pages.

Follow-up to [38112].

Props crstauf.
Fixes #59030.
Built from https://develop.svn.wordpress.org/trunk@56379


git-svn-id: http://core.svn.wordpress.org/trunk@55891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 01:06:21 +00:00
desrosj
c7133f4fae Build/Test Tools: Bump the required versions of Node.js and npm.
This changes the minimum required version of Node.js to 16.19.1, and npm to 8.19.3.

Node.js 14.x reached end of life on April 30, 2023. While 18.x is the currently active LTS version, it can’t yet be used due to a systems level constraint on the build server. 

Updating further will be considered once this blocker is resolved.

Gutenberg has also been updated to follow the same version requirements for consistency.

Props youknowriad, gziolo, swissspidy, kevin940726, desrosj.
Fixes #56658.
Built from https://develop.svn.wordpress.org/trunk@56378


git-svn-id: http://core.svn.wordpress.org/trunk@55890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-09 18:54:51 +00:00
Sergey Biryukov
ba52c45385 Coding Standards: Use strict comparison in wp-includes/kses.php.
Follow-up to [649], [2896], [3418], [8386], [20540], [47219], [54933].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-09 11:01:24 +00:00
Aaron Jorbin
5341f9b212 HTML API: Fix missing * for docblock.
Follow up to [56363].

Props dmsnell.
See #58918. Fixes #59010.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-08 23:01:26 +00:00
Felix Arntz
65a442fbcd Options, Meta APIs: Expand $autoload parameter documentation.
This changeset expands documentation of the `$autoload` parameter of the `add_option()` and `update_option()` functions, in order to provide more context on what autoloading is and which considerations should go into the decision whether to autoload an option.

Excessive autoloading of options can lead to severe performance problems on some sites, and lack of documentation is a partial cause for the issue.

Props rajinsharwar.
Fixes #58963.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-07 19:33:32 +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
Bernhard Reiter
fa83c8e1cd HTML API: Adjust code styling to Gutenberg's linter's preferences.
Adjust the code style according to the rules that the linting process in Gutenberg requires.

There are only a couple code changes that should have no effect on the runtime:
 - A missing check to verify that only `UTF-8` is supported has been added (brought up because it was identified as an undefined variable).
 - A few `return false;` statements have been added to avoid having the linter complain that functions don't return a value despite indicating they return `bool`. The functions are stubs for coming support and currently `throw`, so the `return` statements are unreachable.

Props dmsnell, costdev, davidbaumwald, peterwilsoncc, SergeyBiryukov.
Fixes #58918.
Built from https://develop.svn.wordpress.org/trunk@56363


git-svn-id: http://core.svn.wordpress.org/trunk@55875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-07 13:50:27 +00:00
Sergey Biryukov
da0f366b22 Coding Standards: Use strict comparison in wp-includes/class-wp.php.
Includes minor code layout fixes for better readability.

Follow-up to [1043], [2534], [2584], [2627], [2958], [3252], [3564], [21818], [37356].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-07 10:01:27 +00:00
Sergey Biryukov
52317da292 Coding Standards: Use strict comparison in wp-includes/class-wp-image-editor.php.
Follow-up to [22094].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-06 12:52:25 +00:00
Sergey Biryukov
df89489ac6 Coding Standards: Rewrite loose comparison in wp_list_categories().
A truthy check is more in line with similar checks elsewhere, including conditionals in the same exact code block.

Follow-up to [10275], [34696].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-05 14:02:26 +00:00
Sergey Biryukov
ba7c01a09c Coding Standards: Use strict comparison in wp-includes/revision.php.
Follow-up to [24414], [38118], [38433].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-04 11:58:25 +00:00
Weston Ruter
b26df97c16 Emoji: Suppress console errors from sessionStorage usage in sandboxed post embed iframe.
Amends [56074].

Props westonruter, flixos90.
Fixes #58978.
See #58472.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-04 00:23:25 +00:00
Felix Arntz
7c7f95a8b2 Themes: Avoid unnecessary check whether parent template file exists when not using a child theme.
Prior to this change, the `locate_template()` function would unconditionally check whether the relevant template file exists in the parent theme, which for sites not using a child theme is an exact duplicate of the previous check. This is wasteful and has a small impact on performance since `file_exists()` checks have a cost.

Props nihar007, thekt12, spacedmonkey, mukesh27.
Fixes #58576.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 20:31:22 +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
Weston Ruter
5ccbf34eaa Script Loader: Use defer loading strategy for wp-embed script and move to head (in block themes).
Props westonruter, flixos90, swissspidy.
Fixes #58931.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 19:22:22 +00:00
hellofromTonya
7d0d2b0edf Code Modernization: Deprecate dynamic properties in WP_Text_Diff_Renderer_Table magic methods.
The unknown use of unknown dynamic property within the `WP_Text_Diff_Renderer_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_Text_Diff_Renderer_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.
* Fixes `__set()` by removing the value return after 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].
* Fixes `__isset()` to return `false` if not in the `$compat_fields`, as `isset()` and `__isset()` should always return `bool`:
   * [https://www.php.net/manual/en/language.oop5.overloading.php#object.isset `__isset()` in the PHP manual] 
   * [https://www.php.net/manual/en/function.isset.php `isset()` in the PHP manual] 
* Adds a test class with happy and unhappy paths for these changes.

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 as a property on the child class. When getting its value, e.g. `$user_query->data`, the `WP_Text_Diff_Renderer_Table::__get()` magic method is invoked, the following deprecation notice thrown, and `null` returned:

>The property `data` is not declared. Setting a dynamic property is deprecated since version 6.4.0! Instead, declare 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.

If a plugin adds a property to `$compat_fields` array, then sites using that plugin would experience (a) an `Undefined property` `Warning` (PHP 8) | `Notice` (PHP 7) and (b) a possible change in behavior.

=== 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_Text_Diff_Renderer_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.]

Follow-up to [28525], [31135].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55866 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 18:13:24 +00:00
hellofromTonya
cdc8015125 Code Modernization: Deprecate dynamic properties in WP_User_Query magic methods.
The unknown use of unknown dynamic property within the `WP_User_Query` 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_User_Query`.

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.
* Fixes `__set()` by removing the value return after 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].
* Fixes `__isset()` to return `false` if not in the `$compat_fields`, as `isset()` and `__isset()` should always return `bool`:
   * [https://www.php.net/manual/en/language.oop5.overloading.php#object.isset `__isset()` in the PHP manual] 
   * [https://www.php.net/manual/en/function.isset.php `isset()` in the PHP manual] 
* 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 as a property on the child class. When getting its value, e.g. `$user_query->data`, the `WP_User_Query::__get()` magic method is invoked, the following deprecation notice thrown, and `null` returned:

>The property `data` is not declared. Setting a dynamic property is deprecated since version 6.4.0! Instead, declare 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.

If a plugin adds a property to `$compat_fields` array, then sites using that plugin would experience (a) an `Undefined property` `Warning` (PHP 8) | `Notice` (PHP 7) and (b) a possible change in behavior.

=== 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_User_Query`. 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, #27881, #30891.

Follow-up to [15491], [28528], [31144].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 16:27:25 +00:00
Sergey Biryukov
34dd52dea7 Coding Standards: Use instanceof keyword instead of the is_a() function.
This is a micro-optimization that removes a few unnecessary function calls.

Follow-up to [31188], [34369], [38986], [41159], [43211], [43230], [44606], [45757].

Props ayeshrajans, jrf, rajinsharwar, costdev, mukesh27, SergeyBiryukov.
Fixes #58943.
Built from https://develop.svn.wordpress.org/trunk@56352


git-svn-id: http://core.svn.wordpress.org/trunk@55864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 12:10:28 +00:00
isabel_brison
8ce9f7e74a Build/Test Tools: revert downgrade of uuid.
Reverts the accidental downgrade of uuid in [56065] by changing it back to 9.0.0.

Props Hareesh Pillai, JeffPaul, audrasjb.
Fixes #58623.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-03 04:59:37 +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
hellofromTonya
d0e63ca7d2 Tests: Fix leakage in WP_List_Table tests.
Fixes `WP_List_table` tests leaking into other tests by:

* Restores the original `$hook_suffix` global value.
Rather than modifying the global for all tests, it now restores the original value between tests. Why? To ensure each test starts at a known state.

* Uses a new instance of `WP_List_Table` for each test.
A test may modify the `$list_table` object. If it does, it could impact tests yet to run. By instantiating a new instance in the `set_up()` test fixture, each test is isolated from the others.

Follow-up to [53868], [54215].

Props hellofromTonya, antonvlasenko.
See #58955, #58896.
Built from https://develop.svn.wordpress.org/trunk@56348


git-svn-id: http://core.svn.wordpress.org/trunk@55860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-02 18:00:22 +00:00
Felix Arntz
6cd7404aa3 Media: Simplify logic in wp_get_loading_optimization_attributes().
While the `wp_get_loading_optimization_attributes()` function was only recently introduced in 6.3, its code was mostly ported over from the now deprecated `wp_get_loading_attr_default()` function introduced in 5.5.

That function started out in a simple way, but over time was expanded with more and more conditionals on when to avoid lazy-loading, which ended up making the logic extremely complex and hard to follow.

This changeset refactors the logic to simplify it, in a way that allows to follow it more sequentially, and without making any functional changes, ensuring that the extensive existing unit test coverage still passes. This will facilitate future enhancements to the function to be less error-prone and make it more accessible to new contributors.

Props flixos90, joemcgill.
Fixes #58891.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-02 17:58:26 +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
Felix Arntz
e80768e045 Themes: Use isset instead of array_key_exists in WP_Theme_JSON class.
With the minimum PHP version requirement raised to 7.0, we can now use `isset` on constants that are arrays. Since `isset` is slightly faster than `array_key_exists` (and the different handling of `null` values is irrelevant for the updates here), remaining instances of `array_key_exists` in the `WP_Theme_JSON` class are replaced in this changeset.

Props soean.
Fixes #57067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 20:31: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
4a6971f99c Help/About: Add images to About page, match header style to images.
Props richtabor, markoserb, audrasjb, peterwilsoncc, mukesh27.
See #58067.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 15:04:22 +00:00
audrasjb
ed408e3731 Help/About: Escape "Contribute" links, for better consistency.
Props SergeyBiryukov, peterwilsoncc.
See #23348.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 12:58:22 +00:00
audrasjb
41dabe68ee Help/About: Remove target="_blank" from the Contribute link.
Props davidbaumwald.
See #23348.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 12:50:27 +00:00
Sergey Biryukov
7d34c9b149 Coding Standards: Use strict comparison in wp-includes/option.php.
Follow-up to [8784], [25109].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 11:01:28 +00:00
isabel_brison
3e103142ab Editor: second update of npm packages for 6.3 RC3.
Includes bug fixes for footnotes, patterns, command palette, top toolbar and other small regressions.

Props andrewserong, spacedmonkey.
See #58926.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 08:01:54 +00:00
Bernhard Reiter
8fa9aad5e6 HTML API: Add support for SPAN element.
In this patch we're introducing support for the SPAN element, which is the first
in the class of "any other tag" in the "in body" insertion mode.

This patch introduces the mechanisms required to handle that class of tags but
only introduces SPAN to keep the change focused. With the tests and mechanisms
in place it will be possible to follow-up and add another limited set of tags.

It's important that this not use the default catch-all in the switch handling
`step_in_body` because that would catch tags that have specific rules in previous
case statements that aren't yet added. For example, we don't want to treat the
`TABLE` element as "any other tag".

Props dmsnell.
Fixes #58907.
Built from https://develop.svn.wordpress.org/trunk@56331


git-svn-id: http://core.svn.wordpress.org/trunk@55843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 07:56:23 +00:00
isabel_brison
6359762e66 Editor: fix duplication in templates list.
Excludes parent template when a child template is defined during template retrieval.

Props oandregal, mukesh27, flixos90, bgardner.
See #57756.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 02:12:24 +00:00
audrasjb
29d0198455 Help/About: Make Contribute links translatable.
Follow-up to [17877], [26354], [35898], [43032], [56220], [56312].

Props sereedmedia, tobifjellner, oglekler, ryelle, fierevere, davidbaumwald, audrasjb.
See #23348.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-31 20:23:21 +00:00
Sergey Biryukov
6035d50bab Coding Standards: Use strict comparison in wp-includes/functions.php.
Follow-up to [5999], [6342], [7406], [8369], [10322], [11288], [11332], [11597], [12405], [13569], [14649], [15806], [19773], [26449], [26926], [39831], [40124].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-31 13:33:24 +00:00
Sergey Biryukov
8aa8b5883a Coding Standards: Use strict comparison in wp-includes/formatting.php.
Follow-up to [1345], [4112], [6974], [24214], [25055], [28831], [32863].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-30 08:53:25 +00:00
Sergey Biryukov
18ca91327a Coding Standards: Use strict comparison in wp-includes/feed-atom-comments.php.
Follow-up to [9818].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-29 00:31:35 +00:00
Weston Ruter
ee1baf955c Script Loader: Delay loading comment-reply script with async loading strategy.
Props westonruter, flixos90, joemcgill, sergiomdgomes.
See #12009.
Fixes #58870.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-28 17:17:24 +00:00
Sergey Biryukov
dcc82c39cc Coding Standards: Use strict comparison in wp-includes/class-wp-roles.php.
Follow-up to [25695], [41625].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-28 11:37:25 +00:00
isabel_brison
bae8871465 Editor: initial update of npm packages for 6.3 RC3.
Includes bug fixes for patterns, command palette and several minor regressions.

Props ramonopoly.
See #58926.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-28 07:40:16 +00:00
Sergey Biryukov
29c16a48ec Coding Standards: Use correct case for class name in WP_Http tests.
Follow-up to [8516], [54968].

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


git-svn-id: http://core.svn.wordpress.org/trunk@55831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-27 14:47:20 +00:00