@@ 17-56 (lines=40) @@ | ||
14 | * |
|
15 | * @since 5.3.0 |
|
16 | */ |
|
17 | class Jetpack_Sitemap_Buffer_Image extends Jetpack_Sitemap_Buffer_Fallback { |
|
18 | ||
19 | protected function get_root_element() { |
|
20 | if ( ! isset( $this->root ) ) { |
|
21 | ||
22 | /** |
|
23 | * Filter the XML namespaces included in image sitemaps. |
|
24 | * |
|
25 | * @module sitemaps |
|
26 | * |
|
27 | * @since 4.8.0 |
|
28 | * |
|
29 | * @param array $namespaces Associative array with namespaces and namespace URIs. |
|
30 | */ |
|
31 | $namespaces = apply_filters( |
|
32 | 'jetpack_sitemap_image_ns', |
|
33 | array( |
|
34 | 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
|
35 | 'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', |
|
36 | 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9', |
|
37 | 'xmlns:image' => 'http://www.google.com/schemas/sitemap-image/1.1', |
|
38 | ) |
|
39 | ); |
|
40 | ||
41 | $sitemap_xsl_url = $this->finder->construct_sitemap_url( 'sitemap.xsl' ); |
|
42 | $jetpack_version = JETPACK__VERSION; |
|
43 | ||
44 | $this->root = array( |
|
45 | "<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL |
|
46 | . "<?xml-stylesheet type='text/xsl' href='{$sitemap_xsl_url}'?>" . PHP_EOL |
|
47 | . '<urlset ' . $this->array_to_xml_attr_string( $namespaces ) . '>' . PHP_EOL, |
|
48 | '</urlset>' |
|
49 | ); |
|
50 | ||
51 | $this->byte_capacity -= strlen( join( '', $this->root ) ); |
|
52 | } |
|
53 | ||
54 | return $this->root; |
|
55 | } |
|
56 | } |
|
57 |
@@ 17-56 (lines=40) @@ | ||
14 | * |
|
15 | * @since 5.3.0 |
|
16 | */ |
|
17 | class Jetpack_Sitemap_Buffer_News extends Jetpack_Sitemap_Buffer_Fallback { |
|
18 | ||
19 | protected function get_root_element() { |
|
20 | if ( ! isset( $this->root ) ) { |
|
21 | ||
22 | /** |
|
23 | * Filter the attribute value pairs used for namespace and namespace URI mappings. |
|
24 | * |
|
25 | * @module sitemaps |
|
26 | * |
|
27 | * @since 4.8.0 |
|
28 | * |
|
29 | * @param array $namespaces Associative array with namespaces and namespace URIs. |
|
30 | */ |
|
31 | $namespaces = apply_filters( |
|
32 | 'jetpack_sitemap_news_ns', |
|
33 | array( |
|
34 | 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
|
35 | 'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', |
|
36 | 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9', |
|
37 | 'xmlns:news' => 'http://www.google.com/schemas/sitemap-news/0.9', |
|
38 | ) |
|
39 | ); |
|
40 | ||
41 | $jetpack_version = JETPACK__VERSION; |
|
42 | $news_sitemap_xsl_url = $this->finder->construct_sitemap_url( 'news-sitemap.xsl' ); |
|
43 | ||
44 | $this->root = array( |
|
45 | "<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL |
|
46 | . "<?xml-stylesheet type='text/xsl' href='{$news_sitemap_xsl_url}'?>" . PHP_EOL |
|
47 | . '<urlset ' . $this->array_to_xml_attr_string( $namespaces ) . '>', |
|
48 | '</urlset>' |
|
49 | ); |
|
50 | ||
51 | $this->byte_capacity -= strlen( join( '', $this->root ) ); |
|
52 | } |
|
53 | ||
54 | return $this->root; |
|
55 | } |
|
56 | } |
|
57 |
@@ 17-55 (lines=39) @@ | ||
14 | * |
|
15 | * @since 5.3.0 |
|
16 | */ |
|
17 | class Jetpack_Sitemap_Buffer_Page extends Jetpack_Sitemap_Buffer_Fallback { |
|
18 | ||
19 | protected function get_root_element() { |
|
20 | if ( ! isset( $this->root ) ) { |
|
21 | ||
22 | /** |
|
23 | * Filter the attribute value pairs used for namespace and namespace URI mappings. |
|
24 | * |
|
25 | * @module sitemaps |
|
26 | * |
|
27 | * @since 3.9.0 |
|
28 | * |
|
29 | * @param array $namespaces Associative array with namespaces and namespace URIs. |
|
30 | */ |
|
31 | $namespaces = apply_filters( |
|
32 | 'jetpack_sitemap_ns', |
|
33 | array( |
|
34 | 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
|
35 | 'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', |
|
36 | 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9', |
|
37 | ) |
|
38 | ); |
|
39 | ||
40 | $jetpack_version = JETPACK__VERSION; |
|
41 | $sitemap_xsl_url = $this->finder->construct_sitemap_url( 'sitemap.xsl' ); |
|
42 | ||
43 | $this->root = array( |
|
44 | "<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL |
|
45 | . "<?xml-stylesheet type='text/xsl' href='{$sitemap_xsl_url}'?>" . PHP_EOL |
|
46 | . '<urlset ' . $this->array_to_xml_attr_string( $namespaces ) . '>', |
|
47 | '</urlset>' |
|
48 | ); |
|
49 | ||
50 | $this->byte_capacity -= strlen( join( '', $this->root ) ); |
|
51 | } |
|
52 | ||
53 | return $this->root; |
|
54 | } |
|
55 | } |
|
56 |
@@ 17-56 (lines=40) @@ | ||
14 | * |
|
15 | * @since 5.3.0 |
|
16 | */ |
|
17 | class Jetpack_Sitemap_Buffer_Video extends Jetpack_Sitemap_Buffer_Fallback { |
|
18 | ||
19 | protected function get_root_element() { |
|
20 | if ( ! isset( $this->root ) ) { |
|
21 | ||
22 | /** |
|
23 | * Filter the XML namespaces included in video sitemaps. |
|
24 | * |
|
25 | * @module sitemaps |
|
26 | * |
|
27 | * @since 4.8.0 |
|
28 | * |
|
29 | * @param array $namespaces Associative array with namespaces and namespace URIs. |
|
30 | */ |
|
31 | $namespaces = apply_filters( |
|
32 | 'jetpack_sitemap_video_ns', |
|
33 | array( |
|
34 | 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', |
|
35 | 'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', |
|
36 | 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9', |
|
37 | 'xmlns:video' => 'http://www.google.com/schemas/sitemap-video/1.1', |
|
38 | ) |
|
39 | ); |
|
40 | ||
41 | $video_sitemap_xsl_url = $this->finder->construct_sitemap_url( 'video-sitemap.xsl' ); |
|
42 | $jetpack_version = JETPACK__VERSION; |
|
43 | ||
44 | $this->root = array( |
|
45 | "<!-- generator='jetpack-{$jetpack_version}' -->" . PHP_EOL |
|
46 | . "<?xml-stylesheet type='text/xsl' href='{$video_sitemap_xsl_url}'?>" . PHP_EOL |
|
47 | . '<urlset ' . $this->array_to_xml_attr_string( $namespaces ) . '>', |
|
48 | '</urlset>' |
|
49 | ); |
|
50 | ||
51 | $this->byte_capacity -= strlen( join( '', $this->root ) ); |
|
52 | } |
|
53 | ||
54 | return $this->root; |
|
55 | } |
|
56 | } |
|
57 |