Commit Graph

138 Commits

Author SHA1 Message Date
Pascal Birchler
2a334ede98 Editor: Simplify sanitization code path in WP_Theme_JSON after [57496]
Removes the custom `WP_Theme_JSON::is_assoc()` method again in favor of the existing `wp_is_numeric_array()` helper function.

Props mmaattiiaass, costdev, swissspidy, spacedmonkey.
Fixes #60360.
Built from https://develop.svn.wordpress.org/trunk@57751


git-svn-id: http://core.svn.wordpress.org/trunk@57252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-02 13:41:05 +00:00
Pascal Birchler
29a2c3a05a Editor: add shadow.defaultPresets to appearance tools opt-ins.
Props madhudollu.
Fixes #60633.
Built from https://develop.svn.wordpress.org/trunk@57717


git-svn-id: http://core.svn.wordpress.org/trunk@57218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-27 10:22:11 +00:00
youknowriad
9f0595ab4a Editor: Check for null values in Theme JSON to cater for blockGap.
When resolving theme.json preset variables, add a check to make sure the value is not empty before we run it through strpos() and preg_match_all().

Props ramonopoly, mukesh27, get_dave.
Fixes #60613.
Built from https://develop.svn.wordpress.org/trunk@57716


git-svn-id: http://core.svn.wordpress.org/trunk@57217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-27 10:15:13 +00:00
youknowriad
8f1ccc91ae Editor: Fix block style variation selector generation.
These changes fix the generation of selectors for block style variations. Previously, an incorrect CSS selector could be generated if the block's base selector used an element tag etc.

Props aaronrobertshaw, youknowriad, mukesh27.
Fixes #60453.
Built from https://develop.svn.wordpress.org/trunk@57547


git-svn-id: http://core.svn.wordpress.org/trunk@57048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-07 08:53:13 +00:00
youknowriad
e28108b73e Editor: Sanitize nested array in theme.json properly.
WP_Theme_JSON sanitization is now able to sanitize data contained on indexed arrays. 
So certain data from theme.json, for example, settings.typography.fontFamilies which is a JSON array will be sanitized.

Props mmaattiiaass, mukesh27.
Fixes #60360.
Built from https://develop.svn.wordpress.org/trunk@57496


git-svn-id: http://core.svn.wordpress.org/trunk@56997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-31 10:55:10 +00:00
isabel_brison
2140b001bd Editor: introduce dimensions.aspectRatio block support.
Adds front end rendering logic for the `dimensions.aspectRatio` block support as well as the required logic in `WP_Theme_JSON` and the style engine.

Props andrewserong.
Fixes #60365.

Built from https://develop.svn.wordpress.org/trunk@57491


git-svn-id: http://core.svn.wordpress.org/trunk@56992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-31 02:54:17 +00:00
isabel_brison
04eb7ecf30 Editor: reduce specificity of block style variation selector.
Removes duplicate classname from the block style variation selector generated in `WP_Theme_JSON`’s `get_blocks_metadata` function.

Props flixos90, joemcgill, mukesh27, isabel_brison.
Fixes #60312.

Built from https://develop.svn.wordpress.org/trunk@57490


git-svn-id: http://core.svn.wordpress.org/trunk@56991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-30 23:51:15 +00:00
youknowriad
02cdd7f047 Editor: Fix Theme.json application of custom root selector for styles.
Theme.json stylesheets attempting to use a custom root selector are generated with in correct styles.

Props aaronrobertshaw, get_dave, mukesh27.
Fixes #60343.
Built from https://develop.svn.wordpress.org/trunk@57352


git-svn-id: http://core.svn.wordpress.org/trunk@56858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-25 10:43:12 +00:00
youknowriad
7343352744 Editor: Unset reference used in foreach statement.
In PHP it is a good practice to unset $value if it was created by reference in a foreach loop, as the reference is still valid outside the loop, and this avoids accidental bugs.

Props get_dave.
Fixes #60326.
Built from https://develop.svn.wordpress.org/trunk@57340


git-svn-id: http://core.svn.wordpress.org/trunk@56846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-23 17:11:11 +00:00
isabel_brison
90088c4c92 Editor: add size and repeat to background image support.
Adds background size and background repeat style processing to the background image block support and `WP_Style_Engine` definitions.

Props andrewserong, mukesh27.
Fixes #60175.


Built from https://develop.svn.wordpress.org/trunk@57254


git-svn-id: http://core.svn.wordpress.org/trunk@56760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 06:12:18 +00:00
isabel_brison
d966a9f046 Editor: add setting to disable layout content and wide size controls.
Adds support for an `allowCustomContentAndWideSize` setting in `WP_Theme_JSON` valid settings.

Props andrewserong.
Fixes #60133.

Built from https://develop.svn.wordpress.org/trunk@57247


git-svn-id: http://core.svn.wordpress.org/trunk@56753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-08 06:23:14 +00:00
Sergey Biryukov
25a147845b I18N: Move code out of translatable strings in a few error messages.
Follow-up to [54272], [56101].

Props rabmalin, Presskopp.
Fixes #59563.
Built from https://develop.svn.wordpress.org/trunk@57135


git-svn-id: http://core.svn.wordpress.org/trunk@56646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-25 21:19:30 +00:00
isabel_brison
5951111cba Editor: fix incorrect block custom CSS output.
Fixes output of block custom CSS when multiple rules require a descendant selector.

Props wildworks, mikachan.
Fixes #59499.

Built from https://develop.svn.wordpress.org/trunk@56812


git-svn-id: http://core.svn.wordpress.org/trunk@56324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 03:43:22 +00:00
audrasjb
b5bddaa39d Editor: Fix wrong @since mention in remove_insecure_properties().
Follow-up to [56502].

See #59108.




Built from https://develop.svn.wordpress.org/trunk@56778


git-svn-id: http://core.svn.wordpress.org/trunk@56290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 19:03:26 +00:00
Sergey Biryukov
9bf6faff7c Editor: Reduce the use of the _wp_array_get() function to improve performance.
`_wp_array_get()` is an expensive function, and it's called thousands of times on each page view on the front end. While the function performance was slightly improved in #58376, it is still called more times than it should be.

This commit aims to further optimize its usage:
* In many cases, `_wp_array_get()` can be replaced with a much simpler and faster `isset()` check.
* The `isset()` function is capable of checking nested arrays, so `isset( $foo['a']['b']['c'] )` will return false even if `$foo['a']` is unset, without throwing any errors or warnings.
* When `_wp_array_get()` cannot be directly replaced with `isset()`, it would be good practice to wrap it in an `isset()` function so that `_wp_array_get()` only runs when it needs to.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/51116 #51116 Performance improvement: Reduce the use of the _wp_array_get() function]

Follow-up to [55851], [56382].

Props aristath, jrf, spacedmonkey, mukesh27, swissspidy, hellofromTonya.
Fixes #59405.
Built from https://develop.svn.wordpress.org/trunk@56709


git-svn-id: http://core.svn.wordpress.org/trunk@56221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 13:47:20 +00:00
isabel_brison
2f5d2da8f8 Editor: add lightbox setting.
Adds lightbox as a valid setting to `WP_Theme_JSON` class and as an image block setting in theme.json.

Props czapla, costdev, desrosj.
Fixes #59393.

Built from https://develop.svn.wordpress.org/trunk@56643


git-svn-id: http://core.svn.wordpress.org/trunk@56155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 06:35:20 +00:00
isabel_brison
9c827704be Editor: fix pattern alignment in editor view.
Adjusts root padding for synced patterns in the editor to avoid discrepancies with the front end view.

Props aaronrobertshaw, mukesh27.
Fixes  #59359.

Built from https://develop.svn.wordpress.org/trunk@56615


git-svn-id: http://core.svn.wordpress.org/trunk@56127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 01:45:21 +00:00
isabel_brison
82f6ce639b Editor: add background image support.
Adds a new background block support with the ability to set a background image on blocks that opt into it.

Props andrewserong, mukesh27.
Fixes #59357.

Built from https://develop.svn.wordpress.org/trunk@56614


git-svn-id: http://core.svn.wordpress.org/trunk@56126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 01:29:23 +00:00
isabel_brison
df3137aca1 Editor: add text orientation for blocks with typography support.
Adds a new text orientation option to the typography block support, implemented with CSS writing-mode.

