Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Jetpack_Sitemap_Buffer_Master | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| get_root_element | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | // phpcs:disable Generic.Classes.DuplicateClassName.Found -- sitemap-builder.php will require correct class file. |
| 3 | /** |
| 4 | * Sitemaps (per the protocol) are essentially lists of XML fragments; |
| 5 | * lists which are subject to size constraints. The Jetpack_Sitemap_Buffer_Master |
| 6 | * extends the Jetpack_Sitemap_Buffer class to represent the master sitemap |
| 7 | * buffer. |
| 8 | * |
| 9 | * @since 5.3.0 |
| 10 | * @package automattic/jetpack |
| 11 | */ |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit( 0 ); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * A buffer for constructing master sitemap xml files for users without libxml support. |
| 19 | * |
| 20 | * @since 5.3.0 |
| 21 | * @phan-suppress PhanRedefinedClassReference -- Don't conflict with real version. |
| 22 | */ |
| 23 | class Jetpack_Sitemap_Buffer_Master extends Jetpack_Sitemap_Buffer_Fallback { |
| 24 | // @phan-suppress-previous-line UnusedSuppression -- It's used. |
| 25 | |
| 26 | /** |
| 27 | * Returns a DOM element that contains all master sitemap elements. |
| 28 | */ |
| 29 | protected function get_root_element() { |
| 30 | |
| 31 | if ( ! isset( $this->root ) ) { |
| 32 | |
| 33 | $sitemap_index_xsl_url = $this->finder->construct_sitemap_url( 'sitemap-index.xsl' ); |
| 34 | $jetpack_version = JETPACK__VERSION; |
| 35 | |
| 36 | $this->root = array( |
| 37 | "<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL |
| 38 | . "<?xml-stylesheet type='text/xsl' href='{$sitemap_index_xsl_url}'?>" . PHP_EOL |
| 39 | . "<sitemapindex xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>" . PHP_EOL, |
| 40 | '</sitemapindex>', |
| 41 | ); |
| 42 | |
| 43 | $this->byte_capacity -= strlen( implode( '', $this->root ) ); |
| 44 | } |
| 45 | |
| 46 | return $this->root; |
| 47 | } |
| 48 | } |