Commit Graph

8 Commits

Author SHA1 Message Date
John Blackbourn
c9746ab584 Docs: Various corrections and improvements relating to types used in inline documentation.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-18 13:50:05 +00:00
Sergey Biryukov
e53ffbaf95 Code Modernization: Pass correct default value to http_build_query() in WP_Sitemaps_Provider::get_sitemap_url().
The `WP_Sitemaps_Provider::get_sitemap_url()` method calls the PHP native `http_build_query()` function, the second parameter of which is the ''optional'' `$numeric_prefix` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.

In this case, this function call yielded a `http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without a backward compatibility break.

This change is already covered by tests as 14 of the existing tests failed on these function calls when running the tests on PHP 8.1.

References:
* [https://www.php.net/manual/en/function.http-build-query.php PHP Manual: http_build_query()]
* [https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg PHP RFC: Deprecate passing null to non-nullable arguments of internal functions]

Follow-up to [48470].

Props jrf.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51652


git-svn-id: http://core.svn.wordpress.org/trunk@51258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-23 11:44:01 +00:00
Pascal Birchler
66c6ad97bc Sitemaps: Pass full paths to home_url() calls.
This makes it easier for plugins using the `home_url` filter to detect sitemap URLs.

Props Chouby.
Fixes #50592.
Built from https://develop.svn.wordpress.org/trunk@48470


git-svn-id: http://core.svn.wordpress.org/trunk@48239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-14 11:43:03 +00:00
John Blackbourn
1a77bb81d8 Docs: Remove unnecessary variables names from @return tags.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48100


git-svn-id: http://core.svn.wordpress.org/trunk@47869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:55:12 +00:00
John Blackbourn
fe823d698f Docs: Corrections and improvements to inline docs related to XML sitemaps.
See #50117, #49572
Built from https://develop.svn.wordpress.org/trunk@48098


git-svn-id: http://core.svn.wordpress.org/trunk@47867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:26:10 +00:00
Sergey Biryukov
a15912561e Docs: Document globals in WP_Sitemaps_* classes the same way they are documented in the rest of core.
See #49572, #50117.
Built from https://develop.svn.wordpress.org/trunk@48093


git-svn-id: http://core.svn.wordpress.org/trunk@47860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 17:56:09 +00:00
Sergey Biryukov
e1bd050cb9 Coding Standards: Remove unused variable in WP_Sitemaps_Provider::get_sitemap_entries().
Follow-up to [48072].

See #49542, #50117.
Built from https://develop.svn.wordpress.org/trunk@48080


git-svn-id: http://core.svn.wordpress.org/trunk@47847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-18 14:44:07 +00:00
Pascal Birchler
609dd1d14f Sitemaps: Add XML sitemaps functionality to WordPress.
While web crawlers are able to discover pages from links within the site and from other sites, XML sitemaps supplement this approach by allowing crawlers to quickly and comprehensively identify all URLs included in the sitemap and learn other signals about those URLs using the associated metadata.

See https://make.wordpress.org/core/2020/06/10/merge-announcement-extensible-core-sitemaps/ for more details.

This feature exposes the sitemap index via `/wp-sitemap.xml` and exposes a variety of new filters and hooks for developers to modify the behavior. Users can disable sitemaps completely by turning off search engine visibility in WordPress admin.

This change also introduces a new `esc_xml()` function to escape strings for output in XML, as well as XML support to `wp_kses_normalize_entities()`.

Props Adrian McShane, afragen, adamsilverstein, casiepa, flixos90, garrett-eclipse, joemcgill, kburgoine, kraftbj, milana_cap, pacifika, pbiron, pfefferle, Ruxandra Gradina, swissspidy, szepeviktor, tangrufus, tweetythierry.
Fixes #50117.
See #3670. See #19998.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-17 15:24:07 +00:00