Props poena.
Fixes #59306.

Built from https://develop.svn.wordpress.org/trunk@56605


git-svn-id: http://core.svn.wordpress.org/trunk@56117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 06:49:20 +00:00
Sergey Biryukov
e5490118af Coding Standards: Include one space after function keyword for closures.
Note: This is enforced by WPCS 3.0.0.

Reference: [https://github.com/WordPress/WordPress-Coding-Standards/pull/2328 WPCS: PR #2328 Core: properly check formatting of function declaration statements].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56559


git-svn-id: http://core.svn.wordpress.org/trunk@56071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-12 15:23:18 +00:00
Sergey Biryukov
b80ce60f70 Coding Standards: Use pre-increment/decrement for stand-alone statements.
Note: This is enforced by WPCS 3.0.0:

1. There should be no space between an increment/decrement operator and the variable it applies to.
2. Pre-increment/decrement should be favoured over post-increment/decrement for stand-alone statements. “Pre” will in/decrement and then return, “post” will return and then in/decrement. Using the “pre” version is slightly more performant and can prevent future bugs when code gets moved around.

References:
* [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#increment-decrement-operators WordPress PHP Coding Standards: Increment/decrement operators]
* [https://github.com/WordPress/WordPress-Coding-Standards/pull/2130 WPCS: PR #2130 Core: add sniffs to check formatting of increment/decrement operators]

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56549


git-svn-id: http://core.svn.wordpress.org/trunk@56061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-09 09:28:26 +00:00
isabel_brison
b7439d5712 Editor: tweak root padding styles.
Removes root padding from children of flex and grid layout blocks when root padding aware alignments are set.

Props andrewserong, ramonopoly.
Fixes #59295.

Built from https://develop.svn.wordpress.org/trunk@56546


git-svn-id: http://core.svn.wordpress.org/trunk@56058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 00:51:18 +00:00
isabel_brison
43a50913d6 Editor: performance enhancements to class-wp-theme-json.
Removes unnecessary sanitisation of hardcoded strings and avoids looping over style presets without classes or variables.

Props flixos90.
Fixes #59304.

Built from https://develop.svn.wordpress.org/trunk@56545


git-svn-id: http://core.svn.wordpress.org/trunk@56057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 00:26:21 +00:00
isabel_brison
4b87f197f4 Editor: allow disabling layout controls.
Adds the ability to disable layout controls on a per-block level from theme.json.

Props mukesh27.
Fixes #59294.

Built from https://develop.svn.wordpress.org/trunk@56534


git-svn-id: http://core.svn.wordpress.org/trunk@56046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 01:05:19 +00:00
isabel_brison
5db3477859 Editor: Preserve block style variations when securing theme.
Adds the ability to process block style variations to the `remove_insecure_properties` function of theme json class.

Props dsas, ramonopoly.
Fixes #59108.

Built from https://develop.svn.wordpress.org/trunk@56502


git-svn-id: http://core.svn.wordpress.org/trunk@56014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 02:53:19 +00:00
John Blackbourn
4667b9323f Docs: Miscellaneous docblock corrections and improvements.
See #58833

Built from https://develop.svn.wordpress.org/trunk@56414


git-svn-id: http://core.svn.wordpress.org/trunk@55926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 17:29:20 +00:00
Felix Arntz
268203f8aa Editor: Simplify usage of block_has_support() function by supporting a string.
Most block feature checks are for a single feature string, and for such cases it is not intuitive to require an array for the `$feature` parameter of the `block_has_support()` function.

This changeset brings it in line with other functions like `post_type_supports()`, allowing to pass a string for the `$feature`. An array is still supported for more complex cases where support for sub-features needs to be determined. This change furthermore includes a very minor performance tweak by avoiding calls to the `_wp_array_get()` function if a single feature string is being checked for.

Props thekt12, nihar007, mukesh27, swissspidy.
Fixes #58532.

Built from https://develop.svn.wordpress.org/trunk@56382


git-svn-id: http://core.svn.wordpress.org/trunk@55894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 16:48:19 +00:00
Felix Arntz
e80768e045 Themes: Use isset instead of array_key_exists in WP_Theme_JSON class.
With the minimum PHP version requirement raised to 7.0, we can now use `isset` on constants that are arrays. Since `isset` is slightly faster than `array_key_exists` (and the different handling of `null` values is irrelevant for the updates here), remaining instances of `array_key_exists` in the `WP_Theme_JSON` class are replaced in this changeset.

Props soean.
Fixes #57067.

Built from https://develop.svn.wordpress.org/trunk@56345


git-svn-id: http://core.svn.wordpress.org/trunk@55857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 20:31:25 +00:00
audrasjb
17f0e47798 General: Fix an error introduced in [56179].
Follow-up to [56179].

Unprops audrasjb.



Built from https://develop.svn.wordpress.org/trunk@56181


git-svn-id: http://core.svn.wordpress.org/trunk@55693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 22:17:22 +00:00
audrasjb
90dadb1457 Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178].

Props costdev, audrasjb.
See #58459.



Built from https://develop.svn.wordpress.org/trunk@56179


git-svn-id: http://core.svn.wordpress.org/trunk@55691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 21:40:23 +00:00
isabel_brison
3de83926d6 Editor: update duotone support.
Updates duotone support after stabilisation of selectors API and adds a few small code quality and UI improvements.

Props onemaggie, peterwilsoncc, ajlende, audrasjb, mikeschroder, ramonopoly.
Fixes #58555.

Built from https://develop.svn.wordpress.org/trunk@56101


git-svn-id: http://core.svn.wordpress.org/trunk@55613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-29 06:21:28 +00:00
isabel_brison
c4cb9b82ad Editor: add Post Template fallback styles.
Adds fallback styles necessary for classic themes to display the correct Post Template layout.

Props mikeschroder, ramonopoly.
Fixes #58570.

Built from https://develop.svn.wordpress.org/trunk@56083


git-svn-id: http://core.svn.wordpress.org/trunk@55595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-28 03:49:27 +00:00
isabel_brison
d9e41aa9e9 Editor: refactor and stabilize selectors API.
Restructures the block.json selectors API by moving `__experimentalSelector` props into their own config, stabilizing the selectors API, and enabling more flexible styling options.

Props ramonopoly, spacedmonkey, aaronrobertshaw, onemaggie.
Fixes #58586.

Built from https://develop.svn.wordpress.org/trunk@56058


git-svn-id: http://core.svn.wordpress.org/trunk@55570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 08:48:24 +00:00
isabel_brison
2e2aea02c2 Editor: stabilise layout and refactor definitions.
Marks the layout support stable and moves layout definitions from `theme.json` into `wp-includes/block-supports/layout.php`.

Props andrewserong, poena, ramonopoly, peterwilsoncc.
Fixes #58550.

Built from https://develop.svn.wordpress.org/trunk@56055


git-svn-id: http://core.svn.wordpress.org/trunk@55567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 07:25:22 +00:00
audrasjb
ddd50e3782 Editor: Add a description key to theme.json style variations.
This changeset adds `description` to `VALID_TOP_LEVEL_KEYS` in `class-wp-theme-json.php` to allow for accessibility improvements. The description is added to 
the ARIA label of the style variation container. If the style variation has no description, only the title is used. One purpose is to use the text description 
to improve the style variation preview in the WordPress.org theme directory.

See https://github.com/WordPress/gutenberg/pull/45242.

Props ramonopoly, poena.
Fixes #58614.

 --Cette ligne, et les suivantes ci-dessous, seront ignorées--

M    trunk/src/wp-includes/class-wp-theme-json.php

Built from https://develop.svn.wordpress.org/trunk@56041


git-svn-id: http://core.svn.wordpress.org/trunk@55553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 18:15:22 +00:00
Weston Ruter
33f71c4662 Editor: Use static closures to avoid memory leaks.
Backports Gutenberg changes from https://github.com/WordPress/gutenberg/pull/50723.

Amends [55822].

Fixes #58323.
Props westonruter, spacedmonkey, flixos90. 

Built from https://develop.svn.wordpress.org/trunk@56038


git-svn-id: http://core.svn.wordpress.org/trunk@55550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 17:00:25 +00:00
isabel_brison
2fbd7aeb8f Editor: add support for block-level link hover colors.
Adds the ability to set link hover colors for individual blocks from the block inspector color panel.

Props @youknowriad, @peterwilsoncc, @kebbet.
Fixes #58575.

Built from https://develop.svn.wordpress.org/trunk@56028


git-svn-id: http://core.svn.wordpress.org/trunk@55540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 01:15:21 +00:00
Sergey Biryukov
b916b71dde Code Modernization: Use str_starts_with() in WP_Theme_JSON class methods.
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
2023-06-22 14:14:25 +00:00
oandregal
f3ea3c57cb wp_get_global_styles: allow transforming the CSS Custom Properties into the values they represent.
Props samnajian, ramonopoly, isabel_brison.
Fixes #58588.

Built from https://develop.svn.wordpress.org/trunk@55986


git-svn-id: http://core.svn.wordpress.org/trunk@55498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 08:44:26 +00:00
isabel_brison
2183172222 Editor: add text columns to typography support.
Adds a text columns feature to the typography block support that uses CSS `column-count` for multi-column text.

Props ramonopoly, aaronrobertshaw.
Fixes #58549.

Built from https://develop.svn.wordpress.org/trunk@55985


git-svn-id: http://core.svn.wordpress.org/trunk@55497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 08:18:19 +00:00
isabel_brison
cf320a85d3 Editor: add grid layout type
Add a new `grid` type to the layout block support.

Props andrewserong, costdev, ramonopoly.
Fixes #58554.

Built from https://develop.svn.wordpress.org/trunk@55975


git-svn-id: http://core.svn.wordpress.org/trunk@55487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 04:06:26 +00:00
oandregal
99715f5751 wp_get_global_styles: return the standard format for CSS Custom Properties.
Props samnajian, hellofromtonya, isabel_brison.
Fixes #58467.

Built from https://develop.svn.wordpress.org/trunk@55959


git-svn-id: http://core.svn.wordpress.org/trunk@55471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 07:56:18 +00:00
isabel_brison
06beef84d5 Editor: revert add grid layout type
Reverting the previous commit because it causes e2e to fail on trunk.

See #58554.

Built from https://develop.svn.wordpress.org/trunk@55958


git-svn-id: http://core.svn.wordpress.org/trunk@55470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 06:58:18 +00:00
isabel_brison
03f5a6e91d Editor: add grid layout type
Add a new `grid` type to the layout block support.

Props andrewserong, costdev, ramonopoly.
Fixes #58554.

Built from https://develop.svn.wordpress.org/trunk@55957


git-svn-id: http://core.svn.wordpress.org/trunk@55469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 05:56:21 +00:00
isabel_brison
49aa42f3b6 Editor: update layout classnames and specificity.
Adds a compound layout classname and reduces layout spacing rule specificity.

Props ramonopoly, andrewserong, poena.
Fixes #58548.

Built from https://develop.svn.wordpress.org/trunk@55956


git-svn-id: http://core.svn.wordpress.org/trunk@55468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 05:32:19 +00:00
Felix Arntz
ae515caebf Editor: Introduce WP_Theme_JSON::prepend_to_selector() to improve code quality and performance.
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
2023-06-20 17:54:19 +00:00
isabel_brison
ae884fdc62 General: fix overridden typos.
Fixes two typos in `class-wp-theme-json`.

Props Aristath, nihar007, kapilpaul, oandregal, krupalpanchal.
Fixes #58464.

Built from https://develop.svn.wordpress.org/trunk@55945


git-svn-id: http://core.svn.wordpress.org/trunk@55457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-20 04:59:18 +00:00
oandregal
ddc2c454be Fix lint issues in WP_Theme_JSON::sanitize method.
Add @since tag and indent the parameter properly.

Props mukesh27.
Fixes #58462.


Built from https://develop.svn.wordpress.org/trunk@55915


git-svn-id: http://core.svn.wordpress.org/trunk@55427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-14 10:46:19 +00:00
oandregal
86bad3cdf6 Ignore unregistered block style variations from theme.json.
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
2023-06-14 07:42:19 +00:00
spacedmonkey
a56a09c4ba Editor: Improve the append_to_selector method.
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
2023-06-12 11:22:23 +00:00