This amends the previous commit to avoid a warning on PHP < 7.2.18 if haystack is an empty string:
{{{
Warning: substr_compare(): The start position cannot exceed initial string length
}}}
Follow-up to [55151], [55157].
See #52506.
git-svn-id: https://develop.svn.wordpress.org/trunk@55158 602fd350-edb4-49c9-b593-d223f7449a82
This avoids a fatal error if the file is included directly outside of WordPress core, e.g. by HyperDB.
While WordPress core does include a polyfill function, it is not directly loaded in the `wpdb` class.
This commit replaces the `str_ends_with()` calls with `substr_compare()` for now.
Follow-up to [55151].
Props Otto42.
See #52506.
git-svn-id: https://develop.svn.wordpress.org/trunk@55157 602fd350-edb4-49c9-b593-d223f7449a82
Make it easier for users to download their uploaded media by providing a download link on the attachment details screen and in the media modal.
Props countrymusicchicago, joedolson, amin7
Fixes#41474.
git-svn-id: https://develop.svn.wordpress.org/trunk@55156 602fd350-edb4-49c9-b593-d223f7449a82
This changeset is part of a greater effort to enhance the caching strategy for `theme.json` based data. Similar to [55138] and [55148], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.
This addition of a non-persistent cache results in a significant performance improvement for the overall load time of WordPress, with the Server-Timing load metric being ~8% faster and Time to First Byte being 25+% faster than before.
Props oandregal, spacedmonkey, hellofromtonya, flixos90, azaozz, aristath.
Fixes#57502.
git-svn-id: https://develop.svn.wordpress.org/trunk@55155 602fd350-edb4-49c9-b593-d223f7449a82
In the autosave REST API endpoint, avoid excessive database writes when an autosave is sent with content that is unchanged from the saved post.
Before this fix, clicking "preview" in the editor (which uses the autosave feature) multiple times would cause an identical autosave entry to be deleted and re-created repeatedly.
Props inwerpsel, aduth, mukesh27, ironprogrammer.
Fixes#49532.
git-svn-id: https://develop.svn.wordpress.org/trunk@55154 602fd350-edb4-49c9-b593-d223f7449a82
This change resolves a unit test failure in `Tests_Blocks_RenderReusableCommentTemplate::test_rendering_comment_template_nested()` on systems using `\r\n` line endings.
Props SergeyBiryukov.
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@55153 602fd350-edb4-49c9-b593-d223f7449a82
This updates the following third-party GitHub Actions to their latest versions.
- `actions/cache`
- `actions/checkout`
- `actions/upload-artifact`
- `actions/setup-node`
- `actions/setup-php`
- `actions/github-script`
See #57572.
git-svn-id: https://develop.svn.wordpress.org/trunk@55152 602fd350-edb4-49c9-b593-d223f7449a82
[53575] during the 6.1 cycle was reverted in [54734] to address issues around multiple `%` placeholders not being properly quoted as reported in #56933. Since then, this issue has been resolved and the underlying code improved significantly. Additionally, the unit tests have been expanded and the inline docs have been improved as well.
This change reintroduces `%i` placeholder support in `$wpdb->prepare()` to give extenders the ability to safely escape table and column names in database queries.
Follow-up to [53575] and [54734].
Props craigfrancis, jrf, xknown, costdev, ironprogrammer, SergeyBiryukov.
Fixes#52506.
git-svn-id: https://develop.svn.wordpress.org/trunk@55151 602fd350-edb4-49c9-b593-d223f7449a82
This updates PostCSS related dependencies for the main Core build process to versions that use the latest major version of PostCSS, 8.x.
There were no changes to any versioned CSS files as a result of this update directly. However, two occurrences of `-o-tab-size` have been removed due to the version of `caniuse-lite` used being updated in the process.
See #57554, #57555.
git-svn-id: https://develop.svn.wordpress.org/trunk@55150 602fd350-edb4-49c9-b593-d223f7449a82
This changeset is part of a greater effort to enhance the caching strategy for `theme.json` based data. Similar to [55138], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.
Props oandregal, spacedmonkey, hellofromtonya, flixos90, ironprogrammer, azaozz, aristath, costdev, mcsf.
Fixes#56910.
git-svn-id: https://develop.svn.wordpress.org/trunk@55148 602fd350-edb4-49c9-b593-d223f7449a82
The `get_default_block_editor_settings()` function included several pieces of data that are irrelevant for the purpose that `WP_Theme_JSON_Resolver` was calling it for, yet resulted in three database queries on page load that can be avoided.
This changeset introduces a new function `get_classic_theme_supports_block_editor_settings()` to takes responsibility of only the data needed in `WP_Theme_JSON_Resolver`, which now uses that function. This leads to a reduction of database queries and accordingly a performance improvement.
Props mamaduka, spacedmonkey, oandregal, flixos90, audrasjb, mukesh27.
Fixes#57547.
git-svn-id: https://develop.svn.wordpress.org/trunk@55146 602fd350-edb4-49c9-b593-d223f7449a82
In 6.1.0, the values the `$types` parameter accepts changed to include `'base-layout-styles'`.
This commit updates the DocBlock to reflect this change and provide clear information of what the function will load if no types are passed to it.
Reference:
* https://github.com/WordPress/gutenberg/pull/46817
Follow-up to [54162], [52054].
Props oandregal, jorgefilipecosta , ntsekouras.
Fixes#57563.
See #56792.
git-svn-id: https://develop.svn.wordpress.org/trunk@55144 602fd350-edb4-49c9-b593-d223f7449a82
The WordPress recovery mode only works in combination with the fatal error handler that works as the entry mode for recovery mode. The fatal error handler can be disabled using the `WP_DISABLE_FATAL_ERROR_HANDLER` constant, but so far the logic in the `WP_Recovery_Mode` class was still being initialized even when that constant was set to `true`, which is unnecessary.
This changeset updates the WordPress bootstrap process to only initialize `WP_Recovery_Mode` when needed.
Props costdev.
Fixes#56848.
git-svn-id: https://develop.svn.wordpress.org/trunk@55143 602fd350-edb4-49c9-b593-d223f7449a82
The constant `WP_DEBUG` is a default constant that is set within `wp_initial_constants()` when not defined. This means the constant will always be defined, thus making the `defined( 'WP_DEBUG' )` unnecessary.
Removing the `defined()` provides these benefits:
* Makes the code more readable.
* Tiny performance optimization.
References:
* https://github.com/WordPress/gutenberg/pull/45979
Follow-up to [52049].
Props ocean90, spacedmonkey, mamaduka.
See #57527.
git-svn-id: https://develop.svn.wordpress.org/trunk@55141 602fd350-edb4-49c9-b593-d223f7449a82
For performance, a static variable is added to `wp_theme_has_theme_json()` to cache the boolean result of determining if a theme (or its parent) has a `theme.json` file.
This cache avoids the overhead of calling `get_stylesheet_directory()` and `get_template_directory()` each time `wp_theme_has_theme_json()` is invoked.
The cache is lean, non-persistent, and encapsulated within the function (i.e. function scope and not available externally).
The cache is ignored when:
* `WP_DEBUG` is on to avoid interrupting theme developer's workflow and for extender automated test suites.
* `WP_RUN_CORE_TESTS` is on to ensure each Core test exercises the checking code.
Follow-up to [55092], [55086].
Props oandregal, azaozz, costdev, dmsnell, flixos90, hellofromTonya, Otto42, spacedmonkey.
Fixes#56975.
git-svn-id: https://develop.svn.wordpress.org/trunk@55138 602fd350-edb4-49c9-b593-d223f7449a82
This updates the `caniuse-lite` database from `1.0.30001407` to `1.0.30001448` and applies the resulting changes to generated WP Admin CSS.
This removes two occurrences of `-o-tab-size`, which was required for partial support of the `tab-size` property in Opera Mini. Usage has dropped below 1%, hence this vendor prefix being removed.
See #57555.
git-svn-id: https://develop.svn.wordpress.org/trunk@55137 602fd350-edb4-49c9-b593-d223f7449a82
Parameter names for PHP polyfills in WordPress core need to 100% match the native PHP parameter names. Otherwise using named parameters with those functions could cause fatal errors for installations where the polyfills kick in.
This commit adds inline comments instructing PHPCS to ignore parameters with reserved keywords in the affected functions that should not be renamed:
* `$string` parameter in `mb_substr()` and `mb_strlen()`
* `$array` parameter in `array_key_first()` and `array_key_last()`
This resolves a few WPCS warnings along the lines of:
{{{
It is recommended not to use reserved keyword "string" as function parameter name. Found: $string
}}}
Follow-up to [7140], [10707], [17603], [17621], [32114], [52038], [53365].
Props jrf.
See #56788, #56791.
git-svn-id: https://develop.svn.wordpress.org/trunk@55136 602fd350-edb4-49c9-b593-d223f7449a82
This changeset replaces `this.element._trigger('focus');` with `this.element.trigger('focus');` in `wpdialog` to fix a JS error introduced in [55052].
Indeed, `this` inside the `open()` function of `wpdialog` refers to the jQuery UI widget, whereas `this.element` is the jQuery object of the DOM element. Thus, native jQuery methods need to be used, as `_trigger` is only defined on the jQuery UI widget.
Follow-up to [55052].
Props TobiasBg, audrasjb, shubham1gupta.
Fixes#56830.
git-svn-id: https://develop.svn.wordpress.org/trunk@55134 602fd350-edb4-49c9-b593-d223f7449a82
In `wp_get_typography_font_size_value()`, adds support for using a minimum font size for fluid typography when defined in a theme's `theme.json` file.
Reference:
* Part of [https://github.com/WordPress/gutenberg/pull/42489 Gutenberg PR 42489]
Follow-up to [54497], [54260].
Props andrewserong, ramonopoly, hellofromTonya, joen.
Fixes#57529.
git-svn-id: https://develop.svn.wordpress.org/trunk@55133 602fd350-edb4-49c9-b593-d223f7449a82
Adds pagination and ordering support to `WP_REST_Pattern_Directory_Controller` by allow listing `'per_page'`, `'page'`, `'offset'`, `'order'`, and `'orderby'` query parameters. This change enables pagination and ordering features in the pattern directory explorer by using the same sort as wordpress.org/patterns.
Reference:
* [https://github.com/WordPress/gutenberg/pull/45293 Gutenberg PR 45293]
Follow-up to [55098], [51206], [51021].
Props ntsekouras, ryelle, arrasel403, hellofromTonya, ironprogrammer, mukesh27, robinwpdeveloper.
Fixes#57501.
git-svn-id: https://develop.svn.wordpress.org/trunk@55132 602fd350-edb4-49c9-b593-d223f7449a82
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$global` parameter to `$global_name` in `Tests_Kses::test_kses_globals_are_defined()`.
Follow-up to [52229], [54203], [55090].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55131 602fd350-edb4-49c9-b593-d223f7449a82
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit renames the `$echo` parameter to `$display` in `Tests_Functions_wpRefererField::test_wp_referer_field_should_respect_display_arg()`.
Follow-up to [54420], [54929].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55130 602fd350-edb4-49c9-b593-d223f7449a82
Adds a new non-public `WP_REST_Block_Patterns_Controller::migrate_pattern_categories()` method to automatically migrate existing content's pattern categories to the new ones introduced in [55098].
Old to New
`'buttons'` to `'call-to-action'`
`'columns'` to `'text'`
`'query'` to `'posts'`
Reference:
* Part of [https://github.com/WordPress/gutenberg/pull/46144 Gutenberg PR 46144]
Follow-up to [55098], [53152].
Props ntsekouras, annezazu, jameskoster, joen, hellofromTonya, mcsf, paaljoachim, ryelle.
Fixes#57532.
git-svn-id: https://develop.svn.wordpress.org/trunk@55125 602fd350-edb4-49c9-b593-d223f7449a82
This changeset fixes a bug where clicking on an anchor link in the content changes the state of the button that opens and closes the responsive menu. It adds a conditional to check if the clicked anchor link is inside the primary navigation menu (`#site-navigation`), in order to prevent content anchor links from changing the state of the button.
Known limitations: The state of the button is not reset when the browser is resized. If a menu anchor link is first clicked while on desktop width, and the browser width is reduced, the menu button will show the text "Close" even though the menu is not opened.
Props andreaboe, sabernhardt, poena, afercia, chaion07, cu121, mukesh27.
Fixes#53331.
git-svn-id: https://develop.svn.wordpress.org/trunk@55124 602fd350-edb4-49c9-b593-d223f7449a82
This changeset removes color names from pattern names to make them less opinionated, and avoid mismatching when the user changes related colors. It does not update filenames for now, as they are not directly exposed to end users.
Props poena, mukesh27.
Fixes#56720.
git-svn-id: https://develop.svn.wordpress.org/trunk@55122 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds support for `:link` and `:any-link` in `theme.json`, using the `VALID_ELEMENT_PSEUDO_SELECTORS` array. `:link` can be used to style unvisited links and `:any-link` can be used to style any link containing an `href` attribute.
Props peterwilsoncc, whaze, audrasjb, costdev, mukesh27.
Fixes#57053.
git-svn-id: https://develop.svn.wordpress.org/trunk@55121 602fd350-edb4-49c9-b593-d223f7449a82
This replaces a helper method in `Tests_Theme_wpThemeJsonResolver` with the `wp_recursive_ksort()` function that was introduced later for the same purpose.
Follow-up to [52049], [53129], [55117].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@55118 602fd350-edb4-49c9-b593-d223f7449a82
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.
This commit:
* Renames the `$array` parameter to `$input_array` in `wp_recursive_ksort()`.
* Moves the function next to other array-related functions for consistency.
Follow-up to [53129], [54929].
Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
git-svn-id: https://develop.svn.wordpress.org/trunk@55117 602fd350-edb4-49c9-b593-d223f7449a82
This changeset fixes an issue with the "Dots" style of the Separator block on multiple bundled themes. It adds `max-width: 100%` to this style variation on the following themes: Twenty Eleven, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, and Twenty Sixteen.
Props umesh84, sabernhardt, audrasjb, amin7, esratpopy, multidots1896.
Fixes#56114.
git-svn-id: https://develop.svn.wordpress.org/trunk@55114 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds a `large-text` attribute and removes the `size` attribute of the text input field located in the Slug metabox. It improves its usability, at least for as long as the Slug metabox is available in the Classic Editor.
Props ABTOP, nacin, helen, sabernhardt, abitofmind, tyxla, audrasjb.
Fixes#16346.
git-svn-id: https://develop.svn.wordpress.org/trunk@55113 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds `spellcheck="false"` attribute to Database Password field on the Database Setup screen.
Follow-up to [55094], [55095], [55096].
See #56763.
git-svn-id: https://develop.svn.wordpress.org/trunk@55110 602fd350-edb4-49c9-b593-d223f7449a82
This changeset removes the "Remove selected item" from the classic Navigation Menus screen when no item is selected, and makes it non focusable from assistive technologies.
Plus, this changeset fixes a small unrelated coding standard issue in `nav-menus.css`.
Props kebbet, joedolson, audrasjb.
Fixes#56942.
git-svn-id: https://develop.svn.wordpress.org/trunk@55109 602fd350-edb4-49c9-b593-d223f7449a82