get_sitemap_stylesheet(); } if ( 'index' === $type ) { // All content is escaped below. echo $this->get_sitemap_index_stylesheet(); } exit; } /** * Returns the escaped XSL for all sitemaps, except index. * * @since 5.5.0 */ public function get_sitemap_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( '%s', esc_url( __( 'https://www.sitemaps.org/' ) ), esc_xml( __( 'Learn more about XML sitemaps.' ) ) ); $text = sprintf( /* translators: %s: Number of URLs. */ esc_xml( __( 'Number of URLs in this XML Sitemap: %s.' ) ), '' ); $lang = get_language_attributes( 'html' ); $url = esc_xml( __( 'URL' ) ); $lastmod = esc_xml( __( 'Last Modified' ) ); $changefreq = esc_xml( __( 'Change Frequency' ) ); $priority = esc_xml( __( 'Priority' ) ); $xsl_content = << {$title}

{$title}

{$description}

{$learn_more}

{$text}

{$url} {$lastmod} {$changefreq} {$priority}
XSL; /** * Filters the content of the sitemap stylesheet. * * @since 5.5.0 * * @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. * * @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( '%s', esc_url( __( 'https://www.sitemaps.org/' ) ), esc_xml( __( 'Learn more about XML sitemaps.' ) ) ); $text = sprintf( /* translators: %s: Number of URLs. */ esc_xml( __( 'Number of URLs in this XML Sitemap: %s.' ) ), '' ); $lang = get_language_attributes( 'html' ); $url = esc_xml( __( 'URL' ) ); $lastmod = esc_xml( __( 'Last Modified' ) ); $xsl_content = << {$title}

{$title}

{$description}

{$learn_more}

{$text}

{$url} {$lastmod}
XSL; /** * Filters the content of the sitemap index stylesheet. * * @since 5.5.0 * * @param string $xsl_content Full content for the XML stylesheet. */ return apply_filters( 'wp_sitemaps_stylesheet_index_content', $xsl_content ); } /** * Gets the CSS to be included in sitemap XSL stylesheets. * * @since 5.5.0 * * @return string The CSS. */ public function get_stylesheet_css() { $text_align = is_rtl() ? 'right' : 'left'; $css = <<