Coding Standards: Fix WPCS issues in `wp-includes/sitemaps/`.

Some of these were not caught when running `composer lint:errors`, but are fixed when running `phpcbf` directly.

Follow-up to [48072], [48080].

See #49542, #50117.
Built from https://develop.svn.wordpress.org/trunk@48081


git-svn-id: http://core.svn.wordpress.org/trunk@47848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-06-18 14:46:09 +00:00
parent e1bd050cb9
commit 168a9df672
4 changed files with 16 additions and 12 deletions

View File

@ -40,10 +40,13 @@ class WP_Sitemaps_Renderer {
*/
public function __construct() {
$stylesheet_url = $this->get_sitemap_stylesheet_url();
if ( $stylesheet_url ) {
$this->stylesheet = '<?xml-stylesheet type="text/xsl" href="' . esc_url( $stylesheet_url ) . '" ?>';
}
$stylesheet_index_url = $this->get_sitemap_index_stylesheet_url();
$stylesheet_index_url = $this->get_sitemap_index_stylesheet_url();
if ( $stylesheet_index_url ) {
$this->stylesheet_index = '<?xml-stylesheet type="text/xsl" href="' . esc_url( $stylesheet_index_url ) . '" ?>';
}
@ -160,8 +163,8 @@ class WP_Sitemaps_Renderer {
} else {
_doing_it_wrong(
__METHOD__,
/* translators: %s: list of element names */
sprintf(
/* translators: %s: List of element names. */
__( 'Fields other than %s are not currently supported for the sitemap index.' ),
implode( ',', array( 'loc', 'lastmod' ) )
),
@ -225,8 +228,8 @@ class WP_Sitemaps_Renderer {
} else {
_doing_it_wrong(
__METHOD__,
/* translators: %s: list of element names */
sprintf(
/* translators: %s: List of element names. */
__( 'Fields other than %s are not currently supported for sitemaps.' ),
implode( ',', array( 'loc', 'lastmod', 'changefreq', 'priority' ) )
),

View File

@ -52,7 +52,7 @@ class WP_Sitemaps_Stylesheet {
);
$text = sprintf(
/* translators: %s: number of URLs. */
/* translators: %s: Number of URLs. */
esc_xml( __( 'Number of URLs in this XML Sitemap: %s.' ) ),
'<xsl:value-of select="count( sitemap:urlset/sitemap:url )" />'
);
@ -152,17 +152,17 @@ XSL;
* @since 5.5.0
*/
public function get_sitemap_index_stylesheet() {
$css = $this->get_stylesheet_css();
$title = esc_xml( __( 'XML Sitemap' ) );
$description = esc_xml( __( 'This XML Sitemap is generated by WordPress to make your content more visible for search engines.' ) );
$learn_more = sprintf(
$css = $this->get_stylesheet_css();
$title = esc_xml( __( 'XML Sitemap' ) );
$description = esc_xml( __( 'This XML Sitemap is generated by WordPress to make your content more visible for search engines.' ) );
$learn_more = sprintf(
'<a href="%s">%s</a>',
esc_url( __( 'https://www.sitemaps.org/' ) ),
esc_xml( __( 'Learn more about XML sitemaps.' ) )
);
$text = sprintf(
/* translators: %s: number of URLs. */
/* translators: %s: Number of URLs. */
esc_xml( __( 'Number of URLs in this XML Sitemap: %s.' ) ),
'<xsl:value-of select="count( sitemap:sitemapindex/sitemap:sitemap )" />'
);

View File

@ -207,8 +207,9 @@ class WP_Sitemaps {
}
// 'pagename' is for most permalink types, name is for when the %postname% is used as a top-level field.
if ( 'sitemap-xml' === $query->get( 'pagename' ) ||
'sitemap-xml' === $query->get( 'name' ) ) {
if ( 'sitemap-xml' === $query->get( 'pagename' )
|| 'sitemap-xml' === $query->get( 'name' )
) {
wp_safe_redirect( $this->index->get_index_url() );
exit();
}

View File

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