Docs: Corrections and improvements to inline docs related to XML sitemaps.
See #50117, #49572 git-svn-id: https://develop.svn.wordpress.org/trunk@48098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c7f03167a7
commit
4b1b525f31
@ -49,7 +49,7 @@ function wp_sitemaps_get_server() {
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param WP_Sitemaps $sitemaps Server object.
|
||||
* @param WP_Sitemaps $wp_sitemaps Sitemaps object.
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @return array $sitemaps A list of registered sitemap providers.
|
||||
* @return WP_Sitemaps_Provider[] Array of sitemap providers.
|
||||
*/
|
||||
function wp_get_sitemaps() {
|
||||
$sitemaps = wp_sitemaps_get_server();
|
||||
|
@ -40,7 +40,7 @@ class WP_Sitemaps_Index {
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @return array List of all sitemaps.
|
||||
* @return array[] Array of all sitemaps.
|
||||
*/
|
||||
public function get_sitemap_list() {
|
||||
$sitemaps = array();
|
||||
@ -69,7 +69,7 @@ class WP_Sitemaps_Index {
|
||||
*
|
||||
* @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() {
|
||||
global $wp_rewrite;
|
||||
|
@ -61,7 +61,7 @@ abstract class WP_Sitemaps_Provider {
|
||||
*
|
||||
* @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() {
|
||||
$sitemap_data = array();
|
||||
@ -98,7 +98,7 @@ abstract class WP_Sitemaps_Provider {
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @return array List of sitemaps.
|
||||
* @return array[] Array of sitemap entries.
|
||||
*/
|
||||
public function get_sitemap_entries() {
|
||||
$sitemaps = array();
|
||||
@ -120,7 +120,7 @@ abstract class WP_Sitemaps_Provider {
|
||||
* @param string $object_type Object empty name.
|
||||
* @param string $object_subtype Object subtype name.
|
||||
* 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 );
|
||||
|
||||
|
@ -20,7 +20,7 @@ class WP_Sitemaps_Registry {
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @var array Array of registered sitemaps.
|
||||
* @var WP_Sitemaps_Provider[] Array of registered sitemaps.
|
||||
*/
|
||||
private $sitemaps = array();
|
||||
|
||||
@ -73,7 +73,7 @@ class WP_Sitemaps_Registry {
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @return array List of sitemaps.
|
||||
* @return WP_Sitemaps_Provider[] Array of sitemap providers.
|
||||
*/
|
||||
public function get_sitemaps() {
|
||||
$total_sitemaps = count( $this->sitemaps );
|
||||
|
@ -59,7 +59,7 @@ class WP_Sitemaps_Renderer {
|
||||
*
|
||||
* @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() {
|
||||
global $wp_rewrite;
|
||||
@ -73,12 +73,12 @@ class WP_Sitemaps_Renderer {
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
@ -90,7 +90,7 @@ class WP_Sitemaps_Renderer {
|
||||
*
|
||||
* @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() {
|
||||
global $wp_rewrite;
|
||||
@ -104,12 +104,12 @@ class WP_Sitemaps_Renderer {
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
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'.
|
||||
*/
|
||||
@ -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
|
||||
*/
|
||||
@ -141,13 +141,13 @@ XSL;
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the escaped xsl for the index sitemaps.
|
||||
* Returns the escaped XSL for the index sitemaps.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*/
|
||||
@ -235,7 +235,7 @@ XSL;
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
@ -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
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ class WP_Sitemaps {
|
||||
* @param array $providers {
|
||||
* Array of WP_Sitemaps_Provider objects keyed by their name.
|
||||
*
|
||||
* @type object $posts The WP_Sitemaps_Posts object.
|
||||
* @type object $taxonomies The WP_Sitemaps_Taxonomies object.
|
||||
* @type object $users The WP_Sitemaps_Users object.
|
||||
* @type WP_Sitemaps_Posts $posts The WP_Sitemaps_Posts object.
|
||||
* @type WP_Sitemaps_Taxonomies $taxonomies The WP_Sitemaps_Taxonomies object.
|
||||
* @type WP_Sitemaps_Users $users The WP_Sitemaps_Users object.
|
||||
* }
|
||||
*/
|
||||
$providers = apply_filters(
|
||||
|
@ -31,7 +31,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
|
||||
*
|
||||
* @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() {
|
||||
$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
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
@ -54,7 +54,7 @@ class WP_Sitemaps_Posts extends WP_Sitemaps_Provider {
|
||||
*
|
||||
* @param int $page_num Page of results.
|
||||
* @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 = '' ) {
|
||||
// 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param int $max_num_pages The maximum number of pages. Default null.
|
||||
* @param string $post_type Post type name.
|
||||
* @param null|int $max_num_pages The maximum number of pages. Default null.
|
||||
* @param string $post_type Post type name.
|
||||
*/
|
||||
$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
|
||||
*
|
||||
* @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 ) {
|
||||
/**
|
||||
|
@ -30,7 +30,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
|
||||
*
|
||||
* @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() {
|
||||
$taxonomies = get_taxonomies( array( 'public' => true ), 'objects' );
|
||||
@ -40,7 +40,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
|
||||
*
|
||||
* @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 );
|
||||
}
|
||||
@ -52,7 +52,7 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
|
||||
*
|
||||
* @param int $page_num Page of results.
|
||||
* @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 = '' ) {
|
||||
$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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param int $max_num_pages The maximum number of pages. Default null.
|
||||
* @param string $taxonomy Taxonomy name.
|
||||
* @param int $max_num_pages The maximum number of pages. Default null.
|
||||
* @param string $taxonomy Taxonomy name.
|
||||
*/
|
||||
$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
|
||||
*
|
||||
* @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 ) {
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ class WP_Sitemaps_Users extends WP_Sitemaps_Provider {
|
||||
* @param string $object_subtype Optional. Not applicable for Users but
|
||||
* required for compatibility with the parent
|
||||
* 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 = '' ) {
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user