[54248] reversed the wrapping of `do_shortcode` and `apply_shortcodes` and updated all direct internal calls of `do_shortcode` to `apply_shortcodes` after [47004]. After further consideration, the long history of `do_shortcodes` should be favored over any subjective semantic improvements. This change reverts the remaining changes from #55883 not already reverted in [54278].
Follow-up to [47004], [54248], and [54278].
Props azaozz, jorbin.
See #55883.
Built from https://develop.svn.wordpress.org/trunk@54319
git-svn-id: http://core.svn.wordpress.org/trunk@53878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Not all requests are accompanied by a `$request['email']`. This leads to a PHP 8.1 "passing null to non-nullable" deprecation notice when the `WP_REST_Users_Controller::update_item()` method passes a `null` email address onto `email_exists()`, which eventually reached the `WP_User::get_data_by()` method where things go wrong.
In the next condition in the code of the `WP_REST_Users_Controller::update_item()` method - `if ( $owner_id && $owner_id !== $id )` - you can see that the code already takes this into account as it will not throw a `WP_Error` if `$owner_id` is falsey.
`WP_User::get_data_by()` returns `false` for a failed field request. The other functions through which the return value is passed through, do the same.
So, by setting a default value for `$owner_id` of `false` and only checking `email_exists()` when there is an email to check, the "passing null to non-nullable" deprecation notice is bypassed without breaking BC.
Fixes a whole slew of test errors along the lines of:
{{{
6) WP_Test_REST_Users_Controller::test_update_item_en_US_locale
trim(): Passing null to parameter https://github.com/WordPress/wordpress-develop/pull/1 ($string) of type string is deprecated
/var/www/src/wp-includes/class-wp-user.php:211
/var/www/src/wp-includes/pluggable.php:105
/var/www/src/wp-includes/user.php:1953
/var/www/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php:728
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:1143
/var/www/src/wp-includes/rest-api/class-wp-rest-server.php:990
/var/www/tests/phpunit/includes/spy-rest-server.php:67
/var/www/tests/phpunit/tests/rest-api/rest-users-controller.php:1719
/var/www/vendor/bin/phpunit:123
}}}
Follow-up to [44641], [38832].
Props jrf.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54317
git-svn-id: http://core.svn.wordpress.org/trunk@53876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of version `2.17.0` of the `shivammathur/setup-php` action, the `COMPOSER_NO_INTERACTION` environment variable is configured by default. `—-no-interaction` will always be used.
Props jrf, hellofromTonya, SergeyBiryukov, costdev, desrosj.
Fixes#54695.
Built from https://develop.svn.wordpress.org/trunk@54313
git-svn-id: http://core.svn.wordpress.org/trunk@53872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This brings over the latest bug fixes and improvements ahead of WordPress 6.1 beta 2, which includes an additional style variation, “Aubergine”.
For a full list of changes being included, see the `twentytwentythree` repository on GitHub: 1b97bb83f1...ac96e8d545.
Props mikachan, poena, madhudollu, critterverse, beafialho, felipeelia.
See #56383.
Built from https://develop.svn.wordpress.org/trunk@54312
git-svn-id: http://core.svn.wordpress.org/trunk@53871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`realpath()` already checks if the file exists, and returns `false` on failure. The additional `file_exists()` check is not necessary and can be removed, improving the performance.
This commit simplifies the checks in two functions:
* `register_block_type_from_metadata()`
* `wp_json_file_decode()`
Note: In both of these cases, the values are passed through `wp_normalize_path()` after `realpath()`, so if the file does not exist, the `false` value gets converted to an empty string. The updated checks work both for `false` and `''` values.
Though this is a small tweak, it saves a lot of checks since one of the places we do this is when registering block styles, so it runs quite a few times on each page load.
Reference: [https://www.php.net/manual/en/function.realpath.php PHP Manual: realpath()].
Follow-up to [51599], [54132], [54290], [54291].
Props aristath.
Fixes#56654.
Built from https://develop.svn.wordpress.org/trunk@54309
git-svn-id: http://core.svn.wordpress.org/trunk@53868 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Follow-up [53688].
Removes the hardcoded list of blocks that should be synced from the Gutenberg plugin. webpack reads all information from the `@wordpress/block-library` by scanning `block.json` files.
Props zieladam, azaozz.
Fixes#56179.
Built from https://develop.svn.wordpress.org/trunk@54308
git-svn-id: http://core.svn.wordpress.org/trunk@53867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This appears to need more investigation. Instead, delete the `test-plugin` and `link-manager` directories in REST API plugins controller tests, for which this change was initially intended.
Follow-up to [54300], [54301], [54303].
See #55652, #56629.
Built from https://develop.svn.wordpress.org/trunk@54304
git-svn-id: http://core.svn.wordpress.org/trunk@53863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
After running the multisite PHPUnit test suite, the following files remained, contributing towards a dirty working copy:
{{{
tests/phpunit/data/plugins/link-manager/link-manager.php
tests/phpunit/data/plugins/link-manager/readme.txt
}}}
These files should be deleted after running the tests.
This commit ensures the `link-manager` plugin is deleted during test tear down, which was previously done at the beginning of some test methods, but not afterwards.
Follow-up to [48242], [54300].
Props ironprogrammer.
Fixes#56629.
Built from https://develop.svn.wordpress.org/trunk@54301
git-svn-id: http://core.svn.wordpress.org/trunk@53860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `WP_UnitTestCase_Base::rmdir()` method selectively deletes files from a directory, skipping any paths from the `$ignore_files` property.
This commit updates the method to remove the empty directory if there are no files left, bringing some parity with PHP native `rmdir()` function.
Follow-up to [677/tests], [29120].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54300
git-svn-id: http://core.svn.wordpress.org/trunk@53859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If the `apache_get_modules()` function is redeclared to return an empty array, `apache_mod_loaded()` would assume that no Apache modules are installed and activated, which may not be correct.
This commit improves the logic by using pre-existing `phpinfo()` fallback to check for loaded modules in that case.
Includes replacing a hardcoded number passed as a flag to `phpinfo()` with the `INFO_MODULES` predefined constant for clarity.
Follow-up to [7441], [7508], [29330].
Props engahmeds3ed, audrasjb, Clorith, SergeyBiryukov.
Fixes#56010.
Built from https://develop.svn.wordpress.org/trunk@54299
git-svn-id: http://core.svn.wordpress.org/trunk@53858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Because of the scripts that run when `build:dev` is run, it’s more common for this Grunt task to change version-controlled files than when building WordPress to run from `build`.
This moves the `build:dev` tests before the `build` ones in order to detect changes earlier in the workflow.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54297
git-svn-id: http://core.svn.wordpress.org/trunk@53856 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The following dependencies are being updated:
- `copy-webpack-plugin` from `10.2.4` to `11.0.0`.
- `dotenv` from `16.0.1` to `16.0.2`.
- `dotenv-expand` from `8.0.3` to `9.0.0`.
- `sass` from `1.53.0` to `1.55.0`.
- `sinon-test` from `3.1.3` to `3.1.4`.
- `source-map-loader` from `3.0.1` to `4.0.0`.
- `terser-webpack-plugin` from `5.3.1` to `5.3.6`.
- `uglify-js` from `3.16.1` to `3.17.1`.
- `uuid` from `8.3.2` to `9.0.0`.
- `webpack` from `5.72.0` to `5.74.0`.
This also contains changes after running `npm audit fix`.
Fixes#56641.
Built from https://develop.svn.wordpress.org/trunk@54296
git-svn-id: http://core.svn.wordpress.org/trunk@53855 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The current `timeout-minutes` value of `20` is a bit too short for MacOS jobs in GitHub Actions, which on occasion take a bit longer.
This bumps that limit to `30` to avoid unnecessarily flagging a job as stuck.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54293
git-svn-id: http://core.svn.wordpress.org/trunk@53852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `get_default_block_editor_settings()` function used to repeatedly get the `default-editor-styles.css` file contents without any implementation to avoid this.
This commit utilizes a static variable to remove repetitive calls made during the same request. In tests ran on the front page of a site using Xdebug & Webgrind, the total `file_get_contents()` invocation count goes down from 181 to 93, and total self cost (the time that the function is responsible for) goes down from 160 ms to 93 ms.
Follow-up to [52042].
Props aristath, mukesh27.
Fixes#56637.
Built from https://develop.svn.wordpress.org/trunk@54291
git-svn-id: http://core.svn.wordpress.org/trunk@53850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `register_block_style_handle()` function called `realpath()` when retrieving the normalized style path, and then a few lines below that, recalculated the exact same value, running `realpath()` again.
This commit removes duplicate calculations, reducing the number of `realpath()` calls in the function by half. In tests ran using Xdebug & Webgrind, the total `realpath()` invocation count goes down from 639 to 461, and total self cost (the time that the function is responsible for) goes down from 146 ms to 89 ms.
Follow-up to [48141], [52291], [53091], [54155].
Props aristath.
Fixes#56636.
Built from https://develop.svn.wordpress.org/trunk@54290
git-svn-id: http://core.svn.wordpress.org/trunk@53849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Allows to revert changes applied in [54277] - temporary workaround for the failing Test NPM CI check on Windows.
Improvements included:
- generate combined asset files for both production and development
- store in the repository only the production version of the combined assets for packages, we use everything else only in development
- to make unit tests work, ensure that they ignore react fast refresh and use the production version of combined assets that are present in the source code
Props bernhard-reiter, jsnajdr, clorith, wildworks.
Fixes#56615.
Built from https://develop.svn.wordpress.org/trunk@54289
git-svn-id: http://core.svn.wordpress.org/trunk@53848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The value comes from `get_available_languages()`, which returns an array of strings.
This affects:
* `plugins_update_check_locales` filter.
* `update_plugins_{$hostname}` filter.
Follow-up to [36630], [46660], [50921], [53933], [54284].
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54287
git-svn-id: http://core.svn.wordpress.org/trunk@53846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When initially deprecated in [54240], `global_terms_enabled()` was incorrectly moved to the `wp-includes/ms-deprecated.php` file. This file is only loaded for multisite installs.
The function previously lived in `wp-includes/functions.php`, which is loaded for all sites. The proper deprecated file is `wp-includes/deprecated.php`.
Props vikasprogrammer, davidbaumwald, courane01, desrosj.
Fixes#21734.
Built from https://develop.svn.wordpress.org/trunk@54283
git-svn-id: http://core.svn.wordpress.org/trunk@53842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backports PHP changes in WordPress/gutenberg#43862 to the core. Adds a mechanism to dynamically compute names and descriptions of the author, page, single, tag, category, and taxonomy templates.
Props mcsf, ntsekouras, antonvlasenko, jameskoster.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54280
git-svn-id: http://core.svn.wordpress.org/trunk@53839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Verify that the `resized` property exists on a video in the playlist before attempting to read it. Prevent a TypeError from being thrown and breaking the playlist if a video type requires native video support.
Props afercia, here.
Fixes#47513.
Built from https://develop.svn.wordpress.org/trunk@54279
git-svn-id: http://core.svn.wordpress.org/trunk@53838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[54248] reversed the wrapping of `do_shortcode` and `apply_shortcodes` and updated all direct internal calls of `do_shortcode` to `apply_shortcodes` after [47004]. Default filter callbacks that used `do_shortcode` were also updated to use `apply_shortcodes`. However, this introduced a backward-compatibility break because any attempt to unhook a filter using the previous `do_shortcode` callback would be futile.
This change reverts only the filter callback changes in [54248] to resolve the backward-compatibility break.
Follow-up to [47004] and [54248].
Props ocean90, SergeyBiryukov.
See #55883.
Built from https://develop.svn.wordpress.org/trunk@54278
git-svn-id: http://core.svn.wordpress.org/trunk@53837 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changes the Test NPM GitHub Action workflow to temporarily allow the job validating build tools on Windows to fail.
When the `build:dev` Grunt task is run on Windows, the resulting hashes calculated by Webpack are different than other platforms. This seems to be related to how the `remove-accents` dependency is read and processed during the build script.
Since a Windows machine is not used to build WordPress on the build server, this will only affect local development installs for Windows contributors. While this is investigated, this workflow job can be allowed to fail.
Props bernhard-reiter, desrosj, Clorith, gziolo.
See #56615.
Built from https://develop.svn.wordpress.org/trunk@54277
git-svn-id: http://core.svn.wordpress.org/trunk@53836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit improves PHP performance for core blocks by reading a single PHP file with block metadata, instead of reading a JSON file per-block and then decoding from JSON to PHP.
Includes:
* Adding a new Grunt task to convert `block.json` files to `block-json.php`.
* Using the new `block-json.php` file in the `register_block_type_from_metadata()` function.
Follow-up to [48141].
Props aristath, gziolo, johnbillion, presstoke, mukesh27, hellofromTonya, petitphp, adamsilverstein, costdev, desrosj, SergeyBiryukov.
Fixes#55005.
Built from https://develop.svn.wordpress.org/trunk@54276
git-svn-id: http://core.svn.wordpress.org/trunk@53835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Changed `boolean` to `bool`.
* Added `Optional.` and `Default` for each optional parameter.
* Improved `@return` documentation to include empty string.
Follow-up to [54274], [53421], [53085], [52069].
Props mukesh27, hellofromTonya.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54275
git-svn-id: http://core.svn.wordpress.org/trunk@53834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit merges the remaining changes from [https://github.com/WordPress/gutenberg/pull/40875 Gutenberg PR 40875]. It's Part 2 (see [54162] for Part 1) of a layout improvement initiative and targets `wp_get_layout_style()` in `layout.php`.
Context:
The overall initiative is to improve layout block support:
>to use centralised layout definitions, output base layout styles from global styles, introduce a layout type semantic classname, reduce duplication of container class and style tag output, and fix blockGap at the block level in global styles.
Changes include:
* Adding an optional parameter `$block_spacing` to `wp_get_layout_style()` for setting a custom spacing on the block.
* Adding handle for the block spacing.
* Using the style engine to to enqueue and render layout styles via `wp_style_engine_get_stylesheet_from_css_rules()`.
* Introduces a new test file for `wp_get_layout_style()`.
Follow-up to [54162], [54160], [54159], [53421], [52380], [53085], [52069].
Props andrewserong, isabel_brison, costdev, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54274
git-svn-id: http://core.svn.wordpress.org/trunk@53833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset is part of the Gutenberg changes merged into WP 6.1. It adds spacing presets support in global style properties.
Follow-up to [54211].
Props glendaviesnz, andrewserong, costdev, audrasjb, mukesh27.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54272
git-svn-id: http://core.svn.wordpress.org/trunk@53831 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes the call to `WP_Query` within `get_page_by_title()` by using the correct title parameter, `title`.
Modify the `orderby` parameter to prioritize the oldest published date over the smallest post ID. This ensures the behaviour matches that of the previous version of `get_page_by_title()`.
The tests have been modified to include a populated post table to ensure the posts returned are matched by design rather than coincidence.
Follow up to [54234].
Props dd32, timothyblynjacobs, peterwilsoncc.
Fixes#56609.
See #36905.
Built from https://develop.svn.wordpress.org/trunk@54271
git-svn-id: http://core.svn.wordpress.org/trunk@53830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This relocates the actions `wp_before_load_template` and `wp_after_load_template` to fire within the `load_template()` function.
Prior to this change the actions fired in the `locate_template()` function.
Follow up to [53560].
Props johnjamesjacoby, johnbillion.
Fixes#54541.
Built from https://develop.svn.wordpress.org/trunk@54270
git-svn-id: http://core.svn.wordpress.org/trunk@53829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit improves site editor templates by:
* Adds a post meta `is_wp_suggestion` to templates created from the site editor.
Why? To differentiate the templates created from the post editor in the Template panel in inspector controls and the templates suggested in site editor.
See [https://github.com/WordPress/gutenberg/pull/41387 Gutenberg PR 41387] for more details.
* Expands the template types that can be added to the site editor to include single custom post type and specific posts templates.
See [https://github.com/WordPress/gutenberg/pull/41189 Gutenberg PR 41189] for more details.
* Adds fallback template content on creation in site editor:
* Introduces `get_template_hierarchy()` to get the template hierarchy for a given template slug to be created.
* Adds a `lookup` route to `WP_REST_Templates_Controller` to get the fallback template content.
See [https://github.com/WordPress/gutenberg/pull/42520 Gutenberg PR 42520] for more details.
* Fixes a typo in default category template's description within `get_default_block_template_types()`.
See [https://github.com/WordPress/gutenberg/pull/42586 Gutenberg PR 42586] for more details.
* Changes field checks from `in_array()` to `rest_is_field_included()` in `WP_REST_Post_Types_Controller`.
* Adds an `icon` field to `WP_REST_Post_Types_Controller`
Follow-up to [53129], [52331], [52275], [52062], [51962], [43087].
Props ntsekouras, spacedmonkey, mamaduka, mburridge, jameskoster, bernhard-reiter, mcsf, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54269
git-svn-id: http://core.svn.wordpress.org/trunk@53828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, the logic to determine EXIF rotation information was not providing the correct rotation. This patch respects the information properly by swapping some of the `flip()` logic on certain rotations.
Props tbember, SergeyBiryukov, costdev, mikeschroder, adamsilverstein.
Fixes#54937.
Built from https://develop.svn.wordpress.org/trunk@54265
git-svn-id: http://core.svn.wordpress.org/trunk@53824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit adds three filters to customize the `wp_list_authors()` and `wp_list_users()` output:
* `wp_list_authors_args`: Filters the query arguments for the list of all authors of the site.
* `pre_wp_list_authors_post_counts_query`: Filters whether to short-circuit performing the query for author post counts. This may be useful to account for custom post types or post statuses.
* `wp_list_users_args`: Filters the query arguments for the list of all users of the site.
Follow-up to [979], [3848], [5135], [5727], [31653], [52064], [53486], [53501].
Props kevinB, wonderboymusic, DrewAPicture, Mte90, audrasjb, rafiahmedd, costdev, nacin, afercia, chetan200891, hellofromTonya, TimothyBlynJacobs, chaion07, SergeyBiryukov.
Fixes#17025.
Built from https://develop.svn.wordpress.org/trunk@54262
git-svn-id: http://core.svn.wordpress.org/trunk@53821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit introduces fluid typography block supports and switches to use the Style Engine for typography and colors.
The motivation for fluid typography block supports:
>"Fluid typography" describes how a site's font sizes adapt to every change in screen size, for example, growing larger as the viewport width increases, or smaller as it decreases.
>
>Font sizes can smoothly scale between minimum and maximum viewport widths.
Typography changes introduced from Gutenberg:
* Uses the Style Engine to generate the CSS and classnames in `wp_apply_typography_support()`.
* Introduces `wp_typography_get_preset_inline_style_value()` for backwards-compatibility.
* Introduces a private internal function called `wp_get_typography_value_and_unit()`, for checking and getting typography unit and value.
* Introduces a private internal function called `wp_get_computed_fluid_typography_value()`, for an internal implementation of CSS `clamp()`.
* Deprecates `wp_typography_get_css_variable_inline_style()`.
References:
* [https://github.com/WordPress/gutenberg/pull/40332 WordPress/gutenberg PR 40332] Style Engine: add typography and color to backend
* [https://github.com/WordPress/gutenberg/pull/39529 WordPress/gutenberg PR 39529] Block supports: add fluid typography
Follow-up to [53076], [52302], [52069], [51089], [50761], [49226].
Props ramonopoly, youknowriad, aristath, oandregal, aaronrobertshaw, cbirdsong, jorgefilipecosta, ironprogrammer, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54260
git-svn-id: http://core.svn.wordpress.org/trunk@53819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Following the introduction of `is_login_screen()` in [53884], it is time to reconsider the `is_*_admin()` functions:
* `is_admin()`: Determines whether the current request is for an administrative interface page.
* `is_blog_admin()`: Whether the current request is for a site's administrative interface, e.g. `/wp-admin/`.
* `is_network_admin()`: Whether the current request is for the network administrative interface, e.g. `/wp-admin/network/`.
* `is_user_admin()`: Whether the current request is for a user admin screen, e.g. `/wp-admin/user/`.
For someone new to WordPress, these names can be quite confusing, especially the last one. When using these functions, one always needs to remember that they don't actually check if the current user is a site administrator.
To complicate things further, there is one more similarly named function that does exactly the latter:
* `is_super_admin()`: Determines whether user is a site admin.
With the above in mind, this commit introduces aliases that better match the functionality and allow for more descriptive code:
* `is_admin()` → `is_admin_screen()`
* `is_blog_admin()` → `is_site_admin_screen()`
* `is_network_admin()` → `is_network_admin_screen()`
* `is_user_admin()` → `is_user_admin_screen()`
Additionally, `is_super_admin_user()` is introduced as an alias for `is_super_admin()`:
* `is_super_admin()` → `is_super_admin_user()`
Plugins and themes are encouraged to start using the newer function names to make code self-descriptive and bring more clarity. The older names are not deprecated at this time, though it may be up for discussion in the future.
Follow-up to [2481], [6412], [12393], [12732], [15558], [15481], [15746], [53884].
Props jrf, tobifjellner, SergeyBiryukov.
See #56400.
Built from https://develop.svn.wordpress.org/trunk@54259
git-svn-id: http://core.svn.wordpress.org/trunk@53818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds error logging on `wp_reschedule_event()` and `wp_unschedule_event` in `wp-cron.php`. This allows proper error logging when random errors appear. It also introduces `cron_reschedule_event_error` and `cron_unschedule_event_error` hooks which can be used to trigger additional behaviors when an error occurs.
Props Enchiridion, johnbillion, costdev.
Fixes#56048.
Built from https://develop.svn.wordpress.org/trunk@54258
git-svn-id: http://core.svn.wordpress.org/trunk@53817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Instead of caching main site id an object cache, store main site id on a network options. This results in less database queries on sites without persistent object caching.
Props spacedmonkey, johnjamesjacoby, peterwilsoncc, desrosj.
Fixes#55802.
Built from https://develop.svn.wordpress.org/trunk@54256
git-svn-id: http://core.svn.wordpress.org/trunk@53815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The current coding standards note that the name of the class files should be based on the class name with `class-` prepended, and the underscores replaced by hyphens (see the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions] section in the handbook), except for the three legacy files: `class.wp-dependencies.php`, `class.wp-scripts.php`, `class.wp-styles.php`.
To bring more consistency to the codebase and make it easier to implement autoloading in the future, this commit renames those three legacy files to conform to the coding standards:
* `wp-includes/class.wp-dependencies.php` → `wp-includes/class-wp-dependencies.php`
* `wp-includes/class.wp-scripts.php` → `wp-includes/class-wp-scripts.php`
* `wp-includes/class.wp-styles.php` → `wp-includes/class-wp-styles.php`
Includes:
* Loading the new files from the old ones, for anyone that may have been including the files directly.
* Replacing references to the old filenames with the new filenames.
Follow-up to [7970], [45654], [45662], [45663], [45678], [47197], [52026], [53749].
Props afragen, schlessera, swissspidy, dingo_d, hellofromTonya, SergeyBiryukov.
Fixes#37861. See #55647.
Built from https://develop.svn.wordpress.org/trunk@54254
git-svn-id: http://core.svn.wordpress.org/trunk@53813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This makes it possible to add `box-shadow` to specific blocks (such as buttons or groups), allowing this to be configured in block themes without custom CSS.
Props andrewserong, cbravobernal, madhudollu, scruffian, onemaggie.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54253
git-svn-id: http://core.svn.wordpress.org/trunk@53812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
By running `WP::send_headers()` after posts have been queried, we can ensure that conditional tags like `is_front_page()`, `is_home()`, etc. work as expected.
This provides better context and more flexibility when adjusting HTTP headers via the `wp_headers` filter or `send_headers` action.
Previously, the earliest action where conditional tags worked correctly was `wp`.
Includes moving the `X-Pingback` header, previously sent in `WP::handle_404()` after posts have been queried, to a more appropriate place in `WP::send_headers()`.
Follow-up to [2627], [34442].
Props jonoaldersonwp, joostdevalk, peterwilsoncc, adamsilverstein, SergeyBiryukov.
Fixes#56068.
Built from https://develop.svn.wordpress.org/trunk@54250
git-svn-id: http://core.svn.wordpress.org/trunk@53809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `wp_salt()` WordPress pre-populates the check for duplicate salt values with the default put your unique phrase here. As the `wp-config.php file` for non-en_US can be translated in downloaded packages, a translated version of this phrase ought to be in the pre-populated duplicate values array too.
Props peterwilsoncc, SergeyBiryukov, whaze, costdev, audrasjb.
Fixes#55937.
Built from https://develop.svn.wordpress.org/trunk@54249
git-svn-id: http://core.svn.wordpress.org/trunk@53808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset reverses the wrapping of `apply_shortcodes()` and `do_shortcode()` such that `apply_shortcodes()` is now the recommended function. In addition:
- Calls to `do_shortcode()` have been changed to `apply_shortcodes()`.
- Some default filter callbacks have been changed from `'do_shortcode'` to `'apply_shortcodes'`.
- Applicable documentation has been updated to refer to `apply_shortcodes()` instead.
Follow-up to [47004].
Props SergeyBiryukov, rafiahmedd, namithjawahar, peterwilsoncc, costdev.
Fixes#55883.
Built from https://develop.svn.wordpress.org/trunk@54248
git-svn-id: http://core.svn.wordpress.org/trunk@53807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset improves the `add_settings_section()` function to allow developers to pass extra HTML mark-up to be rendered before and after the settings section. Extra argument `$args` can now be passed to the function, and is an array that can contain the following items:
- `before_section`: HTML content to prepend to the section's HTML output. Receives the section's class name provided with the `section_class` argument via an optional `%s` placeholder. Default empty.
- `after_section`: HTML content to append to the section's HTML output. Default empty.
- `section_class`: The class name to use for the section. Used by `before_section` if a `%s` placeholder is present. Default empty.
The HTML passed using these extra arguments is escaped using `wp_kses_post()` just before rendering. This changeset also provides a set of unit tests for this new feature.
Props griffinjt, nacin, scribu, ross_ritchey, ryan, chriscct7, palmiak, rehanali, costdev, martinkrcho, chaion07, audrasjb, hellofromtonya.
Fixes#17851.
Built from https://develop.svn.wordpress.org/trunk@54247
git-svn-id: http://core.svn.wordpress.org/trunk@53806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [52280] `wp_template_part` and `wp_template` posts, made the title of the post created not translatable. This was changed [54186] by mistake. This commit reverts that change.
Follow up to [54186], [52280].
Props mukesh27, kebbet.
See #55392.
Built from https://develop.svn.wordpress.org/trunk@54246
git-svn-id: http://core.svn.wordpress.org/trunk@53805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`get_sample_permalink()` (ab)uses the `$post->filter` property to indicate a sample permalink is being generated for the post. This change ensures the property is restored to its original value.
Props herregroen, hellofromTonya, peterwilsoncc, Rahmohn, costdev.
Fixes#54736.
Built from https://develop.svn.wordpress.org/trunk@54244
git-svn-id: http://core.svn.wordpress.org/trunk@53803 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the input field used for `alt` attributes in the media library views from a text input to a textarea. This gives users more flexibility in resizing the field for easier management of longer alt attributes.
This patch includes a less-common use of `esc_attr` for a `textarea`. This is because the primary usage of the `alt` attribute will be escaped using `esc_attr`, and the value in editing should match the value output on the front end.
Props edent, sabernhardt, afercia, JavierCasares, audrasjb, joedolson.
Fixes#50066.
Built from https://develop.svn.wordpress.org/trunk@54243
git-svn-id: http://core.svn.wordpress.org/trunk@53802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When `wp.template()` is called in JavaScript for a template element that does not exist, a very nondescript error message is currently returned (“Uncaught TypeError: Cannot read property `replace` of `undefined`”).
This updates adds a check for this scenario and a new “Template not found” error is now thrown instead.
Props joehoyle, noisysocks, hilayt24.
Fixes#36631.
Built from https://develop.svn.wordpress.org/trunk@54241
git-svn-id: http://core.svn.wordpress.org/trunk@53800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Global terms was a feature from the WordPress MU days where multisite and single site installs used different code bases.
In WordPress 3.0, WordPress MU was merged into one location and the UI [14854] and “on” switch [14880] for global terms were completely removed.
Even before this merge, global terms was bug infested and unreliable. After [14854]/[14880], the feature was no longer maintained and became increasingly broken as taxonomies progressed without it (term splitting and term meta do not work at all). At this point, the feature has not worked in 12+ years and there’s no hope for saving it.
This deprecates the remaining global terms related code and no-ops the functions.
Global terms, you don’t have to go home, but you can’t stay here.
Props scribu, wonderboymusic, SergeyBiryukov, nacin, pento, desrosj, johnjamesjacoby, johnbillion, dd32.
Fixes#21734.
Built from https://develop.svn.wordpress.org/trunk@54240
git-svn-id: http://core.svn.wordpress.org/trunk@53799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Underneath the timezone selector on the General Settings screen, a small snippet of info about the selected time zone is displayed.
This information would be missing if the timezone is set to a deprecated timezone value, even though PHP is perfectly capable of generating that information, including for deprecated timezones.
By passing the `DateTimeZone::ALL_WITH_BC` constant as the `$timezoneGroup` parameter to the PHP native `timezone_identifiers_list()` function, a timezone name list is retrieved containing both current and deprecated timezone names, preventing the condition from failing when the current timezone is a deprecated one.
See the extensive write-up about this in ticket #56468.
Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].
Note: As this is an admin/output page, no pre-existing tests are available.
Follow-up to [54207], [54217], [54227], [54229], [54230], [54232], [54233].
Props jrf, costdev, marcyoast.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54237
git-svn-id: http://core.svn.wordpress.org/trunk@53796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Twenty Twenty-Three is a stripped-back, minimal version of Twenty Twenty-Two that includes a collection of 10 distinct style variations designed and submitted by members of the WordPress community.
This unique approach to creating a default theme harnesses all of the flexibility that full site editing has to offer.
Everybody loves you when you’re twenty-three. What’s my age again?
Props amjadr360, anariel-design, audrasjb, beafialho, bgardner, colorful-tones, critterverse, daisyo, desrosj, dianeco, greenshady, joen, jffng, kafleg, kishanjasani, kraftbj, luminuu, madhudollu, mikachan, mtias, onemaggie, pbking , poena, richtabor, scruffian, soean, tanvirul, thelovekesh.
See #56383.
Built from https://develop.svn.wordpress.org/trunk@54235
git-svn-id: http://core.svn.wordpress.org/trunk@53794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Convert `get_page_by_title()` to a `WP_Query` wrapper to take advantage of the object caching built in to the latter.
Add dedicated unit tests for the function `get_page_by_title()`.
Props spacedmonkey, boonebgorges, igmoweb, pcfreak30, pbearne.
Fixes#36905.
Built from https://develop.svn.wordpress.org/trunk@54234
git-svn-id: http://core.svn.wordpress.org/trunk@53793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes a bug where if the `timezone_string` is set to a timezone name which has since been deprecated, no option would be (pre-)selected in the generated dropdown list and when the form using the dropdown list is submitted, the “old”, originally saved value would be lost as the form would submit without a value being selected for the `timezone_string` field.
The fix is a little hacky: it basically checks ahead of generating the actual dropdown list whether the `$selected_zone` value would be recognized and set to “selected” and if not, verifies that the value ''is'' a valid but outdated timezone name and if so, adds an extra dropdown entry to the top of the list with the original value and sets this value to “selected”.
See the extensive write-up about this in ticket #56468.
Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].
Note: There are no pre-existing tests at all for this method and adding a complete set of tests for this method is outside the scope of this ticket, so this fix does not contain any tests.
Follow-up to [54207], [54217], [54227], [54229], [54230], [54232].
Props jrf, costdev, marcyoast.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54233
git-svn-id: http://core.svn.wordpress.org/trunk@53792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes a bug where if the default `timezone_string` is set to a deprecated timezone name due to a localization providing an outdated timezone name string, this localized timezone string would be discarded and an empty string would be set as the timezone value instead.
By passing the `DateTimeZone::ALL_WITH_BC` constant as the `$timezoneGroup` parameter to the PHP native `timezone_identifiers_list()` function, a timezone name list is retrieved containing both current and deprecated timezone names, preventing the invalidation of the option value.
See the extensive write-up about this in ticket #56468.
Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].
Includes:
* Expanding the translators comment to encourage translators to use “old” names over “new” names.
* Adding a dedicated test to the `Tests_Admin_IncludesSchema` test class.
Follow-up to [54207], [54217], [54227], [54229], [54230].
Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54232
git-svn-id: http://core.svn.wordpress.org/trunk@53791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
During install, the user is prompted for database connection settings. Inputs for the database name, username, and password will most likely be changed from the examples given, but these example values are presented as the input's `value` property. This required the user to clear the current value before entering their own.
This change moves the example values for these fields to the `placeholder` property.
Props oliverstapelfeldt, audrasjb, krupalpanchal, sabernhardt.
Fixes#56365.
Built from https://develop.svn.wordpress.org/trunk@54231
git-svn-id: http://core.svn.wordpress.org/trunk@53790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit adds tests in select places to ensure that these date/time related functions continue to behave as expected when the `timezone_string` option is set to an outdated/deprecated timezone name.
The timezone string used in these tests, `America/Buenos_Aires`, is a timezone string which was already deprecated in PHP 5.6.20 (the current minimum PHP version), so using this timezone string, we can safely test the handling of deprecated timezone names on all supported PHP versions.
See: [https://3v4l.org/Holsr#v5.6.20 timezone_identifiers_list() output for PHP 5.6.20].
Follow-up to [54207], [54217], [54227], [54229].
Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54230
git-svn-id: http://core.svn.wordpress.org/trunk@53789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes a bug where if the `timezone_string` is set to a timezone name which has since been deprecated, the option value would be “lost” when saving the value again, as the comparison being done to verify whether it is a valid timezone name would only take “current” timezone names into account and would invalidate deprecated timezone names.
By passing the `DateTimeZone::ALL_WITH_BC` constant as the `$timezoneGroup` parameter to the PHP native `timezone_identifiers_list()` function, a timezone name list is retrieved containing both current and deprecated timezone names, preventing the invalidation of the option value.
See the extensive write-up about this in ticket #56468.
Also see: [https://www.php.net/manual/en/datetimezone.listidentifiers.php PHP Manual: timezone_identifiers_list()].
Includes adding a dedicated test to the data provider used in the `Tests_Option_SanitizeOption` test class.
Note: The new data set is ''named'', even though the other data sets are unnamed, to make sure it is clear what this data set is testing. Adding test names for the original data sets in this data provider would be a great future improvement, but is outside of the scope of this commit.
Follow-up to [18323], [33119], [54207], [54217], [54227].
Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54229
git-svn-id: http://core.svn.wordpress.org/trunk@53788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the "Insert from URL" field in the media library to use a placeholder suggesting the `https://` protocol instead of a value attribute with `http://`.
Props Presskopp, adamsilverstein, joyously, thijso, joedolson, costdev.
Fixes#53404.
Built from https://develop.svn.wordpress.org/trunk@54228
git-svn-id: http://core.svn.wordpress.org/trunk@53787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Based on a two-way comparison between the available timezone city names in PHP 5.6.20 and PHP 8.2.0.
Lists of available timezone names have been retrieved using the PHP `timezone_identifiers_list()` function.
See: [https://3v4l.org/ro1vY/rfc#vgit.master timezone_identifiers_list() output and comparison].
Note: Both spellings of `Kiev`/`Kyiv` need to be in the list to allow it to work PHP cross-version.
* The “old” version — `Kiev` — will be used as the basis to find the localized name for the timezone dropdown lists on PHP 5.6 to 8.1.
* The corrected spelling — `Kyiv` — will be used to find the localized name on PHP 8.2 and up.
Follow-up to [50555], [54207], [54217].
Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54227
git-svn-id: http://core.svn.wordpress.org/trunk@53786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* The `wp_lostpassword_url()` function.
* The `lost_password_html_link` filter.
The filter description was copied from the function, which appears to be not quite accurate, as the lost password can only be reset, not retrieved.
Follow-up to [11448], [54206].
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54224
git-svn-id: http://core.svn.wordpress.org/trunk@53783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds some CSS tweaks to ensure admin notices like the "Automated update failed" notice don't break the layout of the Site Health and Privacy Settings screens.
Props johnjamesjacoby, costdev, Clorith, audrasjb, SergeyBiryukov, joedolson.
Fixes#54624.
Built from https://develop.svn.wordpress.org/trunk@54220
git-svn-id: http://core.svn.wordpress.org/trunk@53779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In past versions of the About page, translator comments referencing the Field Guide and Release Notes links included the current version number. This change updates these translator comments to remove a specific version number, which was not necessary.
This change also abstracts the version number out of the "Read the WordPress X.X Release Notes" string, making it translatable.
Props Presskopp, audrasjb, SergeyBiryukov, marybaum.
Fixes#54741.
Built from https://develop.svn.wordpress.org/trunk@54219
git-svn-id: http://core.svn.wordpress.org/trunk@53778 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset contextualizes the usage of `nonce_life` filter by passing the `$action` parameter. It allows to alterate the default lifespan of nonces on a case by case basis.
Props giuseppemazzapica, dwainm, DrewAPicture, jorbin, audrasjb, SergeyBiryukov, costdev, antonvlasenko.
Fixes#35188.
Built from https://develop.svn.wordpress.org/trunk@54218
git-svn-id: http://core.svn.wordpress.org/trunk@53777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `Europe/Kiev` timezone has been deprecated in PHP 8.2 and replaced with `Europe/Kyiv`.
The tests updated in this commit are testing the WordPress date/time functionality. They are **not** testing whether WP or PHP can handle deprecated timezone names correctly.
To ensure the tests follow the original purpose, the use of `Europe/Kiev` within these tests is now replaced with the `Europe/Helsinki` timezone, which is within the same timezone as `Europe/Kyiv`. This should ensure that these tests run without issue and test what they are supposed to be testing on every supported PHP version (unless at some point in the future `Europe/Helsinki` would be renamed, but that's a bridge to cross if and when).
Note: Separate tests should/will be added to ensure that relevant date/time related functions handle a deprecated timezone correctly, but that is not something ''these'' tests are supposed to be testing.
Follow-up to [45853], [45856], [45876], [45882], [45887], [45908], [45914], [46577], [46154], [46580], [46864], [46974], [54207].
Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54217
git-svn-id: http://core.svn.wordpress.org/trunk@53776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update CSS in the classic visual editor link popup to remove sizing in pixels that caused significant text overlaps when the base font size is scaled or set to a larger custom value in the browser or operating system.
Props jonny-s, sabernhardt, joedolson.
Fixes#53174.
Built from https://develop.svn.wordpress.org/trunk@54216
git-svn-id: http://core.svn.wordpress.org/trunk@53775 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Many `WP_List_Table` child classes in core use mostly the same code to create their "view" links markup. To DRY-up the code, a new `WP_List_Table->get_view_links` method is being introduced to consolidate the HTML link generation when provided an array of links.
This change also implements this new method in the relevant `WP_List_Table_xxx` child classes `get_views` methods. Finally, unit tests are being added to validate view links markup and test for some "unhappy paths".
Props afercia, costdev, garrett-eclipse, Dharm1025, juhise, peterwilsoncc.
Fixes#42066.
Built from https://develop.svn.wordpress.org/trunk@54215
git-svn-id: http://core.svn.wordpress.org/trunk@53774 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Until now, changing a user's role involved deleting a user's role then re-adding. This change creates a new `update_role` function and associated method in `WP_Roles` to consolidate this process.
This commit also introduces new unit tests around `update_role` and adds additional "unhappy path" tests for roles and capabilities in general.
Props maksimkuzmin, peterwilsoncc, NomNom99, costdev, SergeyBiryukov.
Fixes#54572.
Built from https://develop.svn.wordpress.org/trunk@54213
git-svn-id: http://core.svn.wordpress.org/trunk@53772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
For each automatic plugin update, both successful and failed, information about each plugin is included in the email upon completion of the process. This change adds the plugin URL, if known, to the information included for each plugin that was processed.
This change also adds unit tests to validate the email contents after various automatic plugin update scenarios.
Props JosVelasco, pbiron, oliverstapelfeldt, ChrisHardie, Ipstenu, dd32, peterwilsoncc, audrasjb, costdev.
Fixes#53049.
Built from https://develop.svn.wordpress.org/trunk@54212
git-svn-id: http://core.svn.wordpress.org/trunk@53771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [54066], a new filter was added to alter the taxonomies for which class names are generated for a given post type. At the time, the filter name was prefixed with `wp_`.
For consistency with filters of a similar type, this change updates the filter name to `post_class_taxonomies`.
Follow-up to [54066].
Props SergeyBiryukov.
See #37114.
Built from https://develop.svn.wordpress.org/trunk@54208
git-svn-id: http://core.svn.wordpress.org/trunk@53767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `options` table is not explicitly reset after each test or test class, so if an option is changed during a test, it should be reset to the default value ''after'' the test.
This commit does so for those tests which did not have such resetting in place yet, while one or more tests in the class ''do'' change the value of the `timezone_string` option.
Note: The test suite executes a `ROLLBACK` query after each test, which should reset the `options` table in theory, however that appears to not always be enough, as some timezone-related tests can fail in a complete test suite run, while not failing when run in isolation. This commit aims to improve stability of the tests.
Follow-up to [45857] / #45821.
Props jrf, costdev.
See #56468.
Built from https://develop.svn.wordpress.org/trunk@54207
git-svn-id: http://core.svn.wordpress.org/trunk@53766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
On the login page, the "Register" link for new users has been filterable for some time. This change adds the ability to filter the "Lost your password?" link as well.
Props wparslan, audrasjb, rafiahmedd, SergeyBiryukov, antonvlasenko, hellofromTonya.
Fixes#55388.
Built from https://develop.svn.wordpress.org/trunk@54206
git-svn-id: http://core.svn.wordpress.org/trunk@53765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The descriptions provided whenever a REST API check failed lacked details that would help in troubleshooting any issues, most notably the actual REST API endpoint that was being tested.
Adding this vital piece of detail, along with a revamp of the error messages shown, where previously there was a risk that the markup of your website was included as an error message, improves the overall user experience, and gives more accurate details that can be looked when looking up how to fix or improve the behavior of the REST API.
Props dingo_d, shetheliving.
Fixes#54617.
Built from https://develop.svn.wordpress.org/trunk@54205
git-svn-id: http://core.svn.wordpress.org/trunk@53764 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes function name typo by changing from uppercase `get_current_user_ID()` to lowercase `get_current_user_id()`.
>Note: Function names are case-insensitive for the ASCII characters A to Z, though it is usually good form to call functions as they appear in their declaration.
[https://www.php.net/manual/en/functions.user-defined.php As per the PHP manual], PHP functions are case-insensitive, meaning the code runs. However, this fix is necessary for consistency, maintainability, and future-proofing.
Follow-up to [54182].
Unprop hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54204
git-svn-id: http://core.svn.wordpress.org/trunk@53763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changes some admin-area, user-facing text, to better match the guidelines and recommendations set forth in the make/core handbook, specifically:
> the word “we” should be avoided (...) unless its made very clear which group is speaking
Follow-up to [51979], [53131], [53132], [53148], [53156].
Props kebbet, costdev, SergeyBiryukov.
Fixes#55758.
See #46057.
Built from https://develop.svn.wordpress.org/trunk@54200
git-svn-id: http://core.svn.wordpress.org/trunk@53759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Now that the function has its own test class, the remaining test from `Tests_Block_Template_Utils` can be moved to `Tests_Blocks_GetBlockTemplates` for consistency.
Includes:
* Uncommenting some assertions previously commented out.
* Moving the `get_template_ids()` helper method to the top of the class.
* Standardizing on `wpSetUpBeforeClass()`/`wpTearDownAfterClass()` in both classes.
* Declaring the test theme name as a constant in both classes, since the value is not changed by any of the tests.
* Renaming some properties in both classes for clarity.
Follow-up to [51003], [52062], [53927], [54184], [54187].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54198
git-svn-id: http://core.svn.wordpress.org/trunk@53757 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aligns the spacing within the widget with other core widgets, and removes an unintended margin which was pushing the indicator slightly above the centered position it was intended to have.
Props sabernhardt, costdev, mukesh27.
Fixes#56369.
Built from https://develop.svn.wordpress.org/trunk@54197
git-svn-id: http://core.svn.wordpress.org/trunk@53756 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously the description left the user stuck with no path forward if flushing their permalinks was not enough.
This change givers a clearer description of what approving an application may involve (allowing these to connect to the users site), but also an additional step towards resolution if flushing permalinks are not enough; pointing them towards their host.
Props Presskopp, webcommsat.
Fixes#54508.
Built from https://develop.svn.wordpress.org/trunk@54196
git-svn-id: http://core.svn.wordpress.org/trunk@53755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* `WP_Block_Parser::parse()`
* `WP_Block_Parser::$output`
Both the method and the property are documented as returning `WP_Block_Parser_Block[]` (an array of `WP_Block_Parser_Block` objects), but the result is in fact an array of arrays of various values, so `array[]` is the correct notation.
Follow-up to [43751] for the 5.0 branch, [44116] for trunk.
Props Chouby.
Fixes#56581.
Built from https://develop.svn.wordpress.org/trunk@54194
git-svn-id: http://core.svn.wordpress.org/trunk@53753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* `WP_Block_Parser::$empty_attrs`
* `WP_Block_Parser::next_token()`
* `WP_Block_Parser::freeform()`
* `WP_Block_Parser_Block::$innerContent`
The `@since` tags referred to early Gutenberg versions instead of WordPress core. These properties and methods were introduced in WordPress 5.0, so `5.0.0` is the correct version.
Some of the other `@since` tags are removed, as they are related to early Gutenberg development before it was merged into WordPress core, and are not relevant for core.
Follow-up to [43751], [43884], [43955] for the 5.0 branch, [44116], [44261], [44281] for trunk.
Props Chouby.
See #56581.
Built from https://develop.svn.wordpress.org/trunk@54193
git-svn-id: http://core.svn.wordpress.org/trunk@53752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Properly label site and user information on the network registration screen with the HTML5 required attribute and clarify the values expected for the site domain and subdirectory fields.
Props SteelWagstaff, henrywright, sabernhardt.
Fixes#54344.
Built from https://develop.svn.wordpress.org/trunk@54192
git-svn-id: http://core.svn.wordpress.org/trunk@53751 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix a variety of accessibility issues with the network registration and activation screens. Fix associations between error messages and fields, improve labels for radio buttons, add fieldset and legend to properly group fields.
Props afercia, allisonplus, sabernhardt.
Fixes#40361.
Built from https://develop.svn.wordpress.org/trunk@54191
git-svn-id: http://core.svn.wordpress.org/trunk@53750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes the deprecated `-webkit-appearance` CSS property used in `customizer-controls.css`. It doesn't change anything to the interface.
Props laurent22777, desrosj, celloexpressions, costdev, rolfsiebers, audrasjb, Clorith.
Fixes#38431.
Built from https://develop.svn.wordpress.org/trunk@54188
git-svn-id: http://core.svn.wordpress.org/trunk@53747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improve the logic found in `get_user_data_from_wp_global_styles` method. Replace call to `wp_get_recent_posts` with the more standard, `WP_Query` for consistancy. Use transient over standard cache, to improve performance on sites without persistent object caching. Improve handling of cases where `wp_insert_post` returns a `WP_Error`.
Props spacedmonkey, adamsilverstein, mukesh27, peterwilsoncc, andregal.
Fixes#55392.
Built from https://develop.svn.wordpress.org/trunk@54186
git-svn-id: http://core.svn.wordpress.org/trunk@53745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset is a part of a task dedicated to improve wp-admin CSS code with less floating, as float never was intended for layout. The idea is to gradually replace floating methods that take the HTML element out of the normal flow of the document with more modern and robust positioning methods.
Props kebbet.
See #55557.
Built from https://develop.svn.wordpress.org/trunk@54185
git-svn-id: http://core.svn.wordpress.org/trunk@53744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When a post type is passed to `get_block_templates()` in the query, return only the templates that match that post type.
Fixes an issue where:
* when a block template provided by a theme has been edited by the user
* and that template has specific defined `postTypes`
* but after editing, the template was available for all post types.
Follow-up to [52062].
Props aljullu, bernhard-reiter, hellofromTonya.
Fixes#55881.
Built from https://develop.svn.wordpress.org/trunk@54184
git-svn-id: http://core.svn.wordpress.org/trunk@53743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a new feature to persist editor UI preferences between page loads and browsers.
* Adds a new preferences persistence API.
* Saves editor preferences in user meta instead of in browser's local storage.
Why?
Due to the transient nature of browser storage, this persistence is not as sticky as it is expected to be, including: switching browsers (unique storage between browsers), or using private browsing tabs (storage cleared between sessions), or the same user across a network of sites (storage unique by domain).
This is a backport from Gutenberg.[https://github.com/WordPress/gutenberg/pull/39795 See WordPress/gutenberg PR 39795].
Props talldanwp, youknowriad, noisysocks, mamaduka, costdev, ironprogrammer, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54182
git-svn-id: http://core.svn.wordpress.org/trunk@53741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a note that the parameter is optional and defaults to the result of `wp_allowed_protocols()`.
This affects:
* `wp_kses()`
* `filter_block_content()`
* `filter_block_kses()`
* `filter_block_kses_value()`
Includes synchronizing the `$allowed_html` parameter description for consistency.
Follow-up to [649], [6630], [18826], [32603], [43016], [46896], [48478].
Props armondal, SergeyBiryukov.
Fixes#56580.
Built from https://develop.svn.wordpress.org/trunk@54181
git-svn-id: http://core.svn.wordpress.org/trunk@53740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to make it clear that the filter is applied to an HTML ID attribute for the menu item's `<li>` element, and not a numeric ID.
Follow-up to [15407], [25410], [27201], [38559], [51739].
Props dilipbheda, robinwpdeveloper, mukesh27, audrasjb, SergeyBiryukov.
See #56574, #55646.
Built from https://develop.svn.wordpress.org/trunk@54178
git-svn-id: http://core.svn.wordpress.org/trunk@53737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
It is obviously more logical and semantic to remove the `hidden` class when the panel is displayed. Plus, it prevents from weird behavior occurring when plugins also use the `hidden` class to hide stuff.
Props grabmedia, SergeyBiryukov, helen, sabernhardt, costdev, audrasjb.
Fixes#27697.
Built from https://develop.svn.wordpress.org/trunk@54177
git-svn-id: http://core.svn.wordpress.org/trunk@53736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Allows Classic / Hybrid themes to use block-based template parts without using complete block-based templates.
* Exposes the Site Editor's template parts UI
* Adds Appearance > "Template Parts" menu
* Enabled within the theme via adding a theme support for `'block-template-parts'`
{{{#!php
add_theme_support( 'block-template-parts' );
}}}
This is a backport from Gutenberg.[https://github.com/WordPress/gutenberg/pull/42729 See WordPress/gutenberg PR 42729].
Follow-up to [52330], [52069], [52178].
Props mamaduka, fabiankaegy, poena, scruffian, manfcarlo, bernhard-reiter, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54176
git-svn-id: http://core.svn.wordpress.org/trunk@53735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset backports the `wp_theme_element_class_name()` alias for the "internal" `WP_Theme_JSON::get_element_class_name()` function.
This is a backport of [https://github.com/WordPress/gutenberg/pull/44099 gutenberg/PR44099].
Note: this changeset doesn't replace calls to `WP_Theme_JSON::get_element_class_name` in the tests, since those are specifically for the `WP_Theme_JSON` class.
Props bernhard-reiter, cbravobernal, costdev.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54174
git-svn-id: http://core.svn.wordpress.org/trunk@53733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds `text-decoration-thickness: 2px;` to all underlined link to ensure that underline thickness stay consistent across browsers. This fixes an issue where the underline style on links using the Hoefler Text font was too thin in Firefox.
Props allancole, sabernhardt, danfarrow, audrasjb, neychok, multidots1896, maartenj.
Fixes#45925.
Built from https://develop.svn.wordpress.org/trunk@54171
git-svn-id: http://core.svn.wordpress.org/trunk@53730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
- Add a check to `wp_check_php_version()` whether the current PHP version is lower than the next (desired) minimum version.
- Set the next desired minimum PHP version to 7.2.
- Use that check to update the warnings in the `wp_dashboard_php_nag()` widget, and on the Site Health screen.
Props Clorith, SergeyBiryukov, ironprogrammer, azaozz.
See #56199.
Built from https://develop.svn.wordpress.org/trunk@54169
git-svn-id: http://core.svn.wordpress.org/trunk@53728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A cross-team consensus has been reached to allow Twenty Twenty-Two to be tagged as "Accessibility Ready" on the WordPress Themes repository.
Props bph, kjellr, utz119, ryokuhi, joedolson, audrasjb, mikeschroder, poena, annezazu.
Fixes#55172.
Built from https://develop.svn.wordpress.org/trunk@54168
git-svn-id: http://core.svn.wordpress.org/trunk@53727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backports the following changes from the Gutenberg repository:
* [WordPress/gutenberg/40875 gutenberg/40875] Layout: Use semantic classnames, centralize layout definitions, reduce duplication, and fix blockGap in theme.json
* [WordPress/gutenberg/42544 gutenberg/42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg/42544
* [WordPress/gutenberg/42087 gutenberg/42087] Theme.json: Add block support feature level selectors for blocks gutenberg/42087
* [WordPress/gutenberg/43792 gutenberg/43792] Global Styles: Split root layout rules into a different function gutenberg/43792
* [WordPress/gutenberg/42544 gutenberg/42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg/42544
* [WordPress/gutenberg/42665 gutenberg/42665] Layout: Reduce specificity of fallback blockGap styles gutenberg/42665
* [WordPress/gutenberg/42085 gutenberg/42085] Core CSS support for root padding and alignfull blocks gutenberg/42085
Notes:
* It doesn't entirely port over PR 40875 — the remaining PHP changes for that PR will be explored in a separate PR targeting `layout.php`.
* [54159] was reverted in [54160] due to PHPUnit test failures for tests added by the commit. Later, tests passed when applied on top of `trunk`. There were various outages today of upstream `wp-env` dependencies, which likely were the root cause of the earlier failures. For historical tracking and to make sure, recommitting [54159] but instead on top of current `trunk`. See PR 3205 for more details.
* Giving additional props for those who did a deep dive investigation into the failed tests.
Follow-up to [54160], [54159].
Props andrewserong, aaronrobertshaw, isabel_brison, bernhard-reiter, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54162
git-svn-id: http://core.svn.wordpress.org/trunk@53721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The previously available set of filters in the `feed_links()` function to enable or disable display of various feed links was quite limited:
* `feed_links_show_posts_feed` to control the main feed
* `feed_links_show_comments_feed` to control both the global comments feed and the comment feed for singular posts.
In order to disable the other feeds (post type archive, category, tag, custom taxonomy, author archive, search results), one would have to unhook `feed_links_extra()` from `wp_head`, but that would completely remove all of those feeds, as well as the single post comments feed.
To allow for more flexibility, this commit introduces a full set of filters in the `feed_links_extra()` function to control each one of the feeds independently, including a way to enable/disable the single post comments feed when the global comments feed is disabled/enabled:
* `feed_links_extra_show_post_comments_feed`
* `feed_links_extra_show_post_type_archive_feed`
* `feed_links_extra_show_category_feed`
* `feed_links_extra_show_tag_feed`
* `feed_links_extra_show_tax_feed`
* `feed_links_extra_show_author_feed`
* `feed_links_extra_show_search_feed`
All of them default to `true`, except for `feed_links_extra_show_post_comments_feed` which defaults to the result of `feed_links_show_comments_feed` to ensure backward compatibility.
Follow-up to [33838], [33839], [53125].
Props lopo, mukesh27, audrasjb, SergeyBiryukov.
Fixes#55904.
Built from https://develop.svn.wordpress.org/trunk@54161
git-svn-id: http://core.svn.wordpress.org/trunk@53720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This change backports the following changes from Gutenberg repository:
- [WordPress/gutenberg#40875 gutenberg#40875] Layout: Use semantic classnames, centralize layout definitions, reduce duplication, and fix blockGap in theme.json
- [WordPress/gutenberg#42544 gutenberg#42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg#42544
- [WordPress/gutenberg#42087 gutenberg#42087] Theme.json: Add block support feature level selectors for blocks gutenberg#42087
- [WordPress/gutenberg#43792 gutenberg#43792] Global Styles: Split root layout rules into a different function gutenberg#43792
- [WordPress/gutenberg#42544 gutenberg#42544] Layout: Add a disable-layout-styles theme supports flag to opt out of all layout styles gutenberg#42544
- [WordPress/gutenberg#42665 gutenberg#42665] Layout: Reduce specificity of fallback blockGap styles gutenberg#42665
- [WordPress/gutenberg#42085 gutenberg#42085] Core CSS support for root padding and alignfull blocks gutenberg#42085
Note that it doesn't entirely port over PR40875 — the remaining PHP changes for that PR will be explored in a separate PR targeting `layout.php`.
Props andrewserong, aaronrobertshaw, isabel_brison.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54159
git-svn-id: http://core.svn.wordpress.org/trunk@53718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Following the update to replace the HTTP API internals with Requests library in WordPress 4.6, the return value of `wp_remote_retrieve_headers()` has changed from a simple array to an object which implements `ArrayAccess`.
Since `wp_get_http_headers()` directly returns the result of `wp_remote_retrieve_headers()`, its return value should reflect that change.
Includes:
* Updating the return value for the deprecated `wp_get_http()` function, which also directly returns the result of `wp_remote_retrieve_headers()`.
* Minor DocBlock formatting changes for some other HTTP API functions per the documentation standards.
Follow-up to [2416], [6390], [8092], [9013], [37428], [37989], [38730].
Props mhkuu.
See #54225, #55646.
Built from https://develop.svn.wordpress.org/trunk@54157
git-svn-id: http://core.svn.wordpress.org/trunk@53716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This PR migrates the Style Engine PHP functions, classes and tests into Core for 6.1. It backports the original [WordPress/gutenberg#40260 PR #40260] from Gutenberg repository.
Props ramonopoly, bernhard-reiter, costdev, azaozz, andrewserong, mukesh27, aristath.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54156
git-svn-id: http://core.svn.wordpress.org/trunk@53715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Follow-up #54337, [52069]. Part of https://github.com/WordPress/gutenberg/issues/41236. More details in https://github.com/WordPress/gutenberg/issues/33542.
Allow passing more than one script per block for `editorScript`, `script`, and `viewScript` fields in the `block.json` metadata file. This aligns with the previously added changes for `style` and `editorStyle` fields.
This change impacts the `WP_Block_Type` class and the REST API endpoint for block types. To ensure backward compatibiliy old names were soft deprecated in favor of new fields that work with array values and have `_handles` suffix.
Props zieladam, dlh, timothyblynjacobs, aristath, bernhard-reiter.
Fixes#56408.
Built from https://develop.svn.wordpress.org/trunk@54155
git-svn-id: http://core.svn.wordpress.org/trunk@53714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes `.wp-block` container from headings CSS selectors to restore consistency between editor and front-end styles. It also removes `.wp-block` from headings selectors in the `'block-editor'` array of `twentytwenty_get_localized_font_family_elements()`.
Props kajalgohel, kmadhak, poena, multidots1896, tahmidulkarim, audrasjb.
Fixes#56194.
Built from https://develop.svn.wordpress.org/trunk@54154
git-svn-id: http://core.svn.wordpress.org/trunk@53713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds a flexible CSS columns layout to plugin cards in the Plugin Install screen, to ensure plugin cards all have the same height.
Props jamesckemp, audrasjb, joyously, sabernhardt, sharjeelkhanvmi, joyously.
Fixes#55721.
See #55272.
Built from https://develop.svn.wordpress.org/trunk@54149
git-svn-id: http://core.svn.wordpress.org/trunk@53708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `wp_guess_url`, the regex to check for wp-login.php in the URL is slightly too permissive, not escaping `.` in "wp-login.php". `.` is a token in regex that matches any character.
This change simply escapes the `.` and adds unit test coverage for `wp_guess_url`.
Props cfinke, ocean90, jrf, voldemortensen, jdgrimes, curdin, netweb, petitphp, SergeyBiryukov, costdev.
Fixes#36827.
Built from https://develop.svn.wordpress.org/trunk@54146
git-svn-id: http://core.svn.wordpress.org/trunk@53705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Although a `pre_option_{$option}` filter already exists, this change adds a more general `pre_option` filter that will run on every `get_option` call. This brings the control flow into similar flow as `update_option`.
Props flixos90, NathanAtmoz, desrosj, spacedmonkey, pbearne.
Fixes#37930.
Built from https://develop.svn.wordpress.org/trunk@54145
git-svn-id: http://core.svn.wordpress.org/trunk@53704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
WordPress 3.2 introduced several enhancements to the `copy_dir()` function:
* No more re-installing Akismet upon upgrade.
* Respect custom `WP_CONTENT_DIR` for bundled plugins/theme installation.
* Respect custom `WP_CONTENT_DIR`/`WP_LANG_DIR` for language files when upgrading.
* Add an exclusion list to `copy_dir()` as well as `WP_Filesystem_Base::wp_lang_dir()`.
* Standardize `WP_Filesystem` path method returns.
However, the version of `copy_dir()` that runs during the upgrade process is the one from the older install, not the newer, which means that these enhancements would only be available after upgrading to WordPress 3.2 first, e.g. in a subsequent upgrade to WordPress 3.3.
In order to make these enhancements immediately available in WordPress 3.2, specifically to take advantage of skip lists and avoid re-installing Akismet if it was previously deleted, a temporary copy of the function was utilized, with the intention to remove it in WordPress 3.3 or a later release.
With further enhancements made to the Upgrade API to support partial and no-content builds, this temporary copy is no longer relevant and can be safely removed.
Follow-up to [17576], [17580], [17581], [18225].
Props afragen, costdev, dd32, peterwilsoncc, SergeyBiryukov.
Fixes#55712. See #17173.
Built from https://develop.svn.wordpress.org/trunk@54143
git-svn-id: http://core.svn.wordpress.org/trunk@53702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This function was previously already problematic as it does not do proper input validation, and it has already received tweaks related to PHP 8.0 in [50408] / #52534, which also introduced a `_doing_it_wrong()` notice and added tests.
The short of it is:
* The function expects to receive an `array` for the `$l10n` parameter;
* ...but silently supported the parameter being passed as a `string`;
* ...and would expect PHP to gracefully handle everything else or throw appropriate warnings/errors.
In the previous fix, a `_doing_it_wrong()` notice was added for any non-array inputs. The function would also cause a PHP native "Cannot use a scalar value as an array" warning (PHP < 8.0) or error (PHP 8.0+) for all scalar values, except `false`.
PHP 8.1 deprecated autovivification from `false` to `array`, so now `false` starts throwing an "Automatic conversion of false to array is deprecated" notice.
By rights, the function should just throw an exception when a non-array/string input is received, but that would be a backward compatibility break.
So the current change will maintain the previous behavior, but will prevent both the "Cannot use a scalar value as an array" warning/error as well as the "Automatic conversion of false to array" deprecation notice for invalid inputs.
Invalid inputs ''will'' still receive a `_doing_it_wrong()` notice, which is the reason this fix is considered acceptable.
Includes:
* Adding a test passing an empty array.
* Adding a test to the data provider for a `null` input to make sure that the function will not throw a PHP 8.1 "passing null to non-nullable" notice.
This solves the following PHP 8.1 test error:
{{{
Tests_Dependencies_Scripts::test_wp_localize_script_data_formats with data set #8 (false, '[""]')
Automatic conversion of false to array is deprecated
/var/www/src/wp-includes/class.wp-scripts.php:514
/var/www/src/wp-includes/functions.wp-scripts.php:221
/var/www/tests/phpunit/tests/dependencies/scripts.php:1447
/var/www/vendor/bin/phpunit:123
}}}
Reference: [https://www.php.net/manual/en/migration81.deprecated.php#migration81.deprecated.core.autovivification-false PHP Manual: PHP 8.1 Deprecations: Autovivification from false].
Follow-up to [7970], [18464], [18490], [19217], [50408].
Props jrf, costdev.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54142
git-svn-id: http://core.svn.wordpress.org/trunk@53701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset replaces `white-space: nowrap` with `white-space: preline` to ensure long text used in the button block correctly wraps to a second line.
Follow-up to [44148].
Props robertghetau, bhrugesh12, sabernhardt, mukesh27.
Fixes#55783.
Built from https://develop.svn.wordpress.org/trunk@54139
git-svn-id: http://core.svn.wordpress.org/trunk@53698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adss an `aria-hidden="true"` attribute to the optional arrows/chevron characters to the Query Loop and to the Comments Query Loop blocks pagination links.
These characters are text, so they're read out by assistive technologies. For better accessibility, it's best to reduce noise for screen reader users and prevent them to be rendered, using the `aria-hidden="true"` attribute.
Follow-up to [52057].
Props afercia, sabernhardt, kamig478, zieladam, audrasjb, joedolson, costdev.
Fixes#56067.
Built from https://develop.svn.wordpress.org/trunk@54138
git-svn-id: http://core.svn.wordpress.org/trunk@53697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset introduces two new hooks:
- `wp_required_field_indicator` allows developers to filter the HTML output of the `wp_required_field_indicator()` function.
- `wp_required_field_message` does the same for the `wp_required_field_message()` function.
The changeset also adds new phpunit tests for these filters.
Follow-up to [53888], [54136].
Props kebbet, audrasjb, sabernhardt, costdev, mukesh27.
Fixes#56389.
See #54394.
Built from https://develop.svn.wordpress.org/trunk@54137
git-svn-id: http://core.svn.wordpress.org/trunk@53696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes `aria-hidden="true"` attribute used for required fields in comments template, for better accessibility. It removes the attribute from both `wp_required_field_indicator()` and `wp_required_field_message()` patterns.
Follow-up to [53888].
Props juliemoynat, audrasjb, joedolson, sabernhardt, afercia, costdev.
Fixes#55717.
Built from https://develop.svn.wordpress.org/trunk@54136
git-svn-id: http://core.svn.wordpress.org/trunk@53695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This particular code block only makes sense to run when `$this->return_url` is not null. Previously, it caused a "passing null to non-nullable" deprecation notice on PHP 8.1.
By moving the code into the `if ( $this->return_url )` condition block, the code will only be run when `$this->return_url` contains a non-falsey/non-null value.
No additional tests added as this issue was found via the existing tests for the function containing the bug.
This solves the following two PHP 8.1 test errors:
{{{
1) Tests_WP_Customize_Manager::test_return_url
parse_url(): Passing null to parameter #1 ($url) of type string is deprecated
/var/www/src/wp-includes/class-wp-customize-manager.php:4696
/var/www/tests/phpunit/tests/customize/manager.php:2975
/var/www/vendor/bin/phpunit:123
2) Tests_WP_Customize_Manager::test_customize_pane_settings
parse_url(): Passing null to parameter #1 ($url) of type string is deprecated
/var/www/src/wp-includes/class-wp-customize-manager.php:4696
/var/www/src/wp-includes/class-wp-customize-manager.php:4898
/var/www/tests/phpunit/tests/customize/manager.php:3085
/var/www/vendor/bin/phpunit:123
}}}
Follow-up to [46754].
Props jrf, costdev.
See #55656.
Built from https://develop.svn.wordpress.org/trunk@54135
git-svn-id: http://core.svn.wordpress.org/trunk@53694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.
There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.
Trac ticket #56034 is open to investigate and handle the third and fourth type of situations, however it has become clear this will need more time and will not be ready in time for WP 6.1.
To reduce “noise” in the meantime, both in the error logs of WP users moving onto PHP 8.2, in the test run logs of WP itself, in test runs of plugins and themes, as well as to prevent duplicate tickets from being opened for the same issue, this commit adds the `#[AllowDynamicProperties]` attribute to all “parent” classes in WP.
The logic used for this commit is as follows:
* If a class already has the attribute: no action needed.
* If a class does not `extend`: add the attribute.
* If a class does `extend`:
- If it extends `stdClass`: no action needed (as `stdClass` supports dynamic properties).
- If it extends a PHP native class: add the attribute.
- If it extends a class from one of WP's external dependencies: add the attribute.
* In all other cases: no action — the attribute should not be needed as child classes inherit from the parent.
Whether or not a class contains magic methods has not been taken into account, as a review of the currently existing magic methods has shown that those are generally not sturdy enough and often even set dynamic properties (which they should not). See the [https://www.youtube.com/watch?v=vDZWepDQQVE live stream from August 16, 2022] for more details.
This commit only affects classes in the `src` directory of WordPress core.
* Tests should not get this attribute, but should be fixed to not use dynamic properties instead. Patches for this are already being committed under ticket #56033.
* While a number bundled themes (2014, 2019, 2020, 2021) contain classes, they are not a part of this commit and may be updated separately.
Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].
Follow-up to [53922].
Props jrf, hellofromTonya, markjaquith, peterwilsoncc, costdev, knutsp, aristath.
See #56513, #56034.
Built from https://develop.svn.wordpress.org/trunk@54133
git-svn-id: http://core.svn.wordpress.org/trunk@53692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously when a user was locked from editing a post in the block editor, autosave functionality was allowed to overwrite changes made by the editor that has taken control. This patch honors the lock status keeping autosave from conflicitng with other content editors.
Props jhart35, adamsilverstein, sathyapulse, chanthaboune, primetimejas, joemcgill, kadamwhite.
Fixes#55659.
Built from https://develop.svn.wordpress.org/trunk@54130
git-svn-id: http://core.svn.wordpress.org/trunk@53689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This change allows for the muted property to be used in video elements which solves for content that wishes to `autoPlay` when a page is viewed. Adding `muted` to video elements adhears to the requirements browsers have to honor `autoPlay` functionality.
Props prokium, peterwilsoncc, costdev, johnbillion, Benouare.
Fixes#54788.
Built from https://develop.svn.wordpress.org/trunk@54128
git-svn-id: http://core.svn.wordpress.org/trunk@53687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add support for a "_pretty" meta-parameter on all REST controllers which instructs WordPress to return pretty-printed JSON, for better readability when inspecting endpoint responses in curl output or certain developer tools.
Introduce the "rest_json_encode_options" filter to permit site owners to control this behavior globally.
Props Viper007Bond, TimothyBlynJacobs, chrisguitarguy, johnbillion, swissspidy, adamsilverstein, danielbachhuber, rmccue.
Fixes#41998.
Built from https://develop.svn.wordpress.org/trunk@54127
git-svn-id: http://core.svn.wordpress.org/trunk@53686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`wp_resolve_post_date()` extracts year/month/day from a post date (which is a string) and passes it to `wp_checkdate` (and from there to `checkdate()`), which requires `int`s.
Casting the strings to integers avoids PHP notices due to incorrect argument types.
Props hilayt24.
Fixes#54186
Built from https://develop.svn.wordpress.org/trunk@54126
git-svn-id: http://core.svn.wordpress.org/trunk@53685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* `$blog_id` global was replaced with `get_current_blog_id()` and is no longer used directly.
* `$wp_roles` global usage was previously undocumented.
Follow-up to [32637], [38457], [51943].
Props shoaibkarimali.
Fixes#56543.
Built from https://develop.svn.wordpress.org/trunk@54119
git-svn-id: http://core.svn.wordpress.org/trunk@53678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `safecss_filter_attr()` function allows using custom CSS variables like `color: var(--color)`. However, it did not allow assigning values to CSS variables like `--color: #F00`, which is common in Global Styles and Gutenberg.
This commit adds support for assigning values to CSS variables, so that the function can be used consistently in Global Styles and the future Style Engine in Gutenberg.
Follow-up to [50923], [54100].
Props aristath, ramonopoly, SergeyBiryukov.
Fixes#56353.
Built from https://develop.svn.wordpress.org/trunk@54117
git-svn-id: http://core.svn.wordpress.org/trunk@53676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset implements a clearer and more consistent timeout/duration/expiration format. It updates time durations used in various files, as per WordPress coding standards:
- If the value can be represented as an integer (not a fractional) number of minutes (hours, etc.), use the appropriate constant (e.g.: `MINUTE_IN_SECONDS`) multiplied by that number.
- Otherwise, keep the value as is and add a comment with the units for clarity.
Follow-up to [11823], [13177], [21996], [37747], [53714].
Props hztyfoon, audrasjb, arrasel403, krupalpanchal, GaryJ, SergeyBiryukov, peterwilsoncc, rudlinkon, costdev, robinwpdeveloper.
Fixes#56293.
See #55647.
Built from https://develop.svn.wordpress.org/trunk@54113
git-svn-id: http://core.svn.wordpress.org/trunk@53672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevent unnecessary database queries on page load by initializing widget options. On sites with uninitialized widgets, this prevents one or two database queries per uninitialized widget on each page load.
Props Chouby, mvraghavan, costdev, peterwilsoncc, spacedmonkey, mukesh27.
Fixes#54677.
Built from https://develop.svn.wordpress.org/trunk@54112
git-svn-id: http://core.svn.wordpress.org/trunk@53671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Modify how `WP_Query` determines whether a database query contains a taxonomy component and accounts for term changes when generating the cache key. This presents a stale cache been used under some circumstances.
Props Chouby, costdev, peterwilsoncc.
See #22176.
Built from https://develop.svn.wordpress.org/trunk@54111
git-svn-id: http://core.svn.wordpress.org/trunk@53670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Remove the check for future events prior iterating the array of crons in `wp_get_ready_cron_jobs()`. If there are no ready events, the `foreach` loop will break on the first iteration so the optimization is not required.
As WordPress Core adds a number of events by default, accounting for an empty array is not required in most instances.
Props lev0, jrf, SergeyBiryukov.
Fixes#56092.
Built from https://develop.svn.wordpress.org/trunk@54110
git-svn-id: http://core.svn.wordpress.org/trunk@53669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset ensures `h5` and `h5` heading levels don't use the same font size.
Follow-up to [29892].
Props poena, akabarikalpesh, hellofromTonya, afrid1719, aezazshekh, sabernhardt, anitanenova, viralsampat, alansyue, pratiweb, russel07.
Fixes#52028.
Built from https://develop.svn.wordpress.org/trunk@54109
git-svn-id: http://core.svn.wordpress.org/trunk@53668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset addresses an issue where button-style links with Outline style variation were not consistent with the corresponding variation of the Button block.
Props umesh84, sabernhardt, mrfoxtalbot, mohitdadhich10.
Fixes#55824.
Built from https://develop.svn.wordpress.org/trunk@54107
git-svn-id: http://core.svn.wordpress.org/trunk@53666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This enables themes to:
* Set style rules for all heading elements together rather than having to do it individually.
* Style captions in `theme.json` by adding this into your `theme.json` file:
{{{
{
"styles": {
"elements": {
"caption": {
"color": {
"background": "red",
"text": "yellow"
}
}
}
}
}
}}}
This commit backports the original PRs from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41981#41981: Global Styles: Add support for heading elements]
* [https://github.com/WordPress/gutenberg/pull/41140#41140: Global Styles: Add support for caption elements]
Follow-up to [50973].
Props cbravobernal, scruffian, madhudollu, mikachan, zieladam, bph, poena, andraganescu, ndiego, bgardner.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54105
git-svn-id: http://core.svn.wordpress.org/trunk@53664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In order to add more template types we need to update some copy from the current default templates provided.
This updates the `single` template copy as it's needed to clear up the ambiguity between the single template that is the fallback for any custom post type (including `post`) and the menu item to be added in a subsequent commit, that will allow the creation the `single-post` template and any `single_$post_type` template.
This commit backports the original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41302#41302: Site Editor: Update single default template copy]
Follow-up to [52062], [52331].
Props ntsekouras, bernhard-reiter, jameskoster, Mamaduka, scruffian.
Fixes#56534.
Built from https://develop.svn.wordpress.org/trunk@54104
git-svn-id: http://core.svn.wordpress.org/trunk@53663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The theme includes styles for the spacer block for the front which appears to be unnecessary:
* It adds `display: block` even though that is the default.
* It removes top and bottom margin, even though this is not needed in the post content because of collapsing margins between blocks.
* It uses a custom CSS property to force a specific height on mobile. This affects the patterns in the theme negatively.
It also causes styling problems:
* When the spacer block has a height set to `0` in the navigation block, as the theme forces this to be larger on smaller screens.
* When the block is horizontal. Horizontal was not an option when this style was added.
Consequences of removal:
* Removing the use of the custom CSS property will cause a style change for websites that have adjusted the spacing property.
Follow-up to [49216], [49574].
Props poena, mukesh27.
Fixes#56222.
Built from https://develop.svn.wordpress.org/trunk@54103
git-svn-id: http://core.svn.wordpress.org/trunk@53662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds support for the following CSS properties considered safe for inline CSS:
* `flex-wrap`
* `gap`
* `column-gap`
* `row-gap`
Extends support for `margin` and `padding` to include logical properties:
* `margin-block-start`
* `margin-block-end`
* `margin-inline-start`
* `margin-inline-end`
* `padding-block-start`
* `padding-block-end`
* `padding-inline-start`
* `padding-inline-end`
Follow-up to [46235].
Props andrewserong, peterwilsoncc, ramonopoly, bernhard-reiter.
Fixes#56122.
Built from https://develop.svn.wordpress.org/trunk@54102
git-svn-id: http://core.svn.wordpress.org/trunk@53661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Additionally, this commit updates `safecss_filter_attr()` to add support for nested `var()` functions, so that a fallback value can be another CSS variable.
Follow-up to [50923].
Props johnregan3, noisysocks, cbravobernal, uxl, isabel_brison, andrewserong, ramonopoly, joyously, bernhard-reiter, peterwilsoncc.
Fixes#55966.
Built from https://develop.svn.wordpress.org/trunk@54100
git-svn-id: http://core.svn.wordpress.org/trunk@53659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The existing filter `image_editor_output_format` receives an additional parameter `$size_name` which is populated whenever it controls the output format for a specific registered image size to create. Otherwise, it remains empty. In order to achieve this, a low level change has been added in bringing a new `$size_name` class property to the `WP_Image_Editor` base class, which is introduced in a backward compatible way that will not cause conflicts with custom implementations.
This parameter is then used in new logic inside the `wp_default_image_output_mapping()` callback function for the filter, controlling whether `image/jpeg` should map to `image/webp` output or not. By default, this is enabled for all WordPress core image sizes by default, and this list can be modified using a new `wp_image_sizes_with_additional_mime_type_support` filter, e.g. to remove core sizes or add custom sizes.
The customization per image size may be further enhanced by providing a more declarative API via a new parameter on the `add_image_size()` function.
Props eugenemanuilov, flixos90, adamsilverstein, joegrainger.
Fixes#56526.
See #55443, #56288.
Built from https://develop.svn.wordpress.org/trunk@54097
git-svn-id: http://core.svn.wordpress.org/trunk@53656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `amd64/mysql` and `amd64/mariadb` official images from Docker are also compatible with an x64 host machine which means they can be used by default instead of only when the host uses ARM64.
Props bernhard-reiter, czapla, gmovr, withinboredom
Fixes#56528
Built from https://develop.svn.wordpress.org/trunk@54096
git-svn-id: http://core.svn.wordpress.org/trunk@53655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a test fixture (dummy class only used in a test context), which incorrectly implements the magic methods.
With the deprecation of dynamic properties in PHP 8.2, this needs to be fixed.
The new implementation represents a “proper” implementation of the magic methods for a class without non-`public` or typed properties.
Notes:
* Instead of relying on dynamic properties, the magic methods now store properties in a `private` `$arbitrary_props` array and retrieve them from there as well.
* The original `$foo` property, even though declared as `private`, was never `private` in practice due to the way the magic methods were originally implemented. In effect, it was fully publicly retrievable and modifiable without any (type) restrictions. With that in mind, the `foo` property has been moved into the `$arbitrary_props` array to keep the implementation of the magic methods as clean and straightforward as possible. With the adjusted magic methods, access to and modification of `$foo` will (on the surface) continue to work in the same way as before, while under the hood, it is no longer affected by the dynamic properties deprecation.
* Take note of the use of `array_key_exists()` instead of `isset()` in the `__get()` method. This is intentional and allows for `null` values to be stored and retrieved.
* Also take note of `__set()` method no longer returning. `__set()` is supposed to be a `void` method. In practice, the return value would always be ignored due to how PHP handles magic methods, so in effect, this change will not make any difference and does not constitute a backward compatibility break.[[BR]][[BR]]
> The return value of `__set()` is ignored because of the way PHP processes the assignment operator.
Alternatives considered:
* Instead of fixing the magic methods, they could have been removed instead and the class be made to `extend` `stdClass`. It has been chosen not to do so for two reasons:
1. It’s kind of nice to have at least ''one'' correct implementation of magic methods in WP, which can be used as an example to point to as well.
2. Extending `stdClass` would change the class hierarchy, which ''may'' or ''may not'' affect the tests using this fixture (depending on what’s being done with the class). Extending `stdClass` would also obfuscate what’s going on in the class and would require extensive documentation to prevent the extension being inadvertently removed at a future point in time.
* Instead of fixing the magic methods, the test fixture could have been deprecated and/or removed, with the few tests which use the fixture being updated to use `stdClass` for their test fixture instead. It has been chosen not to do so as there may well be external (plugin/theme) tests relying on this test fixture and evaluating whether that is so would be hard, as WP Directory cannot be used, since test code is normally not included in the code published on wp.org. Also note, there is still a (deprecated) `Basic_Subclass` fixture in the test suite, which extends this class.
These magic methods and the `Basic_Object` test fixture were originally introduced in [28480] and [28523]. The fixture was deprecated in [42381] and undeprecated again in [45807].
At this time, the test fixture is used in the `WP_Test_REST_Post_Meta_Fields` and the `Tests_REST_API` test classes.
References:
* [https://www.php.net/manual/en/language.oop5.overloading.php#object.set PHP Manual: Overloading: __set()]
* [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties]
* [https://github.com/php/php-src/issues/7786 php-src: #7786 PHP 8.2: unexpected deprecation for dynamic property set via magic method]
Follow-up to [28480], [28493], [28523], [42381], [45807].
Props jrf, costdev.
See #56514.
Built from https://develop.svn.wordpress.org/trunk@54095
git-svn-id: http://core.svn.wordpress.org/trunk@53654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While the `image_editor_output_format` filter is primarily used in WP Admin, it can also be executed in frontend scope, as the related `WP_Image_Editor` class and `wp_unique_filename()` function are being loaded in that scope.
Follow up to [54086].
See #55443, #56526.
Built from https://develop.svn.wordpress.org/trunk@54094
git-svn-id: http://core.svn.wordpress.org/trunk@53653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces all references to the `WP_UnitTestCase_Base::$factory` property with static function calls to the `WP_UnitTestCase_Base::factory()` method.
This is a consistency improvement for the test suite.
Follow up to [35225], [35242], [49603], [54087], [54088].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54090
git-svn-id: http://core.svn.wordpress.org/trunk@53649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [53164] the `clipboard.js` library was updated to from version 2.0.8 to 2.0.10, and in doing so caused a TypeError JavaScript error to be thrown when the copy button for debug information was used.
With the update, the `clipboard.js` library introduced an enhancement to its `.copy()` API, which now removes the fake DOM element used for copying content, which Site Health previously had to remove manually.
As this fake DOM element is now removed automatically, the copy function within the debug information screen can rely on the library performing the removal, instead of WordPress needing to do so manually.
Props hiren1094, costdev.
Fixes#56515.
Built from https://develop.svn.wordpress.org/trunk@54089
git-svn-id: http://core.svn.wordpress.org/trunk@53648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This replaces all non-static calls to the `WP_UnitTestCase_Base::factory()` method with static function calls, since the method is declared as static.
This is a consistency improvement for the test suite.
Follow up to [35225], [35242], [49603], [54087].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54088
git-svn-id: http://core.svn.wordpress.org/trunk@53647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These magic methods were introduced to prevent a backward compatibility break, but in actual fact:
1. ''Caused'' a backward compatibility break. The original `$factory` property was a `static` property and this declared property was replaced by the magic methods. Unfortunately, it was not realized at the time that these magic methods **''are not called for static property access''**.[[BR]][[BR]]
> Property overloading only works in object context. These magic methods will not be triggered in static context.
And as approaching a static property in a non-static manner is [https://3v4l.org/93HQL not supported in PHP], this effectively created a backward compatibility break instead of preventing it.
2. Were hiding errors in tests, as the magic methods would be invoked for non-existent properties and would return `null` (get) or `false` (isset). See [54040], [54041], and [54077] for bug fixes related to this.
3. Are problematic in relation to PHP 8.2, as the implementation is incomplete, does not protect against dynamic properties and hides PHP notices about undefined properties.
Now, there were several options to mitigate this:
1. Revert the original commit. This would be problematic, as the ''non-static'' version of these properties has now been supported for 7 years, so this would create a new backward compatibility break.
2. Improve the magic methods. With all the issues with magic methods (see the discussion in the [https://www.youtube.com/watch?v=vDZWepDQQVE livestream from August 16, 2022], this would probably cause more problems than it’s worth and would make for a much more complex implementation, which is over the top for this relatively simple functionality, especially in the context of a test suite.
3. Remove the magic methods without adding the property. This would again cause a backward compatibility break, though one for which the mitigation solution would be relatively straightforward, i.e. to replace property access using `$this->factory` with a function call `$this->factory()` (or `self::factory()`, as the method is declared as static). While we can (and have in a subsequent commit) mitigate this for the WP Core test suite, mitigating this for plugin or theme integration tests is outside of our purview and they would still need to deal with this backward compatibility break.
4. The current solution: removing the magic methods, explicitly declaring the (non-static) property and setting it in the `set_up()` method. This does not constitute a backward compatibility break with the functionality as it was over the past 7 years. Setting the property in `set_up()` may be “late”, but that is the earliest place in which the property can be set as non-static. If the factory would be needed prior to `set_up()`, the (static) `WP_UnitTestCase_Base::factory()` method should be called directly. This is no different from how this functionality behaved over the past 7 years.
Note: The property is straight away marked as “deprecated”, since the method should be favored over the use of the property.
Reference: [https://www.php.net/manual/en/language.oop5.overloading.php#object.get PHP Manual: Property overloading: __get()]
Follow-up to [35225], [35242].
Props jrf, costdev.
See #56514.
Built from https://develop.svn.wordpress.org/trunk@54087
git-svn-id: http://core.svn.wordpress.org/trunk@53646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Uploaded JPEGs will automatically be converted to WebP sub-sizes instead of JPEG, saving space and making sites faster.
The original JPEG upload is always retained and can be accessed by calling `wp_get_original_image_url`.
Props azaozz, flixos90.
Fixes#55443.
Built from https://develop.svn.wordpress.org/trunk@54086
git-svn-id: http://core.svn.wordpress.org/trunk@53645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replace logic found in `get_network_option`, `update_network_option` and `delete_network_option` to use the metadata api. Using the metadata api has a number of benefits, such as consistency, default values and useful filters. This change also improves performance by priming the caches of all network options in a single database request.
Props spacedmonkey, swissspidy, sc0ttkclark, johnjamesjacoby, flixos90, jeremyfelt, pento, peterwilsoncc, mukesh27, desrosj.
Fixes#37181
Built from https://develop.svn.wordpress.org/trunk@54080
git-svn-id: http://core.svn.wordpress.org/trunk@53639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* `Tests_Rewrite_OldDateRedirect`
* `Tests_Rewrite_OldSlugRedirect`
This commit updates the latter test class to create a post in the `wpSetUpBeforeClass()` method, for consistency with the former class. This ensures that both classes declare the `$post_id` property as `static`, to avoid a situation where non-static access is accidentally used when copying similar test cases from one class to the other.
Follow-up to [34659], [42587], [54077].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54078
git-svn-id: http://core.svn.wordpress.org/trunk@53637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects:
* `Tests_Rewrite_OldDateRedirect::test_old_date_redirect_cache_invalidation()`
* `Tests_Rewrite_OldSlugRedirect::test_old_slug_redirect_cache_invalidation()`
In the former test, the `$post_id` property is declared as `static`, so can only be approached as static, even when used within the same class in which the property is declared.
Using non-static access will result in `null`. See: https://3v4l.org/93HQL
This PHP notice was hidden so far, due to the existence of magic methods in the `WP_UnitTestCase_Base class`.
All the same, the magic methods as they were, would also return `null` for this property. All in all, the post being updated for this test would never get the correct `post_id`.
Fixed by using static access to approach the `static` property.
On a related note, the described bug fix (using the actual `$post_id` instead of `null`) exposed that this test was as a matter of fact failing. This was just hidden by the first bug.
Based on the original commit introducing the test, an adjustment is now made which appears to be what the test actually ''intended'' to test. A similar change is made to the cache invalidation test for old slug redirects. While not strictly required, it brings some consistency between the two tests and ensures that both tests use a unique `post_name` value to avoid collisions with the previous values.
This bug was discovered while fixing (removing) the magic methods in the `WP_UnitTestCase_Base` class in an effort to improve compatibility with PHP 8.2.
Follow-up to [53549].
Props jrf, costdev, SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54077
git-svn-id: http://core.svn.wordpress.org/trunk@53636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These tests should check the initial `$mysql_recommended_version` and `$mariadb_recommended_version` properties, as `WP_Site_Health::prepare_sql_data()` redefines the former with the latter to simplify further processing if MariaDB is used, leading to a test failure:
{{{
Tests_Site_Health::test_mysql_recommended_version_matches_readme_html
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'5.7'
+'10.3'
}}}
This commit uses the initial property values to ensure the correct versions are being compared.
Follow-up to [54069].
See #55791.
Built from https://develop.svn.wordpress.org/trunk@54076
git-svn-id: http://core.svn.wordpress.org/trunk@53635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This test verifies that the WordPress `readme.html` file recommends a PHP version that is actively supported. However, WordPress currently still recommends PHP 7.4 due to PHP 8.0/8.1 compatibility not being fully achieved, even though PHP 7.4 is end-of-life.
As things were, the assertion in the test was commented out, leading to this test being marked as “risky” for not performing any assertions.
Instead, let’s skip the test with a clear skip notification.
Follow-up to [52260].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54074
git-svn-id: http://core.svn.wordpress.org/trunk@53633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects `Tests_Ajax_MediaEdit::testImageEditOverwriteConstant()`.
In case the `$files_that_should_not_exist` file list is empty, the test would be marked as risky, since it would not perform any assertions.
This small tweak prevents that from happening.
Follow-up to [38113].
Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@54073
git-svn-id: http://core.svn.wordpress.org/trunk@53632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This affects the following test groups:
* Ajax tests
* ms-files tests
* External HTTP tests
* Xdebug tests
The tests being run in these particular test groups are passing on PHP 8.1, however, the test runs are still allowed to “continue on error”. This creates the risk that new PHP 8.1 incompatibilities will be introduced without anyone noticing.
By no longer allowing these test runs to “continue on error”, that risk is removed.
Follow-up to [51588], [51604], [53922].
Props jrf.
See #55656, #55652.
Built from https://develop.svn.wordpress.org/trunk@54072
git-svn-id: http://core.svn.wordpress.org/trunk@53631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This renames some variables for clarity, per the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions]:
> Don’t abbreviate variable names unnecessarily; let the code be unambiguous and self-documenting.
* `$out` is renamed to `$output` in various list table methods and admin functions.
* `$sep` is renamed to `$separator` in various list table methods and admin functions.
This affects:
* `WP_Comments_List_Table::handle_row_actions()`
* `WP_List_Table::row_actions()`
* `WP_Media_List_Table::column_default()`
* `WP_MS_Sites_List_Table::site_states()`
* `WP_MS_Users_List_Table::column_blogs()`
* `WP_Terms_List_Table::column_name()`
* `_wp_dashboard_recent_comments_row()`
* `image_align_input_fields()`
* `image_size_input_fields()`
* `wp_doc_link_parse()`
* `_post_states()`
* `_media_states()`
Follow-up to [8653], [8692], [8864], [8910], [8911], [8916], [9103], [9153], [10607], [15491], [17793], [32644], [54070].
Props mukesh27, costdev.
See #56448, #55647.
Built from https://develop.svn.wordpress.org/trunk@54071
git-svn-id: http://core.svn.wordpress.org/trunk@53630 1a063a9b-81f0-0310-95a4-ce76da25c4cd