wp/wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php
changeset 21 48c4eec2b7e6
parent 18 be944660c56a
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    12 /**
    12 /**
    13  * Stylesheet provider class.
    13  * Stylesheet provider class.
    14  *
    14  *
    15  * @since 5.5.0
    15  * @since 5.5.0
    16  */
    16  */
       
    17 #[AllowDynamicProperties]
    17 class WP_Sitemaps_Stylesheet {
    18 class WP_Sitemaps_Stylesheet {
    18 	/**
    19 	/**
    19 	 * Renders the XSL stylesheet depending on whether it's the sitemap index or not.
    20 	 * Renders the XSL stylesheet depending on whether it's the sitemap index or not.
    20 	 *
    21 	 *
    21 	 * @param string $type Stylesheet type. Either 'sitemap' or 'index'.
    22 	 * @param string $type Stylesheet type. Either 'sitemap' or 'index'.
    22 	 */
    23 	 */
    23 	public function render_stylesheet( $type ) {
    24 	public function render_stylesheet( $type ) {
    24 		header( 'Content-type: application/xml; charset=UTF-8' );
    25 		header( 'Content-Type: application/xml; charset=UTF-8' );
    25 
    26 
    26 		if ( 'sitemap' === $type ) {
    27 		if ( 'sitemap' === $type ) {
    27 			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content escaped below.
    28 			// All content is escaped below.
    28 			echo $this->get_sitemap_stylesheet();
    29 			echo $this->get_sitemap_stylesheet();
    29 		}
    30 		}
    30 
    31 
    31 		if ( 'index' === $type ) {
    32 		if ( 'index' === $type ) {
    32 			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All content escaped below.
    33 			// All content is escaped below.
    33 			echo $this->get_sitemap_index_stylesheet();
    34 			echo $this->get_sitemap_index_stylesheet();
    34 		}
    35 		}
    35 
    36 
    36 		exit;
    37 		exit;
    37 	}
    38 	}