Commit Graph

48387 Commits

Author SHA1 Message Date
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