Skip to content

Commit

Permalink
Set formatting options
Browse files Browse the repository at this point in the history
  • Loading branch information
kraftbj committed Feb 7, 2025
1 parent a2aaa84 commit e214b8c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions projects/plugins/jetpack/modules/sitemaps/sitemap-buffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ public function __construct( $item_limit, $byte_limit, $time ) {
$this->is_full_flag = false;
$this->timestamp = $time;

$this->finder = new Jetpack_Sitemap_Finder();
$this->doc = new DOMDocument( '1.0', 'UTF-8' );
$this->finder = new Jetpack_Sitemap_Finder();
$this->doc = new DOMDocument( '1.0', 'UTF-8' );
$this->doc->formatOutput = true;
$this->doc->preserveWhiteSpace = false;

$this->item_capacity = max( 1, (int) $item_limit );
$this->byte_capacity = max( 1, (int) $byte_limit ) - strlen( $this->doc->saveXML() );
Expand Down Expand Up @@ -270,11 +272,9 @@ protected function array_to_xml_string( $array, $parent = null, $root = null ) {
$return_string = false;

if ( null === $parent ) {
$return_string = true;
$root = new DOMDocument();
$root->formatOutput = true; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$root->preserveWhiteSpace = false; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
$parent = $root;
$return_string = true;
$root = new DOMDocument();
$parent = $root;
}

if ( is_array( $array ) ) {
Expand Down

0 comments on commit e214b8c

Please sign in to comment.