This adjusts `str_contains()` code layout to have an early exit for an empty `$needle`, matching similar fragments in `str_starts_with()` and `str_ends_with()` for better readability.
Follow-up to [52039], [52040].
See #57839.
git-svn-id: https://develop.svn.wordpress.org/trunk@55726 602fd350-edb4-49c9-b593-d223f7449a82
Per the documentation standards, it should not be used outside of the default bundled themes.
Follow-up to [52049], [52051], [53331], [54156], [54214], [55203], [55719].
See #57840.
git-svn-id: https://develop.svn.wordpress.org/trunk@55725 602fd350-edb4-49c9-b593-d223f7449a82
This moves a reference link in `::get_attribute_names_with_prefix()` below the code example, so that it is correctly displayed in the Developer Resources.
Includes updating some other `@see` tags for consistency as per the documentation standards.
Additionally, the example code for `WP_HTML_Tag_Processor::get_tag()` is updated to show lowercase tag names in the input HTML, so that it does not convey the wrong impression that the uppercase output from `::get_tag()` depends on the case of the input HTML.
Follow-up to [55203].
Props dmsnell, johnbillion, audrasjb, SergeyBiryukov.
Fixes#58254.
git-svn-id: https://develop.svn.wordpress.org/trunk@55724 602fd350-edb4-49c9-b593-d223f7449a82
In [55718] the Unicode replacement character was mistakenly removed. The purpose of including the character was to communicate what it looks like and why the Tag Processor won't insert it into the document.
This changeset brings the character back and adds a small clue to fix the confusion that may lead to its removal.
Follow-up to [55718].
Props dmsnell.
Fixes#58256
See #57840.
git-svn-id: https://develop.svn.wordpress.org/trunk@55723 602fd350-edb4-49c9-b593-d223f7449a82
This patch adjusts some minor neutral whitespace that the Gutenberg linting rejects.
There are no code changes otherwise.
Props dmsnell.
Fixes#58250.
git-svn-id: https://develop.svn.wordpress.org/trunk@55721 602fd350-edb4-49c9-b593-d223f7449a82
This aims to make the update process more reliable and ensures that if a plugin or theme update fails, the previous version can be safely restored.
* When updating a plugin or theme, the old version is moved to a temporary backup directory:
* `wp-content/upgrade-temp-backup/plugins/[plugin-slug]` for plugins
* `wp-content/upgrade-temp-backup/themes/[theme-slug]` for themes.
* If the update fails, then the backup kept in the temporary backup directory is restored to its original location.
* If the update succeeds, the temporary backup is deleted.
To further help troubleshoot plugin and theme updates, two new checks were added to the Site Health screen:
* A check to make sure that the `upgrade-temp-backup` directory is writable.
* A check that there is enough disk space available to safely perform updates.
To avoid confusion: The temporary backup directory will NOT be used to “roll back” a plugin to a previous version after a completed update. This directory will simply contain a transient backup of the previous version of a plugin or theme being updated, and as soon as the update process finishes, the directory will be empty.
Follow-up to [55204], [55220].
Props afragen, costdev, pbiron, azaozz, hellofromTonya, aristath, peterwilsoncc, TJNowell, bronsonquick, Clorith, dd32, poena, TimothyBlynJacobs, audrasjb, mikeschroder, a2hosting, KZeni, galbaras, richards1052, Boniu91, mai21, francina, TobiasBg, desrosj, noisysocks, johnbillion, dlh, chaion07, davidbaumwald, jrf, thisisyeasin, ignatggeorgiev, SergeyBiryukov.
Fixes#51857.
git-svn-id: https://develop.svn.wordpress.org/trunk@55720 602fd350-edb4-49c9-b593-d223f7449a82
This changeset removes the `aligncenter` class from `h2` and `is-subheading` items in the WordPress 6.2 About Page, for more consistent alignment. Also, future minor releases will add more left-aligned paragraphs under the "Maintenance Releases" section.
Props shagors, sabernhardt, mukesh27, amin7, costdev, pavanpatil1, audrasjb.
Fixes#57387.
git-svn-id: https://develop.svn.wordpress.org/trunk@55716 602fd350-edb4-49c9-b593-d223f7449a82
The `permissions` key in a job declares the GitHub permissions that are granted to the token that's used by the job. Restricting the permissions reduces the impact that a vulnerability in the CI system can have.
Props desrosj, johnbillion
See #57865
git-svn-id: https://develop.svn.wordpress.org/trunk@55715 602fd350-edb4-49c9-b593-d223f7449a82
This changeset updates the jQuery version to 3.6.4 in `script-loader.php` to correcly match the current version used in WordPress.
This was accidentally missed in [55491].
Props nickpap, TobiasBg, dhrumilk.
Fixes#58203.
See #57324.
git-svn-id: https://develop.svn.wordpress.org/trunk@55713 602fd350-edb4-49c9-b593-d223f7449a82
This resolves a fatal error on PHP < 8.0, as `wp-includes/compat.php` is not loaded in this file, so `str_starts_with()` may not be available.
Follow-up to [55703].
Props dd32, flixos90, DigTek.
Fixes#58244. See #58012.
git-svn-id: https://develop.svn.wordpress.org/trunk@55710 602fd350-edb4-49c9-b593-d223f7449a82
The `view_items` post type label is used in the Editor, for the `aria-label` of the link to go back to the Posts list. When editing a Reusable block, it fallbacks to 'View Posts'. It should be 'View Reusable blocks'.
Fixes#58209.
git-svn-id: https://develop.svn.wordpress.org/trunk@55709 602fd350-edb4-49c9-b593-d223f7449a82
A bug was discovered where where the parser wasn't returning to the
start of the affected tag after making some updates.
In few words, the Tag Processor has not been treating its own internal
pointer `bytes_already_parsed` the same way it treats its bookmarks.
That is, when updates are applied to the input document and then
`get_updated_html()` is called, the internal pointer transfers to
the newly-updated content as if no updates had been applied since
the previous call to `get_updated_html()`.
In this patch we're creating a new "shift accumulator" to account for
all of the updates that accrue before calling `get_updated_html()`.
This accumulated shift will be applied when swapping the input document
with the output buffer, which should result in the pointer pointing to
the same logical spot in the document it did before the udpate.
In effect this patch adds a single workaround for treating the
internal pointer like a bookmark, plus a temporary pointer which points
to the beginning of the current tag when calling `get_updated_html()`.
This will preserve the assumption that updating a document doesn't
move that pointer, or shift which tag is currently matched.
Props dmsnell, zieladam.
Fixes#58179.
git-svn-id: https://develop.svn.wordpress.org/trunk@55706 602fd350-edb4-49c9-b593-d223f7449a82
This changeset removes an unnecessary `esc_html()` escapement for `link_url`, as `esc_url()` already does the job.
Follow-up to [11383].
Props utsav72640, audrasjb.
Fixes#58239.
git-svn-id: https://develop.svn.wordpress.org/trunk@55704 602fd350-edb4-49c9-b593-d223f7449a82
`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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55703 602fd350-edb4-49c9-b593-d223f7449a82
Add a helper function called `wp_cache_set_last_changed` to set the last changed value for cache groups. This function has a new action called `wp_cache_set_last_changed`, allowing for developers to cache invalidate when last changed value is changed.
Props tillkruess, spacedmonkey, peterwilsoncc, mukesh27, johnjamesjacoby.
Fixes#57905.
git-svn-id: https://develop.svn.wordpress.org/trunk@55702 602fd350-edb4-49c9-b593-d223f7449a82
In [55252] the function `wp_queue_posts_for_term_meta_lazyload` was refactored to use `wp_cache_get_multiple`. This refactor included a call to `get_term`. However, calling get_term calls `sanitize_term`, which sanitizes all fields in a term. The full term object is not needed in this context as term meta only needs to the term id, which is already in the function. Saving calls to `sanitize_term` will improve performance of this function.
Props spacedmonkey, joemcgill, mukesh27.
Fixes#57966.
git-svn-id: https://develop.svn.wordpress.org/trunk@55701 602fd350-edb4-49c9-b593-d223f7449a82
The former URL used to refer to LGPL 2.1 at the time, but does not redirect to its current location.
Includes updating the `Algorithm::Diff` Perl module URL.
Props jigar-bhanushali, utsav72640.
Fixes#58217.
git-svn-id: https://develop.svn.wordpress.org/trunk@55700 602fd350-edb4-49c9-b593-d223f7449a82
This more closely matches the previous behavior with multiple `if`/`elseif` statements.
Follow-up to [55688].
See #56982.
git-svn-id: https://develop.svn.wordpress.org/trunk@55698 602fd350-edb4-49c9-b593-d223f7449a82
The autosaves and revisions controllers used to set the same class properties in a slightly different order.
This commit makes the `::__construct()` methods of both classes more consistent to simplify future maintenance.
Follow-up to [46272], [51962].
See #57839.
git-svn-id: https://develop.svn.wordpress.org/trunk@55697 602fd350-edb4-49c9-b593-d223f7449a82
`WP_REST_Revisions_Controller::delete_item_permissions_check()` no longer uses the value of the `$parent_post_type` variable anywhere.
Follow-up to [45812], [47547], [47850].
Props Soean, mukesh27.
Fixes#58218.
git-svn-id: https://develop.svn.wordpress.org/trunk@55696 602fd350-edb4-49c9-b593-d223f7449a82
This PR removes the `wp_enqueue_registered_block_scripts_and_styles` callback from the `enqueue_block_editor_assets` action.
There are two actions to enqueue block assets: `enqueue_block_editor_assets` and `enqueue_block_assets`. The former enqueues the assets to the editor and the later enqueues them to the front-end and the editor. Given `wp_enqueue_registered_block_scripts_and_styles` is already bound to the `enqueue_block_assets` (front-end and editor), it is unnecessary to bind it to `enqueue_block_editor_assets` (editor) as well.
This was originally introduced at [44157] and hasn't been modified since.
Props ellatrix, costdev.
Fixes#58208.
git-svn-id: https://develop.svn.wordpress.org/trunk@55695 602fd350-edb4-49c9-b593-d223f7449a82
This replaces the only remaining instance of `dirname( __FILE__ )` in core to avoid the performance overhead of a function call.
Follow-up to [47198], [50161], [50631].
Props hztyfoon, rudlinkon.
Fixes#58207.
git-svn-id: https://develop.svn.wordpress.org/trunk@55691 602fd350-edb4-49c9-b593-d223f7449a82
This changeset improves the loading spinner alignment of the Classic Editor's tag field.
Follow-up to [19897], [31611].
Props Presskopp, SergeyBiryukov, audrasjb.
Fixes#58136.
git-svn-id: https://develop.svn.wordpress.org/trunk@55689 602fd350-edb4-49c9-b593-d223f7449a82
Use `continue` to help separate each case for better readability, instead of having a wall of `if`/`elseif`.
Includes simplifying a similar fragment in `make_site_theme_from_default()`.
Follow-up to [1575], [2037], [2040], [2044], [2346], [7999], [14080], [14485].
Props costdev, krunal265, hellofromTonya, brookedot, SergeyBiryukov.
Fixes#56982.
git-svn-id: https://develop.svn.wordpress.org/trunk@55688 602fd350-edb4-49c9-b593-d223f7449a82
`get_block_templates()` is responsible for finding block templates that match a given search. The function receives a query parameter with the relevant metadata (slugs of the templates, areas of the template parts, etc) to find the user templates (database) and theme templates (file directory).
This function can be made more performant by changing how it works. Before this change, it processed all the block templates and discarded the ones that didn't match the query after it occurred. This commit makes it so it discards the templates that don't match the query before processing them. As a result, it only has to process the subset of templates that will be used, instead of all of them.
This change impacts any theme with block templates. TwentyTwentyThree reports a 15% improvement in Time To First Byte.
Props spacedmonkey, jorgefilipecosta, youknowriad, flixos90, mukesh27.
Fixes#57756.
git-svn-id: https://develop.svn.wordpress.org/trunk@55687 602fd350-edb4-49c9-b593-d223f7449a82
Remove the `theme` parameter from the query passed to `get_block_templates()`. It is not used or documented. This removal doesn't have any effect in the code, as the data is ignored anyway.
Props draganescu, audrasjb, davidbaumwald, hellofromTonya.
Fixes#57736.
git-svn-id: https://develop.svn.wordpress.org/trunk@55686 602fd350-edb4-49c9-b593-d223f7449a82
The parameter appears to have been passed by accident, as the function does not accept any parameters.
Follow-up to [54218].
Props malavvasita, hztyfoon, dd32.
Fixes#58181.
git-svn-id: https://develop.svn.wordpress.org/trunk@55685 602fd350-edb4-49c9-b593-d223f7449a82
This changeset replaces `echo __()` with the appropriate `_e()` function. It also ensures the punctuation is included in the translation string.
Props mujuonly, audrasjb, vladytimy, krupalpanchal, mukesh27.
Fixes#58138.
git-svn-id: https://develop.svn.wordpress.org/trunk@55684 602fd350-edb4-49c9-b593-d223f7449a82
This aims to better match similar fragments in other core functions.
Follow-up to [11162], [13844], [14170], [55682].
See #57839.
git-svn-id: https://develop.svn.wordpress.org/trunk@55683 602fd350-edb4-49c9-b593-d223f7449a82
The cache group `users-queries` was added in [55657]. This global cache group, was named to be inline with cache groups added in [55526]. However, the naming of the group does not match, as other cache groups, do not end with s at the end. This change fix this naming.
Props spacedmonkey, SergeyBiryukov, peterwilsoncc.
See #40613.
git-svn-id: https://develop.svn.wordpress.org/trunk@55680 602fd350-edb4-49c9-b593-d223f7449a82