Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/sitemaps
File: sitemap-buffer-page.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
[0] Fix | Delete
// phpcs:disable Generic.Classes.DuplicateClassName.Found -- sitemap-builder.php will require correct class file.
[1] Fix | Delete
/**
[2] Fix | Delete
* Sitemaps (per the protocol) are essentially lists of XML fragments;
[3] Fix | Delete
* lists which are subject to size constraints. The Jetpack_Sitemap_Buffer_Page
[4] Fix | Delete
* extends the Jetpack_Sitemap_Buffer class to represent the single page sitemap
[5] Fix | Delete
* buffer.
[6] Fix | Delete
*
[7] Fix | Delete
* @since 5.3.0
[8] Fix | Delete
* @package automattic/jetpack
[9] Fix | Delete
*/
[10] Fix | Delete
[11] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[12] Fix | Delete
exit( 0 );
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* A buffer for constructing sitemap page xml files.
[17] Fix | Delete
*
[18] Fix | Delete
* @since 5.3.0
[19] Fix | Delete
*/
[20] Fix | Delete
class Jetpack_Sitemap_Buffer_Page extends Jetpack_Sitemap_Buffer {
[21] Fix | Delete
/**
[22] Fix | Delete
* Jetpack_Sitemap_Buffer_Page constructor.
[23] Fix | Delete
*
[24] Fix | Delete
* @param int $item_limit The maximum size of the buffer in items.
[25] Fix | Delete
* @param int $byte_limit The maximum size of the buffer in bytes.
[26] Fix | Delete
* @param string $time The initial datetime of the buffer. Must be in 'YYYY-MM-DD hh:mm:ss' format.
[27] Fix | Delete
*/
[28] Fix | Delete
public function __construct( $item_limit, $byte_limit, $time = '1970-01-01 00:00:00' ) {
[29] Fix | Delete
parent::__construct( $item_limit, $byte_limit, $time );
[30] Fix | Delete
[31] Fix | Delete
$this->doc->appendChild(
[32] Fix | Delete
$this->doc->createComment( "generator='jetpack-" . JETPACK__VERSION . "'" )
[33] Fix | Delete
);
[34] Fix | Delete
$this->doc->appendChild(
[35] Fix | Delete
$this->doc->createComment( 'Jetpack_Sitemap_Buffer_Page' )
[36] Fix | Delete
);
[37] Fix | Delete
[38] Fix | Delete
$this->doc->appendChild(
[39] Fix | Delete
$this->doc->createProcessingInstruction(
[40] Fix | Delete
'xml-stylesheet',
[41] Fix | Delete
'type="text/xsl" href="' . $this->finder->construct_sitemap_url( 'sitemap.xsl' ) . '"'
[42] Fix | Delete
)
[43] Fix | Delete
);
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* Returns a DOM element that contains all single page sitemap elements.
[48] Fix | Delete
*/
[49] Fix | Delete
protected function get_root_element() {
[50] Fix | Delete
if ( ! isset( $this->root ) ) {
[51] Fix | Delete
[52] Fix | Delete
/**
[53] Fix | Delete
* Filter the attribute value pairs used for namespace and namespace URI mappings.
[54] Fix | Delete
*
[55] Fix | Delete
* @module sitemaps
[56] Fix | Delete
*
[57] Fix | Delete
* @since 3.9.0
[58] Fix | Delete
*
[59] Fix | Delete
* @param array $namespaces Associative array with namespaces and namespace URIs.
[60] Fix | Delete
*/
[61] Fix | Delete
$namespaces = apply_filters(
[62] Fix | Delete
'jetpack_sitemap_ns',
[63] Fix | Delete
array(
[64] Fix | Delete
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
[65] Fix | Delete
'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd',
[66] Fix | Delete
'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
[67] Fix | Delete
)
[68] Fix | Delete
);
[69] Fix | Delete
[70] Fix | Delete
$this->root = $this->doc->createElement( 'urlset' );
[71] Fix | Delete
[72] Fix | Delete
foreach ( $namespaces as $name => $value ) {
[73] Fix | Delete
$this->root->setAttribute( $name, $value );
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
$this->doc->appendChild( $this->root );
[77] Fix | Delete
$this->byte_capacity -= strlen( $this->doc->saveXML( $this->root ) );
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
return $this->root;
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function