Sitemaps: Rename 'sitemap' to 'provider' in `WP_Sitemaps_Registry` class.
This class is for registering sitemap providers, not individual sitemaps. Props swissspidy. Fixes #50724. Built from https://develop.svn.wordpress.org/trunk@48536 git-svn-id: http://core.svn.wordpress.org/trunk@48298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
73a8fb4cc3
commit
12daeec1f7
|
@ -58,7 +58,7 @@ function wp_get_sitemaps() {
|
|||
return array();
|
||||
}
|
||||
|
||||
return $sitemaps->registry->get_sitemaps();
|
||||
return $sitemaps->registry->get_providers();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ function wp_register_sitemap( $name, WP_Sitemaps_Provider $provider ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
return $sitemaps->registry->add_sitemap( $name, $provider );
|
||||
return $sitemaps->registry->add_provider( $name, $provider );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ class WP_Sitemaps_Index {
|
|||
public function get_sitemap_list() {
|
||||
$sitemaps = array();
|
||||
|
||||
$providers = $this->registry->get_sitemaps();
|
||||
$providers = $this->registry->get_providers();
|
||||
/* @var WP_Sitemaps_Provider $provider */
|
||||
foreach ( $providers as $name => $provider ) {
|
||||
$sitemap_entries = $provider->get_sitemap_entries();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Sitemaps: WP_Sitemaps_Registry class
|
||||
*
|
||||
* Handles registering sitemaps.
|
||||
* Handles registering sitemap providers.
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Sitemaps
|
||||
|
@ -16,47 +16,47 @@
|
|||
*/
|
||||
class WP_Sitemaps_Registry {
|
||||
/**
|
||||
* Registered sitemaps.
|
||||
* Registered sitemap providers.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @var WP_Sitemaps_Provider[] Array of registered sitemaps.
|
||||
* @var WP_Sitemaps_Provider[] Array of registered sitemap providers.
|
||||
*/
|
||||
private $sitemaps = array();
|
||||
private $providers = array();
|
||||
|
||||
/**
|
||||
* Adds a sitemap with route to the registry.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $name Name of the sitemap.
|
||||
* @param string $name Name of the sitemap provider.
|
||||
* @param WP_Sitemaps_Provider $provider Instance of a WP_Sitemaps_Provider.
|
||||
* @return bool True if the sitemap was added, false if it is already registered.
|
||||
* @return bool True if the provider was added, false if it is already registered.
|
||||
*/
|
||||
public function add_sitemap( $name, WP_Sitemaps_Provider $provider ) {
|
||||
if ( isset( $this->sitemaps[ $name ] ) ) {
|
||||
public function add_provider( $name, WP_Sitemaps_Provider $provider ) {
|
||||
if ( isset( $this->providers[ $name ] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->sitemaps[ $name ] = $provider;
|
||||
$this->providers[ $name ] = $provider;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a single registered sitemaps provider.
|
||||
* Returns a single registered sitemap provider.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $name Sitemap provider name.
|
||||
* @return WP_Sitemaps_Provider|null Sitemaps provider if it exists, null otherwise.
|
||||
*/
|
||||
public function get_sitemap( $name ) {
|
||||
if ( ! isset( $this->sitemaps[ $name ] ) ) {
|
||||
public function get_provider( $name ) {
|
||||
if ( ! isset( $this->providers[ $name ] ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->sitemaps[ $name ];
|
||||
return $this->providers[ $name ];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ class WP_Sitemaps_Registry {
|
|||
*
|
||||
* @return WP_Sitemaps_Provider[] Array of sitemap providers.
|
||||
*/
|
||||
public function get_sitemaps() {
|
||||
return $this->sitemaps;
|
||||
public function get_providers() {
|
||||
return $this->providers;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ class WP_Sitemaps {
|
|||
// Register each supported provider.
|
||||
/* @var WP_Sitemaps_Provider $provider */
|
||||
foreach ( $providers as $name => $provider ) {
|
||||
$this->registry->add_sitemap( $name, $provider );
|
||||
$this->registry->add_provider( $name, $provider );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ class WP_Sitemaps {
|
|||
exit;
|
||||
}
|
||||
|
||||
$provider = $this->registry->get_sitemap( $sitemap );
|
||||
$provider = $this->registry->get_provider( $sitemap );
|
||||
|
||||
if ( ! $provider ) {
|
||||
return;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-beta2-48535';
|
||||
$wp_version = '5.5-beta2-48536';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue