PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / 1.8.0
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel v1.8.0
1.8.0 1.7.1 1.7.0 1.6.0 1.5.2 trunk 0.1 0.2.0 0.2.1 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 1.0 1.1 1.2 1.3.1 1.4.0 1.4.1 1.5.0 All 27 releases
flywp / includes / StaticSite / Engine / Discovery / SitemapSource.php

SitemapSource.php in FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel 1.8.0, at includes/StaticSite/Engine/Discovery/SitemapSource.php

38 lines 895 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FlyWP\StaticSite\Engine\Discovery;
4
5 /**
6 * Sitemaps: the WordPress core sitemap with its sub-sitemaps, or the index of an active SEO plugin.
7 *
8 * No HTTP probes. The gateway gives only sitemaps that are on.
9 * The crawler follows the <loc> links in the sitemap files.
10 *
11 * @since 1.8.0
12 */
13 class SitemapSource implements UrlSource {
14
15 /**
16 * @var WordPressGateway
17 */
18 private $wp;
19
20 /**
21 * @param WordPressGateway $wp Gateway.
22 */
23 public function __construct( WordPressGateway $wp ) {
24 $this->wp = $wp;
25 }
26
27 /**
28 * {@inheritdoc}
29 */
30 public function urls() {
31 foreach ( $this->wp->sitemap_urls() as $url ) {
32 $stylesheet = '.xsl' === substr( $url, -4 ) || false !== strpos( $url, 'sitemap-stylesheet=' );
33
34 yield new DiscoveredUrl( $url, $stylesheet ? 'asset' : 'sitemap' );
35 }
36 }
37 }
38