This changeset modifies `WP_HTML_Processor::create_fragment( $html, $context )` to use a full processor and `create_fragment_at_node` instead of the other way around. This makes more sense and makes the main factory methods more clear, where the state required for fragments is set up in `create_fragment_at_node` instead of in both `create_fragment` and `create_fragment_at_current_node`.
This allows for more HTML contexts to be provided to the basic `create_fragment` where the provided context HTML is appended to `<!DOCTYPE html>`, a full processor is created, the last tag opener is found, and a fragment parser is created at that node via `create_fragment_at_current_node`.
The HTML5lib tests are updated accordingly to use this new method to create fragments.
Props jonsurrell, dmsnell, bernhard-reiter.
Fixes#62584.
Built from https://develop.svn.wordpress.org/trunk@59467
git-svn-id: http://core.svn.wordpress.org/trunk@58853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The file could declare its own `$theme` variable, which would override the one used in the `foreach` loop.
To prevent this, call `wp_get_theme()` before loading the file and store the instance in a different variable.
Props neo2k23, swissspidy.
See #62244.
Built from https://develop.svn.wordpress.org/trunk@59466
git-svn-id: http://core.svn.wordpress.org/trunk@58852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses two instances of the (numeric string) `gmdate( 'Z' )` being added to an `int` value.
Affected functions:
* `upgrade_110()`
* `WP_Date_Query::validate_date_values()`
Follow-up to [942], [29925], [45424].
Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59465
git-svn-id: http://core.svn.wordpress.org/trunk@58851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a missing "D" in the character list used by strspn to find tag openers, causing tags starting with D to be skipped by the tag processor in some circumstances.
Follow-up to [58613].
Props jonsurrell, santosguillamot, wongjn, cbravobernal.
Fixes#62522.
Built from https://develop.svn.wordpress.org/trunk@59464
git-svn-id: http://core.svn.wordpress.org/trunk@58850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses two instances of the (numeric string) return value from `wp_count_terms()` being used directly in `ceil()`, which expects an `int|float`.
Affected methods:
* `WP_Sitemaps_Taxonomies::get_max_num_pages()`
* `wp_nav_menu_item_taxonomy_meta_box()`
Reference: [https://www.php.net/manual/en/function.ceil.php PHP Manual: ceil()].
Follow-up to [14248], [14291], [14569], [14943], [48072], [57648].
Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59462
git-svn-id: http://core.svn.wordpress.org/trunk@58848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In #34114, just-in-time (JIT) translation loading was implemented for projects hosted on WordPress.org. This is now expanded to all other plugins/themes.
Projects with a custom `Text Domain` and `Domain Path` header no longer need to call `load_plugin_textdomain()` or `load_theme_textdomain()`.
This reduces the risk of calling them too late, after some translation calls already happened, and generally makes it easier to properly internationalize a plugin or theme.
This moves the `get_plugin_data()` from `wp-admin/includes/plugin.php` to `wp-includes/functions.php` so it's available during the plugin loading process.
Props swissspidy.
Fixes#62244.
Built from https://develop.svn.wordpress.org/trunk@59461
git-svn-id: http://core.svn.wordpress.org/trunk@58847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
If sending an auto update email to the site administrator's email address, look up if a user with the same email exists and switch to that user's locale. If not, explicitly switches to the site locale.
This is a follow-up to [59128] where this was previously added for other types of emails.
Props benniledl, swissspidy.
Fixes#62496.
Built from https://develop.svn.wordpress.org/trunk@59460
git-svn-id: http://core.svn.wordpress.org/trunk@58846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
It is possible to supply a set of default query `args` to `register_taxonomy()` which will be used when querying a list of terms -- for example, `orderby` in order to specify how the resulting list of terms should be sorted.
The Terms REST API controller previously respected these default query args only if the request included a post ID. This changeset makes it so that the default args will also be respected if no post ID is provided.
Props bernhard-reiter, jsnajdr.
Fixes#62500.
Built from https://develop.svn.wordpress.org/trunk@59458
git-svn-id: http://core.svn.wordpress.org/trunk@58844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates `WP_Theme_JSON::get_svg_filters()` to use `WP_Duotone::get_filter_svg_from_preset()` instead of the `wp_get_duotone_filter_svg()` function, deprecated in WordPress 6.3.
Follow-up to [52757], [56101].
Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59455
git-svn-id: http://core.svn.wordpress.org/trunk@58841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This addresses two instances where a function that is documented as returning `{someType}|null` doesn't explicitly return `null`.
Affected functions:
* `array_key_first()`
* `WP_REST_Posts_Controller::handle_terms()`
Follow-up to [38832], [52038].
Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59453
git-svn-id: http://core.svn.wordpress.org/trunk@58839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This extracts the logic responsible for parsing the `.version-support-*.json` files and returning a list of supported PHP and MySQL versions for a given branch of WordPress into a reusable workflow so that other workflows can make use of the functionality without repeating code.
See #62221.
Built from https://develop.svn.wordpress.org/trunk@59452
git-svn-id: http://core.svn.wordpress.org/trunk@58838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a new function, `wp_render_empty_block_template_warning`, that renders a warning for logged-in users when a block template is empty.
Reviewed by get_dave, richtabor.
Props vcanales, mikachan, peterwilsoncc, richtabor, get_dave, mrfoxtalbot, matveb, arielmaidana, seifradwane, annezazu.
Fixes#62053.
Built from https://develop.svn.wordpress.org/trunk@59449
git-svn-id: http://core.svn.wordpress.org/trunk@58835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
HTML Fragment parsing always happens with a context node, which may impact how a fragment of HTML is parsed. HTML Fragment Processors can be instantiated with a `BODY` context node via `WP_HTML_Processor::create_fragment( $html )`.
This changeset adds a static method called `create_fragment_at_current_node( string $html_fragment )`. It can only be called when the processor is paused at a `#tag`, with some additional constraints:
- The opening and closing tags must appear in the HTML input (no virtual tokens).
- No "self-contained" elements are allowed ( `IFRAME`, `SCRIPT`, `TITLE`, etc.).
If successful, the method will return a `WP_HTML_Processor` instance whose context is inherited from the node that the method was called from.
Props jonsurrell, bernhard-reiter, gziolo.
Fixes#62357.
Built from https://develop.svn.wordpress.org/trunk@59444
git-svn-id: http://core.svn.wordpress.org/trunk@58830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Moving the comments directly above `wp.i18n._x()` so that they can be picked up properly.
* Simplifying the context to avoid unnecessarily translating the string twice for the same use case.
* Using the established translator comments format for consistency.
Follow-up to [59428].
See #62402.
Built from https://develop.svn.wordpress.org/trunk@59431
git-svn-id: http://core.svn.wordpress.org/trunk@58817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When `load_*_textdomain()` functions are called after WordPress has already attempted just-in-time loading of translations, nothing happens.
This updates the related logic to retry translation loading when a custom path is set to ensure all translations are available.
Additionally, this also fixes cases where an `en_US.mo` file is provided with non-English strings to override the default language.
Follow up to [59157].
Props swissspidy, peterwilsoncc, desrosj, apermo, sergeybiryukov, wildworks, tigriweb, twvania, looswebstudio, stimul, audrasjb, finntown, bluantinoo, timwhitlock, albigdd.
See #62337.
Built from https://develop.svn.wordpress.org/trunk@59430
git-svn-id: http://core.svn.wordpress.org/trunk@58816 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improvements were made in 6.7 to ensure that salts stored in the database were primed more efficiently.
The logic added to accomplish this suffered from an edge case where array indexes were unexpectedly missing when `wp_salt()` was called recursively.
Follow up to [58837].
Props juliobox, ankitkumarshah, dilipbheda, johnbillion, joemcgill, desrosj.
Fixes#62424.
Built from https://develop.svn.wordpress.org/trunk@59427
git-svn-id: http://core.svn.wordpress.org/trunk@58813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The Learn WordPress website is supposed to automatically redirect to the correct locale according to the browser's language settings, however that may not work as expected in some cases.
This commit brings consistency with the other WordPress.org links, which can be localized as appropriate.
Follow-up to [56720].
Props timse201, ruturajraval2305, yogeshbhutkar, ajayghaghretiya-multidots, swissspidy, sabernhardt, im3dabasia1, mukesh27.
Fixes#62459.
Built from https://develop.svn.wordpress.org/trunk@59425
git-svn-id: http://core.svn.wordpress.org/trunk@58811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [59138], the login screens were updated to change the `h1` heading from the logo to screen-reader hidden text. Along with that HTML change, we changed the CSS selectors from `.login h1` to `.login .wp-login-logo`. This unnecessary change increased specificity and broke the CSS selectors used by a wide variety of plugins to replace the login logo.
Commit reverts the change in selector back to using the `.login h1` pattern.
Props leecollings, sabernhardt, im3dabasia1, roytanck, sailpete, joedolson.
Fixes#62410.
Built from https://develop.svn.wordpress.org/trunk@59424
git-svn-id: http://core.svn.wordpress.org/trunk@58810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In the Modern color scheme, the font color on hover in the admin bar is bright green. However, in the WordPress.org site itself, the color used is Blueberry 2. This commits aligns both colors on the more balanced Blueberry color.
Props fushar, Joen.
Fixes#62219.
Built from https://develop.svn.wordpress.org/trunk@59419
git-svn-id: http://core.svn.wordpress.org/trunk@58805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
An `$include_node_paths_only` option to `get_block_nodes()` was introduced to improve performance.
When set to `true`, this option tells the function to only return paths, and not selectors, for consumers that only needed paths to style values.
For one of the conditional blocks, block style variations wasn't included.
This commit adds them to the array of paths following the existing model `$node[]['path' => [], 'variations' => ['path' => []]]`.
Follow-up to [61858].
Props aaronrobertshaw, ramonopoly.
Fixes #62399.
Built from https://develop.svn.wordpress.org/trunk@59418
git-svn-id: http://core.svn.wordpress.org/trunk@58804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Based on the user agent stylesheet rules outlined in https://html.spec.whatwg.org/multipage/rendering.html#img-contain-size, images that have `sizes=auto` while applying `width: auto` or `width: fit-content` would be constrained to only 300px width.
This changeset overrides said user agent stylesheet rule with a much larger constraint, to avoid the problem.
Additionally, it introduces a filter `wp_img_tag_add_auto_sizes` which can be used to opt out of the functionality, as an additional measure.
Props joemcgill, flixos90, dooperweb, SirLouen, azaozz, mukesh27, apermo.
Fixes#62413.
See #61847, #62345.
Built from https://develop.svn.wordpress.org/trunk@59415
git-svn-id: http://core.svn.wordpress.org/trunk@58801 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Support for uploading AVIF was added in [57524]. A new block of conditional logic was added determine which function should be used to create the new image file that resulted in these expensive functions being run twice.
This combines the two conditional logic to ensure the appropriate function is only run once regardless of format.
Props adamsilverstein, glynnquelch.
Fixes#62331.
Built from https://develop.svn.wordpress.org/trunk@59413
git-svn-id: http://core.svn.wordpress.org/trunk@58799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Changeset [59399] fixed missing DOCTYPEs in normalized HTML output. It missed an edge case where public and system identifiers may contain double quotes, in which case they must be quoted with single quotes.
This commit addresses that issue and adds tests.
Follow-up to [59399].
Props jonsurrell, luisherranz, apermo.
Fixes#62396.
Built from https://develop.svn.wordpress.org/trunk@59410
git-svn-id: http://core.svn.wordpress.org/trunk@58796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adjust some CSS characteristics in the customizer accordions to avoid a slight horizontal scroll, allow the chevron icon to be part of the clickable control surface, and resolve a pre-existing padding issue allowing overflow on accordion headings.
Follow up to [59224].
Props laurelfulford, wildworks, domainsupport, sabernhardt, rcreators, desrosj, sainathpoojary.
Fixes#62313, #62335.
Built from https://develop.svn.wordpress.org/trunk@59409
git-svn-id: http://core.svn.wordpress.org/trunk@58795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Wrapping long lines for better readability.
* Bringing some consistency to the placement of `href` and `aria-label` attributes.
* Adding missing `aria-label` attributes for Live Preview links.
Follow-up to [26726], [52020], [51083].
Props patelketan, sainathpoojary, SergeyBiryukov.
Fixes#62405.
Built from https://develop.svn.wordpress.org/trunk@59400
git-svn-id: http://core.svn.wordpress.org/trunk@58786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Output DOCTYPE when calling `WP_HTML_Processor::serialize` on a full document that includes a DOCTYPE.
The DOCTYPE should be included in the serialized/normalized HTML output as it has an impact in how the document is handled, in particular whether the document should be handled in quirks or no-quirks mode.
This only affects the serialization of full parsers at this time because DOCTYPE tokens are currently ignored in all possible fragments. The omission of the DOCTYPE is subtle but can change the serialized document's quirks/no-quirks mode.
Props jonsurrell.
Fixes#62396.
Built from https://develop.svn.wordpress.org/trunk@59399
git-svn-id: http://core.svn.wordpress.org/trunk@58785 1a063a9b-81f0-0310-95a4-ce76da25c4cd