PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 All 503 releases
jetpack / modules / sitemaps / sitemap-buffer-page-fallback.php

sitemap-buffer-page-fallback.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.1, at modules/sitemaps/sitemap-buffer-page-fallback.php

65 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 // phpcs:disable Generic.Classes.DuplicateClassName.Found -- sitemap-builder.php will require correct class file.
3 /**
4 * Sitemaps (per the protocol) are essentially lists of XML fragments;
5 * lists which are subject to size constraints. The Jetpack_Sitemap_Buffer_Page
6 * extends the Jetpack_Sitemap_Buffer class to represent the single page sitemap
7 * buffer.
8 *
9 * @since 5.3.0
10 * @package automattic/jetpack
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit( 0 );
15 }
16
17 /**
18 * A buffer for constructing sitemap page xml files for users with no libxml support.
19 *
20 * @since 5.3.0
21 * @phan-suppress PhanRedefinedClassReference -- Don't conflict with real version.
22 */
23 class Jetpack_Sitemap_Buffer_Page extends Jetpack_Sitemap_Buffer_Fallback {
24 // @phan-suppress-previous-line UnusedSuppression -- It's used.
25 /**
26 * Returns a DOM element that contains all single page sitemap elements.
27 */
28 protected function get_root_element() {
29 if ( ! isset( $this->root ) ) {
30
31 /**
32 * Filter the attribute value pairs used for namespace and namespace URI mappings.
33 *
34 * @module sitemaps
35 *
36 * @since 3.9.0
37 *
38 * @param array $namespaces Associative array with namespaces and namespace URIs.
39 */
40 $namespaces = apply_filters(
41 'jetpack_sitemap_ns',
42 array(
43 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
44 'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd',
45 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
46 )
47 );
48
49 $jetpack_version = JETPACK__VERSION;
50 $sitemap_xsl_url = $this->finder->construct_sitemap_url( 'sitemap.xsl' );
51
52 $this->root = array(
53 "<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL
54 . "<?xml-stylesheet type='text/xsl' href='{$sitemap_xsl_url}'?>" . PHP_EOL
55 . '<urlset ' . $this->array_to_xml_attr_string( $namespaces ) . '>',
56 '</urlset>',
57 );
58
59 $this->byte_capacity -= strlen( implode( '', $this->root ) );
60 }
61
62 return $this->root;
63 }
64 }
65