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
This commit is contained in:
John Blackbourn 2020-06-19 22:26:10 +00:00
parent acb8983ac1
commit fe823d698f
11 changed files with 42 additions and 42 deletions

View File

@ -49,7 +49,7 @@ function wp_sitemaps_get_server() {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param WP_Sitemaps $sitemaps Server object. * @param WP_Sitemaps $wp_sitemaps Sitemaps object.
*/ */
do_action( 'wp_sitemaps_init', $wp_sitemaps ); do_action( 'wp_sitemaps_init', $wp_sitemaps );
} }
@ -58,11 +58,11 @@ function wp_sitemaps_get_server() {
} }
/** /**
* Gets a list of sitemap providers. * Gets an array of sitemap providers.
* *
* @since 5.5.0 * @since 5.5.0
* *
* @return array $sitemaps A list of registered sitemap providers. * @return WP_Sitemaps_Provider[] Array of sitemap providers.
*/ */
function wp_get_sitemaps() { function wp_get_sitemaps() {
$sitemaps = wp_sitemaps_get_server(); $sitemaps = wp_sitemaps_get_server();

View File

@ -40,7 +40,7 @@ class WP_Sitemaps_Index {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @return array List of all sitemaps. * @return array[] Array of all sitemaps.
*/ */
public function get_sitemap_list() { public function get_sitemap_list() {
$sitemaps = array(); $sitemaps = array();
@ -69,7 +69,7 @@ class WP_Sitemaps_Index {
* *
* @global WP_Rewrite $wp_rewrite WordPress rewrite component. * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* *
* @return string The sitemap index url. * @return string The sitemap index URL.
*/ */
public function get_index_url() { public function get_index_url() {
global $wp_rewrite; global $wp_rewrite;

View File

@ -61,7 +61,7 @@ abstract class WP_Sitemaps_Provider {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @return array List of sitemap types including object subtype name and number of pages. * @return array[] Array of sitemap types including object subtype name and number of pages.
*/ */
public function get_sitemap_type_data() { public function get_sitemap_type_data() {
$sitemap_data = array(); $sitemap_data = array();
@ -98,7 +98,7 @@ abstract class WP_Sitemaps_Provider {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @return array List of sitemaps. * @return array[] Array of sitemap entries.
*/ */
public function get_sitemap_entries() { public function get_sitemap_entries() {
$sitemaps = array(); $sitemaps = array();
@ -120,7 +120,7 @@ abstract class WP_Sitemaps_Provider {
* @param string $object_type Object empty name. * @param string $object_type Object empty name.
* @param string $object_subtype Object subtype name. * @param string $object_subtype Object subtype name.
* Empty string if the object type does not support subtypes. * Empty string if the object type does not support subtypes.
* @param string $page Page of results. * @param int $page Page number of results.
*/ */
$sitemap_entry = apply_filters( 'wp_sitemaps_index_entry', $sitemap_entry, $this->object_type, $type['name'], $page ); $sitemap_entry = apply_filters( 'wp_sitemaps_index_entry', $sitemap_entry, $this->object_type, $type['name'], $page );

View File

@ -20,7 +20,7 @@ class WP_Sitemaps_Registry {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @var array Array of registered sitemaps. * @var WP_Sitemaps_Provider[] Array of registered sitemaps.
*/ */
private $sitemaps = array(); private $sitemaps = array();
@ -73,7 +73,7 @@ class WP_Sitemaps_Registry {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @return array List of sitemaps. * @return WP_Sitemaps_Provider[] Array of sitemap providers.
*/ */
public function get_sitemaps() { public function get_sitemaps() {
$total_sitemaps = count( $this->sitemaps ); $total_sitemaps = count( $this->sitemaps );

View File

@ -59,7 +59,7 @@ class WP_Sitemaps_Renderer {
* *
* @global WP_Rewrite $wp_rewrite WordPress rewrite component. * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* *
* @return string The sitemap stylesheet url. * @return string The sitemap stylesheet URL.
*/ */
public function get_sitemap_stylesheet_url() { public function get_sitemap_stylesheet_url() {
global $wp_rewrite; global $wp_rewrite;
@ -73,12 +73,12 @@ class WP_Sitemaps_Renderer {
/** /**
* Filters the URL for the sitemap stylesheet. * Filters the URL for the sitemap stylesheet.
* *
* If a falsy value is returned, no stylesheet will be used and * If a falsey value is returned, no stylesheet will be used and
* the "raw" XML of the sitemap will be displayed. * the "raw" XML of the sitemap will be displayed.
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param string $sitemap_url Full URL for the sitemaps xsl file. * @param string $sitemap_url Full URL for the sitemaps XSL file.
*/ */
return apply_filters( 'wp_sitemaps_stylesheet_url', $sitemap_url ); return apply_filters( 'wp_sitemaps_stylesheet_url', $sitemap_url );
} }
@ -90,7 +90,7 @@ class WP_Sitemaps_Renderer {
* *
* @global WP_Rewrite $wp_rewrite WordPress rewrite component. * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
* *
* @return string The sitemap index stylesheet url. * @return string The sitemap index stylesheet URL.
*/ */
public function get_sitemap_index_stylesheet_url() { public function get_sitemap_index_stylesheet_url() {
global $wp_rewrite; global $wp_rewrite;
@ -104,12 +104,12 @@ class WP_Sitemaps_Renderer {
/** /**
* Filters the URL for the sitemap index stylesheet. * Filters the URL for the sitemap index stylesheet.
* *
* If a falsy value is returned, no stylesheet will be used and * If a falsey value is returned, no stylesheet will be used and
* the "raw" XML of the sitemap index will be displayed. * the "raw" XML of the sitemap index will be displayed.
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param string $sitemap_url Full URL for the sitemaps index xsl file. * @param string $sitemap_url Full URL for the sitemaps index XSL file.
*/ */
return apply_filters( 'wp_sitemaps_stylesheet_index_url', $sitemap_url ); return apply_filters( 'wp_sitemaps_stylesheet_index_url', $sitemap_url );
} }

View File

@ -16,7 +16,7 @@
*/ */
class WP_Sitemaps_Stylesheet { class WP_Sitemaps_Stylesheet {
/** /**
* Renders the xsl stylesheet depending on whether its the sitemap index or not. * Renders the XSL stylesheet depending on whether it's the sitemap index or not.
* *
* @param string $type Stylesheet type. Either 'sitemap' or 'index'. * @param string $type Stylesheet type. Either 'sitemap' or 'index'.
*/ */
@ -37,7 +37,7 @@ class WP_Sitemaps_Stylesheet {
} }
/** /**
* Returns the escaped xsl for all sitemaps, except index. * Returns the escaped XSL for all sitemaps, except index.
* *
* @since 5.5.0 * @since 5.5.0
*/ */
@ -141,13 +141,13 @@ XSL;
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param string $xsl Full content for the xml stylesheet. * @param string $xsl_content Full content for the XML stylesheet.
*/ */
return apply_filters( 'wp_sitemaps_stylesheet_content', $xsl_content ); return apply_filters( 'wp_sitemaps_stylesheet_content', $xsl_content );
} }
/** /**
* Returns the escaped xsl for the index sitemaps. * Returns the escaped XSL for the index sitemaps.
* *
* @since 5.5.0 * @since 5.5.0
*/ */
@ -235,7 +235,7 @@ XSL;
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param string $xsl Full content for the xml stylesheet. * @param string $xsl_content Full content for the XML stylesheet.
*/ */
return apply_filters( 'wp_sitemaps_stylesheet_index_content', $xsl_content ); return apply_filters( 'wp_sitemaps_stylesheet_index_content', $xsl_content );
} }
@ -277,11 +277,11 @@ XSL;
}'; }';
/** /**
* Filters the css only for the sitemap stylesheet. * Filters the CSS only for the sitemap stylesheet.
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param string $css CSS to be applied to default xsl file. * @param string $css CSS to be applied to default XSL file.
*/ */
return apply_filters( 'wp_sitemaps_stylesheet_css', $css ); return apply_filters( 'wp_sitemaps_stylesheet_css', $css );
} }

View File

@ -83,9 +83,9 @@ class WP_Sitemaps {
* @param array $providers { * @param array $providers {
* Array of WP_Sitemaps_Provider objects keyed by their name. * Array of WP_Sitemaps_Provider objects keyed by their name.
* *
* @type object $posts The WP_Sitemaps_Posts object. * @type WP_Sitemaps_Posts $posts The WP_Sitemaps_Posts object.
* @type object $taxonomies The WP_Sitemaps_Taxonomies object. * @type WP_Sitemaps_Taxonomies $taxonomies The WP_Sitemaps_Taxonomies object.
* @type object $users The WP_Sitemaps_Users object. * @type WP_Sitemaps_Users $users The WP_Sitemaps_Users object.
* } * }
*/ */
$providers = apply_filters( $providers = apply_filters(

View File

@ -31,7 +31,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @return array Map of registered post type objects (WP_Post_Type) keyed by their name. * @return WP_Post_Type[] Array of registered post type objects keyed by their name.
*/ */
public function get_object_subtypes() { public function get_object_subtypes() {
$post_types = get_post_types( array( 'public' => true ), 'objects' ); $post_types = get_post_types( array( 'public' => true ), 'objects' );
@ -42,7 +42,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param array $post_types Map of registered post type objects (WP_Post_Type) keyed by their name. * @param WP_Post_Type[] $post_types Array of registered post type objects keyed by their name.
*/ */
return apply_filters( 'wp_sitemaps_post_types', $post_types ); return apply_filters( 'wp_sitemaps_post_types', $post_types );
} }
@ -54,7 +54,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
* *
* @param int $page_num Page of results. * @param int $page_num Page of results.
* @param string $post_type Optional. Post type name. Default empty. * @param string $post_type Optional. Post type name. Default empty.
* @return array $url_list Array of URLs for a sitemap. * @return array Array of URLs for a sitemap.
*/ */
public function get_url_list( $page_num, $post_type = '' ) { public function get_url_list( $page_num, $post_type = '' ) {
// Bail early if the queried post type is not supported. // Bail early if the queried post type is not supported.
@ -159,13 +159,13 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
/** /**
* Filters the max number of pages before it is generated. * Filters the max number of pages before it is generated.
* *
* Passing a non-null value will effectively short-circuit the generation, * Passing a non-null value will short-circuit the generation,
* returning that value instead. * returning that value instead.
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param int $max_num_pages The maximum number of pages. Default null. * @param null|int $max_num_pages The maximum number of pages. Default null.
* @param string $post_type Post type name. * @param string $post_type Post type name.
*/ */
$max_num_pages = apply_filters( 'wp_sitemaps_posts_pre_max_num_pages', null, $post_type ); $max_num_pages = apply_filters( 'wp_sitemaps_posts_pre_max_num_pages', null, $post_type );
@ -188,7 +188,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
* @since 5.5.0 * @since 5.5.0
* *
* @param string $post_type Post type name. * @param string $post_type Post type name.
* @return array $args Array of WP_Query arguments. * @return array Array of WP_Query arguments.
*/ */
protected function get_posts_query_args( $post_type ) { protected function get_posts_query_args( $post_type ) {
/** /**

View File

@ -30,7 +30,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @return array Map of registered taxonomy objects keyed by their name. * @return WP_Taxonomy[] Array of registered taxonomy objects keyed by their name.
*/ */
public function get_object_subtypes() { public function get_object_subtypes() {
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' ); $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
@ -40,7 +40,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param array $taxonomies Map of registered taxonomy objects keyed by their name. * @param WP_Taxonomy[] $taxonomies Array of registered taxonomy objects keyed by their name.
*/ */
return apply_filters( 'wp_sitemaps_taxonomies', $taxonomies ); return apply_filters( 'wp_sitemaps_taxonomies', $taxonomies );
} }
@ -52,7 +52,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
* *
* @param int $page_num Page of results. * @param int $page_num Page of results.
* @param string $taxonomy Optional. Taxonomy name. Default empty. * @param string $taxonomy Optional. Taxonomy name. Default empty.
* @return array $url_list Array of URLs for a sitemap. * @return array Array of URLs for a sitemap.
*/ */
public function get_url_list( $page_num, $taxonomy = '' ) { public function get_url_list( $page_num, $taxonomy = '' ) {
$supported_types = $this->get_object_subtypes(); $supported_types = $this->get_object_subtypes();
@ -134,13 +134,13 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
/** /**
* Filters the max number of pages before it is generated. * Filters the max number of pages before it is generated.
* *
* Passing a non-null value will effectively short-circuit the generation, * Passing a non-null value will short-circuit the generation,
* returning that value instead. * returning that value instead.
* *
* @since 5.5.0 * @since 5.5.0
* *
* @param int $max_num_pages The maximum number of pages. Default null. * @param int $max_num_pages The maximum number of pages. Default null.
* @param string $taxonomy Taxonomy name. * @param string $taxonomy Taxonomy name.
*/ */
$max_num_pages = apply_filters( 'wp_sitemaps_taxonomies_pre_max_num_pages', null, $taxonomy ); $max_num_pages = apply_filters( 'wp_sitemaps_taxonomies_pre_max_num_pages', null, $taxonomy );
@ -159,7 +159,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
* @since 5.5.0 * @since 5.5.0
* *
* @param string $taxonomy Taxonomy name. * @param string $taxonomy Taxonomy name.
* @return array $args Array of WP_Term_Query arguments. * @return array Array of WP_Term_Query arguments.
*/ */
protected function get_taxonomies_query_args( $taxonomy ) { protected function get_taxonomies_query_args( $taxonomy ) {
/** /**

View File

@ -34,7 +34,7 @@ class WP_Sitemaps_Users extends WP_Sitemaps_Provider {
* @param string $object_subtype Optional. Not applicable for Users but * @param string $object_subtype Optional. Not applicable for Users but
* required for compatibility with the parent * required for compatibility with the parent
* provider class. Default empty. * provider class. Default empty.
* @return array $url_list Array of URLs for a sitemap. * @return array Array of URLs for a sitemap.
*/ */
public function get_url_list( $page_num, $object_subtype = '' ) { public function get_url_list( $page_num, $object_subtype = '' ) {
/** /**

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-alpha-48097'; $wp_version = '5.5-alpha-48098';
/** /**
* 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.