Sitemaps: Rename `wp_get_sitemaps()` to `wp_get_sitemaps_providers()`

Following [48536], rename the function to match the rest of the sitemaps logic.

Also eliminates some dead code after [48523].

Props pbiron.
See #50724. See #50643.
Built from https://develop.svn.wordpress.org/trunk@48540


git-svn-id: http://core.svn.wordpress.org/trunk@48302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2020-07-21 15:57:04 +00:00
parent 1c52ad8d3f
commit 694b407297
3 changed files with 3 additions and 15 deletions

View File

@ -22,8 +22,6 @@
function wp_sitemaps_get_server() { function wp_sitemaps_get_server() {
global $wp_sitemaps; global $wp_sitemaps;
$is_enabled = (bool) get_option( 'blog_public' );
// If there isn't a global instance, set and bootstrap the sitemaps system. // If there isn't a global instance, set and bootstrap the sitemaps system.
if ( empty( $wp_sitemaps ) ) { if ( empty( $wp_sitemaps ) ) {
$wp_sitemaps = new WP_Sitemaps(); $wp_sitemaps = new WP_Sitemaps();
@ -51,13 +49,8 @@ function wp_sitemaps_get_server() {
* *
* @return WP_Sitemaps_Provider[] Array of sitemap providers. * @return WP_Sitemaps_Provider[] Array of sitemap providers.
*/ */
function wp_get_sitemaps() { function wp_get_sitemaps_providers() {
$sitemaps = wp_sitemaps_get_server(); $sitemaps = wp_sitemaps_get_server();
if ( ! $sitemaps ) {
return array();
}
return $sitemaps->registry->get_providers(); return $sitemaps->registry->get_providers();
} }
@ -72,11 +65,6 @@ function wp_get_sitemaps() {
*/ */
function wp_register_sitemap( $name, WP_Sitemaps_Provider $provider ) { function wp_register_sitemap( $name, WP_Sitemaps_Provider $provider ) {
$sitemaps = wp_sitemaps_get_server(); $sitemaps = wp_sitemaps_get_server();
if ( ! $sitemaps ) {
return false;
}
return $sitemaps->registry->add_provider( $name, $provider ); return $sitemaps->registry->add_provider( $name, $provider );
} }

View File

@ -49,7 +49,7 @@ class WP_Sitemaps_Registry {
* @since 5.5.0 * @since 5.5.0
* *
* @param string $name Sitemap provider name. * @param string $name Sitemap provider name.
* @return WP_Sitemaps_Provider|null Sitemaps provider if it exists, null otherwise. * @return WP_Sitemaps_Provider|null Sitemap provider if it exists, null otherwise.
*/ */
public function get_provider( $name ) { public function get_provider( $name ) {
if ( ! isset( $this->providers[ $name ] ) ) { if ( ! isset( $this->providers[ $name ] ) ) {

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-beta2-48539'; $wp_version = '5.5-beta2-48540';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.