4574 Commits

Author SHA1 Message Date
Peter Wilson
a20c20774f Formatting: Account for HTML entities in wp_extract_urls().
Prevent `wp_extract_urls()` trimming HTML entities within URLs. Correctly escaped URLs such as https://youtube.com/watch?v=dQw4w9WgXcQ&t=1 will now be extracted as https://youtube.com/watch?v=dQw4w9WgXcQ&t=1 rather than truncated.

Props trex005, voldemortensen, johnbillion, ironprogrammer, costdev, hellofromtonya.
Fixes #30580



git-svn-id: https://develop.svn.wordpress.org/trunk@53044 602fd350-edb4-49c9-b593-d223f7449a82
2022-04-01 03:38:55 +00:00
Peter Wilson
afc55a72de Canonical: Include all public status in 404 redirects.
In `redirect_guess_404_permalink()` search for posts using all publicly queryable statuses rather than limiting options to the `publish` status.

Props goaroundagain, costdev, htdat, audrasjb, chaion07.
Fixes #47911.



git-svn-id: https://develop.svn.wordpress.org/trunk@53043 602fd350-edb4-49c9-b593-d223f7449a82
2022-04-01 03:23:07 +00:00
Peter Wilson
b1b305b826 Posts, Post Types: Set post filter in update_post_cache().
Ensure the post cache is primed with raw sanitized data. This resolves an inconsistency between how posts retrieved via `get_post()` vs `WP_Query` are cached.

This prevents `sanitize_post( $post, 'raw' )` being run multiple times on a cached post. This can happen over 20 times per post on some page loads so avoiding this will provide a noticeable performance boost.

Props Cybr, SergeyBiryukov, peterwilsoncc, hellofromTonya, costdev.
Fixes #50567.



git-svn-id: https://develop.svn.wordpress.org/trunk@53042 602fd350-edb4-49c9-b593-d223f7449a82
2022-04-01 03:16:33 +00:00
Jonny Harris
ed3854948f Taxonomy: Improve performance by taxonomy queries by adding a limitting requested terms.
Add a limit to the number of terms requested in taxonomy queries. This improves the performance of the query and the likelihood of hitting an existing term query cache. 

Props Spacedmonkey, peterwilsoncc, flixos90. 
Fixes #55360. 



git-svn-id: https://develop.svn.wordpress.org/trunk@53037 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-31 10:04:25 +00:00
Jonny Harris
1d0c189f21 Comments: Improve performance of the wp_count_comments function.
Improve performance of the `wp_count_comments` function by replacing a complex query with multiple calls to the `get_comments` function. Passing the `count` parameter to the `get_comments` function results in a simple 
count query that returns quickly. Using `get_comments` also means that query is cached and run through filters. 


Props FolioVision, markjaquith, nacin, ryan, coffee2code, wonderboymusic, ComputerGuru, jb510, SergeyBiryukov, Znuff, Rahe, uday17035, spacedmonkey, peterwilsoncc.
Fixes #19901.



git-svn-id: https://develop.svn.wordpress.org/trunk@53036 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-31 09:07:02 +00:00
Peter Wilson
d2ab3d1837 Build/Test Tools: Add unit tests for feed_links_extra().
Props costdev, hellofromTonya.
Fixes #54713.
See #54725.



git-svn-id: https://develop.svn.wordpress.org/trunk@53033 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-31 00:55:16 +00:00
Felix Arntz
0514150026 Media: Introduce wp_content_img_tag filter.
This filter allows modifying individual `img` tags within a blob of content that are by default processed by the `wp_filter_content_tags()` function. The addition of this filter facilitates plugins that tweak images to accomplish this goal without re-implementing duplicate content image parser logic, which furthermore can have a negative performance impact due to additional regular expressions.

In addition to the filterable `img` tag, the filter receives the context (typically the function or filter in which the content is parsed) and the attachment ID. The latter may be 0, in case the image is not an attachment (for example when it is an external image URL).

Props adamsilverstein, flixos90, pbearne, peterwilsoncc.
Fixes #55347.


git-svn-id: https://develop.svn.wordpress.org/trunk@53028 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-29 23:56:18 +00:00
Joe Dolson
86ed0d2e57 Media: Preserve attachment properties on cropping custom logo.
Migrate the alternative text, title, description, and caption of an image over to the cropped copy of the image after cropping. Ensure that characteristics added to an image prior to cropping are not lost.

