| @@ -8,8 +8,12 @@ | ||
| 8 | 8 | * @since 4.8.0 |
| 9 | 9 | * @package automattic/jetpack |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | + exit( 0 ); | |
| 14 | +} | |
| 15 | + | |
| 12 | 16 | /** |
| 13 | 17 | * A buffer for constructing sitemap xml files. |
| 14 | 18 | * |
| 15 | 19 | * Models a list of strings such that |
| @@ -109,10 +113,12 @@ | ||
| 109 | 113 | public function __construct( $item_limit, $byte_limit, $time ) { |
| 110 | 114 | $this->is_full_flag = false; |
| 111 | 115 | $this->timestamp = $time; |
| 112 | 116 | |
| 113 | - $this->finder = new Jetpack_Sitemap_Finder(); | |
| 114 | - $this->doc = new DOMDocument( '1.0', 'UTF-8' ); | |
| 117 | + $this->finder = new Jetpack_Sitemap_Finder(); | |
| 118 | + $this->doc = new DOMDocument( '1.0', 'UTF-8' ); | |
| 119 | + $this->doc->formatOutput = true; | |
| 120 | + $this->doc->preserveWhiteSpace = false; | |
| 115 | 121 | |
| 116 | 122 | $this->item_capacity = max( 1, (int) $item_limit ); |
| 117 | 123 | $this->byte_capacity = max( 1, (int) $byte_limit ) - strlen( $this->doc->saveXML() ); |
| 118 | 124 | } |