A new `has_translation()` function can be used to determine whether a translation exists for a given string.
Props louiswol94, swissspidy, drzraf, ckanitz, tomhine, mchirag2002, samuelsilvapt.
Fixes#52696.
git-svn-id: https://develop.svn.wordpress.org/trunk@59029 602fd350-edb4-49c9-b593-d223f7449a82
An infinite loop was discovered in specific situations within foreign content inside the HTML Processor when a given node inside foreign content must be handled in the rules for the current insertion mode.
This patch resolves the loop by handling those nodes directly instead of reprocessing the node, which previously was redirecting control flow back to where the loop started.
Developed in https://github.com/wordpress/wordpress-develop/7347
Discussed in https://core.trac.wordpress.org/ticket/61656
Follow-up to [58868].
Props jonsurrell.
See #61576.
git-svn-id: https://develop.svn.wordpress.org/trunk@59024 602fd350-edb4-49c9-b593-d223f7449a82
With the introduction of Block Bindings, it became more common to see workflows where users need to see the custom fields that are available or connected. They were relying on the meta key, however it feelt too technical sometimes. The solution is adding a new label argument to include a human-readable name that can be used across the UI.
Props santosguillamot, mamaduka, gziolo, timothyblynjacobs, peterwilsoncc.
Fixes#61998.
git-svn-id: https://develop.svn.wordpress.org/trunk@59023 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that `WP_Network::$id` is stored internally as `int`, to match the documented type.
Follow-up to [37870].
Props ironprogrammer, scottculverhouse, spacedmonkey, SergeyBiryukov.
See #62035.
git-svn-id: https://develop.svn.wordpress.org/trunk@59020 602fd350-edb4-49c9-b593-d223f7449a82
Removes the pattern from the inserter while retaining the related code to ensure the content renders for sites making use of the pattern.
Props annezazu, talldanwp, richtabor, mikachan.
Fixes#61708.
git-svn-id: https://develop.svn.wordpress.org/trunk@59019 602fd350-edb4-49c9-b593-d223f7449a82
Adds tracking of HEIC image type support alongside WebP and AVID image types when requesting upgrade from WordPress.org
Props adamsilverstein, swissspidy, dd32, mukesh27.
Fixes#61981.
git-svn-id: https://develop.svn.wordpress.org/trunk@59018 602fd350-edb4-49c9-b593-d223f7449a82
Increases the frequency of heartbeat API requests from once every 15 seconds to once every 10 seconds.
The purpose of this change is to reduce the length of time before a post becomes unlocked as a user navigates around the WordPress Dashboard and ceases editing a post.
`wp.heartbeat.interval()` has been modified to allow theme and plugin authors to set the heartbeat interval to any value between one second and one hour rather than limiting them to a fixed set of values.
Props azaozz, annezazu, jorbin, kirasong.
Fixes#61960.
git-svn-id: https://develop.svn.wordpress.org/trunk@59016 602fd350-edb4-49c9-b593-d223f7449a82
Adds a test to ensure that interting a child term invalidates the cache of a `get_terms()` query by the parent ID.
Props Dekadinious, peterwilsoncc.
See #62031, #61530.
git-svn-id: https://develop.svn.wordpress.org/trunk@59015 602fd350-edb4-49c9-b593-d223f7449a82
The HTML specification indicates that an HTML tag with the name "IMAGE"
should be renamed as "IMG" and handled as if it were an "IMG", but this
only applies to elements in the HTML namespace.
In this patch the HTML Processor is updated to ensure that it doesn't
remap the tag name when processing foreign content, such as SVG and
MathML markup.
Developed in https://github.com/wordpress/wordpress-develop/7330
Discussed in https://core.trac.wordpress.org/ticket/61656
Props dmsnell, jonsurrell.
See #61576.
git-svn-id: https://develop.svn.wordpress.org/trunk@59014 602fd350-edb4-49c9-b593-d223f7449a82
This is the part five in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other.
This patch separates the fifth of twelve groups, the `wp-mu-plugins` info, into a separate method focused on that data.
This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code.
Developed in https://github.com/wordpress/wordpress-develop/7305
Discussed in https://core.trac.wordpress.org/ticket/61648
Props apermo, dmsnell.
See #61648.
git-svn-id: https://develop.svn.wordpress.org/trunk@59011 602fd350-edb4-49c9-b593-d223f7449a82
The function is referenced in the `_block_template_render_title_tag()` DocBlock, and should therefore be included in the documentation.
Follow-up to [30074], [30615], [31170], [35294], [51003].
Props poena.
See #61608.
git-svn-id: https://develop.svn.wordpress.org/trunk@59010 602fd350-edb4-49c9-b593-d223f7449a82
This implements the HTML spec for applying auto sizes to lazy-loaded images by prepending `auto` to the `sizes` attribute generated by WordPress if the image has a `loading` attribute set to `lazy`. For browser that support this HTML spec, the image's size value will be set to the concrete object size of the image. For browsers that don't support the spec, the word "auto" will be ignored when parsing the sizes value.
References:
- https://html.spec.whatwg.org/multipage/images.html#sizes-attributes
- https://github.com/whatwg/html/pull/8008
Props mukesh27, flixos90, joemcgill, westonruter, peterwilsoncc.
Fixes#61847.
git-svn-id: https://develop.svn.wordpress.org/trunk@59008 602fd350-edb4-49c9-b593-d223f7449a82
This is the part four in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other.
This patch separates the fourth of twelve groups, the `wp-server` info, into a separate method focused on that data.
This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code.
Developed in https://github.com/wordpress/wordpress-develop/7283
Discussed in https://core.trac.wordpress.org/ticket/61648
Props apermo, costdev, dmsnell, kebbet, mukesh27.
See #61648.
git-svn-id: https://develop.svn.wordpress.org/trunk@59002 602fd350-edb4-49c9-b593-d223f7449a82
There are places in the HTML API code where some tools get confused and flag invalid types for the return of a function because they are unable to detect that the end of the function is unreachable.
Since PHP doesn't provide a way to encode total matching in the source code, this patch adds a few extra lines in those unreachable locations to satisfy any tooling which isn't able to fully analyze the code.
Additionally this serves as extra guarding in case someone changes these functions in a way which would break them and the existing test suite doesn't catch those breakages.
Developed in https://github.com/WordPress/wordpress-develop/pull/7315
Discussed in https://core.trac.wordpress.org/ticket/62018
Props dlh, dmsnell.
Fixes#62018.
git-svn-id: https://develop.svn.wordpress.org/trunk@59001 602fd350-edb4-49c9-b593-d223f7449a82
About half of the file's code was a back-compat polyfill of base64 functions for IE9.
Since WordPress no longer supports IE9 as of version 4.8, and all modern browsers come with these functions, the polyfills can be removed.
Follow-up to [26072], [26131], [26601], [47771].
Props TobiasBg, sabernhardt.
Fixes#61995.
git-svn-id: https://develop.svn.wordpress.org/trunk@58997 602fd350-edb4-49c9-b593-d223f7449a82
During a refactor to modularize the debug data class, it came up that the ordering of the sections inside of the returned debug info is relevant to existing UIs, as they iterate the array, which happens in insertion order.
This patch presets each section at the start to ensure that the ordering remains consistent even as code within the method is rearranged. As the mini-project progresses, this assignment will be the final place all the sections are referenced.
Developed in https://github.com/WordPress/wordpress-develop/pull/7289
Discussed in https://core.trac.wordpress.org/ticket/61648
Props apermo, dmsnell, sergeybiryukov.
See #61648.
git-svn-id: https://develop.svn.wordpress.org/trunk@58996 602fd350-edb4-49c9-b593-d223f7449a82
The `pop_until( $tag_name )` method in the stack of open elements should only be examining HTML elements, but it has only been checking the tag name. This has led to closing the wrong tags when run from inside foreign content. A very specific situation where this may arise is when a `TEMPLATE` closer is found inside foreign content, inside another template.
{{{
HTML:template SVG:template HTML:/template
<template><svg><template><foreignObject><div></template><div>
╰──< this outer TEMPLATE is closed by this one >───╯
}}}
This patch constains the method to checking for elements matching the tag name which are in the HTML namespace so that the proper detection occurs.
Developed in https://github.com/WordPress/wordpress-develop/pull/7286
Discussed in https://core.trac.wordpress.org/ticket/61576
Follow-up to [58867].
Props dmsnell, jonsurrell.
See #61576.
git-svn-id: https://develop.svn.wordpress.org/trunk@58992 602fd350-edb4-49c9-b593-d223f7449a82
The HTML API has been behaving as if CSS class name selectors matched class names in an ASCII case-insensitive manner. This is only true if the document in question is set to quirks mode. Unfortunately most documents processed will be set to no-quirks mode, meaning that some CSS behaviors have been matching incorrectly when provided with case variants of class names.
In this patch, the CSS methods have been audited and updated to adhere to the rules governing ASCII case sensitivity when matching classes. This includes `add_class()`, `remove_class()`, `has_class()`, and `class_list()`. Now, it is assumed that a document is in no-quirks mode unless a full HTML parser infers quirks mode, and these methods will treat class names in a byte-for-byte manner. Otherwise, when a document is in quirks mode, the methods will compare the provided class names against existing class names for the tag in an ASCII case insensitive way, while `class_list()` will return a lower-cased version of the existing class names.
The lower-casing in `class_list()` is performed for consistency, since it's possible that multiple case variants of the same comparable class name exists on a tag in the input HTML.
Developed in https://github.com/WordPress/wordpress-develop/pull/7169
Discussed in https://core.trac.wordpress.org/ticket/61531
Props dmsnell, jonsurrell.
See #61531.
git-svn-id: https://develop.svn.wordpress.org/trunk@58985 602fd350-edb4-49c9-b593-d223f7449a82
Add the `OPTIONS /wp/v2/pages` route to the list. The request is made via the `useBlockEditorSettings` hook at the top of the editor React tree. Preloading should improve the editor's loading time.
Avoid hardcoding paths for the 'attachment' post type; use the `rest_get_route_for_post_type_items` helper method instead.
Props mamaduka, noisysocks.
See #61884.
git-svn-id: https://develop.svn.wordpress.org/trunk@58984 602fd350-edb4-49c9-b593-d223f7449a82
This adds a guard to verify the result of `get_post_type_object()` before retrieving the `all_items` label, as the function returns `null` if the post type does not exist.
Follow-up to [24527].
Props pcarvalho, akshat280, mukesh27, SergeyBiryukov.
Fixes#60947.
git-svn-id: https://develop.svn.wordpress.org/trunk@58983 602fd350-edb4-49c9-b593-d223f7449a82
Exclude links from activating the comment submission shortcut.
[45790] introduced a shortcut to submit comment forms using `Ctrl/Cmd + Enter`. This keyboard combination is also the combination for opening a link in a new tab, which resulted in submitting the form when using the Log Out or Edit Profile links.
Props greentreefrog, sabernhardt, narenin.
Fixes#61919.
git-svn-id: https://develop.svn.wordpress.org/trunk@58981 602fd350-edb4-49c9-b593-d223f7449a82
Improves the `'admin_bar_menu'` docblock by adding recommendations for customizing / changing existing items.
It also improves the `wp_admin_bar_render()` function's docblock by removing the "most optimal point" sentence.
The [58748] changeset moved the user menu to a higher priority level (of `9991`) to achieve:
>so nodes added with higher priorities will still be shown visually before the user and recovery menu items, as they were prior to [58215].
When hooking into `'admin_bar_menu'` with a priority level less than 9991 and attempting to get the `'my-account'` node, `null` is returned. While the preferred approach is to hook into `'wp_before_admin_bar_render'`, the documentation of the `'admin_bar_menu'` action was previously misleading.
Follow-up to [58748], [58759].
Props michaelwp85, narenin, sabernhardt, joedolson, costdev, jorbin, hellofromTonya, mukesh27, pbiron.
Fixes#61738.
git-svn-id: https://develop.svn.wordpress.org/trunk@58978 602fd350-edb4-49c9-b593-d223f7449a82
In [57715], headings on the About pages were given `text-wrap: balance`. This rule causes unexpected breaks in non-latin langauges, e.g., Japanese, Korean. This fix sets the text-wrap to `pretty` for browsers that support it, and uses `balance` for English-only.
Props akshat2802, wildworks, ryelle, sabernhardt, hellofromTonya.
Fixes#60892.
git-svn-id: https://develop.svn.wordpress.org/trunk@58976 602fd350-edb4-49c9-b593-d223f7449a82
It is recommended that for every option it is explicitly set whether to autoload it or not. This changeset updates relevant `update_option()` and `add_option()` calls.
Note that the `$autoload` parameter is only needed for `update_option()` if the option is potentially not present yet, i.e. the call will pass through to `add_option()`. Since WordPress core adds the majority of its options to the database during installation, only `update_option()` calls for dynamically added options need to be modified, which is what this changeset does.
As part of revisiting the autoload values for dynamically added WordPress core options, this changeset modifies some options to no longer be autoloaded, since they are only accessed in a few specific places that are not relevant for a regular request. These options are:
* `recently_activated`
* `_wp_suggested_policy_text_has_changed`
* `{upgradeLock}.lock`
* `dashboard_widget_options`
* `ftp_credentials`
* `adminhash`
* `nav_menu_options`
* `wp_force_deactivated_plugins`
* `delete_blog_hash`
* `allowedthemes`
* `{sessionId}_paused_extensions`
* `recovery_keys`
* `https_detection_errors`
* `fresh_site`
An upgrade routine is present as well that sets those options to no longer autoload for existing sites.
Props pbearne, flixos90, mukesh27, swissspidy, SergeyBiryukov, joemcgill, adamsilverstein.
Fixes#61103.
git-svn-id: https://develop.svn.wordpress.org/trunk@58975 602fd350-edb4-49c9-b593-d223f7449a82
A common use-case for the 'wp_get_loading_optimization_attributes' filter is to modify attributes based on the 'src' attribute. However, the `wp_img_tag_add_loading_optimization_attrs()` was not passing that attribute to the function as expected, which would make such usage of the filter unreliable. This changeset ensures the 'src' attribute is also passed in this scenario. All other calls to `wp_get_loading_optimization_attributes()` already included the attribute.
Props deepakrohilla, prestonwordsworth, mukesh27, adamsilverstein, joemcgill, flixos90.
Fixes#61436.
See #58893.
git-svn-id: https://develop.svn.wordpress.org/trunk@58974 602fd350-edb4-49c9-b593-d223f7449a82
Introduces a filter to the `block_bindings_source_value` to allow developers to
modify the value returned by any block binding source.
Props snehapatil02, cbravobernal, gziolo, santosguillamot, bacoords, codersantosh.
Fixes#61181.
git-svn-id: https://develop.svn.wordpress.org/trunk@58972 602fd350-edb4-49c9-b593-d223f7449a82
The `html5lib-tests` suite skips a number of tests due to unsupported markup. At the moment, these tests all report "Test includes unsupported markup." This patch calls the `get_unsupported_exception()` method in these skipped cases to improve the messages reported to PHPUnit so they're more informative: e.g. "Unsupported markup: Foster parenting is not supported."
Developed in https://github.com/WordPress/wordpress-develop/pull/7285
Discussed in https://core.trac.wordpress.org/ticket/61646
Follow-up to [58714].
Props dmsnell, jonsurrell.
See #61646.
git-svn-id: https://develop.svn.wordpress.org/trunk@58971 602fd350-edb4-49c9-b593-d223f7449a82
HTML parsing rules at times differentiate character tokens that are all null bytes, all whitespace, or other content. This patch introduces a new function which may be used to classify text node sub-regions and lead to more efficient application of these parsing rules.
Further, when classified in this way, application code may skip some rules and decoding entirely, improving performance. For example, this can be used to ease the implementation of skipping inter-element whitespace, which is usually not rendered.
Developed in https://github.com/WordPress/wordpress-develop/pull/7236
Discussed in https://core.trac.wordpress.org/ticket/61974
Props dmsnell, jonsurrell.
Fixes#61974.
git-svn-id: https://develop.svn.wordpress.org/trunk@58970 602fd350-edb4-49c9-b593-d223f7449a82