Make WordPress Core


Ignore:
Timestamp:
07/21/2020 03:27:48 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Sitemaps: Rename 'sitemap' to 'provider' in WP_Sitemaps_Registry class.

This class is for registering sitemap providers, not individual sitemaps.

Props swissspidy.
Fixes #50724.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/sitemaps/class-wp-sitemaps-registry.php

    r48532 r48536  
    33 * Sitemaps: WP_Sitemaps_Registry class
    44 *
    5  * Handles registering sitemaps.
     5 * Handles registering sitemap providers.
    66 *
    77 * @package WordPress
     
    1717class WP_Sitemaps_Registry {
    1818    /**
    19      * Registered sitemaps.
     19     * Registered sitemap providers.
    2020     *
    2121     * @since 5.5.0
    2222     *
    23      * @var WP_Sitemaps_Provider[] Array of registered sitemaps.
     23     * @var WP_Sitemaps_Provider[] Array of registered sitemap providers.
    2424     */
    25     private $sitemaps = array();
     25    private $providers = array();
    2626
    2727    /**
     
    3030     * @since 5.5.0
    3131     *
    32      * @param string               $name     Name of the sitemap.
     32     * @param string               $name     Name of the sitemap provider.
    3333     * @param WP_Sitemaps_Provider $provider Instance of a WP_Sitemaps_Provider.
    34      * @return bool True if the sitemap was added, false if it is already registered.
     34     * @return bool True if the provider was added, false if it is already registered.
    3535     */
    36     public function add_sitemap( $name, WP_Sitemaps_Provider $provider ) {
    37         if ( isset( $this->sitemaps[ $name ] ) ) {
     36    public function add_provider( $name, WP_Sitemaps_Provider $provider ) {
     37        if ( isset( $this->providers[ $name ] ) ) {
    3838            return false;
    3939        }
    4040
    41         $this->sitemaps[ $name ] = $provider;
     41        $this->providers[ $name ] = $provider;
    4242
    4343        return true;
     
    4545
    4646    /**
    47      * Returns a single registered sitemaps provider.
     47     * Returns a single registered sitemap provider.
    4848     *
    4949     * @since 5.5.0
     
    5252     * @return WP_Sitemaps_Provider|null Sitemaps provider if it exists, null otherwise.
    5353     */
    54     public function get_sitemap( $name ) {
    55         if ( ! isset( $this->sitemaps[ $name ] ) ) {
     54    public function get_provider( $name ) {
     55        if ( ! isset( $this->providers[ $name ] ) ) {
    5656            return null;
    5757        }
    5858
    59         return $this->sitemaps[ $name ];
     59        return $this->providers[ $name ];
    6060    }
    6161
     
    6767     * @return WP_Sitemaps_Provider[] Array of sitemap providers.
    6868     */
    69     public function get_sitemaps() {
    70         return $this->sitemaps;
     69    public function get_providers() {
     70        return $this->providers;
    7171    }
    7272}
Note: See TracChangeset for help on using the changeset viewer.