Prior to PHP 7.0, `substr( '', -0, 0 )` returns `false` instead of an empty string, so the strict comparison further in the function did not work as expected.
This commit addresses a test failure on PHP < 7.0, making the function consistently return `true` if both haystack and needle are an empty string.
Follow-up to [52040], [56014], [56015].
See #58220.
Built from https://develop.svn.wordpress.org/trunk@56016
git-svn-id: http://core.svn.wordpress.org/trunk@55528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids a warning on PHP < 7.2.18 if haystack is an empty string:
{{{
Warning: substr_compare(): The start position cannot exceed initial string length
}}}
Follow-up to [52040], [55158], [55990], [56014].
See #58220.
Built from https://develop.svn.wordpress.org/trunk@56015
git-svn-id: http://core.svn.wordpress.org/trunk@55527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`str_ends_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) ends with the given substring (needle).
WordPress core includes a polyfill for `str_ends_with()` on PHP < 8.0 as of WordPress 5.9.
Follow-up to [55990].
See #58220.
Built from https://develop.svn.wordpress.org/trunk@56014
git-svn-id: http://core.svn.wordpress.org/trunk@55526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since both functions return the exact same thing, this changeset makes `twentyseventeen_is_static_front_page()` an alias of `twentyseventeen_is_frontpage()`
and updates the related docblocks and function callback.
Props mukesh27, soulseekah, swissspidy, sabernhardt, audrasjb, SergeyBiryukov, hareesh-pillai.
Fixes#43515.
Built from https://develop.svn.wordpress.org/trunk@56012
git-svn-id: http://core.svn.wordpress.org/trunk@55524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset improves `update.js` by adding `is-enqueued` class to enqueued plugin updates to prevent users from asking for several updates for the same
plugin at the same time, which previously resulted to …an interesting experience.
Props bitnissen, swissspidy, MarcGuay, xkon, afercia, swissspidy, bookdude13, simonemanfre, vasilism, costdev, zunaid321.
Fixes#40966.
Built from https://develop.svn.wordpress.org/trunk@56009
git-svn-id: http://core.svn.wordpress.org/trunk@55521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a show/hide toggle for new passwords in initial user creation and database access during install and setup process using the same model as on user profiles. Add a new password toggle script. Change setup config table to two columns, matching the install table layout.
Props xmarcos, matt, markjaquith, nazgul, akbigdog, intoxination, rob1n, MichaelH, empireoflight, rmccue, markoheijnen, r0uter, amansurov, bi0xid, DrewAPicture, Narthur, wpnook, markparnell, costdev, clorith, ryokuhi, sabernhardt, bgoewert, ironprogrammer, adeltahri, joedolson, mukesh27, audrasjb, sergeybiryukov.
Fixes#3534.
Built from https://develop.svn.wordpress.org/trunk@56008
git-svn-id: http://core.svn.wordpress.org/trunk@55520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset fixes a bug where WordPress core's own block editor styles (`wp-block-{$block_name}-editor`) were referencing the same CSS files as their frontend equivalents (`wp-block-{$block_name}`). This would result in incorrect frontend styles potentially being loaded in the block editor.
Tests for the related logic have been added.
Props flixos90, joemcgill, mukesh27, spacedmonkey.
Fixes#58605.
Built from https://develop.svn.wordpress.org/trunk@56005
git-svn-id: http://core.svn.wordpress.org/trunk@55517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replace use of `list` to parse array keys into variables. `list` throws errors if the keys don't exist, and many extenders will not define the new array keys. The code path already falls back effectively for empty values.
Also add translator comments to screen reader hidden text, fix a docblock, and fix an HTML error.
Follow up to [r55971].
Props kebbet, chouby, joedolson.
Fixes#32170.
Built from https://develop.svn.wordpress.org/trunk@56004
git-svn-id: http://core.svn.wordpress.org/trunk@55516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids fatal errors on PHP < 8.0 if the file is included via `wp-admin/load-scripts.php` or `wp-admin/load-styles.php`, in which case the polyfills from `wp-includes/compat.php` are not loaded.
Follow-up to [55703], [55710], [55988].
Props ryelle.
See #58206.
Built from https://develop.svn.wordpress.org/trunk@56002
git-svn-id: http://core.svn.wordpress.org/trunk@55514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since the `$auto_upgrade_notice` has been added to the `update-core.php` table listing if an `$upgrade_notice` is present by virtue of the `readme.txt`
containing data in the `== Upgrade Notice ==` section, this text will appear in between the compatibility information and the auto update information.
This changeset provides a more consistent appearance in the interface.
Props afragen, costdev, zunaid321.
Fixes#57939.
Built from https://develop.svn.wordpress.org/trunk@56001
git-svn-id: http://core.svn.wordpress.org/trunk@55513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This avoids fatal errors on PHP < 8.0 if the file is included directly outside of WordPress core, e.g. by HyperDB.
While WordPress core does include polyfills for these functions, they are not directly loaded in the `wpdb` class.
Follow-up to [54384], [55157], [55158], [55988], [55990].
Props dd32, ryelle, joedolson.
See #58206.
Built from https://develop.svn.wordpress.org/trunk@55994
git-svn-id: http://core.svn.wordpress.org/trunk@55506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Modify the E2E workflow to store the screenshots and HTML files generated during failing tests as an artifact in the workflow.
No artefact is stored for passing test runs.
Props peterwilsoncc, isabel_brison.
Fixes#58596.
Built from https://develop.svn.wordpress.org/trunk@55991
git-svn-id: http://core.svn.wordpress.org/trunk@55503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`str_starts_with()` and `str_ends_with()` were introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins or ends with the given substring (needle).
WordPress core includes a polyfill for these functions on PHP < 8.0 as of WordPress 5.9.
This commit uses `str_starts_with()` and `str_ends_with()` in core files where appropriate:
* `$needle === substr( $string, 0, $length )`, where `$length` is the length of `$needle`, is replaced with `str_starts_with( $haystack, $needle )`.
* `$needle === substr( $string, $offset )`, where `$offset` is negative and the absolute value of `$offset` is the length of `$needle`, is replaced with `str_ends_with( $haystack, $needle )`.
This aims to make the code more readable and consistent, as well as better aligned with modern development practices.
Follow-up to [52039], [52040], [52326], [55703], [55710], [55987], [55988].
Props Soean, spacedmonkey, Clorith, ocean90, azaozz, sabernhardt, SergeyBiryukov.
Fixes#58220.
Built from https://develop.svn.wordpress.org/trunk@55990
git-svn-id: http://core.svn.wordpress.org/trunk@55502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).
WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.
This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.
Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].
Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes#58206.
Built from https://develop.svn.wordpress.org/trunk@55988
git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to make the code more readable and consistent, as the function is already used extensively in core files.
WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9.
Follow-up to [55703], [55959].
Props spacedmonkey.
Fixes#58012.
Built from https://develop.svn.wordpress.org/trunk@55987
git-svn-id: http://core.svn.wordpress.org/trunk@55499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset improve Dashboard screen options by stacking them vertically on small screens.
Props dhrumilk, prashantbhivsane, marybaum, dhruvishah2203, ababir, mukesh27, chiragrathod103, oglekler, tb1909, jahidcse, audrasjb.
Fixes#57977.
Built from https://develop.svn.wordpress.org/trunk@55984
git-svn-id: http://core.svn.wordpress.org/trunk@55496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset switches the `wp_enqueue_*` functions to `wp_register_*` for IE-related resources, which maintains handles, source references, etc., keeps all
IE-specific files within the theme package to avoid errors, and requires site admins to opt in to loading them in the theme.
It also replaces the content of `html5.js` shiv with a comment (to avoid 404s), and removes IE specific code from `header.php`.
Props desrosj, sabernhardt, audrasjb, neychok, oglekler.
See #56699.
Built from https://develop.svn.wordpress.org/trunk@55982
git-svn-id: http://core.svn.wordpress.org/trunk@55494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset switches the `wp_enqueue_*` functions to `wp_register_*` for IE-related resources, which maintains handles, source references, etc., keeps all
IE-specific files within the theme package to avoid errors, and requires site admins to opt in to loading them in the theme.
It also replaces the content of `html5.js` shiv with a comment (to avoid 404s), removes IE-specific code in general stylesheets, and removes IE specific code
from Customizer, header.php and custom-header.php.
Props desrosj, sabernhardt, audrasjb, neychok, oglekler.
See #56699.
Built from https://develop.svn.wordpress.org/trunk@55981
git-svn-id: http://core.svn.wordpress.org/trunk@55493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset switches the `wp_enqueue_*` functions to `wp_register_*` for IE-related resources, which maintains handles, source references, etc., keeps all
IE-specific files within the theme package to avoid errors, and requires site admins to opt in to loading them in the theme.
It also replace the content of `html5.js` shiv with a comment (to avoid 404s) and removes IE-specific code in general stylesheets.
Props desrosj, sabernhardt, audrasjb, neychok, oglekler.
See #56699.
Built from https://develop.svn.wordpress.org/trunk@55980
git-svn-id: http://core.svn.wordpress.org/trunk@55492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update the performance tests to account for the relocation of the theme unit test data repository to the WordPress organisation on GitHub.
Props costdev, kafleg, williampatton, dd32, otto42, poena, jrf, joemcgill, peterwilsoncc, mukesh27.
Fixes#58569.
Built from https://develop.svn.wordpress.org/trunk@55976
git-svn-id: http://core.svn.wordpress.org/trunk@55488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Hide the password for the "Post via e-mail" settings in writing options. Use the same password hiding mechanisms in use elsewhere in core.
Props mastrup, denis-de-bernardy, ryan, brookedot, wojtek.szkutnik, dd32, sabreuse, sergeybiryukov, costdev, peterwilsoncc, zgrkaralar, clorith, renyot, sabernhardt, boniu91, ironprogrammer, bgoewert.
Fixes#9883.
Built from https://develop.svn.wordpress.org/trunk@55974
git-svn-id: http://core.svn.wordpress.org/trunk@55486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Implement `aria-sort` and change icon states to indicate current sort for list tables. Allow screen reader users to get context about the current sort and allow sighted users to know how the table is currently sorted.
Props afercia, rianrietveld, joedolson, alexstine, johnjamesjacoby.
Fixes#32170.
Built from https://develop.svn.wordpress.org/trunk@55971
git-svn-id: http://core.svn.wordpress.org/trunk@55483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset improves a JS conditional statement to fix a console error thrown by Firefox on `event.target.matches`.
Props kjellr, laurelfulford, audrasjb, dimijazz, ianbelanger, pbiron, poena, McAlyster, janpaulkleijn, swissspidy, mukesh27, rehanali.
Fixes#46474.
See #45903 (fixes one of the two issues of this ticket).
Built from https://develop.svn.wordpress.org/trunk@55970
git-svn-id: http://core.svn.wordpress.org/trunk@55482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As placeholders may introduce confusion about whether the example is the input's predefined value or not, this changeset moves the "Just another WordPress
site" historic tagline as an example quoted in the field's description.
Props Cybr, audrasjb, sabernhardt, pavanpatil1, tb1909.
Fixes#57675.
Built from https://develop.svn.wordpress.org/trunk@55969
git-svn-id: http://core.svn.wordpress.org/trunk@55481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The intention behind this change is to prevent sensitive data in responses for logged in users being cached and available to others, for example via the browser history after the user logs out.
The `no-store` directive instructs caches in the browser or within proxies not to store the response in the cache. This is subtly different from the `no-cache` directive which means the response can be cached but must be revalidated before re-use. WordPress does not use ETag headers by default therefore this does not achieve the same result.
The `private` directive complements the `no-store` directive by specifying that the response contains private information that should not be stored in a public cache. Som
e proxy caches may ignore the `no-store` directive but respect the `private` directive, thus it is included.
The existing `Cache-Control` header for users who are not logged in remains unchanged, and the existing cache prevention directives remain in place for backwards compatib
ility.
Props soulseekah, luehrsen, Dharm1025, markdoliner, rutviksavsani, ayeshrajans, paulkevan, clorith, andy786, johnbillion
Fixes#21938, Fixes#57627
Built from https://develop.svn.wordpress.org/trunk@55968
git-svn-id: http://core.svn.wordpress.org/trunk@55480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes unused parameters and variables, fixes a typo, and improves some docblocks as per documentation standards.
Props upadalavipul, mukesh27, costdev, sabernhardt, hellofromtonya, audrasjb.
Fixes#57397.
Built from https://develop.svn.wordpress.org/trunk@55963
git-svn-id: http://core.svn.wordpress.org/trunk@55475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Because `update_menu_item_cache` parameter doesn't have any description in this function, the `wp_get_nav_menu_items()` documentation page on DevHub fallbacks
to `get_post()` params descriptions… which fallbacks to `parse_query()`.
In parse_query(), the `update_menu_item_cache` param is set to `false` by default, so `wp_get_nav_menu_items()` ends up with a value of `false` by default,
which is wrong since `wp_get_nav_menu_items()` overrides this parameter to set it to true by default.
This changeset adds `update_menu_item_cache` parameter to `wp_get_nav_menu_items()` docblock, and indicates that it is set to `true` by default.
Follow-up to [53504].
Props audrasjb, matmoe.
Fixes#58468.
See #57840.
Built from https://develop.svn.wordpress.org/trunk@55962
git-svn-id: http://core.svn.wordpress.org/trunk@55474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
On the `<body>` element, as a best practice background color and text color should always be set together. This makes it easier to quickly understand the
underlying color scheme.
Props allancole, joyously, samful, sabernhardt, oglekler, ronakganatra, tb1909, ugyensupport.
Fixes#45916.
Built from https://develop.svn.wordpress.org/trunk@55960
git-svn-id: http://core.svn.wordpress.org/trunk@55472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the `label` for `.check-column` inside list tables to a block filling the entire cell. Improves accessibility by increasing the target area for the control.
Props mitchoyoshitaka, lessbloat, sabernhardt, ogleker, tacoverdo, joostdevalk, karmatosed.
Fixes#21516.
Built from https://develop.svn.wordpress.org/trunk@55954
git-svn-id: http://core.svn.wordpress.org/trunk@55466 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds a `is_block_theme` property to each theme in the `wp/v2/themes` API response, which uses `WP_Theme::is_block_theme` to determinate whether
the theme is block theme or not.
Props grantmkin, ironprogrammer, zunaid321, azaozz, spacedmonkey, audrasjb, costdev.
Fixes#58123.
Built from https://develop.svn.wordpress.org/trunk@55951
git-svn-id: http://core.svn.wordpress.org/trunk@55463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `WP_Theme_JSON::append_to_selector()` method was previously used for both appending and prepending which violated the single responsibility principle. It resulted in additional conditionals which also came at a performance cost, particularly because the method is called over 1,000 times during a regular WordPress request.
With the new `WP_Theme_JSON::prepend_to_selector()` method, there are now two distinct methods for the two distinct purposes. The now useless third parameter on `WP_Theme_JSON::append_to_selector()` has been removed (rather than deprecated), which is acceptable given that it is a protected method on a class that is not intended for extensions.
Props bor0, costdev, flixos90, isabel_brison, oandregal, spacedmonkey.
Fixes#58193.
See #58457.
Built from https://develop.svn.wordpress.org/trunk@55950
git-svn-id: http://core.svn.wordpress.org/trunk@55462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Due to partially duplicated logic for displaying row actions in the Media Library with and without the “Unattached” filter, the “Copy URL” and “Download file” row actions were unintentionally missing with the filter applied.
This commit aims to simplify the logic and bring more consistency to the code.
Includes displaying the “Download file” row action even when the “Trash” filter is applied, giving the user one more chance to download the media file before they delete it.
Follow-up to [8901], [13100], [16227], [16229], [52842], [55198], [55221].
Props kebbet, costdev, pbiron, oglekler, SergeyBiryukov.
Fixes#57890, #57893.
Built from https://develop.svn.wordpress.org/trunk@55949
git-svn-id: http://core.svn.wordpress.org/trunk@55461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Redirect users visiting the `wp-admin/media.php` file to the media library, `wp-admin/upload.php`. An user facing warning is displayed when the media library is reached via a deprecated link.
Follow up to [55647].
Props jorbin, audrasjb, azaozz, NekoJonez, kebbet, costdev.
Fixes#57612.
Built from https://develop.svn.wordpress.org/trunk@55943
git-svn-id: http://core.svn.wordpress.org/trunk@55455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change check to see if the current theme is a block theme, to check the path `/templates/index.html` first over the deprecated path `/block-templates/index.html`.
As this path was deprecated in WP 5.9, it is more likely the block theme would use the current path. This saves a file_exists call which improves performance.
Props nihar007, spacedmonkey.
Fixes#58520.
Built from https://develop.svn.wordpress.org/trunk@55941
git-svn-id: http://core.svn.wordpress.org/trunk@55453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `usermeta` group was introduced in WP 2.0, but was never actually used in WordPress core.
The `user_meta` group is used instead.
Follow-up to [3011], [15482], [16562], [53823], [53832], [54940].
Props ignatggeorgiev, peterwilsoncc, oglekler, pamprn09, spacedmonkey, SergeyBiryukov.
Fixes#58175.
Built from https://develop.svn.wordpress.org/trunk@55940
git-svn-id: http://core.svn.wordpress.org/trunk@55452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fix an edge case caching issue, where if a developer use the `wp_cache_themes_persistently` filter and is running the site in multisite configuration, it meant block template are incorrectly cached. Block templates are stored in the posts table. But in a multisite configuration, different sites on the multisite could have different block templates stored in there post table. As themes cache group is a global group, it resulted in incorrect values being cached.
Props maniu, spacedmonkey, hellofromTonya, oglekler, mukesh27, joemcgill.
Fixes#57886.
Built from https://develop.svn.wordpress.org/trunk@55939
git-svn-id: http://core.svn.wordpress.org/trunk@55451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a check to the start of `copy_dir()` that the destination directory exists and attempts to create it if it does not.
An error is returned if the directory can not be created, either due to a permissions error or the parent directory not existing.
Props caraffande, costdev, zunaid321.
Fixes#41855.
Built from https://develop.svn.wordpress.org/trunk@55938
git-svn-id: http://core.svn.wordpress.org/trunk@55450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the log in link that appears after completing installation so that it does not use the button styling. Links should look like links.
Props xavortm, menakas, afercia, rianrietveld, johnbillion, drw158, joedolson.
Fixes#40470.
Built from https://develop.svn.wordpress.org/trunk@55933
git-svn-id: http://core.svn.wordpress.org/trunk@55445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Change the button block in Twenty Fourteen to use relative instead of fixed line-height. Prevent visual errors with larger font sizes on the front-end.
Props nidhidhandhukiya, algorithmsunlocks, mayur8991, sabernhardt.
Fixes#58444.
Built from https://develop.svn.wordpress.org/trunk@55932
git-svn-id: http://core.svn.wordpress.org/trunk@55444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since [54358], a new CSS file classic-themes.css is enqueued on all pages on the front end of themes without `theme.json`. This is a blocking http request, the impact on performance will be affected by network conditions. Inlining this style, stops this blocking request. By adding style data of path to the registered style, the function `wp_maybe_inline_styles` will automatically inline the style for us.
Props spacedmonkey, adamsilverstein.
Fixes#58480.
Built from https://develop.svn.wordpress.org/trunk@55930
git-svn-id: http://core.svn.wordpress.org/trunk@55442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since WordPress 4.6 introduced just-in-time translation loading, themes and plugins no longer need to manually call `load_theme_textdomain`/`load_plugin_textdomain`, unless they are on a version prior to 4.6.
This change removes the `load_theme_textdomain()` call from Twenty Seventeen and up, since these themes all require at least WordPress 4.7.
On older default themes, `load_theme_textdomain()` is called conditionally depending on the WordPress version.
Props piyushtekwani.
Fixes#58318.
Built from https://develop.svn.wordpress.org/trunk@55929
git-svn-id: http://core.svn.wordpress.org/trunk@55441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces a new `pre_load_textdomain` filter, which is useful for plugins to develop and test alternative loading/caching strategies for translations. This brings consistency with the existing `pre_load_script_translations` filter for JavaScript translations.
Props ocean90, swissspidy.
Fixes#58035.
Built from https://develop.svn.wordpress.org/trunk@55928
git-svn-id: http://core.svn.wordpress.org/trunk@55440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Modifies the tests for `get_tag_link()`, `get_term()` and `get_term_field()` to:
- use shared fixtures as possible
- improves variable names
- add `@covers` annotation as required
Props peterwilsoncc, costdev.
See #57841.
Built from https://develop.svn.wordpress.org/trunk@55924
git-svn-id: http://core.svn.wordpress.org/trunk@55436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevents `wp_set_object_terms()` throwing a deprecation notice in PHP 8.1+ when passing an empty value as the second parameter to clear the terms.
Props audrasjb, chouby, costdev, jrf, peterwilsoncc, prashantbhivsane, sergeybiryukov.
Fixes#57923.
Built from https://develop.svn.wordpress.org/trunk@55921
git-svn-id: http://core.svn.wordpress.org/trunk@55433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Significant restructure of the admin image editor interface, but no new functionality. Reorganize editing buttons into a common region at the top of the editor. Move image rotation tools into a pop-out menu. Add 180 degree rotation option. Add scale button to control group. Move sidebar tools next to the editing canvas to improve visual proximity between action and result. Enlarge editing canvas and crop handles. Separate activating crop functions from applying crop. Add numeric inputs for crop & scale values.
A long term goal is to move undo/redo and cancel/save into the modal title bar, but that is not feasible without significant updates to the modal framework.
Props afercia, karmatosed, nrqsnchz, antpb, chaion07, costdev, peterwilsoncc, antpb, sabernhardt, prashantbhivsane, joedolson.
Fixes#50523.
Built from https://develop.svn.wordpress.org/trunk@55919
git-svn-id: http://core.svn.wordpress.org/trunk@55431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This PR makes sure unregistered block style variations declared via `theme.json` are ignored. It fixes an issue by style variations don't work in the editor and CSS rules without a selector are output to the front-end.
Props isabel_brison.
Fixes#58462.
Built from https://develop.svn.wordpress.org/trunk@55912
git-svn-id: http://core.svn.wordpress.org/trunk@55424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `register_block_type_from_metadata` function, skip calling `file_exists` on core blocks. Core blocks are part of the codebase and will never not exist. Not calling this function is better for performance, as the file lookup can be expensive.
Props spacedmonkey, joemcgill.
Fixes#58385.
Built from https://develop.svn.wordpress.org/trunk@55910
git-svn-id: http://core.svn.wordpress.org/trunk@55422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a check in `wp_maybe_inline_styles` to check that style is registered before processing items in queue. It is possible that developers may have called `wp_deregister_style`, unregistering style but the style still be in the queue to be processed. Without this check, typing to access the `src` property would result in a notice error.
Follow on from [55888].
Props spacedmonkey, flixos90, dd32, kebbet.
See #58394.
Built from https://develop.svn.wordpress.org/trunk@55909
git-svn-id: http://core.svn.wordpress.org/trunk@55421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improve `append_to_selector` method in `WP_Theme_JSON` by checking to see if string contains a common before imploding / exploding string, which improves performance.
Originally developed and tested in [WordPress/gutenberg#47833 Gutenberg PR 47833].
Props spacedmonkey, flixos90, mukesh27, joemcgill, wildworks, oandregal, mamaduka.
Fixes#58231.
Built from https://develop.svn.wordpress.org/trunk@55907
git-svn-id: http://core.svn.wordpress.org/trunk@55419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds a `pre` class to "Downloading update from…" user facing strings located in `Core_Upgrader`, `Language_Pack_Upgrader`, `Plugin_Upgrader` and
`Theme_Upgrader` classes.
Follow-up to [11295].
Props sumitsingh, costdev.
Fixes#58477.
Built from https://develop.svn.wordpress.org/trunk@55899
git-svn-id: http://core.svn.wordpress.org/trunk@55411 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Make focus outline fully visible at all media query breakpoints, prevent the date filter from becoming hidden, and match the heading styles to other screens.
Props sabernhardt, hareesh-pillai, alvitazwar052.
Fixes#54395.
Built from https://develop.svn.wordpress.org/trunk@55896
git-svn-id: http://core.svn.wordpress.org/trunk@55408 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `$args` parameter of `apply_filters()` is optional. This changeset updates the related Docblock description accordingly so the parameter is not marked as
`required` on DevHub.
Props gaeldenysiak, audrasjb, gilles66.
Fixes#58481.
See #57840.
Built from https://develop.svn.wordpress.org/trunk@55893
git-svn-id: http://core.svn.wordpress.org/trunk@55405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This hidden field added in [24552] to fix an issue with Chrome that was ignoring `autocomplete="off"` in `<input>`, by using a hidden, non-named, non-empty
input right before the password field. However this input was only hidden via CSS and didn't have any label, which is considered as an accessibility issue.
This changeset replaces `class="hidden"` with `type="hidden"` to properly indicate to user agents that it is an hidden field.
Follow-up to [24552].
Props smit08, audrasjb, sabernhardt, ryokuhi, tushar284, ashikurwp, siddhantwadhwani, pavanpatil1.
Fixes#56776.
--Cette ligne, et les suivantes
ci-dessous, seront ignorées--
M trunk/src/wp-admin/user-edit.php
M trunk/src/wp-admin/user-new.php
Built from https://develop.svn.wordpress.org/trunk@55892
git-svn-id: http://core.svn.wordpress.org/trunk@55404 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Updates `wp_get_active_and_valid_themes()` to return early when `wp_using_themes()` returns `false`. This prevents a theme's `functions.php` from being loaded erroneously when the site isn't using themes.
Also adds `define( 'WP_USE_THEMES', true );` to the test suite bootstrap. Some tests randomly break without it because they were dependent on the previous buggy behavior.
Props bpayton, costdev, danielbachhuber, hellofromtonya, sergeybiryukov, spacedmonkey.
Fixes#57928.
Built from https://develop.svn.wordpress.org/trunk@55890
git-svn-id: http://core.svn.wordpress.org/trunk@55402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `wp_maybe_inline_styles` function is called twice on the average page load. On it's second run however, it did not check to see if the style had already been processed on the first run. This resulted in calling `filesize` and `get_file_contents` unnecessarily, which was bad for performance. Now, the loop around the queued styles, checks to see if the source is set to false, meaning it has already been processed. This change also replaces calls to `filesize` with the core function `wp_filesize`, which improves extensibility.
Props spacedmonkey, flixos90, peterwilsoncc, joemcgill.
Fixes#58394.
Built from https://develop.svn.wordpress.org/trunk@55888
git-svn-id: http://core.svn.wordpress.org/trunk@55400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `WP_Theme` class, replace two calls to `file_exists` with a call to the method `is_block_theme`. This method `is_block_theme` does the same file exists check, but it then caches the result for improved performance.
Props nihar007, spacedmonkey, mukesh27, costdev, juzar.
Fixes#58405.
Built from https://develop.svn.wordpress.org/trunk@55885
git-svn-id: http://core.svn.wordpress.org/trunk@55397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds context to various strings:
- `'Background'` string when referring to Custom Background appearance screens
- `'Header'` string when referring to Custom Header appearance screens
- `'General'`, `'Header'` and `'Footer'` strings when referring to template part areas
Props gonzomir, SergeyBiryukov, mukesh27, costdev, ankitmaru.
Fixes#58424.
Built from https://develop.svn.wordpress.org/trunk@55881
git-svn-id: http://core.svn.wordpress.org/trunk@55393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Use `register_block_type_from_metadata` in `register_core_block_types_from_metadata` function instead of `register_block_type`. This saves an unnecessary call to `file_exists` in `register_block_type` as core block files will always exist.
Props nihar007, spacedmonkey, mukesh27, gziolo, sudipatel007.
Fixes#58342.
Built from https://develop.svn.wordpress.org/trunk@55879
git-svn-id: http://core.svn.wordpress.org/trunk@55391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `sprintf()` is not being passed any values, and there is no placeholder to replace.
This originated in r52132 in which I erroneously included this `sprintf()` in
two places. I fixed one of the cases in r52151 but I missed the other.
Follow-up to [52132], [52151].
Fixes#58436.
See #44632.
Built from https://develop.svn.wordpress.org/trunk@55875
git-svn-id: http://core.svn.wordpress.org/trunk@55387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously when the `mimes` element was not specified in the overrides array passed to `_wp_handle_upload()` it resulted in boolean false being passed to this parameter, which is incorrect. The fallback value should be `null`.
Props platonkristinin, pkbhatt
Fixes#58349
Built from https://develop.svn.wordpress.org/trunk@55872
git-svn-id: http://core.svn.wordpress.org/trunk@55384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since cron events often consume extra memory by nature, it makes sense to give them the full amount available by default. In practice this means the memory will be increased to `WP_MAX_MEMORY_LIMIT` (which is 256MB by default) during cron event processing if the default memory limit is lower than this value.
The new `cron_memory_limit` filter can be used to adjust this value if necessary.
Note that this change will not by default affect external means of processing cron events, such as the `wp cron` command in WP-CLI, server-level crontab events, or any other cron event processing mechanism that bypasses `wp-cron.php`.
Props iandunn, thakkarhardik
Fixes#56628
Built from https://develop.svn.wordpress.org/trunk@55871
git-svn-id: http://core.svn.wordpress.org/trunk@55383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This moves the query for user ID of the new network's administrator closer to where the value is actually used.
Includes removing unnecessary `get_userdata()` call, as user ID is the only data needed here.
Follow-up to [12756], [35575], [43628].
Props nihar007, sakibmd, mukesh27, costdev, SergeyBiryukov.
Fixes#58423.
Built from https://develop.svn.wordpress.org/trunk@55869
git-svn-id: http://core.svn.wordpress.org/trunk@55381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a performance issue where the JIT logic is invoked for every translation call if the there are no translations in the current locale. With this change, the information is cached by adding `Noop_Translations` instances to the global `$l10n` array. This way, `get_translations_for_domain()` returns earlier, thus avoiding subsequent `_load_textdomain_just_in_time()` calls.
Props swissspidy, johnbillion, ocean90.
Fixes#58321.
Built from https://develop.svn.wordpress.org/trunk@55865
git-svn-id: http://core.svn.wordpress.org/trunk@55377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The Change button is supposed to perform the “Change role to...” action only, but could unintentionally be used for other bulk actions if the role was not selected.
This commit removes an extra check and ensures the correct error message is displayed in that case:
Sorry, you are not allowed to give users that role.
Follow-up to [6990], [8691], [9028], [15576], [15642], [34636], [49944].
Props haritpanchal, costdev, ankit-k-gupta, SergeyBiryukov.
Fixes#57952.
Built from https://develop.svn.wordpress.org/trunk@55864
git-svn-id: http://core.svn.wordpress.org/trunk@55376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Removes script from the `wp_print_footer_scripts` action in Twenty Nineteen, Twenty Twenty, and Twenty Twenty-One.
* Switches enqueue functions to just register the scripts in Twenty Fifteen, Twenty Sixteen, and Twenty Seventeen.
* Rearranges Twenty Seventeen's scripts to connect `twentyseventeenScreenReaderText` with the global script instead of the unused skip link fix.
* Updates scripts in Twenty Fifteen and Twenty Sixteen with code from Twenty Seventeen _to run on Internet Explorer only_. Twenty Sixteen needed to keep an adjustment that offsets the toolbar and border.
* Removes the script from JS files in Twenty Thirteen and Twenty Fourteen and edits their modified dates.
Props sabernhardt, westonruter, joedolson, flixos90, mukesh27.
Fixes#54421.
Built from https://develop.svn.wordpress.org/trunk@55861
git-svn-id: http://core.svn.wordpress.org/trunk@55373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Previously, when scaling an image larger than the source size in the image edit states the image would silently fail the scaling action. This patch provides an error when someone attempts to scale an image larger than the source size while also disabling the button to initiate the action.
Props brookedot, joedolson, markoheijnen, mikeschroder, desrosj, Mista-Flo, costdev.
Fixes#26381.
Built from https://develop.svn.wordpress.org/trunk@55859
git-svn-id: http://core.svn.wordpress.org/trunk@55371 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds support for schwa character. Ə (U+018F) and ə (U+0259) are part of Latin Extended-B and used in
several languages like Azerbaijani or also in gender neutral Italian.
Props suleymankenar, audrasjb, przemekhernik.
Fixes#57609.
Built from https://develop.svn.wordpress.org/trunk@55858
git-svn-id: http://core.svn.wordpress.org/trunk@55370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of [55855] wp_queue_comments_for_comment_meta_lazyload was deprecated. But deprecate to wp-admin/deprecated.php and not wp-includes/deprecated.php.This is incorrect, as this is a public function and not an admin function.
Props SergeyBiryukov, spacedmonkey.
See #58301.
Built from https://develop.svn.wordpress.org/trunk@55856
git-svn-id: http://core.svn.wordpress.org/trunk@55368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of [55749] wp_queue_comments_for_comment_meta_lazyload is no longer used in core. This commit, deprecates this function. Update docs and tests accordingly.
Props sh4lin, spacedmonkey, costdev, peterwilsoncc.
Fixes#58301.
Built from https://develop.svn.wordpress.org/trunk@55855
git-svn-id: http://core.svn.wordpress.org/trunk@55367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Ensure that the option `can_compress_scripts` is autoloaded on single sites, as this option is used in all requests. This change saves one database query per page request.
Props RavanH, spacedmonkey, costdev, azaozz, flixos90.
Fixes#55270.
Built from https://develop.svn.wordpress.org/trunk@55854
git-svn-id: http://core.svn.wordpress.org/trunk@55366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The changeset [55695] introduced a regression in the order of styles for the editor, causing the styles registered for the block (both editor and front) to be loaded after any other styles enqueued using the `enqueue_block_editor_assets` hook.
Since the original behavior was introduced in WordPress 5.0 changing it breaks the expectations of the ecosystem.
Props ellatrix.
Fixes#58208.
Built from https://develop.svn.wordpress.org/trunk@55852
git-svn-id: http://core.svn.wordpress.org/trunk@55364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When using a block theme, `_wp_array_get()` is the most called function on the front end of a site.
This commit makes a few minor performance optimizations, which add up to a noticeable improvement.
Follow-up to [49135], [49143], [49580].
Props aristath, jrf, afercia, costdev, swissspidy, flixos90, spacedmonkey, mukesh27, samiamnot, SergeyBiryukov.
Fixes#58376.
Built from https://develop.svn.wordpress.org/trunk@55851
git-svn-id: http://core.svn.wordpress.org/trunk@55363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `wp_filter_content_tags()` function, which modifies image tags for example to optimize performance, is hooked into the `the_content` filter by default. When rendering an excerpt for a post that doesn't have a manually provided excerpt, the post content is used to generate the excerpt, handled by the `wp_trim_excerpt()` function.
Prior to this changeset, this led to `wp_filter_content_tags()` being called on the content when generating the excerpt, which is wasteful as all tags are stripped from the excerpt, and it furthermore could result in a lazy-loading bug when the post content contained images, as those images were being counted even though they would never be rendered as part of the excerpt.
This changeset fixes the bug and slightly improves performance for generating an excerpt by temporarily unhooking the `wp_filter_content_tags()` function from the `the_content` filter when using it to generate the excerpt.
Props costdev, flixos90, joemcgill, mukesh27, salvoaranzulla, spacedmonkey, thekt12, westonruter.
Fixes#56588.
Built from https://develop.svn.wordpress.org/trunk@55850
git-svn-id: http://core.svn.wordpress.org/trunk@55362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When the logic to exclude images that likely appear above the fold from being lazy-loaded was introduced in WordPress 5.9, initially only images that appear within the main query loop were being considered. However, there is a good chance that images above the fold are rendered before the loop starts, for example in the header template part.
It is particularly common for a theme to display the featured image for a single post in the header. Based on HTTP Archive data from February 2023, the majority of LCP images that are still being lazy-loaded on WordPress sites use the `wp-post-image` class, i.e. are featured images.
This changeset enhances the logic in `wp_get_loading_attr_default()` to not lazy-load images that appear within or after the header template part and before the query loop, using a new `WP_Query::$before_loop` property.
For block themes, this was for the most part already addressed in [55318], however this enhancement implements the solution in a more generally applicable way that brings the improvement to classic themes as well.
Props thekt12, flixos90, spacedmonkey, costdev, zunaid321, mukesh27.
Fixes#58211.
See #53675, #56930.
Built from https://develop.svn.wordpress.org/trunk@55847
git-svn-id: http://core.svn.wordpress.org/trunk@55359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [55569] `get_pages` was converted to use `WP_Query` internally. But for plugins that were extending the `get_pages` filters and filter `WP_Query` query arguments, this could result in a conflict. Add a filter `get_pages_query_args` to allow developers to change arguments passed to `WP_Query` but also have the context of the original arguments passed to the `get_pages` function.
This change also expands test coverage of `get_pages` to ensure no breakages in the future.
Props spacedmonkey, westonruter, costdev, flixos90, kenwins, marianne38.
See #12821.
Built from https://develop.svn.wordpress.org/trunk@55845
git-svn-id: http://core.svn.wordpress.org/trunk@55357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [55818] did a check to see if `WP_Metadata_Lazyloader` class existed and the loaded in the class file if it did not. However, require in wp-settings.php was not removed and resulted in the class being loaded twice. To be safe, only include the class file in meta.php and remove from wp-settings.php file.
Props spacedmonkey, ryelle.
See #58185.
Built from https://develop.svn.wordpress.org/trunk@55826
git-svn-id: http://core.svn.wordpress.org/trunk@55338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In order to skip lazy-loading the first few images on a page, as of WordPress 5.9 there has been logic to count images that are eligible based on certain criteria. One of those groups are images that appear within the content of a post.
This changeset fixes a bug where images created via `get_the_post_thumbnail()` or `wp_get_attachment_image()` that are injected into the post content would skew the count and therefore result in all images to be lazy-loaded, potentially hurting load time performance. This is relevant for example when those functions are called in server-side rendered blocks, or any other filter callbacks hooked into `the_content`.
Props flixos90, antpb, joedolson, spacedmonkey, mukesh27, thekt12, costdev, jrf.
Fixes#58089.
See #53675.
Built from https://develop.svn.wordpress.org/trunk@55825
git-svn-id: http://core.svn.wordpress.org/trunk@55337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since WordPress 5.9, a "context" value of "wp_get_attachment_image" has been used in the `wp_get_attachment_image()` function to provide context to underlying functions where that is relevant, e.g. `wp_get_loading_attr_default()`. Since that value used to be not customizable, it required a workaround in `get_the_post_thumbnail()` to avoid calling those functions in `wp_get_attachment_image()`, which resulted in unnecessary complexity and was prone to errors.
This changeset introduces a `wp_get_attachment_image_context` filter and leverages it with private filter callback functions that are leveraged by default when `get_the_post_thumbnail()` is called. This avoids the need for the previous workaround and furthermore provides flexibility for other callers of `wp_get_attachment_image()` to provide their own contexts.
Props flixos90, costdev, thekt12, westonruter, spacedmonkey.
Fixes#58212.
Built from https://develop.svn.wordpress.org/trunk@55821
git-svn-id: http://core.svn.wordpress.org/trunk@55333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Follow on from [55747].
As `get_sites` can be called very early in the bootstrap process, like in the sunrise.php file, it means that the `WP_Metadata_Lazyloader` may not have been loaded yet in the wp-settings.php file. Add a simple check to see if the class exists and if it does not exist then load the class file in.
Props spacedmonkey, peterwilsoncc, dd32.
See #58185.
Built from https://develop.svn.wordpress.org/trunk@55818
git-svn-id: http://core.svn.wordpress.org/trunk@55330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Pass false to the `lazy_load_term_meta` parameter given to the `WP_Query` found in `get_block_templates`. Template post types only ever have one term assigned to them. So priming term meta, does not help performance as lazy loading term meta is only useful if loading multiple terms. As `get_block_templates` is run multiple times on a block theme request, this saves processing time.
Props spacedmonkey, andraganescu, ntsekouras, oandregal, westonruter.
Fixes#58230.
Built from https://develop.svn.wordpress.org/trunk@55817
git-svn-id: http://core.svn.wordpress.org/trunk@55329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The previous default threshold for how many content images to skip lazy-loading on (which was just 1) has proven to be too strict: HTTP Archive data shows that >70% of sites have up to 3 equal-sized images in the initial viewport, each of which could be the LCP image and therefore should not be lazy-loaded. Lazy-loading too many images has adverse effects on load time performance, while increasing the default threshold will not negatively affect load time performance even for sites where a threshold of 1 would be the perfect choice.
The change of default value in this changeset will improve performance for more WordPress sites out of the box. The `wp_omit_loading_attr_threshold` filter can still be used to customize and fine tune the value where needed.
Props thekt12, spacedmonkey, westonruter, flixos90.
Fixes#58213.
Built from https://develop.svn.wordpress.org/trunk@55816
git-svn-id: http://core.svn.wordpress.org/trunk@55328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Passing `update_term_meta_cache` argument value false by default resulting in `get_terms` to not prime the term meta cache in `wp_get_object_terms`. Priming of term meta is not needed in this context.
Props spacedmonkey, rutviksavsani.
Fixes#57701.
Built from https://develop.svn.wordpress.org/trunk@55759
git-svn-id: http://core.svn.wordpress.org/trunk@55271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`$new_title` and `$new_slug` can be null if `get_sample_permalink_html()`
was called with default parameters, and they are documented as
`string|null` in the function DocBlock.
Follow-up to [34347].
Props Enchiridion, audrasjb, SergeyBiryukov.
Fixes#58322.
See #33927. --Cette ligne, et les
suivantes
ci-dessous, seront ignorées--
M trunk/src/wp-admin/includes/post.php
Built from https://develop.svn.wordpress.org/trunk@55758
git-svn-id: http://core.svn.wordpress.org/trunk@55270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
With `get_the_author()` returning an empty string instead of `null` if called before `$authordata` is set, and no longer causing a PHP 8.1 "null to non-nullable" deprecation notice, there is no need for these tests to ignore the notice.
Follow-up to [51968], [55755].
See #58157.
Built from https://develop.svn.wordpress.org/trunk@55756
git-svn-id: http://core.svn.wordpress.org/trunk@55268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If the `$authordata` global is not set, `get_the_author()` returned `null`, causing a PHP 8.1 "null to non-nullable" deprecation notice in `ent2ncr()` hooked via `the_author` filter:
{{{
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
}}}
This commit updates `get_the_author()` to return an empty string if called before `$authordata` is set, bringing consistency with a few other similar functions which also return an empty string in this case:
* `get_the_author_meta()`
* `get_the_author_posts_link()`
* `get_the_modified_author()`
Follow-up to [695/tests], [2858], [11138], [12284], [20575], [34677], [44616], [53187].
Props Soean, jrf, sabernhardt, salvoaranzulla, antpb, ebai4, sajjad67, tijmensmit, SergeyBiryukov.
Fixes#58157.
Built from https://develop.svn.wordpress.org/trunk@55755
git-svn-id: http://core.svn.wordpress.org/trunk@55267 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.
In this case, the properties, as used in the class methods, fall in the “known property” category.
Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].
Follow-up to [53942], [53948], [53949], [53952], [53953], [53954], [53957], [54037].
Props jrf, thomask.
See #58298.
Built from https://develop.svn.wordpress.org/trunk@55752
git-svn-id: http://core.svn.wordpress.org/trunk@55264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The terms "roll back" and "rolled back" are used in user facing strings since [55720]. These termes are not that clear for novice users and may be difficult to translate in some locales. This changeset replaces "roll back" with "restore" and "rolled back" with "restored" or "not applied" depending of the context of the screen.
Follow-up to [55720].
Props kebbet, costdev, NekoJonez, audrasjb, SergeyBiryukov, davidbaumwald.
Fixes#58282.
Built from https://develop.svn.wordpress.org/trunk@55750
git-svn-id: http://core.svn.wordpress.org/trunk@55262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [34270] introduced lazy loading of comment meta. However, this was only in the context of `WP_Query`. Other parts of the codebase, like `WP_Comment_Query` did not lazily load comment meta. In this change, calls to `update_meta_cache` are now replaced with `wp_lazyload_comment_meta`, that instead of priming comment meta caches, just adds them to the queue to be primed it ever called. This results in far less database queries, as there a number of places where comment meta is being primed unnecessarily and never used. Adding everything to the comment meta queue, also means that if comment meta is used, that is all loaded in a single database / cache call.
Follow on from [55671], [55747].
Props spacedmonkey, peterwilsoncc, flixos90, mukesh27.
Fixes#57801.
Built from https://develop.svn.wordpress.org/trunk@55749
git-svn-id: http://core.svn.wordpress.org/trunk@55261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [36566] a framework to lazily load metadata was introduced. This supported term and comment meta by default. In this commit, extends support for site ( blog ) meta. Site meta is not heavily used by core and is used by developers to extend multisite. In this change, `_prime_site_caches` and `WP_Site_Query` now call the new function `wp_lazyload_site_meta`. The function `wp_lazyload_site_meta` accepts an array of ids and adds them to the queue of metadata to be lazily loaded. The function `get_blogs_of_user` was updated to now lazily load site meta.
Follow on from [55671].
Props spacedmonkey, johnjamesjacoby, peterwilsoncc, mukesh27.
Fixes#58185.
Built from https://develop.svn.wordpress.org/trunk@55747
git-svn-id: http://core.svn.wordpress.org/trunk@55259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In preparation for viewing revisions of templates and template parts in the editor, this set changes adds the `_edit_link` argument when registering the `wp_template` and `wp_template_part` post types. This commit also updates `get_edit_post_link` to account for the unique edit URLs for these post types.
Finally, this commit also adds new unit tests for the `get_edit_post_link` function, including tests for the `post`, `wp_template`, and `wp_template_part` post types.
Fixes#57709.
Props andraganescu, spacedmonkey, antonvlasenko, youknowriad, ramonopoly, ironprogrammer, annezazu.
Built from https://develop.svn.wordpress.org/trunk@55743
git-svn-id: http://core.svn.wordpress.org/trunk@55255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `WP_UnitTestCase::flush_cache` method, the properties of the global `$wp_object_cache` object were manaully being reset to flush the cache. The function `wp_cache_flush_runtime` was added in [52772] and is designed to reset any class properties to default values. Using `wp_cache_flush_runtime` improve compatibility with third party object caches, as it allows developers to define their own `wp_cache_flush_runtime` function.
Props rmccue, johnbillion, wonderboymusic, boonebgorges, voldemortensen, dd32, DrewAPicture, tillkruess, spacedmonkey.
Fixes#31463.
Built from https://develop.svn.wordpress.org/trunk@55741
git-svn-id: http://core.svn.wordpress.org/trunk@55253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the block editor related npm dependencies to their latest patch versions ahead of WordPress 6.2.1 RC1.
Updated packages:
- @wordpress/annotations@2.26.4
- @wordpress/block-directory@4.3.12
- @wordpress/block-editor@11.3.10
- @wordpress/block-library@8.3.12
- @wordpress/components@23.3.7
- @wordpress/customize-widgets@4.3.12
- @wordpress/edit-post@7.3.12
- @wordpress/edit-site@5.3.12
- @wordpress/edit-widgets@5.3.12
- @wordpress/editor@13.3.10
- @wordpress/format-library@4.3.10
- @wordpress/interface@5.3.8
- @wordpress/list-reusable-blocks@4.3.7
- @wordpress/preferences@3.3.7
- @wordpress/reusable-blocks@4.3.10
- @wordpress/rich-text@6.3.4
- @wordpress/server-side-render@4.3.7
- @wordpress/widgets@3.3.10
This changeset includes the following fixes:
- i18n: Add context to labels related to CSS position properties gutenberg#49135
- Comments: Fix 'sprintf requires more than 1 params' error gutenberg#49054
- Fix the site editor loading in multi-site installs gutenberg#49861
- Fix quick inserter going off-screen in some situations gutenberg#49881
- Site Editor: Decode the site title properly gutenberg#49685
- Firefox: fix input rules (React async state issue) gutenberg#48210
- Only show alignment info when parent layout is constrained. gutenberg#49703
- [Inserter]: Fix onHover error on patterns tab in mobile gutenberg#49450
- Fix site editor redirection after creating new template or template part gutenberg#49364
Props mamaduka, audrasjb, wildworks, ocean90, aristath, costdev, hellofromtonya, youknowriad, mdxfr, oandregal, mattwiebe, bph, ndiego, talldanwp, joen, ellatrix, kevin940726, isabel_brison, andrewserong, ntsekouras, welcher.
Fixes#58274.
Built from https://develop.svn.wordpress.org/trunk@55737
git-svn-id: http://core.svn.wordpress.org/trunk@55249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This adjusts `str_contains()` code layout to have an early exit for an empty `$needle`, matching similar fragments in `str_starts_with()` and `str_ends_with()` for better readability.
Follow-up to [52039], [52040].
See #57839.
Built from https://develop.svn.wordpress.org/trunk@55726
git-svn-id: http://core.svn.wordpress.org/trunk@55238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This moves a reference link in `::get_attribute_names_with_prefix()` below the code example, so that it is correctly displayed in the Developer Resources.
Includes updating some other `@see` tags for consistency as per the documentation standards.
Additionally, the example code for `WP_HTML_Tag_Processor::get_tag()` is updated to show lowercase tag names in the input HTML, so that it does not convey the wrong impression that the uppercase output from `::get_tag()` depends on the case of the input HTML.
Follow-up to [55203].
Props dmsnell, johnbillion, audrasjb, SergeyBiryukov.
Fixes#58254.
Built from https://develop.svn.wordpress.org/trunk@55724
git-svn-id: http://core.svn.wordpress.org/trunk@55236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [55718] the Unicode replacement character was mistakenly removed. The purpose of including the character was to communicate what it looks like and why the Tag Processor won't insert it into the document.
This changeset brings the character back and adds a small clue to fix the confusion that may lead to its removal.
Follow-up to [55718].
Props dmsnell.
Fixes#58256
See #57840.
Built from https://develop.svn.wordpress.org/trunk@55723
git-svn-id: http://core.svn.wordpress.org/trunk@55235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to make the update process more reliable and ensures that if a plugin or theme update fails, the previous version can be safely restored.
* When updating a plugin or theme, the old version is moved to a temporary backup directory:
* `wp-content/upgrade-temp-backup/plugins/[plugin-slug]` for plugins
* `wp-content/upgrade-temp-backup/themes/[theme-slug]` for themes.
* If the update fails, then the backup kept in the temporary backup directory is restored to its original location.
* If the update succeeds, the temporary backup is deleted.
To further help troubleshoot plugin and theme updates, two new checks were added to the Site Health screen:
* A check to make sure that the `upgrade-temp-backup` directory is writable.
* A check that there is enough disk space available to safely perform updates.
To avoid confusion: The temporary backup directory will NOT be used to “roll back” a plugin to a previous version after a completed update. This directory will simply contain a transient backup of the previous version of a plugin or theme being updated, and as soon as the update process finishes, the directory will be empty.
Follow-up to [55204], [55220].
Props afragen, costdev, pbiron, azaozz, hellofromTonya, aristath, peterwilsoncc, TJNowell, bronsonquick, Clorith, dd32, poena, TimothyBlynJacobs, audrasjb, mikeschroder, a2hosting, KZeni, galbaras, richards1052, Boniu91, mai21, francina, TobiasBg, desrosj, noisysocks, johnbillion, dlh, chaion07, davidbaumwald, jrf, thisisyeasin, ignatggeorgiev, SergeyBiryukov.
Fixes#51857.
Built from https://develop.svn.wordpress.org/trunk@55720
git-svn-id: http://core.svn.wordpress.org/trunk@55232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset removes the `aligncenter` class from `h2` and `is-subheading` items in the WordPress 6.2 About Page, for more consistent alignment. Also, future minor releases will add more left-aligned paragraphs under the "Maintenance Releases" section.
Props shagors, sabernhardt, mukesh27, amin7, costdev, pavanpatil1, audrasjb.
Fixes#57387.
Built from https://develop.svn.wordpress.org/trunk@55716
git-svn-id: http://core.svn.wordpress.org/trunk@55228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `permissions` key in a job declares the GitHub permissions that are granted to the token that's used by the job. Restricting the permissions reduces the impact that a vulnerability in the CI system can have.
Props desrosj, johnbillion
See #57865
Built from https://develop.svn.wordpress.org/trunk@55715
git-svn-id: http://core.svn.wordpress.org/trunk@55227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `view_items` post type label is used in the Editor, for the `aria-label` of the link to go back to the Posts list. When editing a Reusable block, it fallbacks to 'View Posts'. It should be 'View Reusable blocks'.
Fixes#58209.
Built from https://develop.svn.wordpress.org/trunk@55709
git-svn-id: http://core.svn.wordpress.org/trunk@55221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
A bug was discovered where where the parser wasn't returning to the
start of the affected tag after making some updates.
In few words, the Tag Processor has not been treating its own internal
pointer `bytes_already_parsed` the same way it treats its bookmarks.
That is, when updates are applied to the input document and then
`get_updated_html()` is called, the internal pointer transfers to
the newly-updated content as if no updates had been applied since
the previous call to `get_updated_html()`.
In this patch we're creating a new "shift accumulator" to account for
all of the updates that accrue before calling `get_updated_html()`.
This accumulated shift will be applied when swapping the input document
with the output buffer, which should result in the pointer pointing to
the same logical spot in the document it did before the udpate.
In effect this patch adds a single workaround for treating the
internal pointer like a bookmark, plus a temporary pointer which points
to the beginning of the current tag when calling `get_updated_html()`.
This will preserve the assumption that updating a document doesn't
move that pointer, or shift which tag is currently matched.
Props dmsnell, zieladam.
Fixes#58179.
Built from https://develop.svn.wordpress.org/trunk@55706
git-svn-id: http://core.svn.wordpress.org/trunk@55218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`str_starts_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins with the given substring (needle).
WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9.
This commit replaces `0 === strpos( ... )` with `str_starts_with()` in core files, making the code more readable and consistent, as well as improving performance.
While `strpos()` is slightly faster than the polyfill on PHP < 8.0, `str_starts_with()` is noticeably faster on PHP 8.0+, as it is optimized to avoid unnecessarily searching along the whole haystack if it does not find the needle.
Follow-up to [52039], [52040], [52326].
Props spacedmonkey, costdev, sabernhardt, mukesh27, desrosj, jorbin, TobiasBg, ayeshrajans, lgadzhev, SergeyBiryukov.
Fixes#58012.
Built from https://develop.svn.wordpress.org/trunk@55703
git-svn-id: http://core.svn.wordpress.org/trunk@55215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add a helper function called `wp_cache_set_last_changed` to set the last changed value for cache groups. This function has a new action called `wp_cache_set_last_changed`, allowing for developers to cache invalidate when last changed value is changed.
Props tillkruess, spacedmonkey, peterwilsoncc, mukesh27, johnjamesjacoby.
Fixes#57905.
Built from https://develop.svn.wordpress.org/trunk@55702
git-svn-id: http://core.svn.wordpress.org/trunk@55214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [55252] the function `wp_queue_posts_for_term_meta_lazyload` was refactored to use `wp_cache_get_multiple`. This refactor included a call to `get_term`. However, calling get_term calls `sanitize_term`, which sanitizes all fields in a term. The full term object is not needed in this context as term meta only needs to the term id, which is already in the function. Saving calls to `sanitize_term` will improve performance of this function.
Props spacedmonkey, joemcgill, mukesh27.
Fixes#57966.
Built from https://develop.svn.wordpress.org/trunk@55701
git-svn-id: http://core.svn.wordpress.org/trunk@55213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The autosaves and revisions controllers used to set the same class properties in a slightly different order.
This commit makes the `::__construct()` methods of both classes more consistent to simplify future maintenance.
Follow-up to [46272], [51962].
See #57839.
Built from https://develop.svn.wordpress.org/trunk@55697
git-svn-id: http://core.svn.wordpress.org/trunk@55209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This PR removes the `wp_enqueue_registered_block_scripts_and_styles` callback from the `enqueue_block_editor_assets` action.
There are two actions to enqueue block assets: `enqueue_block_editor_assets` and `enqueue_block_assets`. The former enqueues the assets to the editor and the later enqueues them to the front-end and the editor. Given `wp_enqueue_registered_block_scripts_and_styles` is already bound to the `enqueue_block_assets` (front-end and editor), it is unnecessary to bind it to `enqueue_block_editor_assets` (editor) as well.
This was originally introduced at [44157] and hasn't been modified since.
Props ellatrix, costdev.
Fixes#58208.
Built from https://develop.svn.wordpress.org/trunk@55695
git-svn-id: http://core.svn.wordpress.org/trunk@55207 1a063a9b-81f0-0310-95a4-ce76da25c4cd