It is best to always escape the complete value of an attribute, not a partial value, as otherwise the escaping could be (partially) undone when the values are joined together.
While the hardcoded hyphen in this case don't necessarily create that risk, it may change to a value which could be problematic, so making it a habit to escape the value in one go is best practice.
Escaping the complete value also means that a single `esc_attr()` call can be used instead of two.
Follow-up to [14444], [16652], [55616], [56632].
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56633
git-svn-id: http://core.svn.wordpress.org/trunk@56145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset restricts edit term link generation if the user lacks the `edit_term` cap in order to prevent PHP 8.1+ deprecations shown when a user lacks this
capability and `get_edit_term_link()` returns null.
Props thelovekesh, jrf.
Fixes#59336.
Built from https://develop.svn.wordpress.org/trunk@56631
git-svn-id: http://core.svn.wordpress.org/trunk@56143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This introduces classes for the "Log in", "Register" and "Lost your password?" links in the footer of `wp-login.php` forms so that they may be easily targeted for individual styling.
The new classes are:
- `.wp-login-log-in`
- `.wp-login-register`
- `.wp-login-lost-password`
Props wparslan, thomasplevy, rajinsharwar, audrasjb, joedolson, costdev.
Fixes#57590.
Built from https://develop.svn.wordpress.org/trunk@56628
git-svn-id: http://core.svn.wordpress.org/trunk@56140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is a follow-up to [56452] in which a new filter hook was added to `get_available_post_mime_types()` to override a potentially slow query. This renames the previous hook from `get_available_post_mime_types` to `pre_get_available_post_mime_types` for clarity.
Props rcorrales, emrikol, johnbillion, joemcgill, mukesh27.
Fixes#52759.
Built from https://develop.svn.wordpress.org/trunk@56623
git-svn-id: http://core.svn.wordpress.org/trunk@56135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In PHPUnit 10.3.5, 9.6.13 and 8.5.34, the child processes used for process isolation now use temporary files to communicate their result to the parent process.
This caused a failure in some tests that set the `open_basedir` PHP directive to a value that did not include `sys_get_temp_dir()`.
This adds `sys_get_temp_dir()` to the `open_basedir` value set by the tests to ensure that permission is still granted for the temporary directory.
PHPUnit uses `sys_get_temp_dir()`. To ensure the result is the same, Core's `get_temp_dir()` function is not used.
References:
- https://github.com/sebastianbergmann/phpunit/issues/5356
Props desrosj, mukesh27, SergeyBiryukov, costdev.
Fixes#59394.
Built from https://develop.svn.wordpress.org/trunk@56622
git-svn-id: http://core.svn.wordpress.org/trunk@56134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit enhances the performance of the get_block_theme_folders function by introducing a new method called get_block_template_folders within the WP_Theme class. Previously, this function suffered from poor performance due to repeated file lookups using file_exists. The new method implements basic caching, storing the result in the theme's cache, similar to how block themes are cached in the block_theme property (see [55236]).
Additionally, this change improves error handling by checking if a theme exists before attempting to look up the file. It also enhances test coverage.
Props spacedmonkey, thekt12, swissspidy, flixos90, costdev, mukesh27.
Fixes#58319.
Built from https://develop.svn.wordpress.org/trunk@56621
git-svn-id: http://core.svn.wordpress.org/trunk@56133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces two new functions `traverse_and_serialize_blocks` and `traverse_and_serialize_block` with the additional `$callback` argument. It is possible to pass parent block, block index, chunk index to the callback argument.
Reverts changes applied to `serialize_blocks` and `serialize_block` in #59327 with [56557].
Props ockham, mukesh27.
See #59313.
Built from https://develop.svn.wordpress.org/trunk@56620
git-svn-id: http://core.svn.wordpress.org/trunk@56132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [50776], the `filter_set_block_editor_settings_post()` callback was introduced for use in block editor settings tests.
This contained a reference to an `$allowed_block_types` parameter, which doesn't exist.
This changes the reference to `$editor_settings`.
Follow-up to [50776].
Props david.binda, mukesh27, SergeyBiryukov.
Fixes#59391.
Built from https://develop.svn.wordpress.org/trunk@56619
git-svn-id: http://core.svn.wordpress.org/trunk@56131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
For #59313, we need to implement functions to insert a given parsed block into another parsed block's inner blocks, and to prepend and append to that array, respectively.
We will use those functions in combination with `traverse_and_serialize_blocks` (see #59327) to implement automatic insertion of hooked blocks into block templates and patterns.
Props gziolo.
Fixes#59385.
Built from https://develop.svn.wordpress.org/trunk@56618
git-svn-id: http://core.svn.wordpress.org/trunk@56130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [52190], some new instances of the `join()` alias were introduced in the test suite.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.
This replaces the new `join()` uses with the canonical `implode()` function name.
Follow-up to [46182], [49193], [49805], [52190].
Props david.binda, mukesh27.
Fixes#59389.
Built from https://develop.svn.wordpress.org/trunk@56616
git-svn-id: http://core.svn.wordpress.org/trunk@56128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The dimension attributes `width` and `height` should be present on every image in order to avoid layout shifts and be able to leverage WordPress core's image loading optimization functionality.
This changeset adds dimension attributes to the `core/image` blocks used in block patterns in Twenty Twenty-Two, where this is particularly critical as WordPress core cannot backfill the attributes for those images, as their sources are not part of the Media Library.
Props spacedmonkey, thekt12, mukesh27, flixos90.
Fixes#59256.
Built from https://develop.svn.wordpress.org/trunk@56613
git-svn-id: http://core.svn.wordpress.org/trunk@56125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `wp_get_loading_optimization_attributes()` function, which was introduced in 6.3, based on the now deprecated `wp_get_loading_attr_default()` function introduced in 5.5, relies on a `$context` parameter based on which it may alter its behavior and the attributes returned. So far, it has only supported context values used within WordPress core.
This changeset decouples the behaviors of the function from specific contexts, allowing for more flexibility. Theme and plugin developers will be able to rely on their own context values when rendering images in non-standard ways, rather than being forced to use a core context, to get the loading optimization benefits the function provides.
As part of this change, a `wp_loading_optimization_force_header_contexts` filter is introduced, which allows filtering the map of context values and whether they should be considered header contexts, i.e. i.e. any image having one of these contexts will be assumed to appear above the fold.
Props mukesh27, costdev, flixos90.
Fixes#58894.
Built from https://develop.svn.wordpress.org/trunk@56612
git-svn-id: http://core.svn.wordpress.org/trunk@56124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Some custom post types or taxonomies may not need the Quick Edit functionality, in which case adding hidden fields and rendering the form with the data to edit would be redundant.
This commit introduces two filters for more granular control:
* `quick_edit_enabled_for_post_type`
* `quick_edit_enabled_for_taxonomy`
Follow-up to [8857], [9083], [9098].
Props garyc40, sabernhardt, mukesh27, costdev, oglekler, wyrfel, peterwilsoncc, faguni22, robinwpdeveloper, webcommsat, johnbillion, azaozz, hellofromTonya, GunGeekATX, Jick, mikeschinkel, jane, nacin, helen, wonderboymusic, DrewAPicture, SergeyBiryukov.
Fixes#16502, #19343, #57596.
Built from https://develop.svn.wordpress.org/trunk@56611
git-svn-id: http://core.svn.wordpress.org/trunk@56123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In the `WP_Hook` class the function `array_keys` was called every time an array of hook priorities was needed. For sites with lots of filters or actions, this would result in thousands of calls to the `array_keys` function, which uses server resources. Instead of recomputing this array every time it is needed, only compute it when filters are added and removed, then store the result as a class property. Improve unit tests to ensure this behaviour is tested.
Props spacedmonkey, bor0, flixos90, hellofromTonya, mukesh27.
Fixes#58458.
Built from https://develop.svn.wordpress.org/trunk@56609
git-svn-id: http://core.svn.wordpress.org/trunk@56121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Allow admin notices to be created with additional attributes. Test attributes include `hidden`, `data-*`, and `role="*"` values, which are all in use in various admin notices across core.
This commit adds `aria-live` and `hidden` to the KSES global attributes array to support core usages.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600], [56601], [56602].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56603
git-svn-id: http://core.svn.wordpress.org/trunk@56115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In a handful of admin notices, a `tabindex` attribute is set so that JS can move focus to the notice `div`. Rather than adding `tabindex` to globally accepted attributes for `wp_kses_post()`, move the assignment of `tabindex` into the JS handlers that display those notices. The attribute is only relevant if JS is running, so there is no reason to add it in the original HTML notice.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600], [56601].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56602
git-svn-id: http://core.svn.wordpress.org/trunk@56114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add additional usage of `wp_admin_notice()` in `wp-admin/network/` where previously overlooked.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56601
git-svn-id: http://core.svn.wordpress.org/trunk@56113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add additional usage of `wp_admin_notice()` in `wp-admin/` on `.error` and miscellaneous usages previously overlooked.
Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599].
Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56600
git-svn-id: http://core.svn.wordpress.org/trunk@56112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds further usages of `wp_admin_notice()` in `/wp-admin/includes/` on `.notice-error`, `.notice-warning`, `.error`, and `.updated`.
Ongoing task to implement new function across core.
Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597].
Props joedolson, mukesh27, costdev.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56599
git-svn-id: http://core.svn.wordpress.org/trunk@56111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds further usages of `wp_admin_notice()` in the root level of `/wp-includes/` on `.error` and `.notice-info`.
Ongoing task to implement new function across core.
Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590].
Props joedolson, costdev.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56597
git-svn-id: http://core.svn.wordpress.org/trunk@56109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In the get_option function, a cache lookup for the notoptions key is performed, which stores an array of keys for options known not to exist. This optimization prevents repeated database queries when certain options are requested. However, the cache lookup for notoptions was conducted before checking if the requested option exists in the cache. Given that it's more likely that the option does exist, this commit reorders the checks to first verify the option's existence in the cache before confirming its absence. This adjustment reduces redundant queries and also eliminates an unnecessary cache lookup, improving overall performance.
Props spacedmonkey, costdev, flixos90, azaozz.
Fixes#58277.
Built from https://develop.svn.wordpress.org/trunk@56595
git-svn-id: http://core.svn.wordpress.org/trunk@56107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Test files should comply with the naming conventions accepted by PHPUnit, not with the WP naming conventions.
While the `WordPress.File.FileName` sniff makes a best effort to prevent throwing errors for files containing test classes, the recommended manner to deal with test files is to exclude the complete test directory from being subject to this sniff.
This updates the ruleset to follow the recommendation.
Follow-up to [42346], [45607].
Props jrf.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@56594
git-svn-id: http://core.svn.wordpress.org/trunk@56106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When various methods parameters in child classes were renamed to `$item` to match the parent class for PHP 8 named parameter support, most of the methods restored the more descriptive, specific name at the beginning for better readability, with several exceptions for methods consisting only of a few lines.
To avoid confusion about why some methods do that and some don't, this commit aims to bring more consistency to the code, specifically in list tables' `::column_default()` methods.
Follow-up to [51728], [51737], [51786].
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56586
git-svn-id: http://core.svn.wordpress.org/trunk@56098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Incorporating a new 'cache_results' parameter into the WP_Term_Query class, this commit empowers developers with the ability to bypass query caches, explicitly triggering database queries when needed. This brings the `WP_Term_Query` class inline with `WP_Query` and `WP_User_Query` that already have a 'cache_results' parameter.
Update the `term_exists` function to use this new parameter, so the term query caches are not used while importing.
Props dlh, spacedmonkey, peterwilsoncc.
Fixes#52710.
Built from https://develop.svn.wordpress.org/trunk@56585
git-svn-id: http://core.svn.wordpress.org/trunk@56097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `the_header_image_tag` function was introduced in WordPress 4.4 as part of [35594]. It is used in all themes created post WordPress 4.4 that supported header images. The function `get_header_image_tag` continues to get updated with new image features, like lazy loading, async decoding and fetch priority. To ensure our core themes maintain compatibility and benefit from these enhancements, a backward compatibility shim has been applied, integrating the `the_header_image_tag` function into the following core themes:
- Twenty Ten
- Twenty Eleven
- Twenty Twelve
- Twenty Fourteen
- Twenty Sixteen
This change ensures future compatibility and modern image features are applied for header images to these older themes.
Props spacedmonkey, flixos90, mukesh27.
Fixes#58675.
Built from https://develop.svn.wordpress.org/trunk@56583
git-svn-id: http://core.svn.wordpress.org/trunk@56095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Rather than using `_inject_theme_attribute_in_block_template_content` to inject the `theme` attribute into all Template Part blocks found in a given file-based Block Template, introduce a new function called `_inject_theme_attribute_in_template_part_block`, and use that as second argument to `serialize_blocks()` (introduced in [56557]) in order to inject said attribute during tree traversal for serialization.
This allows for a more modular approach that will eventually be extended to implement automatic insertion of hooked blocks.
Note that we're guarding `_build_block_template_result_from_file()` (i.e. the callsite of `_inject_theme_attribute_in_template_part_block` and previously of `_inject_theme_attribute_in_block_template_content`) against regressions through additional unit test coverage added in [56562].
Props @gziolo.
Fixes#59338. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56578
git-svn-id: http://core.svn.wordpress.org/trunk@56090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since most core scripts are registered using `WP_Scripts::add()`, which is not affected by the signature change, only calls to `wp_register_script()` using the old signature need to be updated. There is only a single instance left, which is updated in this changeset.
Props incursadesigns.
Fixes#58634.
Built from https://develop.svn.wordpress.org/trunk@56568
git-svn-id: http://core.svn.wordpress.org/trunk@56080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Building upon the changes introduced in [53760], this commit refines the behavior of the REST API index. Specifically, it addresses performance concerns related to the unnecessary preparation of item links, such as site icon and logo links.
Prior to this update, the index controller was invoking the prepare_links method regardless of whether the _links or _embedded fields were requested in the response. This led to unnecessary database lookups and decreased overall performance.
In this commit, we implement a more efficient approach. Now, the prepare_links method will only be called when the _links or _embedded fields are explicitly requested in the response. This optimization ensures that we prepare links only when they are intended for inclusion in the API response, reducing unnecessary overhead.
By implementing this improvement, we enhance the overall efficiency and performance of the WordPress core REST API index controller.
Props spacedmonkey, niravsherasiya7707, dlh, mukesh27, costdev, swissspidy.
Fixes#57902.
Built from https://develop.svn.wordpress.org/trunk@56566
git-svn-id: http://core.svn.wordpress.org/trunk@56078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This patch updates documentation and an internal variable name within the
HTML Processor class so that they are more helpful and complete to a reader.
There should be no functional or visual changes in this patch.
Props dmsnell, mukesh27.
Fixes#59267.
Built from https://develop.svn.wordpress.org/trunk@56565
git-svn-id: http://core.svn.wordpress.org/trunk@56077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When encountering elements that imply switching into the RAWTEXT parsing state,
the Tag Processor should skip processing until exiting the RAWTEXT state.
In this patch the Tag Processor does just that, except for the case of the
deprecated XMP element which implies further and more complicated rules.
There's an implicit assumption that the SCRIPT ENABLED flag in HTML parsing
is enabled so that the contents of NOSCRIPT can be skipped. Otherwise, it would
be required to parse the contents of that tag.
Props dmsnell.
Fixes#59292.
Built from https://develop.svn.wordpress.org/trunk@56563
git-svn-id: http://core.svn.wordpress.org/trunk@56075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While we already have unit test coverage for `_inject_theme_attribute_in_block_template_content`, those tests only verify that ''that'' function does what is supposed to do; there's however no guarantee that `_build_block_template_result_from_file` uses that function (or whatever other technique) to actually inject the theme attribute.
This patch adds test coverage to verify that the theme attribute is correctly injected by `_build_block_template_result_from_file`.
Props costdev, gziolo, mukesh27, spacedmonkey.
Fixes#59325. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56562
git-svn-id: http://core.svn.wordpress.org/trunk@56074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes removing redundant `@covers` tags. There is already an existing annotation for the whole test class, following the [https://docs.phpunit.de/en/9.6/annotations.html#covers PHPUnit recommendation]:
> This annotation can be added to the docblock of the test class or the individual test methods. The recommended way is to add the annotation to the docblock of the test class, not to the docblock of the test methods.
Follow-up to [56560].
See #58682.
Built from https://develop.svn.wordpress.org/trunk@56561
git-svn-id: http://core.svn.wordpress.org/trunk@56073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
All blocks relevant for the excerpt are already being parsed in `excerpt_remove_blocks()`. Therefore running `do_blocks()` on the post content only to create the excerpt is unnecessary and wasteful from a performance perspective.
Props thekt12, spacedmonkey, mukesh27, joemcgill.
Fixes#58682.
Built from https://develop.svn.wordpress.org/trunk@56560
git-svn-id: http://core.svn.wordpress.org/trunk@56072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `$current_token` reference has been stored in the HTML Processor itself, but I suggested to move it into the externalized state so that it can be stored and replaced.
In this patch the reference is moved to that state variable and it should become more possible to save and load state, to resume execution after pausing.
Props dmsnell.
Fixes#59268.
Built from https://develop.svn.wordpress.org/trunk@56558
git-svn-id: http://core.svn.wordpress.org/trunk@56070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Allow passing a function callback to serialize_block(s) that is invoked on each node in the tree of parsed blocks as it is traversed for serialization.
A function argument was chosen for passing the callback function as it reflects a pattern familiar from other algorithms that apply a given callback function while traversing a data structure -- most notably PHP's own `array_map()`.
Introducing a filter was considered as an alternative but ultimately dismissed. For a fairly low-level and general-purpose function such as `serialize_block()`, using a filter to pass the callback seemed risky, as it also requires ''removing'' that filter after usage in order to prevent the callback from being accidentally applied when `serialize_block()` is called in an entirely different context.
Introducing a separate function for applying a given operation during tree traversal (i.e. independently of serialization) was also considered but dismissed, as it would unnecessarily duplicate tree traversal.
Props dlh, gziolo.
Fixes#59327. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56557
git-svn-id: http://core.svn.wordpress.org/trunk@56069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
* Add `defer` loading strategy for all frontend end-user theme scripts (excluding Customizer preview).
* Move scripts to the `head` which relate to the initial page viewport to ensure they start loading earlier and execute sooner while still not blocking rendering.
* Update Twenty Twenty's script loader (`TwentyTwenty_Script_Loader`) to support core's built-in script loading strategies (#12009), while also retaining backwards-compatibility for child themes that may set `async` and `defer` script data.
* Update the main script loading strategy in Twenty Twenty from `async` to `defer` for better performance on repeat page views, since when an `async` script is cached it will block rendering.
Props westonruter, flixos90, sabernhardt.
Fixes#59316.
Built from https://develop.svn.wordpress.org/trunk@56556
git-svn-id: http://core.svn.wordpress.org/trunk@56068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When utilizing the `terms_clauses` or `get_terms_fields` filters within `WP_Term_Query` and the selected fields are modified, the entire term object is now cached. This adjustment is necessary because filters can broaden the selected fields beyond just the term ID. Fields linked to the term object, such as the count or parent, may undergo modifications when queried. Caching the complete object ensures the accurate storage of these modified fields within the cache.
Props spacedmonkey, tnolte, peterwilsoncc.
Fixes#58116.
Built from https://develop.svn.wordpress.org/trunk@56555
git-svn-id: http://core.svn.wordpress.org/trunk@56067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In `WP_Upgrader::delete_temp_backup()`, a malformed `sprintf()` call did not pass the value, triggering a Warning in PHP 7 and a Fatal Error in PHP 8.
This fixes the malformed `sprintf()` call by correctly passing the value.
Follow-up to [55720].
Props akihiroharai, afragen.
Fixes#59320.
Built from https://develop.svn.wordpress.org/trunk@56550
git-svn-id: http://core.svn.wordpress.org/trunk@56062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replaces `trigger_error()` with `wp_trigger_error()` in each of the `WP_Text_Diff_Renderer_Table` magic methods.
[56354] added the dynamic properties deprecation messages to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods. Since that commit, `wp_trigger_error()` was introduced (see [56530]) as a wrapper for `trigger_error()`.
Follow-up to [56354], [56530].
See #58898, #57686.
Built from https://develop.svn.wordpress.org/trunk@56544
git-svn-id: http://core.svn.wordpress.org/trunk@56056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replaces `trigger_error()` with `wp_trigger_error()` in each of the `WP_User_Query` magic methods.
[56353] added the dynamic properties deprecation messages to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods. Since that commit, `wp_trigger_error()` was introduced (see [56530]) as a wrapper for `trigger_error()`.
Follow-up to [56353], [56530].
See #58897, #57686.
Built from https://develop.svn.wordpress.org/trunk@56543
git-svn-id: http://core.svn.wordpress.org/trunk@56055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replaces `trigger_error()` with `wp_trigger_error()` in each of the `WP_List_Table` magic methods.
[56349] added the dynamic properties deprecation messages to the `__get()`, `__set()`, `__isset()`, `__unset()` magic methods. Since that commit, `wp_trigger_error()` was introduced (see [56530]) as a wrapper for `trigger_error()`.
Follow-up to [56349], [56356], [56530].
See #58896, #57686.
Built from https://develop.svn.wordpress.org/trunk@56542
git-svn-id: http://core.svn.wordpress.org/trunk@56054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The static instance of `WP_Font_Face` is not needed. It was an unnecessary carryover from the experimental Fonts API (which was not introduced into Core).
Whereas the Fonts API needed to persist its data (i.e. to maintain the registered and enqueued fonts throughout the web request), Font Face does not have data to persist.
Font Face processes the fonts it receives when `WP_Font_Face::generate_and_print( $fonts )` is invoked. Thus, a singleton is not needed.
Removing the static reduces the amount of the code in the function and eliminates running its tests in separate processes to ensure a different instance is always used.
References:
* [https://github.com/WordPress/gutenberg/pull/54228 Gutenberg PR 54228].
Follow-up to [56500].
Props hellofromTonya, costdev.
Fixes#59165.
Built from https://develop.svn.wordpress.org/trunk@56540
git-svn-id: http://core.svn.wordpress.org/trunk@56052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates all 3rd-party GitHub actions to their latest versions. The following actions were updated:
- `actions/cache`
- `actions/checkout`
- `actions/setup-node`
- `codecov/codecov-action`
- `shivammathur/setup-php`
- `slackapi/slack-github-action`
In the latest version of `actions/checkout` (`4.0.0`), a new input was introduced to control the output of command progress. This change uses this new `show-progress` input to turn off displaying progress by default. Progress will be shown when a workflow is run with debug mode enabled, just in case it contains helpful information.
Props johnbillion, desrosj.
See #58867.
Built from https://develop.svn.wordpress.org/trunk@56537
git-svn-id: http://core.svn.wordpress.org/trunk@56049 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the npm dependencies for Twenty Nineteen and Twenty Twenty to their latest versions. This also includes the results of running `npm audit fix`.
There are no changes in any built files as a result.
See #58863.
Built from https://develop.svn.wordpress.org/trunk@56533
git-svn-id: http://core.svn.wordpress.org/trunk@56045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
While `npm install` was working without issue after [56531], `npm ci` was not. The latter expects dependencies in the `package-lock.json` to match those in `package.json` exactly.
Follow up to [56378], [56387], [56442], [56531[.
Fixes#59187. See #56658.
Built from https://develop.svn.wordpress.org/trunk@56532
git-svn-id: http://core.svn.wordpress.org/trunk@56044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This results in a new `package-lock.json` file being generated that uses `lockfileVersion` 2.x.
There are no changes to built files as a result of this update.
Follow up to [56378], [56387], [56442].
Props mikestraw, whyisjake, jivygraphics.
Fixes#59187. See #56658.
Built from https://develop.svn.wordpress.org/trunk@56531
git-svn-id: http://core.svn.wordpress.org/trunk@56043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces `wp_trigger_error()` as a wrapper around PHP's native `trigger_error()`. As a wrapper, it's lean and not opinionated about the message. It accepts an E_USER family error level, meaning it is not limited to only notices.
Where `_doing_it_wrong()` intends to loudly alert developers "Hey you're doing it wrong - fix it", `wp_trigger_error()` is not opinionated and does not add wording. Rather, it passes the given message to `trigger_error()`.
`wp_trigger_error()` is meant for every `trigger_error()` instance. It can be used:
* in `_doing_it_wrong()` and each `_deprecated_*()` function.
* for PHP 8.x deprecations.
* for PHP error parity.
* for less severe "doing it wrong" instance that do not require bailing out.
* when a component or extension is not available on the server
* for instances where it's not clear if a plugin's or theme's code is the root cause.
* and more.
Technical details:
* Does not trigger the error if `WP_DEBUG` is not `true`.
* Includes `wp_trigger_error_run` action to allow hooking in for backtracing and deeper debug.
* Accepts an E_USER error level, but defaults to `E_USER_NOTICE`.
* Requires a function name, though can be an empty string. As the output message generated by `trigger_error()` references the file and line number where it was invoked, passing the function's name provides more information where the error/warning/notice/deprecation happened. It's intended to help with debug.
* A WordPress version number is not included.
* As messages can appear in the browser, the message is escaped using `esc_html()`. As noted in [https://www.php.net/manual/en/function.trigger-error.php the PHP manual]: "HTML entities in message are not escaped. Use htmlentities() on the message if the error is to be displayed in a browser."
References:
* [https://www.php.net/manual/en/function.trigger-error.php PHP manual for `trigger_error()`].
* [https://www.php.net/manual/en/errorfunc.constants.php E_USER constants (error level) in the PHP manual].
Props azaozz, hellofromTonya, flixos90, costdev, peterwilsoncc, oglekler, mukesh27.
See #57686.
Built from https://develop.svn.wordpress.org/trunk@56530
git-svn-id: http://core.svn.wordpress.org/trunk@56042 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Ensures that preview callbacks attached to the `stylesheet` and `template` filters do not run before `pluggable.php` has been included. These callbacks need functionality from `pluggable.php`.
Props: scruffian, johnbillion, SergeyBiryukov, okat, okat.
Fixes: #59000.
Built from https://develop.svn.wordpress.org/trunk@56529
git-svn-id: http://core.svn.wordpress.org/trunk@56041 1a063a9b-81f0-0310-95a4-ce76da25c4cd