diff options
Diffstat (limited to 'plugins/jetpack/modules/sitemaps/sitemap-buffer.php')
-rw-r--r-- | plugins/jetpack/modules/sitemaps/sitemap-buffer.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/plugins/jetpack/modules/sitemaps/sitemap-buffer.php b/plugins/jetpack/modules/sitemaps/sitemap-buffer.php index 0853a49a..98751664 100644 --- a/plugins/jetpack/modules/sitemaps/sitemap-buffer.php +++ b/plugins/jetpack/modules/sitemaps/sitemap-buffer.php @@ -108,10 +108,10 @@ abstract class Jetpack_Sitemap_Buffer { */ public function __construct( $item_limit, $byte_limit, $time ) { $this->is_full_flag = false; - $this->timestamp = $time; + $this->timestamp = $time; $this->finder = new Jetpack_Sitemap_Finder(); - $this->doc = new DOMDocument( '1.0', 'UTF-8' ); + $this->doc = new DOMDocument( '1.0', 'UTF-8' ); $this->item_capacity = max( 1, intval( $item_limit ) ); $this->byte_capacity = max( 1, intval( $byte_limit ) ) - strlen( $this->doc->saveXML() ); @@ -133,10 +133,9 @@ abstract class Jetpack_Sitemap_Buffer { * don't do anything and report success. * * @since 4.8.0 + * @deprecated 5.3.0 Use Jetpack_Sitemap_Buffer::append. * * @param string $item The item to be added. - * - * @return bool True if the append succeeded, False if not. */ public function try_to_add_item( $item ) { _deprecated_function( @@ -173,7 +172,7 @@ abstract class Jetpack_Sitemap_Buffer { return false; } else { $this->item_capacity -= 1; - $added_element = $this->array_to_xml_string( $array, $this->get_root_element(), $this->doc ); + $added_element = $this->array_to_xml_string( $array, $this->get_root_element(), $this->doc ); $this->byte_capacity -= strlen( $this->doc->saveXML( $added_element ) ); @@ -189,8 +188,8 @@ abstract class Jetpack_Sitemap_Buffer { * @return string The contents of the buffer (with the footer included). */ public function contents() { - if( $this->is_empty() ) { - // The sitemap should have at least the root element added to the DOM + if ( $this->is_empty() ) { + // The sitemap should have at least the root element added to the DOM. $this->get_root_element(); } return $this->doc->saveXML(); @@ -280,8 +279,8 @@ abstract class Jetpack_Sitemap_Buffer { * @since 4.8.0 Rename, add $depth parameter, and change return type. * @since 5.3.0 Refactor, remove $depth parameter, add $parent and $root, make access protected. * - * @param array $array A recursive associative array of tag/child relationships. - * @param DOMElement $parent (optional) an element to which new children should be added. + * @param array $array A recursive associative array of tag/child relationships. + * @param DOMElement $parent (optional) an element to which new children should be added. * @param DOMDocument $root (optional) the parent document. * * @return string|DOMDocument The rendered XML string or an object if root element is specified. @@ -291,7 +290,7 @@ abstract class Jetpack_Sitemap_Buffer { if ( null === $parent ) { $return_string = true; - $parent = $root = new DOMDocument(); + $parent = $root = new DOMDocument(); } if ( is_array( $array ) ) { |