equal
deleted
inserted
replaced
12 /** |
12 /** |
13 * Class WP_Sitemaps_Renderer |
13 * Class WP_Sitemaps_Renderer |
14 * |
14 * |
15 * @since 5.5.0 |
15 * @since 5.5.0 |
16 */ |
16 */ |
|
17 #[AllowDynamicProperties] |
17 class WP_Sitemaps_Renderer { |
18 class WP_Sitemaps_Renderer { |
18 /** |
19 /** |
19 * XSL stylesheet for styling a sitemap for web browsers. |
20 * XSL stylesheet for styling a sitemap for web browsers. |
20 * |
21 * |
21 * @since 5.5.0 |
22 * @since 5.5.0 |
120 * @since 5.5.0 |
121 * @since 5.5.0 |
121 * |
122 * |
122 * @param array $sitemaps Array of sitemap URLs. |
123 * @param array $sitemaps Array of sitemap URLs. |
123 */ |
124 */ |
124 public function render_index( $sitemaps ) { |
125 public function render_index( $sitemaps ) { |
125 header( 'Content-type: application/xml; charset=UTF-8' ); |
126 header( 'Content-Type: application/xml; charset=UTF-8' ); |
126 |
127 |
127 $this->check_for_simple_xml_availability(); |
128 $this->check_for_simple_xml_availability(); |
128 |
129 |
129 $index_xml = $this->get_sitemap_index_xml( $sitemaps ); |
130 $index_xml = $this->get_sitemap_index_xml( $sitemaps ); |
130 |
131 |
131 if ( ! empty( $index_xml ) ) { |
132 if ( ! empty( $index_xml ) ) { |
132 // All output is escaped within get_sitemap_index_xml(). |
133 // All output is escaped within get_sitemap_index_xml(). |
133 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
134 echo $index_xml; |
134 echo $index_xml; |
135 } |
135 } |
136 } |
136 } |
137 |
137 |
138 /** |
138 /** |
185 * @since 5.5.0 |
185 * @since 5.5.0 |
186 * |
186 * |
187 * @param array $url_list Array of URLs for a sitemap. |
187 * @param array $url_list Array of URLs for a sitemap. |
188 */ |
188 */ |
189 public function render_sitemap( $url_list ) { |
189 public function render_sitemap( $url_list ) { |
190 header( 'Content-type: application/xml; charset=UTF-8' ); |
190 header( 'Content-Type: application/xml; charset=UTF-8' ); |
191 |
191 |
192 $this->check_for_simple_xml_availability(); |
192 $this->check_for_simple_xml_availability(); |
193 |
193 |
194 $sitemap_xml = $this->get_sitemap_xml( $url_list ); |
194 $sitemap_xml = $this->get_sitemap_xml( $url_list ); |
195 |
195 |
196 if ( ! empty( $sitemap_xml ) ) { |
196 if ( ! empty( $sitemap_xml ) ) { |
197 // All output is escaped within get_sitemap_xml(). |
197 // All output is escaped within get_sitemap_xml(). |
198 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
199 echo $sitemap_xml; |
198 echo $sitemap_xml; |
200 } |
199 } |
201 } |
200 } |
202 |
201 |
203 /** |
202 /** |