Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/sitemaps
File: sitemap-buffer-page-xmlwriter.php
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
[0] Fix | Delete
/**
[1] Fix | Delete
* XMLWriter implementation of the page sitemap buffer.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 14.6
[4] Fix | Delete
* @package automattic/jetpack
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit( 0 );
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* A buffer for constructing sitemap page xml files using XMLWriter.
[13] Fix | Delete
*
[14] Fix | Delete
* @since 14.6
[15] Fix | Delete
*/
[16] Fix | Delete
class Jetpack_Sitemap_Buffer_Page_XMLWriter extends Jetpack_Sitemap_Buffer_XMLWriter {
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* Initialize the buffer with required headers (no root element here).
[20] Fix | Delete
*/
[21] Fix | Delete
protected function initialize_buffer() {
[22] Fix | Delete
// Add generator comment
[23] Fix | Delete
$this->writer->writeComment( "generator='jetpack-" . JETPACK__VERSION . "'" );
[24] Fix | Delete
$this->writer->writeComment( 'Jetpack_Sitemap_Buffer_Page_XMLWriter' );
[25] Fix | Delete
[26] Fix | Delete
// Add stylesheet
[27] Fix | Delete
$this->writer->writePi(
[28] Fix | Delete
'xml-stylesheet',
[29] Fix | Delete
'type="text/xsl" href="' . $this->finder->construct_sitemap_url( 'sitemap.xsl' ) . '"'
[30] Fix | Delete
);
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
/**
[34] Fix | Delete
* Start the root element and write its namespaces.
[35] Fix | Delete
*/
[36] Fix | Delete
protected function start_root() {
[37] Fix | Delete
$this->writer->startElement( 'urlset' );
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Filter the attribute value pairs used for namespace and namespace URI mappings.
[41] Fix | Delete
*
[42] Fix | Delete
* @module sitemaps
[43] Fix | Delete
*
[44] Fix | Delete
* @since 3.9.0
[45] Fix | Delete
*
[46] Fix | Delete
* @param array $namespaces Associative array with namespaces and namespace URIs.
[47] Fix | Delete
*/
[48] Fix | Delete
$namespaces = apply_filters(
[49] Fix | Delete
'jetpack_sitemap_ns',
[50] Fix | Delete
array(
[51] Fix | Delete
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
[52] Fix | Delete
'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd',
[53] Fix | Delete
'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
[54] Fix | Delete
)
[55] Fix | Delete
);
[56] Fix | Delete
[57] Fix | Delete
foreach ( $namespaces as $name => $value ) {
[58] Fix | Delete
$this->writer->writeAttribute( $name, $value );
[59] Fix | Delete
}
[60] Fix | Delete
}
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Append a URL entry to the sitemap.
[64] Fix | Delete
*
[65] Fix | Delete
* @param array $array The URL item to append.
[66] Fix | Delete
*/
[67] Fix | Delete
protected function append_item( $array ) {
[68] Fix | Delete
if ( ! empty( $array['url'] ) ) {
[69] Fix | Delete
$this->array_to_xml( $array );
[70] Fix | Delete
}
[71] Fix | Delete
}
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function