Commit Graph

2377 Commits

Author SHA1 Message Date
Sergey Biryukov
2ec23a82ed Code Modernization: Replace usage of strpos() with str_starts_with().
`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
2023-05-02 15:45:22 +00:00
Andrew Ozz
b1a6d31cfe Script Loader: Improve code style and readability in _wp_normalize_relative_css_links().
Props: westonruter.
See: 58069.
Built from https://develop.svn.wordpress.org/trunk@55669


git-svn-id: http://core.svn.wordpress.org/trunk@55181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-21 03:13:22 +00:00
Weston Ruter
189c1ee49a Script Loader: Optimize performance of _wp_normalize_relative_css_links() by more than 2x.
* Replace `preg_match_all()` and its secondary `str_replace()` call with `preg_replace_callback()`.
* Fix case where paths beginning with `http` and `https` (but not `http:` and `https:`) were erroneously not counted as relative.
* Improve code style and readability by consolidating conditions and returning once.
* Use `str_starts_with()` consistently instead of `strpos()`.

Follow-up to [52036], [52695], and [52754].

Fixes #58069.
See #54243.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-19 01:26:28 +00:00
Peter Wilson
a0de188b5d Script Loader: Remove unused wp-nux CSS dependency.
Neither `wp-edit-post` nor `wp-editor` use the styles included in the `wp-nux` CSS file. This removes nux as a dependency from the registration of the two files.

Props flixos90, youknowriad, peterwilsoncc.
Fixes #57827.
See #57643.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-04 23:37:20 +00:00
spacedmonkey
dd5f6c7b10 Script Loader: Return early in _wp_theme_json_webfonts_handler if theme.json not present.
Check to see if the theme.json file exists before processing the rest of the code in `_wp_theme_json_webfonts_handler`. This improves performance by not trying to parse the theme.json, early in the bootstrap process. 

Props spacedmonkey, hellofromTonya, flixos90.
Fixes #57814.
Built from https://develop.svn.wordpress.org/trunk@55612


git-svn-id: http://core.svn.wordpress.org/trunk@55124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-30 11:08:21 +00:00
Sergey Biryukov
f940bc822d Coding Standards: Apply various alignment corrections from composer format.
This fixes a few WPCS warnings along the lines of:
* Array double arrow not aligned correctly
* Equals sign not aligned with surrounding statements
* Usage of ELSE IF is discouraged; use ELSEIF instead

Follow-up to [55099], [55192], [55194], [55271].

Props davidbaumwald, jrf, SergeyBiryukov.
Fixes #57994.
Built from https://develop.svn.wordpress.org/trunk@55606


git-svn-id: http://core.svn.wordpress.org/trunk@55118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-29 07:13:23 +00:00
Aaron Jorbin
2f20a88190 External Libraries: Update jQuery to 3.6.4.
Update the jQuery library from 3.6.1 to 3.6.3.

[3.6.4 release announcement](https://blog.jquery.com/2023/03/08/jquery-3-6-4-released-selector-forgiveness/)
[Full changelog](https://github.com/jquery/jquery/compare/3.6.3...3.6.4)

Props TobiasBg, audrasjb, hellofromTonya.
See #57324.
Fixes 57888.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-08 18:37:33 +00:00
Felix Arntz
259af07d2b Editor: Fix invalid parameters being passed to wp_register_style().
Boolean `true` is not a valid value for the `$ver` or `$media` parameters of `wp_register_style()`.

Props sabernhardt, flixos90, hellofromtonya.
Fixes #57771. See #56990, #57688.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54950 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 21:34:19 +00:00
audrasjb
418a21fdbc Help/About: Use the new /documentation/ URLs for HelpHub links in WordPress Admin.
As `https://wordpress.org/support/` was redirected to `https://wordpress.org/documentation/`, this changeset replaces various `/support/article/*` links with `/documentation/article/*` to avoid an extra redirect.

This also updates links to Support Forums by replacing `https://wordpress.org/support/` URLs with `https://wordpress.org/support/forums/`.

Props SergeyBiryukov, audrasjb, dhrupo, hasanmisbah, sakibmd, sabernhardt.
See #57726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-23 10:38:21 +00:00
audrasjb
e61ec90f68 Administration: Move wp-theme-plugin-editor script before </body>.
This changeset moves the `wp-theme-plugin-editor` admin script before `</body>` instead of in the `<head>`. This fixes an issue where the collapse admin menu feature was not working in the Theme|Plugin File Editor screens.

Props itsnikhilpatel, dilipbheda, stalukder03, audrasjb, adeltahri, Ankit-K-Gupta, mahbubshovan.
Fixes #57073.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54943 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-22 23:39:17 +00:00
hellofromTonya
5bf74c0433 Editor: Fix 'wp-block-library-theme' style enqueue conditions.
Fixes the conditions for when to enqueue the opinionated block styles (i.e. `'wp-block-library-theme'` stylesheet):

* the theme adds `'wp-block-styles'` theme support;
* and no editor styles are declared.

This resolves an issue with themes that do not add the `'wp-block-styles'` theme support while not impacting themes that do.

Follow-up to [53419], [52069], [50761], [44157].

Props mikachan, costdev, glendaviesnz, hellofromTonya, jffng, mamaduka, ndiego, poena, sannevndrmeulen, scruffian.
Fixes #57561.
Built from https://develop.svn.wordpress.org/trunk@55368


git-svn-id: http://core.svn.wordpress.org/trunk@54901 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-20 21:13:27 +00:00
hellofromTonya
be815b3093 Themes: Remove local() from @font-face styles in _wp_theme_json_webfonts_handler().
Removes adding `local()` as a `@font-face` `src` within `_wp_theme_json_webfonts_handler()`.

Why?

To fix font incompatibilities when a user has the font-family locally installed on their viewing computer or device. It's unknown if all of the font-face variations specified by theme.json and/or global styles are:

* installed on the user's computer/device.
* and in one file or multiple files.

The previous implementation used the `src` specified when registering the font with the API. That src will likely vary from user computer/device to user computer/device.

To avoid these unknowns which could cause incompatibilities or styling issues, this changeset removes adding `local()` to the generated font-face CSS styles.

