5239 Commits

Author SHA1 Message Date
Sergey Biryukov
7104aa0a9c Login and Registration: Set correct default values in wp_signon().
The `$credentials['user_login']` and `$credentials['user_password']` parameters are passed by reference to the `wp_authenticate` action, and are at that point [https://www.php.net/manual/en/language.references.pass.php#124383 created as null] if they don't exist in the array.

This commit sets those values to an empty string, resolving two PHP 8.1 deprecation notices:
 * One from `preg_replace()` in `wp_strip_all_tags()` via `sanitize_user()` in `wp_authenticate()`:
{{{
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
}}}
 * One from `trim()` in `wp_authenticate()` itself:
{{{
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated
}}}

Includes documenting the `$credentials` parameter using hash notation.

Follow-up to [6643], [37697].

Props lenasterg, TobiasBg, ocean90, afragen, lkraav, SergeyBiryukov.
Fixes #56850.

git-svn-id: https://develop.svn.wordpress.org/trunk@55301 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-09 01:29:42 +00:00
Daniel Bachhuber
b46b855070 REST API: Support non-Latin characters in template route regex.
Non-Latin characters are URL-encoded (e.g. `%cf%84%ce%b5%cf%83%cf%84`). Matching `%` in the route ensures templates with non-Latin titles can be properly saved.

Props antonyagrios, mburridge.
Fixes #57329.


git-svn-id: https://develop.svn.wordpress.org/trunk@55294 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 23:45:18 +00:00
Aaron Jorbin
ad2ba3ed0d Comments: Improve rel attribute usage in comments.
Internal links should be followed and it should be easier to modify other rel attributes on comments. This adds a helper function for determining if a URL is internal and also adds some new filters to make it easy to modify rel attributes in comments.

Props thomasplevy, desrosj, sabernhardt, benish74, samiamnot, galbaras, jorbin.

Fixes #53290, #56444.


git-svn-id: https://develop.svn.wordpress.org/trunk@55289 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 18:52:24 +00:00
David Baumwald
6ae5afcfaf Editor: svn add new files missed in [55285].
Follow-up to [55285].

See #57618.

git-svn-id: https://develop.svn.wordpress.org/trunk@55286 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 18:09:44 +00:00
David Baumwald
f7c2299a0e Editor: Introduce sticky position block support.
In the Gutenberg plugin, a position block support feature was introduced last year, that allows a Group block to be set to a "sticky" position, meaning that when the page scrolls, the block will stick to the top of the window.

This change merges the "sticky" position feature for blocks introduced in Gutenberg 15.0.

Props andrewserong, flixos90, mukesh27.
Fixes #57618.

git-svn-id: https://develop.svn.wordpress.org/trunk@55285 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:59:44 +00:00
John Blackbourn
6fc77d21d3 Application Passwords: Allow plain HTTP success and reject URLs when using a local environment type.
It's not uncommon for local environments to run over HTTP due to the relative complexity of configuring HTTPS for a local environment. This change allows HTTP URLs for application password responses when that is the case.

Props peterwilsoncc, wppunk, cadic, viralsampat

Fixes #52617


git-svn-id: https://develop.svn.wordpress.org/trunk@55283 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:43:55 +00:00
Felix Arntz
05c1b0c6c8 Editor: Add layout controls to children of flex layout blocks.
Props isabel_brison, andrewserong, davidbaumwald, flixos90, mamaduka, ntsekouras, hellofromtonya.
Fixes #57584.


git-svn-id: https://develop.svn.wordpress.org/trunk@55282 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:41:11 +00:00
Daniel Bachhuber
d91fd84eb1 Media: Add test file missed in [55278].
See #57370.


git-svn-id: https://develop.svn.wordpress.org/trunk@55280 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:37:16 +00:00
Jb Audras
024946f9d1 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@55279 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:26:14 +00:00
Daniel Bachhuber
d80c313c80 Media: Bail early if image is already the requested size.
In `WP_Image_Editor_Imagick`, bail early in `make_subsize()` if the image is already the requested size. Previously, `make_subsize()` would create another copy of the file. `WP_Image_Editor_GD` doesn't have the same problem.

Props wojtekn, danielbachhuber.
Fixes #57370.


git-svn-id: https://develop.svn.wordpress.org/trunk@55278 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 17:22:41 +00:00
David Baumwald
5b2a6ae7cc Themes: Revert appearance tools theme support.
The appearance tools theme support(merged in [55067]) includes block gap, a feature that was not intended for themes without a theme.json.

Until it has been determined if the feature can and should be enabled in these themes, and has been successfully tested, the appearance tools theme support should be reverted.

Reverts [55067].

Props poena, Mamaduka, audrasjb.
Fixes #57649.

git-svn-id: https://develop.svn.wordpress.org/trunk@55273 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 16:42:11 +00:00
Joe Dolson
67f101e791 Formatting: Treat math elements as block-level elements.
The `math` element can be displayed either as a block or inline element. If `wpautop` only treats it as an inline element, it will break multiline elements by inserting `br` elements. Treating the element as a block element means that the editor won't break common normative usages of the `math` element. 

Prevent `math` elements from having internal elements split up with `br` elements, disrupting formatting.

Props nicholaswilson, wojtek.szkutnik, hakre, conner_bw, ericlewis, hughie.molloy, SteelWagstaff, ryokuhi, joedolson, bgoewert, adamsilverstein, joedolson.
Fixes #13340.

git-svn-id: https://develop.svn.wordpress.org/trunk@55272 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 16:16:47 +00:00
Sergey Biryukov
73d8988e4d Tests: Use assertSameSets() in WP_Query tests for search_columns argument.
This aims to resolve intermittent test failures due to indeterminate sort order.

Follow-up to [55248].

Props petitphp, costdev, audrasjb, johnbillion.
Fixes #43867.

git-svn-id: https://develop.svn.wordpress.org/trunk@55264 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 14:58:08 +00:00
Jb Audras
67662cbe1b Media: Introduce wp_get_attachment_link_attributes filter.
This changeset introduces the `wp_get_attachment_link_attributes` hook to allow developers to filter the link attributes when getting the attachment link.

Props NathanAtmoz, aaroncampbell, antpb, costdev.
Fixes #41574.


git-svn-id: https://develop.svn.wordpress.org/trunk@55262 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 14:33:44 +00:00
Jb Audras
3ba96e225d Privacy: Add rel="privacy-policy" to the Privacy Policy link.
This changeset adds a `rel="privacy-policy"` attribute to user-facing links to the Privacy Policy of the website, when a privacy policy page is set and available. While this `rel` value is still a RFC of the Link Types HTML specification, this changeset helps to make Privacy Policy link more discoverable for user agents and HTML parsers. 

Props dshanske, audrasjb, bhavz-10, bookwyrm, faisal03, JeffPaul, peterwilsoncc, paapst, davidbaumwald, costdev, robinwpdeveloper, kawserz.
Fixes #56345.


git-svn-id: https://develop.svn.wordpress.org/trunk@55261 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 14:03:26 +00:00
Jonny Harris
dcd1ba9330 Options, Meta APIs: Add a filter to allow the shortcut return to wp_load_alloptions function.
Add a new filter `pre_wp_load_alloptions` in the `wp_load_alloptions` function to short circuit the return value. 

Props pbearne, spacedmonkey, joyously, SergeyBiryukov, mukesh27, costdev. 
Fixes #56045.

git-svn-id: https://develop.svn.wordpress.org/trunk@55256 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 12:47:30 +00:00
Jb Audras
6636a6979f Revisions: Add a way to filter the revisions considered for deletion.
This changeset introduces a new filter for `wp_save_post_revision()`. `wp_save_post_revision_revisions_before_deletion` passes the revisions to be considered for deletion, and the new revision's post ID.

This allows extenders to exclude specific revisions from being considered for deletion.

Props jhned, costdev, audrasjb, adamsilverstein, mukesh27.
Fixes #57320.


git-svn-id: https://develop.svn.wordpress.org/trunk@55254 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 12:38:01 +00:00
Jonny Harris
35a678b0e6 Taxonomy: Implement wp_cache_get_multiple in wp_queue_posts_for_term_meta_lazyload.
In [47938] the `wp_cache_get_multiple` function was added to core. This function allows for multiple cache keys to be received from cache in a single function call. `wp_queue_posts_for_term_meta_lazyload` function does many calls to cache. To get taxonomy relationship for multiple posts and get all terms. Replace calls to `get_object_term_cache` with calls to `wp_cache_get_multiple` and `_prime_term_caches`. This improves performance on sites that implement the `wp_cache_get_multiple` in their object caching drop-in. 

Props spacedmonkey, ocean90, SergeyBiryukov, costdev, flixos90, joemcgill, 10upsimon. 
Fixes #57150.

git-svn-id: https://develop.svn.wordpress.org/trunk@55252 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 12:07:46 +00:00
Jb Audras
face5a97dd Build/Test Tools: Add unit tests for wp_set_password hook.
Follow-up to [55056].

Props audrasjb, SergeyBiryukov, costdev.
Fixes #57436.


git-svn-id: https://develop.svn.wordpress.org/trunk@55250 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 09:24:00 +00:00
Jb Audras
4b6d7ebbc5 Query: Add a search_columns argument to control which fields are searched in a search query.
Previously, the `s` argument of the `WP_Query::parse_query()` method searched the `post_title`, `post_excerpt`, and `post_content` fields, with no way of controlling this apart from using the `posts_search` filter and adjusting the SQL manually. This changeset adds the ability to specify which fields are searched when performing a query, using the `search_columns` argument.

Props johnbillion, birgire, petitphp, audrasjb, costdev, mukesh27.
Fixes #43867.


git-svn-id: https://develop.svn.wordpress.org/trunk@55248 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 08:53:01 +00:00
Riad Benguella
07fc9b2d74 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@55246 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 07:01:56 +00:00
Peter Wilson
d46dc08342 Formatting: Guard wp_strip_all_tags() against fatal errors.
Check the input of `wp_strip_all_tags()` before passing it to `strip_tags()`. This protects against fatal errors introduced in PHP 8, retaining the `E_USER_WARNING` from PHP 7, and prevents a PHP 8.1 deprecation notice when passing null.

Props chocofc1, costdev, jrf, dd32, audrasjb, peterwilsoncc.
Fixes #56434.



git-svn-id: https://develop.svn.wordpress.org/trunk@55245 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 03:32:43 +00:00
Peter Wilson
9d8e1ae068 Filesystem API: Add test for uncovered WP_Error in move_dir().
Introduces a test for the `WP_Error` object `destination_not_deleted_move_dir` in the `move_dir()` function.

Follow up to [55226].

Props costdev, mukesh27.
Fixes #57375.



git-svn-id: https://develop.svn.wordpress.org/trunk@55244 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-07 03:15:49 +00:00
Felix Arntz
84a59fe5f7 Themes: Add caching to WP_Theme::is_block_theme().
This changeset adds a `block_theme` entry in the theme cache data, similar to the existing entries `headers`, `errors`, `stylesheet`, and `template`.

Props spacedmonkey, costdev, joemcgill, flixos90, mukesh27, adamsilverstein.
Fixes #57114.


git-svn-id: https://develop.svn.wordpress.org/trunk@55236 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 19:57:41 +00:00
Felix Arntz
195393fdbb Editor: Use WP_HTML_Tag_Processor in wp_render_elements_support().
Props ntsekouras.
Fixes #57642.


git-svn-id: https://develop.svn.wordpress.org/trunk@55235 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 19:41:25 +00:00
Felix Arntz
363ed92463 Editor: Support the block_types and viewport_width props for remote patterns fetched from Pattern Directory.
Props ntsekouras, ironprogrammer, hellofromtonya, flixos90.
Fixes #57611.


git-svn-id: https://develop.svn.wordpress.org/trunk@55234 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 19:38:08 +00:00
Jorge Costa
97a0b1e7f3 Block editor: Update WP_Theme_JSON_Resolver and improve its performance.
This commit includes the latest updates WP_Theme_JSON_Resolver class made in the block editor. Some of these updates improve the performance of the class.

Props Mamaduka, hellofromTonya, flixos90, jorgefilipecosta, oandregal, spacedmonkey, audrasjb, costdev, scruffian.
Closes #57545.

git-svn-id: https://develop.svn.wordpress.org/trunk@55231 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-06 15:31:50 +00:00
Pascal Birchler
81f31d6fd8 I18N: Improve method names in WP_Locale_Switcher().
This is a follow-up to [55161] to rename `::get_current_locale()` to `::get_switched_locale()` and `::get_current_user_id()` to `::get_switched_user_id()` for improved clarity.

Also:

* Fix docblock for `switch_locale` filter. The User ID is `false` if missing, not `null`.
* Add additional test involving `restore_previous_locale()` and improve test cleanup.

And most importantly: happy birthday ocean90! 🎂

Props johnjamesjacoby, ocean90.
See #57123.

git-svn-id: https://develop.svn.wordpress.org/trunk@55224 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-04 20:45:36 +00:00
Felix Arntz
8900fdfd76 Editor: Add missing WP_Theme_JSON::process_blocks_custom_css() method.
Follow up to [55192].

Props aristath, mamaduka, mukesh27, hellofromtonya.
Fixes #57621.


git-svn-id: https://develop.svn.wordpress.org/trunk@55216 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 18:23:55 +00:00
Jb Audras
5c840d93bb HTTP API: Fix a unit test failure found after [55210].
Follow-up to [55210].

See #54225.


git-svn-id: https://develop.svn.wordpress.org/trunk@55211 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 13:51:11 +00:00
Jb Audras
8fbe21a37a HTTP API: Fix request header inconsistencies.
This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes #54225.


git-svn-id: https://develop.svn.wordpress.org/trunk@55210 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 13:33:18 +00:00
Jb Audras
4b71b1565a Media: Replace consecutive periods in sanitize_file_name().
On some servers, consecutive periods in a filename can cause a 403 Forbidden response.
This changeset replaces consecutive periods with a single period, and adds related unit tests.

Props ArtZ91, costdev, SergeyBiryukov, arthurshlain, mukesh27.
Fixes #57242.


git-svn-id: https://develop.svn.wordpress.org/trunk@55209 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 12:46:18 +00:00
Peter Wilson
4833e2c06f Posts, Post Types: Add test coverage for _truncate_post_slug().
Props xknown, mukesh27, costdev, audrasjb.
Fixes #56868.
See #56793.


git-svn-id: https://develop.svn.wordpress.org/trunk@55208 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 04:03:00 +00:00
Peter Wilson
0138b0dcd6 Posts, Post Types: Deprecate get_page_by_title() in favour of WP_Query.
Formally deprecate `get_page_by_title()`. In its current form the function is unpredictable in that it may return a result that leads to a 404 error and will return different results depending on the database version/engine combination used.

It is recommended developers use `WP_Query` instead:

{{{
$query = new WP_Query(
 array(
  'post_type' => 'page',
  'title'     => 'Sample Page',
 )
);
}}}


Props TimothyBlynJacobs, costdev, mukesh27, spacedmonkey, peterwilsoncc.
Fixes #57041.


git-svn-id: https://develop.svn.wordpress.org/trunk@55207 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 03:56:10 +00:00
Andrew Ozz
5872edc052 Filesystem API: Add directory support to WP_Filesystem_Direct::move().
Introduces:
- New function: `wp_opcache_invalidate_directory()`, to recursively call `wp_opcache_invalidate()` after overwriting .php files.
- New function: `move_dir()`, similar to `copy_dir()` that uses `WP_Filesystem::move()` followed by `wp_opcache_invalidate_directory()`, and has a fallback to `copy_dir()`.

Props: costdev, afragen, peterwilsoncc, sergeybiryukov, ironprogrammer, flixos90, bronsonquick, mukesh27, azaozz.
Fixes #57375.

git-svn-id: https://develop.svn.wordpress.org/trunk@55204 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 01:48:36 +00:00
Andrew Ozz
39bfc2580d Introduce HTML API with HTML Tag Processor
This commit pulls in the HTML Tag Processor from the Gutenbeg repository.

The Tag Processor attempts to be an HTML5-spec-compliant parser that provides the ability in PHP to find specific HTML tags and then add, remove, or update attributes on that tag. It provides a safe and reliable way to modify the attribute on HTML tags.

More information: https://github.com/WordPress/wordpress-develop/pull/3920.

Props: antonvlasenko, bernhard-reiter, costdev, dmsnell, felixarntz, gziolo, hellofromtonya, zieladam, flixos90, ntsekouras, peterwilsoncc, swissspidy, andrewserong, onemaggie, get_dave, aristath, scruffian, justlevine, andraganescu, noisysocks, dlh, soean, cbirdsong, revgeorge, azaozz.
Fixes #57575.

git-svn-id: https://develop.svn.wordpress.org/trunk@55203 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 01:03:59 +00:00
Tonya Mork
67c8bf8e0d Editor: Add missing controls to flex layouts in wp_get_layout_style().
Adds missing controls to flex layouts in `wp_get_layout_style()` for justify-content and vertical alignment options.

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

Follow-up to [54274].

Props isabel_brison, andrewserong, jameskoster, joen, onemaggie , ndiego.
Fixes #57602.

git-svn-id: https://develop.svn.wordpress.org/trunk@55201 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 00:34:59 +00:00
Tonya Mork
8ff5899348 Widgets: Preserve classic sidebars when switching to a block theme.
When switching to a block theme, classic sidebars were orphaned and their widgets remapping to the `'wp_inactive_widgets'` sidebar . This changeset preserves the sidebars and their widgets, providing a migration path to a block theme without losing the widgets.

Classic sidebars are now:

* Stored in a new theme mod called `'wp_classic_sidebars'`;
* Restored to the `$wp_registered_sidebars` global variable when the `'widgets_init'` action fires (via a new internal function called `_wp_block_theme_register_classic_sidebars()`);
* And marked as `'inactive'` when interacting with sidebars REST API endpoint.

References:
* [https://github.com/WordPress/gutenberg/pull/45509 Gutenberg PR 45509] which adds an option for importing widgets from sidebars into template parts.

Follow-up to [50995], [6334].

Props mamaduka, audrasjb, hellofromTonya, ironprogrammer, jameskoster, joen, matveb, mukesh27, noisysocks, poena, youknowriad.
Fixes #57531.

git-svn-id: https://develop.svn.wordpress.org/trunk@55200 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-03 00:13:52 +00:00
Joe Dolson
a501f4f40d Media: Add argument to get_attached_file() for subsizes.
Add a `$size` argument to `get_attached_file()` to simplify getting the path to an intermediate image size.
 
Props paulschreiber, audrasjb, Mista-Flo.
Fixes #51780.

git-svn-id: https://develop.svn.wordpress.org/trunk@55199 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-02 23:38:49 +00:00
Jorge Costa
e53d61ac01 Editor: Remove need for template prefix in get_template_hierarchy.
This commit removes the need to pass a template prefix in get_template_hierarchy.
This is required because, in some block editor usages, the template prefix is not known.

Props youknowriad, davidbaumwald, jorgefilipecosta.
Fixes #57614.

git-svn-id: https://develop.svn.wordpress.org/trunk@55194 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-02 19:36:29 +00:00
Felix Arntz
7b43a6da54 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.


git-svn-id: https://develop.svn.wordpress.org/trunk@55192 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-02 18:50:54 +00:00
Felix Arntz
6b4b2eb60f Editor: Use a non-persistent object cache instead of transient in wp_get_global_stylesheet().
This changeset is part of a greater effort to enhance the caching strategy for theme.json based data. Similar to [55138], [55148], and [55155], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

Props spacedmonkey, oandregal, flixos90, ajlende, hellofromtonya.
Fixes #57568.


git-svn-id: https://develop.svn.wordpress.org/trunk@55185 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-01 22:57:04 +00:00
Tonya Mork
888e139a94 KSES: Allow position-related CSS properties.
Adds support for the following CSS properties considered safe for inline CSS:
* `position`
* `top`
* `right`
* `bottom`
* `left`
* `z-index`

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

Follow-up to [54117].

Props andrewserong, mukesh27.
Fixes #57504.

git-svn-id: https://develop.svn.wordpress.org/trunk@55184 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-01 22:50:11 +00:00
Tonya Mork
36da826901 REST API: Declare 'edit_css' capability in links within WP_REST_Global_Styles_Controller.
Updates the Global Styles endpoint to expose the `'edit_css'` capability via action links.

References:
* [https://github.com/WordPress/gutenberg/pull/46815 Gutenberg PR 46815] Part of an effort to hide custom CSS setting for users without `'edit_css'` capability.

Follow-up to [52342], [52051].

Props mamaduka, dsas, glendaviesnz, mmtr86, talldanwp, timothyblynjacobs.
Fixes #57526.

git-svn-id: https://develop.svn.wordpress.org/trunk@55177 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-01 18:36:08 +00:00
Tonya Mork
7374cdeb74 Themes: Add shadow presets support for theme.json.
Adds shadow presets support for `theme.json` within the `WP_Theme_JSON` by 

* Adding it to presets metadata and valid settings.
* Defining the default shadow presets in Core's `theme.json`.

Includes PHPUnit tests. 

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

Follow-up to [54162], [52049], [50973].

Props madhudollu, mamaduka, oandregal, scruffian, hellofromTonya.
Fixes #57559.

git-svn-id: https://develop.svn.wordpress.org/trunk@55176 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-01 18:05:44 +00:00
Tonya Mork
f3b858cb98 Editor: Introduce minimum height dimensions block support.
This changeset adds the new dimension feature's PHP code for supporting minimum height in the block editor inspector and in global styles. Minimum height is quite useful for defining the minimum vertical dimensions of a block, while allowing it to expand beyond that size. 

In this changeset:

* Adds support in `theme.json`.
* Adds support in the style engine.
* Adds support in `wp_apply_dimensions_support()`.
* Renames the setting from `'__experimentalDimensions'` to `dimensions` in `wp_register_dimensions_support()`.
* Adds PHPUnit tests.

Is renaming `'__experimentalDimensions'` a backwards-compatibility (BC) break?

Though the setting has been in the code since 5.9.0, it was never wired to anything, ie it did not expose any controls or styles. Notice in `wp_register_dimensions_support()` and `wp_apply_dimensions_support()` prior to this changeset, there are inline comments as placeholders for height and width support, but no code.

If a developer opted in to use it, it had no effect.

A search in wp.org's plugin and themes repo showed no instances of this experimental setting.

Given there was no functionality attached to it (until this changeset), no change in behavior or effect from removing it, and no usage found in the plugins and themes repository, it does appear to be a BC break.

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

Follow-up to [53076], [52069].

Props andrewserong, aaronrobertshaw , costdev, hellofromTonya, isabel_brison, joen, paaljoachim, mukesh27, ntsekouras, oandregal, ramonopoly.
Fixes #57582.

git-svn-id: https://develop.svn.wordpress.org/trunk@55175 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-01 16:13:49 +00:00
Sergey Biryukov
d2f6c417ff Docs: Improve documentation for block pattern properties.
Includes:
* Adding the `templateTypes` property to the `WP_Block_Patterns_Registry::register()` DocBlock.
* Adding `@since` notes for the `postTypes` and `templateTypes` properties to:
 * `_register_theme_block_patterns()`
 * `WP_Block_Patterns_Registry::register()`
* Bringing some consistency to the order of properties between:
 * `_register_theme_block_patterns()`
 * `WP_Block_Patterns_Registry::register()`
 * `WP_REST_Block_Patterns_Controller::prepare_item_for_response()`
 * `WP_REST_Block_Patterns_Controller::get_item_schema()`

Follow-up to [52943], [53152], [54263], [55168].

See #56792.

git-svn-id: https://develop.svn.wordpress.org/trunk@55173 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-01 15:00:19 +00:00
Tonya Mork
52e5e065b3 Editor: Add support for editing block style variations in global styles.
To allow editing of block style variations in global styles, this changeset adds the following for server side support:

* building of block style schema into `WP_Theme_JSON::sanitize()`.
* appending of style variation selectors to block metadata in `WP_Theme_JSON::get_blocks_metadata()`.
* building of selectors and variations for nodes in `WP_Theme_JSON::get_block_nodes()`.

Tests for happy and unhappy paths are included.

Reference:
* [https://github.com/WordPress/gutenberg/pull/46343 Gutenberg PR 46343]

Follow-up to [54118], [50973], [50959].

Props isabel_brison, 
Fixes #57583.

git-svn-id: https://develop.svn.wordpress.org/trunk@55172 602fd350-edb4-49c9-b593-d223f7449a82
2023-02-01 13:41:16 +00:00
Felix Arntz
6036ee03af Media: Allow to omit decoding="async" on tags from wp_get_attachment_image().
When adding `decoding="async"` to images was introduced in [53480], it did not provide the ability to customize that behavior specifically for image tags returned from `wp_get_attachment_image()`.

With this changeset it is now possible to explicitly provide a `decoding` value of e.g. boolean `false` in the `$attr` parameter of the function, to ensure the attribute is omitted.

Props maximej, adamsilverstein, flixos90, costdev, peterwilsoncc, mukesh27.
Fixes #57086.


git-svn-id: https://develop.svn.wordpress.org/trunk@55171 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-31 19:39:51 +00:00
Jonny Harris
4ca85e7528 Query: Use WP_Query in get_page_by_path.
Replace raw database queries in `get_page_by_path` with a call to `WP_Query` class. This has a number of benefits, including improved caching and priming of post caches. To maintain backwards compatibility, this function calls `WP_Query` to gets all matching posts of all post statuses.  

Props spacedmonkey, peterwilsoncc, costdev, 
Fixes #56689.

git-svn-id: https://develop.svn.wordpress.org/trunk@55169 602fd350-edb4-49c9-b593-d223f7449a82
2023-01-31 16:54:22 +00:00