sitemap-buffer-fallback.php
6 years ago
sitemap-buffer-image-fallback.php
7 years ago
sitemap-buffer-image.php
8 years ago
sitemap-buffer-master-fallback.php
7 years ago
sitemap-buffer-master.php
8 years ago
sitemap-buffer-news-fallback.php
7 years ago
sitemap-buffer-news.php
8 years ago
sitemap-buffer-page-fallback.php
7 years ago
sitemap-buffer-page.php
8 years ago
sitemap-buffer-video-fallback.php
7 years ago
sitemap-buffer-video.php
8 years ago
sitemap-buffer.php
7 years ago
sitemap-builder.php
6 years ago
sitemap-constants.php
6 years ago
sitemap-finder.php
7 years ago
sitemap-librarian.php
6 years ago
sitemap-logger.php
7 years ago
sitemap-state.php
7 years ago
sitemap-stylist.php
6 years ago
sitemaps.php
6 years ago
sitemap-buffer-image-fallback.php
57 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Sitemaps (per the protocol) are essentially lists of XML fragments; |
| 4 | * lists which are subject to size constraints. The Jetpack_Sitemap_Buffer_Image |
| 5 | * extends the Jetpack_Sitemap_Buffer class to represent the single image sitemap |
| 6 | * buffer. |
| 7 | * |
| 8 | * @since 5.3.0 |
| 9 | * @package Jetpack |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * A buffer for constructing sitemap image xml files for users that have no libxml support. |
| 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 |