Props flixos90, Clorith, afercia, antonvlasenko, ironprogrammer, hellofromTonya.
Fixes #37750.


git-svn-id: https://develop.svn.wordpress.org/trunk@53027 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-29 21:46:09 +00:00
Jb Audras
1cb0e9ced6 Editor: Use wp_unique_id() instead of uniqid() to generate CSS class names.
Backports changes from https://github.com/WordPress/gutenberg/pull/38891.
See https://github.com/WordPress/gutenberg/issues/38889.

Props westonruter, mamaduka.
See #55474.


git-svn-id: https://develop.svn.wordpress.org/trunk@53012 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-29 13:04:24 +00:00
Jonny Harris
e19b7ead2c Users: Introduce the concept of a large site to single site installations.
Currently in WordPress multisite there is a concept of large networks. The function `wp_is_large_network` is used to determine if a network has a large number of sites or users. If a network is marked as large, then 
expensive queries to calculate user counts are not run on page load but deferred to scheduled events. However there are a number of places in a single site installation where this functionality would also be useful, as 
expensive calls to count users and roles can make screens in the admin extremely slow.

In this change, the `get_user_count` function and related functionality around it is ported to be available in a single site context. This means that expensive calls to the `count_users` function are replaced with 
calls to `get_user_count`. This change also includes a new function called `wp_is_large_user_count` and a filter of the same name, to mark if a site is large.

Props johnbillion, Spacedmonkey, Mista-Flo, lumpysimon, tharsheblows, obenland, miss_jwo, jrchamp, flixos90, macbookandrew, pento, desrosj, johnjamesjacoby, jb510, davidbaumwald, costdev. 
Fixes #38741.



git-svn-id: https://develop.svn.wordpress.org/trunk@53011 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-29 12:41:00 +00:00
Jonny Harris
1792018b4b Query: Ensure that sticky post query returns all sticky posts.
Ensure that the `posts_per_page` parameter submit to sticky post query matches the number of sticky posts requested. 

Follow-up to [52982]

Props Spacedmonkey, peterwilsoncc.
See #36907.



git-svn-id: https://develop.svn.wordpress.org/trunk@52990 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-25 09:54:52 +00:00
SergeyBiryukov
55c399ff04 Tests: Use a more descriptive name for the sticky posts test that verifies the parameters from the main query.
Reorder the parameters of the `get_posts()` call for consistency with similar calls elsewhere.

Follow-up to [52982].

See #36907.

git-svn-id: https://develop.svn.wordpress.org/trunk@52985 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-23 16:26:01 +00:00
Sergey Biryukov
fc4e1a4d5c Docs: Adjust documentation in get_post_galleries() tests per the documentation standards.
Follow-up to [52190], [52797].

Props azouamauriac, SergeyBiryukov.
See #54725, #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52984 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-23 15:01:48 +00:00
Sergey Biryukov
041328b241 Tests: Remove some unused variables in phpunit/tests/filters.php.
Follow-up to [29422], [31014].

Props azouamauriac.
See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52983 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-23 14:48:28 +00:00
Jonny Harris
b3d6638139 Query: Improved sticky post query
Ensure that the parameters `update_post_meta_cache`, `update_post_term_cache`, `cache_results`, `suppress_filters` and 
`lazy_load_term_meta` that are passed to WP_Query, are also passed down to the secondary query used to get sticky 
posts. 

Props Spacedmonkey, peterwilsoncc, rehanali, uday17035. 
Fixes #36907.



git-svn-id: https://develop.svn.wordpress.org/trunk@52982 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-23 10:37:11 +00:00
Jb Audras
6c270d0d17 Administration: Replace contracted verb forms for better consistency.
This changeset replaces contracted verb forms like `doesn't`, `can't`, or `isn't` with non-contracted forms like `does not`, `cannot`, or `is not`, for better consistency across the WordPress administration. It also updates some corresponding unit tests strings.

Props Presskopp, socalchristina, aandrewdixon, francina, SergeyBiryukov, JeffPaul, audrasjb, hellofromTonya.
Fixes #38913.
See #39176.


git-svn-id: https://develop.svn.wordpress.org/trunk@52978 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-22 16:23:32 +00:00
Jonny Harris
e10b6967fa Build/Test Tools: Make comment cache group persistent in object-cache.php.
After the comment cache group was made persistent in [37613], also make 
persistent in object-cache.php used for PHPUnit tests. 

