PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 12.9.5
Jetpack – WP Security, Backup, Speed, & Growth v12.9.5
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 14.2.2 14.3.1 14.4.2 All 500 releases
jetpack / modules / sitemaps / sitemap-buffer-video-fallback.php
sitemap-buffer-video-fallback.php
60 lines 2.0 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_Video
6 * extends the Jetpack_Sitemap_Buffer class to represent the single video sitemap
7 * buffer.
8 *
9 * @since 5.3.0
10 * @package automattic/jetpack
11 */
12
13 /**
14 * A buffer for constructing sitemap video xml files for users without libxml support.
15 *
16 * @since 5.3.0
17 */
18 class Jetpack_Sitemap_Buffer_Video extends Jetpack_Sitemap_Buffer_Fallback {
19 /**
20 * Returns a DOM element that contains all video sitemap elements.
21 */
22 protected function get_root_element() {
23 if ( ! isset( $this->root ) ) {
24
25 /**
26 * Filter the XML namespaces included in video sitemaps.
27 *
28 * @module sitemaps
29 *
30 * @since 4.8.0
31 *
32 * @param array $namespaces Associative array with namespaces and namespace URIs.
33 */
34 $namespaces = apply_filters(
35 'jetpack_sitemap_video_ns',
36 array(
37 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
38 'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd',
39 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
40 'xmlns:video' => 'http://www.google.com/schemas/sitemap-video/1.1',
41 )
42 );
43
44 $video_sitemap_xsl_url = $this->finder->construct_sitemap_url( 'video-sitemap.xsl' );
45 $jetpack_version = JETPACK__VERSION;
46
47 $this->root = array(
48 "<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL
49 . "<?xml-stylesheet type='text/xsl' href='{$video_sitemap_xsl_url}'?>" . PHP_EOL
50 . '<urlset ' . $this->array_to_xml_attr_string( $namespaces ) . '>',
51 '</urlset>',
52 );
53
54 $this->byte_capacity -= strlen( implode( '', $this->root ) );
55 }
56
57 return $this->root;
58 }
59 }
60