From 168a9df6722e476d241e36fb2f05e917bfaa7c10 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 18 Jun 2020 14:46:09 +0000 Subject: [PATCH] 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 --- wp-includes/sitemaps/class-wp-sitemaps-renderer.php | 9 ++++++--- .../sitemaps/class-wp-sitemaps-stylesheet.php | 12 ++++++------ wp-includes/sitemaps/class-wp-sitemaps.php | 5 +++-- wp-includes/version.php | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/wp-includes/sitemaps/class-wp-sitemaps-renderer.php b/wp-includes/sitemaps/class-wp-sitemaps-renderer.php index 860f74242d..373a9dbdaf 100644 --- a/wp-includes/sitemaps/class-wp-sitemaps-renderer.php +++ b/wp-includes/sitemaps/class-wp-sitemaps-renderer.php @@ -40,10 +40,13 @@ class WP_Sitemaps_Renderer { */ public function __construct() { $stylesheet_url = $this->get_sitemap_stylesheet_url(); + if ( $stylesheet_url ) { $this->stylesheet = ''; } - $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 = ''; } @@ -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' ) ) ), diff --git a/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php b/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php index 3a80a7e2cd..66ad2e399d 100644 --- a/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php +++ b/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php @@ -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.' ) ), '' ); @@ -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( '%s', 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.' ) ), '' ); diff --git a/wp-includes/sitemaps/class-wp-sitemaps.php b/wp-includes/sitemaps/class-wp-sitemaps.php index 6c6a795af8..1e72f13d51 100644 --- a/wp-includes/sitemaps/class-wp-sitemaps.php +++ b/wp-includes/sitemaps/class-wp-sitemaps.php @@ -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(); } diff --git a/wp-includes/version.php b/wp-includes/version.php index baedaffd6b..ce548492e5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.