References:
* [https://github.com/WordPress/gutenberg/pull/47254 Gutenberg PR 47254]

Follow-up to [53282].

Props luehrsen, aristath, ehtmlu, hellofromTonya, wetah.
Fixes #57430.
Built from https://develop.svn.wordpress.org/trunk@55314


git-svn-id: http://core.svn.wordpress.org/trunk@54847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-13 14:33:18 +00:00
audrasjb
3223743a6a I18N: Introduce word_count_type property to WP_Locale.
This changesets adds a `word_count_type` property, so that it does not need to be translated separately across multiple projects.

List of changes:
- New property: `WP_Locale::word_count_type`.
- New method: `WP_Locale::get_word_count_type()`.
- New function: `wp_get_word_count_type()` as a wrapper for `WP_Locale::get_word_count_type()`.
- All `_x( 'words', 'Word count type. Do not translate!' )` strings have been replaced with a call to `wp_get_word_count_type()`.

Props pedromendonca, desrosj, costdev, mukesh27, johnbillion.
Fixes #56698.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 17:28:18 +00:00
desrosj
bca7495bac External Libraries: Update element-closest.
This updates the `element-closest` polyfill to the latest version, `3.0.2`.

Because of changes to how the package is now built and distributed, both files for the library now contain minified code.

This library is no longer used by Core itself and maintained as a courtesy. Any projects utilizing it should reevaluate their usage requirements with modern browsers.

Props hareesh-pillai, gziolo, mukesh27, costdev.
Fixes #52851.
Built from https://develop.svn.wordpress.org/trunk@55275


git-svn-id: http://core.svn.wordpress.org/trunk@54808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 16:48:31 +00:00
joedolson
9f8f0aa58e Media: Enable selective optout for video and audio shortcodes.
Make the JavaScript selectors for audio and video shortcodes aware of the state of the `wp_video_shortcode_library` and `wp_audio_shortcode_library` filters. Allow extenders to replace the library for either media shortcode.

Props westonruter, joedolson, rudlinkon, obayedmamur.
Fixes #40144.
Built from https://develop.svn.wordpress.org/trunk@55271


git-svn-id: http://core.svn.wordpress.org/trunk@54804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 16:00:42 +00:00
desrosj
ebef2f74cb External Libraries: Update miscellaneous libraries to their latest versions.
This updates the following external libraries to their latest versions:

- `polyfill-library` from `4.4.0` to `4.7.0`.
- `regenerator-runtime` from `0.13.9` to `0.13.11`.

These updates are minor without any breaking changes.

These libraries are no longer used by Core itself and maintained as a courtesy. Any projects relying on them should reevaluate their usage as modern browsers have made these almost entirely unnecessary.

Fixes #57646.
Built from https://develop.svn.wordpress.org/trunk@55269


git-svn-id: http://core.svn.wordpress.org/trunk@54802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 15:56:37 +00:00
youknowriad
a41c798835 Block Editor: Updated the WordPress packages to include Gutenberg 15.1.0 changes.
In addition to all the packages being updated to the latest versions, 
this commit also includes some mandatory changes to avoid editor breakage:

 - Update React to to 18.2.0.
 - Add the right stylesheets to support iframed block editors.

Props ntsekouras, mamaduka, flixos90, desrosj, peterwilsoncc.
See #57471.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 07:04:52 +00:00
audrasjb
e5b74056b6 External Libraries: Update jQuery Migrate to version 3.4.0.
A full list of changes in this release can be found upstream on the jQuery Migrate GitHub repository:
https://github.com/jquery/jquery-migrate/compare/3.3.2...3.4.0.

Props desrosj, audrasjb, a4jpcom, stalukder03, mukesh27, adeltahri, robinwpdeveloper, mahbubshovan.
Fixes #56743.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 20:59:15 +00:00
Felix Arntz
5b4af6125a Editor: Add support for custom CSS in global styles.
This changeset introduces functions `wp_get_global_styles_custom_css()` and `wp_enqueue_global_styles_custom_css()`, which allow accessing and enqueuing custom CSS added via global styles.

Custom CSS via global styles is handled separately from custom CSS via the Customizer. If a site uses both features, the custom CSS from both sources will be loaded. The global styles custom CSS is then loaded after the Customizer custom CSS, so if there are any conflicts between the rules, the global styles take precedence.

Similarly to e.g. [55185], the result is cached in a non-persistent cache, except when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

Props glendaviesnz, oandregal, ntsekouras, mamaduka, davidbaumwald, hellofromtonya, flixos90.
Fixes #57536.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 18:52:17 +00:00
hellofromTonya
b0521eaa50 Editor: Separate content styles for iframe in __wp_get_iframed_editor_assets() and wp_default_styles().
This changeset:
* Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`).
* Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies.

Why?

These PHP changes are part of the initiative to:

* Separate the content styles contained in the block editor package into a separate stylesheet.
* Avoid loading all block editor styles into the iframe.

References:
* [https://github.com/WordPress/gutenberg/pull/44298 Gutenberg PR 44298].

Follow-up to [53160], [50761].

Props ellatrix, youknowriad.
Fixes #57550.
Built from https://develop.svn.wordpress.org/trunk@55179


git-svn-id: http://core.svn.wordpress.org/trunk@54712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 20:17:13 +00:00
hellofromTonya
8ddb28368a Themes: Introduce wp_theme_has_theme_json() for public consumption.
Adds `wp_theme_has_theme_json()` for public consumption, to replace the private internal Core-only `WP_Theme_JSON_Resolver::theme_has_support()` method. This new global function checks if a theme or its parent has a `theme.json` file.

For performance, results are cached as an integer `1` or `0` in the `'theme_json'` group with `'wp_theme_has_theme_json'` key. This is a non-persistent cache. Why? To make the derived data from `theme.json` is always fresh from the potential modifications done via hooks that can use dynamic data (modify the stylesheet depending on some option, settings depending on user permissions, etc.).

Also adds a new public function `wp_clean_theme_json_cache()` to clear the cache on `'switch_theme'` and `start_previewing_theme'`.

References:
* [https://github.com/WordPress/gutenberg/pull/45168 Gutenberg PR 45168] Add `wp_theme_has_theme_json` as a public API to know whether a theme has a `theme.json`.
* [https://github.com/WordPress/gutenberg/pull/45380 Gutenberg PR 45380] Deprecate `WP_Theme_JSON_Resolver:theme_has_support()`.
* [https://github.com/WordPress/gutenberg/pull/46150 Gutenberg PR 46150] Make `theme.json` object caches non-persistent.
* [https://github.com/WordPress/gutenberg/pull/45979 Gutenberg PR 45979] Don't check if constants set by `wp_initial_constants()` are defined.
* [https://github.com/WordPress/gutenberg/pull/45950 Gutenberg PR 45950] Cleaner logic in `wp_theme_has_theme_json`.

Follow-up to [54493], [53282], [52744], [52049], [50959].

Props oandregal, afragen, alexstine, aristath, azaozz, costdev, flixos90, hellofromTonya, mamaduka, mcsf, ocean90, spacedmonkey.
Fixes #56975.
Built from https://develop.svn.wordpress.org/trunk@55086


git-svn-id: http://core.svn.wordpress.org/trunk@54619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-18 11:40:10 +00:00
youknowriad
3df45e0dc3 Editor: Add inert attribute polyfill.
The new Gutenberg packages are using the inert attribute
to disable some parts of the HTML tree in an accessible way.

Props ntsekouras.
Fixes #57492.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54617 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-18 11:16:33 +00:00
Peter Wilson
f25373720c External Libraries: Update jQuery to 3.6.3.
Update the jQuery library from 3.6.1 to 3.6.3.

* [https://blog.jquery.com/2022/12/13/jquery-3-6-2-released/ 3.6.2 release announcement]
* [https://blog.jquery.com/2022/12/20/jquery-3-6-3-released-a-quick-selector-fix/ 3.6.3 release announcement]
* [https://github.com/jquery/jquery/compare/3.6.1...3.6.3 Full changelog]

Props TobiasBg, naeemhaque, mukesh27, mgol.
Fixes #57324.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-22 03:25:30 +00:00
audrasjb
ef48ee8739 Text Changes: Remove capitalization on "site editing".
Follow-up to [54786].

Props ocean90.
See #57026.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-10 11:33:14 +00:00
audrasjb
b63b1a86ee Text Changes: Replace "Full site editing" with "Site Editor".
This changeset replaces the various occurrences of "Full site editing" with "Site Editor" as it is the new official name of the feature.

For more background about this change, see https://make.wordpress.org/updates/2022/11/04/site-editor-a-more-user-friendly-name/.

Props audrasjb, peterwilsoncc, poena.
Fixes #57026.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-10 09:40:16 +00:00
Sergey Biryukov
f0af926dd6 Coding Standards: Correct alignment in various files.
This fixes `Equals sign not aligned with surrounding statements` WPCS warnings, so that the output of `composer format` is clean.

Follow-up to [54445], [54476], [54494], [54522], [54652], [54687].

See #56791.
Built from https://develop.svn.wordpress.org/trunk@54754


git-svn-id: http://core.svn.wordpress.org/trunk@54306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-05 22:03:16 +00:00
Bernhard Reiter
bbb40de012 Editor: Correctly apply Button block styles for classic themes
In [54358], styling for Button blocks that had been removed from classic themes was reintroduced. However, it was added with a global scope, whereas editor styles are usually added with a `.editor-styles-wrapper` selector, which makes them more specific.

This change modifies the way that classic theme styles are added so that they also get wrapped in an `.editor-styles-wrapper` selector to match specificity.

Furthermore, adjust specificity for some Button block related styling in the editor for the Twenty Twelve and Twenty Twenty themes.

Merges [https://github.com/WordPress/gutenberg/pull/44731 Gutenberg PR 44731] into trunk.

Follow-up to [54358].
Props scruffian, cbravobernal, sabernhardt, audrasjb.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54687


git-svn-id: http://core.svn.wordpress.org/trunk@54239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-25 12:19:18 +00:00
hellofromTonya
88cee0d359 Editor: Rename new theme_json_{$context} filters.
The newly introduced filters are renamed to use the `wp_theme_json_data{$context}` structure:

* `theme_json_default` renamed to `wp_theme_json_data_default`
* `theme_json_theme` renamed to `wp_theme_json_data_theme`
* `theme_json_blocks` renamed to `wp_theme_json_data_blocks`
* `theme_json_user` renamed to `wp_theme_json_data_user`

The following new filter gets the `wp_` prefix added:
* `theme_json_get_style_nodes` renamed to `wp_theme_json_get_style_nodes`

Follow-up to [56467], [54183], [54118].

Props kebbet, desrosj, mukesh27, ocean90, sergeybiryukov, davidbaumwald, hellofromTonya.
Fixes #56796.
Built from https://develop.svn.wordpress.org/trunk@54501


git-svn-id: http://core.svn.wordpress.org/trunk@54060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 20:08:12 +00:00
audrasjb
2ddc837e83 Editor: Reinstate old persistence system configuration for the block editor usage data.
In [54182], the configuration for the old preference persistence system was removed. This system is still used for block usage data (to show the most frequently used blocks in the inserter). Furthermore some plugins may use this persistence system.

This changeset reinstates the previous persistence system used by the "Most used blocks" feature in the block inserter.

Follow-up to [54182].

Props talldanwp.
Fixes #56778.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:30:11 +00:00
audrasjb
ae50e2c014 Editor: Add missing blocks origin to theme.json.
This changeset updates the blocks origin name from core to blocks and adds it to the list of valid origins for `theme.json`.
(See the original fix in [https://github.com//pull/3319 Gutenberg's PR 44363]).

Why?

- This new origin was missing from the list.
- The `core` name is not reflective of what it does, as this data origin is related to block styles, whether they come with WordPress or third-party blocks.
- The existing filter for this piece of data is called `theme_json_blocks`, to reflect it filters "block" data.
- Though `core` origin was used in the past for `default`, this commit reverts it. Why? It was confusing. The goal is to use names that communicate what part of the pipeline are processing (`default > blocks > theme > custom`).

How?

- Renames the string, from `core` to `blocks`.
- Adds `blocks` to the list of valid origins.
- Verifies that the `$theme_json->get_stylesheet()` call uses the proper `$origins` at all times.

Follow-up to [54162], [54251].

Props oandregal, czapla, jorgefilipecosta, scruffian, bernhard-reiter hellofromTonya.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-07 09:40:13 +00:00
desrosj
436bf77300 External Libraries: Update clipboard and polyfill-library.
This updates the Clipboard.js and `polyfill-library` dependencies to their latest versions (`2.0.11` and `4.4.0`, respectively).

Fixes #56670.
Built from https://develop.svn.wordpress.org/trunk@54386


git-svn-id: http://core.svn.wordpress.org/trunk@53945 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 15:55:23 +00:00
davidbaumwald
fc0840a5f5 Docs: Add @since to wp_enqueue_classic_theme_styles() docblock.
Follow-up to [54358].

Props kebbet.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54359


git-svn-id: http://core.svn.wordpress.org/trunk@53918 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 19:15:10 +00:00
davidbaumwald
143fd4c1f7 Editor: Reintroduce styles that were removed for classic themes.
After block CSS was merged with `theme.json` styles in [https://github.com/WordPress/gutenberg/pull/34180 Gutenberg PR #34180], this removed some existing, default styling for some elements, including buttons.  This change re-adds the removed styles by enqueueing `classic.css` for classic themes.

Merges [https://github.com/WordPress/gutenberg/pull/44334 Gutenberg PR #44334] into trunk.

Follow-up to [54257].

Props scruffian, oandregal, ramonopoly, aristath, andrewserong, get_dave, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54358


git-svn-id: http://core.svn.wordpress.org/trunk@53917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 18:55:10 +00:00
desrosj
0084598e3b External Libraries: Update MediaElement.js to version 4.2.17.
This is a minor bug fix release and the latest in the 4.x branch.

A full list of changes can be found on the library’s GitHub: https://github.com/mediaelement/mediaelement/releases/tag/4.2.17.

While this is not the latest version (the 5.x branch is), further testing needs to be done to confirm compatibility in WordPress. #56320 has been opened to explore this.

Props cdbessig, desrosj.
Fixes #56319.
Built from https://develop.svn.wordpress.org/trunk@54354


git-svn-id: http://core.svn.wordpress.org/trunk@53913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 14:21:11 +00:00
gziolo
d963f95253 Build: Improve how combined assets are generated
Allows to revert changes applied in [54277] - temporary workaround for the failing Test NPM CI check on Windows.

Improvements included:
- generate combined asset files for both production and development
- store in the repository only the production version of the combined assets for packages, we use everything else only in development
- to make unit tests work, ensure that they ignore react fast refresh and use the production version of combined assets that are present in the source code

Props bernhard-reiter, jsnajdr, clorith, wildworks.
Fixes #56615.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-23 08:27:12 +00:00
John Blackbourn
c117e5ae74 Docs: Various improvements and corrections to inline docs.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 20:32:09 +00:00
Sergey Biryukov
c58963b07f Coding Standards: Rename WordPress Dependencies API class files.
The current coding standards note that the name of the class files should be based on the class name with `class-` prepended, and the underscores replaced by hyphens (see the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions] section in the handbook), except for the three legacy files: `class.wp-dependencies.php`, `class.wp-scripts.php`, `class.wp-styles.php`.

To bring more consistency to the codebase and make it easier to implement autoloading in the future, this commit renames those three legacy files to conform to the coding standards:

* `wp-includes/class.wp-dependencies.php` → `wp-includes/class-wp-dependencies.php`
* `wp-includes/class.wp-scripts.php` → `wp-includes/class-wp-scripts.php`
* `wp-includes/class.wp-styles.php` → `wp-includes/class-wp-styles.php`

Includes:
* Loading the new files from the old ones, for anyone that may have been including the files directly.
* Replacing references to the old filenames with the new filenames.

Follow-up to [7970], [45654], [45662], [45663], [45678], [47197], [52026], [53749].

Props afragen, schlessera, swissspidy, dingo_d, hellofromTonya, SergeyBiryukov.
Fixes #37861. See #55647.
Built from https://develop.svn.wordpress.org/trunk@54254


git-svn-id: http://core.svn.wordpress.org/trunk@53813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 14:17:12 +00:00
desrosj
510047a552 Coding Standards: Applying an alignment fix from running composer format.
Follow up to [54214].

See #56467.
Built from https://develop.svn.wordpress.org/trunk@54238


git-svn-id: http://core.svn.wordpress.org/trunk@53797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 01:42:10 +00:00
audrasjb
130e13e39e Editor: Backport block supports filter callback, registrations and tests to 6.1.
This changeset backports the following changes:

- Implement [https://github.com/WordPress/gutenberg/pull/42880 gutenberg#42880]: Backport script loader: enqueue stored block supports styles
- Allow a way to bypass `SCRIPT_DEBUG` in tests. See [https://github.com/WordPress/wordpress-develop/pull/3259#issuecomment-1250403735 comment] and the related [https://github.com/WordPress/gutenberg/pull/44248 Gutenberg pull request]

Props ramonopoly, gziolo, bernhard-reiter, audrasjb, costdev.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 20:56:10 +00:00
desrosj
0fe6115af2 External Libraries: Update the jQuery UI library to version 1.13.2.
This is a bug fix release. For more information on the changes included, see https://jqueryui.com/changelog/1.13.2/.

Props Clorith, monolithon, desrosj.
Fixes #56239.
Built from https://develop.svn.wordpress.org/trunk@54209


git-svn-id: http://core.svn.wordpress.org/trunk@53768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 18:04:09 +00:00
hellofromTonya
94ae52c079 Editor: Fix function name case in wp_default_packages_inline_scripts().
Fixes function name typo by changing from uppercase `get_current_user_ID()` to lowercase `get_current_user_id()`.

>Note: Function names are case-insensitive for the ASCII characters A to Z, though it is usually good form to call functions as they appear in their declaration.
[https://www.php.net/manual/en/functions.user-defined.php As per the PHP manual], PHP functions are case-insensitive, meaning the code runs. However, this fix is necessary for consistency, maintainability, and future-proofing.

Follow-up to [54182].

Unprop hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54204


git-svn-id: http://core.svn.wordpress.org/trunk@53763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 14:20:09 +00:00
desrosj
9913822661 External Libraries: Update the jQuery library to version 3.6.1.
This is a maintenance release. For more information on the changs included, see https://blog.jquery.com/2022/08/26/jquery-3-6-1-maintenance-release/.

Props tobiasbg.
See #56451.
Built from https://develop.svn.wordpress.org/trunk@54202


git-svn-id: http://core.svn.wordpress.org/trunk@53761 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 14:16:24 +00:00
Sergey Biryukov
335203e971 Editor: Finalize the theme_json_get_style_nodes hook name.
This consolidates the name of a filter introduced earlier in the 6.1 cycle, renaming it from `get_style_nodes` to `theme_json_get_style_nodes` as to be more coherent with the other hooks introduced in 6.1 as well.

This commit backports the original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/44189 #44189 Use prefix 'theme_json_' in hooks related to theme.json]

Reference: [https://github.com/WordPress/wordpress-develop/pull/3247 #3247 Add hooks to filter theme.json data].

Follow-up to [54118].

Props oandregal, scruffian, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54183


git-svn-id: http://core.svn.wordpress.org/trunk@53742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 20:28:18 +00:00
hellofromTonya
8c85dde1c6 Editor: Persist preferences in user meta.
Adds a new feature to persist editor UI preferences between page loads and browsers.

* Adds a new preferences persistence API.
* Saves editor preferences in user meta instead of in browser's local storage.

Why?
Due to the transient nature of browser storage, this persistence is not as sticky as it is expected to be, including: switching browsers (unique storage between browsers), or using private browsing tabs (storage cleared between sessions), or the same user across a network of sites (storage unique by domain).

This is a backport from Gutenberg.[https://github.com/WordPress/gutenberg/pull/39795 See WordPress/gutenberg PR 39795].

Props talldanwp, youknowriad, noisysocks, mamaduka, costdev, ironprogrammer, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54182


git-svn-id: http://core.svn.wordpress.org/trunk@53741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-15 16:45:40 +00:00
gziolo
714e57b2fc Blocks: Allow registering multiple items for all supported asset types
Follow-up #54337, [52069]. Part of https://github.com/WordPress/gutenberg/issues/41236. More details in https://github.com/WordPress/gutenberg/issues/33542.

Allow passing more than one script per block for `editorScript`, `script`, and `viewScript` fields in the `block.json` metadata file. This aligns with the previously added changes for `style` and `editorStyle` fields.

This change impacts the `WP_Block_Type` class and the REST API endpoint for block types. To ensure backward compatibiliy old names were soft deprecated in favor of new fields that work with array values and have `_handles` suffix.

Props zieladam, dlh, timothyblynjacobs, aristath, bernhard-reiter.
Fixes #56408.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 10:52:08 +00:00
Sergey Biryukov
70c0f6f0e1 Editor: Backport Elements API updates.
This commit backports the original PRs from Gutenberg repository:

* [https://github.com/WordPress/gutenberg/pull/40260 #40260 Add support for button elements to theme.json]
* [https://github.com/WordPress/gutenberg/pull/40889 #40889 Theme Json: Don't output double selectors for elements inside blocks]
* [https://github.com/WordPress/gutenberg/pull/41140 #41140 Global Styles: Add support for caption elements]
* [https://github.com/WordPress/gutenberg/pull/41160 #41160 Global Styles: Load block CSS conditionally]
* [https://github.com/WordPress/gutenberg/pull/41240 #41240 Global Styles: Button Element: update button element selector]
* [https://github.com/WordPress/gutenberg/pull/41335 #41335 Duotone: Fix CSS Selectors rendered by theme.json duotone/filter settings for blocks on public pages]
* [https://github.com/WordPress/gutenberg/pull/41446 #41446 Block styles: Account for style block nodes that have no name]
* [https://github.com/WordPress/gutenberg/pull/41696 #41696 Global Styles: Allow references to values in other locations in the tree]
* [https://github.com/WordPress/gutenberg/pull/41753 #41753 Elements: Add an API make it easier to get class names]
* [https://github.com/WordPress/gutenberg/pull/41786 #41786 Support pseudo selectors on elements in theme json]
* [https://github.com/WordPress/gutenberg/pull/41822 #41822 Elements: Button - Fix element selectors]
* [https://github.com/WordPress/gutenberg/pull/41981 #41981 Global Styles: Add support for heading elements]
* [https://github.com/WordPress/gutenberg/pull/42072 #42072 Fix link element hover bleeding into button element default styles]
* [https://github.com/WordPress/gutenberg/pull/42096 #42096 Add visited to link element allowed pseudo selector list]
* [https://github.com/WordPress/gutenberg/pull/42669 #42669 Link elements: Add a :where selector to the :not to lower specificity]
* [https://github.com/WordPress/gutenberg/pull/42776 #42776 Theme JSON: Add a static $blocks_metadata data definition to the Gutenberg instance of WP_Theme_JSON]
* [https://github.com/WordPress/gutenberg/pull/43088 #43088 Pseudo elements supports on button elements]
* [https://github.com/WordPress/gutenberg/pull/43167 #43167 Theme_JSON: Use existing append_to_selector for pseudo elements]
* [https://github.com/WordPress/gutenberg/pull/43988 #43988 Styles API: Fixed selectors for nested elements]

Props onemaggie, bernhard-reiter, cbravobernal, mmaattiiaass, scruffian, andraganescu, dpcalhoun, get_dave, Mamaduka, SergeyBiryukov.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54118


git-svn-id: http://core.svn.wordpress.org/trunk@53677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-10 12:38:12 +00:00
noisysocks
4a5f783888 Script Loader: Pass startOfWeek setting to @wordpress/date
Allows the block editor to respect the site's Week Starts On setting by defining
`i10n.startOfWeek` when initialising the `@wordpress/date` module.

This is a backport of https://github.com/WordPress/gutenberg/pull/41648.

See #56467.
Props andrewserong.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-06 02:52:11 +00:00
desrosj
e69d717f37 Script Loader: Allow a priority to be passed to wp_enqueue_block_support_styles().
`wp_enqueue_block_support_styles()` attaches inline styles to the `wp_head` or `wp_footer` actions. This adds a priority parameter to the function to allow the styles to be given a loading order when necessary.

Props bernhard-reiter, ramonopoly.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54048


git-svn-id: http://core.svn.wordpress.org/trunk@53607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-01 15:45:09 +00:00
noisysocks
1d55913400 Editor: Ensure that timezone.offset passed to @wordpress/date is a float
Fixes inconsistent type of `timezone.offset` passed to `@wordpress/date`. It
should always be a float, never a string.

Props talldanwp.
Fixes #56459.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53515 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-30 01:04:12 +00:00
desrosj
866abfda9f External Libraries: Update the Moment library to version 2.29.4.
This is a minor bug fix release.

Props dilipbheda.
Fixes #56031.
Built from https://develop.svn.wordpress.org/trunk@53725


git-svn-id: http://core.svn.wordpress.org/trunk@53284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-19 19:43:25 +00:00