See #54725 



git-svn-id: https://develop.svn.wordpress.org/trunk@52976 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-22 11:34:32 +00:00
Peter Wilson
e6eaa58741 Taxonomy: Increase cache hits in WP_Term_Query.
Increase the number of cache hits in `WP_Term_Query` by normalizing data included in the cache key.

Arguments that do not affect the SQL query, eg `update_term_meta_cache`, are removed from cache key generation. Arguments that are accepted in multiple formats, eg a string and an array, are normalized for both the cache key and the SQL query.

Props spacedmonkey.
Fixes #55352.



git-svn-id: https://develop.svn.wordpress.org/trunk@52970 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-21 03:53:33 +00:00
Sergey Biryukov
26c7b2b079 KSES: Add support for <ruby> and related elements.
`<ruby>` element and its friends are used to attach annotation text onto a piece of text. This is especially commonly used in Japanese content, but it can also been seen in content of other languages like Chinese.

The set of elements to enable such functionality consists of `<ruby>`, `<rt>`, and `<rp>` in the [https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element HTML Standard], while some browsers (like Firefox) additionally support `<rb>` and `<rtc>` for more advanced formatting, which are not yet included in the official HTML spec, but can be found in a [https://www.w3.org/TR/html-ruby-extensions/ W3C extension].

Props upsuper, mukesh27, SergeyBiryukov.
Fixes #54698.

git-svn-id: https://develop.svn.wordpress.org/trunk@52969 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-21 00:28:55 +00:00
Peter Wilson
e7a9f9df4e KSES: Allow lang, xml:lang, dir attributes globally.
Globally permit the `lang`, `xml:lang`, and `dir` attributes on all elements rather than a subset in accordance with the HTML specification.

Props upsuper, SergeyBiryukov, mukesh27, audrasjb.
Fixes #54699.


git-svn-id: https://develop.svn.wordpress.org/trunk@52968 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-21 00:11:08 +00:00
John Blackbourn
95d26d682f Formatting: Add support for formatting sizes as PB, EB, ZB, and YB.
Props henry.wright, Presskopp

Fixes #40875


git-svn-id: https://develop.svn.wordpress.org/trunk@52955 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-18 20:46:17 +00:00
John Blackbourn
735e913200 Plugins: Convert apply_filters() into a proper variadic function.
This makes its signature more correct by implementing the spread operator, and adjusts the internal logic correspondingly without affecting performance.

Props jrf, SergeyBiryukov, davidbaumwald, mauriac, johnbillion

Fixes #53218


git-svn-id: https://develop.svn.wordpress.org/trunk@52952 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-18 18:21:40 +00:00
Robert Anderson
3b8dc986d2 Add WP_Block_Editor_Context::$name
Adds a new `WP_Block_Editor_Context::$name` and field. This allows plugin
developers to tell which block editor is being loaded when using filters such as
`allowed_block_types_all` and `block_editor_rest_api_preload_paths`.

Fixes #55301.
Props talldanwp, gziolo, andraganescu.


git-svn-id: https://develop.svn.wordpress.org/trunk@52942 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-17 03:35:13 +00:00
Peter Wilson
c7e067c578 Tests: Include special characters in term names for wp_set_term_objects().
Test `wp_set_term_objects()` using terms with special characters in the name, for example ampersand, bullet and other symbols and punctuation.

Props kapacity, costdev.
Fixes #53152.
See #54725.



git-svn-id: https://develop.svn.wordpress.org/trunk@52938 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-16 03:04:40 +00:00
Dominik Schilling
8a64e9fef9 I18N, Script Loader: Don't register empty locale data objects.
For `wp.i18n` the library [https://github.com/messageformat/Jed Jed] was initially used which was throwing an error if a domain was not registered but used in a translate function. Later, the library was replaced by [https://github.com/aduth/tannin Tannin] which no longer requires the domain to be registered and thus we can avoid printing an empty-ish translations script that doesn't add any translations.

Props jsnajdr.
Fixes #55250.

git-svn-id: https://develop.svn.wordpress.org/trunk@52937 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-15 15:57:57 +00:00
Tonya Mork
f6b39a9d66 Media: Relocate wp_filesize() function for use in frontend and backend.
A new function `wp_filesize()` was added with [52837]. The function lived in the `wp-admin/includes/file.php` file. However, this admin specific function is not loaded into memory when hitting `media/edit` endpoint. The result was a `500` Internal Server Error. Why? The function is invoked with that endpoint, but the function does not exist in memory.

This commit relocates the new function to the `wp-includes/functions.php` file. In doing so, the function is available for both the frontend and backend.

Follow-up to [52837].

Props talldanwp, spacedmonkey, costdev, antonvlasenko.
Fixes #55367.

git-svn-id: https://develop.svn.wordpress.org/trunk@52932 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-14 16:30:35 +00:00
Jonny Harris
34d46cd501 Taxonomy: Use get_terms instead of a database lookup in term_exists().
Replace raw SQL queries to the terms table, with a call to the `get_terms` function. Using `get_terms` means that `term_exists` is now cached. For developers using `term_exists` where cache invalidation is disabled, such as importing, a workaround was added to ensure that queries are uncached. 

Props Spacedmonkey, boonebgorges, flixos90, peterwilsoncc. 
Fixes #36949. 


git-svn-id: https://develop.svn.wordpress.org/trunk@52921 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-11 11:05:02 +00:00
Tonya Mork
e5cb4986f1 Build/Test Tools: Add trash and restore of a single post e2e tests.
Adds an end-to-end (e2e) test case for:
* Emptying a post from the trash.
* Restoring a post from the trash.

Props pavanpatil1, pooja1210, justinahinon, kevin940726.
Fixes #54843.

git-svn-id: https://develop.svn.wordpress.org/trunk@52839 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-10 16:26:56 +00:00
Jonny Harris
7fc225aa87 Media: Store attachment’s file size in metadata.
Store the file size of all newly uploaded attachments, as part of the metadata stored in post meta. Storing file size means, developers will not have to resort to doing `filesize` function calls, that can be time consuming on assets on offloaded to services like Amazon’s S3. 

This change also introduces a new helper function called, `wp_filesize`. This is a wrapper around the `filesize` php function, that adds some helpful filters and ensures the return value is an integer.

Props Cybr, Spacedmonkey, SergeyBiryukov, johnwatkins0, swissspidy, desrosj, joemcgill, azaozz, antpb, adamsilverstein, uday17035. 
Fixes #49412. 



git-svn-id: https://develop.svn.wordpress.org/trunk@52837 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-10 13:08:19 +00:00
Jonny Harris
4a9f5fe3be Taxonomy: Only store term_ids and object_ids in WP_Term_Query query caches.
The query cache currently implemented in `WP_Term_Query` caches the final output of the query, depending on what fields are requested. This is wasteful, as if a user requests `fields` => `all`, then an unlimited array of `WP_Term` objects could be stored in the object cache. Instead of storing the whole WP_Term object, this change only the term_id is stored. To get an array the full WP_Term objects, the `_prime_term_caches` function is called with an array of ids. In instances where a persistent object cache is not in use, then this will result in another SQL query to be run. After `_prime_term_caches` is called if this term is requested again in the same page load, then it will already be loaded into memory.  If a user runs `WP_Term_Query` with the fields param set to `all_with_object_id`, an array of objects containing both the term_id and object_ids are stored in cache. 

This change also improves the logic to load term meta caches. This change ensures that term meta is always primed for all terms loaded in the term query. 

Props Spacedmonkey, boonebgorges, jbpaul17, peterwilsoncc, flixos90, pbearne.
Fixes #37189.


git-svn-id: https://develop.svn.wordpress.org/trunk@52836 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-10 10:56:09 +00:00
Sergey Biryukov
6b224e3ac0 Canonical: Check if the URL scheme exists in strip_fragment_from_url().
This avoids an "Undefined index" PHP notice when a schemeless URI is passed.

Props dd32, SergeyBiryukov.
Fixes #55333.

git-svn-id: https://develop.svn.wordpress.org/trunk@52833 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-09 15:06:09 +00:00
Peter Wilson
4d29532b9b Media: Revert query string support for wp_check_filetype().
Revert [52829] due to fatal errors in some Multisite configurations.

Props dd32, SergeyBiryukov, audrasjb.
See #30377.



git-svn-id: https://develop.svn.wordpress.org/trunk@52832 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-09 00:46:24 +00:00
Jb Audras
176afff375 Media: Allow wp_check_filetype() to support query strings in URLs.
This changeset adjusts the regex in `wp_check_filetype()` to support query strings in URLs.

Follow-up to [30640], [32172].

Props voldemortensen, johnbillion, layotte, dd32, atomicjack, supercleanse, spencercameron, ianmjones, audrasjb.
Fixes #30377.


git-svn-id: https://develop.svn.wordpress.org/trunk@52829 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-07 22:50:12 +00:00
Sergey Biryukov
4cee32dd66 Themes: Correct the logic for displaying a _doing_it_wrong() notice for add_theme_support( 'html5' ).
* Calling `add_theme_support( 'html5' )` without passing an array of supported types should throw a `_doing_it_wrong()` notice: "You need to pass an array of types".
* If the second parameter is not specified, it should fall back to an array of `comment-list`, `comment-form`, and `search-form` for backward compatibility.
* If the second parameter is not an array, the function should return `false`.

The latter two points are covered by existing unit tests. The first one is now addressed by `@expectedIncorrectUsage`.

Follow-up to [25193], [25235], [25785].

Props audrasjb, peterwilsoncc, SergeyBiryukov.
Fixes #51657.

git-svn-id: https://develop.svn.wordpress.org/trunk@52828 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-07 14:42:49 +00:00
Sergey Biryukov
34d98887a2 Tests: Restore the original user role in the (add|remove)_user_role hooks test.
This makes sure the test does not unintentionally affect other tests.

Follow-up to [52823].

Fixes #54164.

git-svn-id: https://develop.svn.wordpress.org/trunk@52824 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-06 23:02:12 +00:00
Sergey Biryukov
864ab55b33 Users: Bring some consistency to user role hooks.
This standardizes the actions that one needs to hook to for tracking user role changes:

* `add_user_role` is only fired when the user has actually gained a new role.
* `remove_user_role` is only fired when the role was actually removed.

Both actions are now fired in `WP_User::set_role()` as appropriate.

Props dd32, SergeyBiryukov.
Fixes #54164.

git-svn-id: https://develop.svn.wordpress.org/trunk@52823 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-06 16:09:06 +00:00
Sergey Biryukov
f0fdad1c8e Query: Make sure WP_Query::get_queried_object() works for author_name before ::get_posts() is run.
Previously, the queried object with author data was not available before the posts loop when `author_name` is used in the query instead of `author`. With block themes, this use case appears to be more common to display the author name in the header.

This commit adjusts the logic in `WP_Query::get_queried_object()` to fall back to the `author_name` field if `author` is not present, similar to how taxonomy slugs are handled.

Follow-up to [1728], [3290], [10992].

Props dd32, swissspidy, SergeyBiryukov.
Fixes #55100.

git-svn-id: https://develop.svn.wordpress.org/trunk@52822 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-05 15:33:05 +00:00
Sergey Biryukov
b28dcfd832 Docs: Add a @since note for WP::parse_request() about the new return value.
Includes minor code layout fixes for consistency. Additionally, this moves a more general unit test above the more specific one.

Follow-up to [52814].

See #10886.

git-svn-id: https://develop.svn.wordpress.org/trunk@52815 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-02 15:38:27 +00:00
Jonny Harris
69b9940da2 Bootstrap/Load: Stop unnecessary queries when using the do_parse_request filter.
Developers of plugins and themes can use the `do_parse_request` filter to hot-wire requests and hook in early to render custom pages. However, even through these request may not need post queries and 404 lookups to be run, they run anyway. This can results in unnecessary SQL queries running on these requests. By adding a return value to the `parse_request` method of the `WP` class, these queries can now be skipped. 

Props junsuijin, ryan, westi, sivel, dd32, wonderboymusic, arnee, tyxla, DrewAPicture, lukecavanagh, SergeyBiryukov, davidbaumwald, Spacedmonkey, pbearne.
Fixes #10886.



git-svn-id: https://develop.svn.wordpress.org/trunk@52814 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-02 15:10:48 +00:00
Sergey Biryukov
f0dfa682a5 Themes: Make sure the current_theme_supports-{$feature} filter is consistently applied.
Previously, the filter was not applied if there are no arguments passed to `current_theme_supports()`.

Follow-up to [12350], [19682].

Props helgatheviking, azouamauriac, pavanpatil1, SergeyBiryukov.
Fixes #55219.

git-svn-id: https://develop.svn.wordpress.org/trunk@52812 602fd350-edb4-49c9-b593-d223f7449a82
2022-03-01 16:05:14 +00:00
Sergey Biryukov
2d5f6833fb I18N: Add a $locale parameter for remove_accents().
This highlights the fact that `remove_accents()` is locale-aware and makes it easier to utilize the function with different locales without having to use `switch_to_locale()` or the `locale` filter.

Additionally, this commit relaxes the check for character replacements in German locales to include formal and informal variants of any `de_*` locale, even if WordPress does not have a native translation for some of them yet.

Props malthert, johnbillion, knutsp, ocean90, SergeyBiryukov.
Fixes #54415.

git-svn-id: https://develop.svn.wordpress.org/trunk@52809 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-28 15:40:15 +00:00
Sergey Biryukov
0bc5d361c3 Tests: Rename the $success variable to $result in the wp_mail() test for an empty home URL.
The previously name could be a bit confusing if the function is expected to fail.

Follow-up to [52799].

See #54730.

git-svn-id: https://develop.svn.wordpress.org/trunk@52800 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-25 14:08:53 +00:00
Sergey Biryukov
391922e8b4 Code Modernization: Check the return type of wp_parse_url() in wp_mail().
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

In PHP 8.1, if the home URL does not have a "host" component, it would lead to a `substr(): Passing null to parameter #1 ($string) of type string is deprecated` notice.

Changing the logic around and adding validation for the return type value of `wp_parse_url()` prevents that.

Follow-up to [48601], [51606], [51622], [51626], [51629], [51630].

Props dennisatyoast, jrf.
See #54730.

git-svn-id: https://develop.svn.wordpress.org/trunk@52799 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-25 13:46:23 +00:00
Sergey Biryukov
06b740f5f6 Tests: Add a @ticket reference for the current_theme_supports-{$feature} filter test.
Follow-up to [19682], [495/tests].

Props azouamauriac.
See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52798 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-25 13:07:25 +00:00
Jb Audras
ee201606fb Media: Make get_post_galleries() only return galleries.
This change makes sure only gallery content is returned by `get_post_galleries()`. It fixes an issue where non gallery block content was also returned by the function.

Props BinaryMoon, costdev, glendaviesnz.
Fixes #55203.


git-svn-id: https://develop.svn.wordpress.org/trunk@52797 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-25 12:42:10 +00:00
Tonya Mork
6853d10368 Formatting: Make terms in wpautop() and shortcode_unautop() more welcoming and inclusive.
The developer facing humor in these functions were from a different era of WordPress. Tolerance for in-jokes and other developer facing humor has decreased over the years. Terms like "pee" and "tinkle" may make some folks chuckle while for others it makes them uncomfortable.

Terminology of the past is being (or has been) re-evaluated to transform words into a language that are inclusive and welcome for all. This commit is part of that effort as it replaces.

Follow-up [13], [9255].

Props ricomoorman, tzipporahwitty, ironprogrammer, peterwilsoncc, jeremyfelt, Viper007Bond, rmccue, SergeyBiryukov, hellofromTonya.
Fixes #25615.

git-svn-id: https://develop.svn.wordpress.org/trunk@52789 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-23 20:01:55 +00:00
Sergey Biryukov
7a96aefac6 Docs: Use third-person singular verbs in some test descriptions in phpunit/tests/functions/.
Follow-up to [42971], [45371], [46159], [46175], [47779], [50962], [50964], [51910], [52778].

Props azouamauriac, SergeyBiryukov.
See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52780 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-21 14:50:07 +00:00
Sergey Biryukov
f764d7381a Docs: Fix typo in TracTickets::isTracTicketClosed() description.
Follow-up to [761/tests], [762/tests], [891/tests].

See #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52779 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-20 10:12:37 +00:00
Sergey Biryukov
109953c1fb Tests: Convert _wp_to_kebab_case() tests to use a data provider.
Follow-up to [51198], [51225].

See #54725.

git-svn-id: https://develop.svn.wordpress.org/trunk@52778 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 13:43:53 +00:00
Sergey Biryukov
3d0607f0df Docs: Correct parameter types for data_wp_validate_boolean().
Follow-up to [46159], [46224], [52775], [52776].

See #54725, #54729.

git-svn-id: https://develop.svn.wordpress.org/trunk@52777 602fd350-edb4-49c9-b593-d223f7449a82
2022-02-19 13:25:05 +00:00