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 / SiteFileSource.php

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

44 lines 1.2 KB
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 * Files that pages do not always link: robots.txt, favicon.ico, the site icon and the theme style.css.
7 *
8 * - WordPress serves robots.txt and favicon.ico through rewrite rules under the home path, also in a subdirectory install.
9 * - Multisite is out of scope. The engine builds one site: the site of the current home URL.
10 * - No directory scan. Only style.css of the theme and the parent theme.
11 *
12 * @since 1.8.0
13 */
14 class SiteFileSource implements UrlSource {
15
16 /**
17 * @var WordPressGateway
18 */
19 private $wp;
20
21 /**
22 * @param WordPressGateway $wp Gateway.
23 */
24 public function __construct( WordPressGateway $wp ) {
25 $this->wp = $wp;
26 }
27
28 /**
29 * {@inheritdoc}
30 */
31 public function urls() {
32 $home = $this->wp->home_url();
33
34 if ( '' !== (string) $this->wp->option( 'permalink_structure' ) ) {
35 yield new DiscoveredUrl( $home . 'robots.txt', 'file' );
36 yield new DiscoveredUrl( $home . 'favicon.ico', 'file' );
37 }
38
39 foreach ( array_merge( $this->wp->site_icon_urls(), $this->wp->theme_stylesheet_urls() ) as $url ) {
40 yield new DiscoveredUrl( $url, 'asset' );
41 }
42 }
43 }
44