abilities
1 month ago
sitemap-buffer-factory.php
7 months ago
sitemap-buffer-fallback.php
7 months ago
sitemap-buffer-image-fallback.php
7 months ago
sitemap-buffer-image-xmlwriter.php
7 months ago
sitemap-buffer-image.php
7 months ago
sitemap-buffer-master-fallback.php
7 months ago
sitemap-buffer-master-xmlwriter.php
7 months ago
sitemap-buffer-master.php
7 months ago
sitemap-buffer-news-fallback.php
7 months ago
sitemap-buffer-news-xmlwriter.php
7 months ago
sitemap-buffer-news.php
7 months ago
sitemap-buffer-page-fallback.php
7 months ago
sitemap-buffer-page-xmlwriter.php
7 months ago
sitemap-buffer-page.php
7 months ago
sitemap-buffer-video-fallback.php
7 months ago
sitemap-buffer-video-xmlwriter.php
7 months ago
sitemap-buffer-video.php
7 months ago
sitemap-buffer-xmlwriter.php
7 months ago
sitemap-buffer.php
7 months ago
sitemap-builder.php
1 month ago
sitemap-constants.php
7 months ago
sitemap-finder.php
7 months ago
sitemap-librarian.php
7 months ago
sitemap-logger.php
7 months ago
sitemap-state.php
7 months ago
sitemap-stylist.php
7 months ago
sitemaps.php
1 month ago
sitemap-buffer-master-xmlwriter.php
54 lines
| 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | /** |
| 3 | * XMLWriter implementation of the master sitemap buffer. |
| 4 | * |
| 5 | * @since 14.6 |
| 6 | * @package automattic/jetpack |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit( 0 ); |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * A buffer for constructing master sitemap xml files using XMLWriter. |
| 15 | * |
| 16 | * @since 14.6 |
| 17 | */ |
| 18 | class Jetpack_Sitemap_Buffer_Master_XMLWriter extends Jetpack_Sitemap_Buffer_XMLWriter { |
| 19 | |
| 20 | /** |
| 21 | * Initialize the buffer with required headers (no root element here). |
| 22 | */ |
| 23 | protected function initialize_buffer() { |
| 24 | // Add generator comment |
| 25 | $this->writer->writeComment( "generator='jetpack-" . JETPACK__VERSION . "'" ); |
| 26 | $this->writer->writeComment( 'Jetpack_Sitemap_Buffer_Master_XMLWriter' ); |
| 27 | |
| 28 | // Add stylesheet |
| 29 | $this->writer->writePi( |
| 30 | 'xml-stylesheet', |
| 31 | 'type="text/xsl" href="' . $this->finder->construct_sitemap_url( 'sitemap-index.xsl' ) . '"' |
| 32 | ); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Start the root element and write its namespaces. |
| 37 | */ |
| 38 | protected function start_root() { |
| 39 | $this->writer->startElement( 'sitemapindex' ); |
| 40 | $this->writer->writeAttribute( 'xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9' ); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Append a sitemap entry to the master sitemap. |
| 45 | * |
| 46 | * @param array $array The sitemap item to append. |
| 47 | */ |
| 48 | protected function append_item( $array ) { |
| 49 | if ( ! empty( $array['sitemap'] ) ) { |
| 50 | $this->array_to_xml( $array ); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 |