PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.1.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.1.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Config / Strategies / Site_File.php

Site_File.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.1.0, at src/Performance/Config/Strategies/Site_File.php

52 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The class for retrieving configuration values from a file.
4 *
5 * @since 0.1.0
6 *
7 * @package SolidWP\Performance
8 */
9
10 declare( strict_types=1 );
11
12 namespace SolidWP\Performance\Config\Strategies;
13
14 use SolidWP\Performance\Config\Contracts\Strategy;
15 use SolidWP\Performance\StellarWP\SuperGlobals\SuperGlobals;
16
17 /**
18 * Stores and retrieves configuration values from a file.
19 *
20 * @since 0.1.0
21 *
22 * @package SolidWP\Performance
23 */
24 class Site_File extends File implements Strategy {
25
26 /**
27 * The base path to the config directory.
28 *
29 * @since 0.1.0
30 *
31 * @var string
32 */
33 protected string $config_dir = WP_CONTENT_DIR . '/cache/solid-performance';
34
35 /**
36 * {@inheritdoc}
37 */
38 public function get_config_file_path(): string {
39 if ( defined( 'MULTISITE' ) && ! MULTISITE ) {
40 return $this->config_dir . '/config.php';
41 }
42
43 if ( defined( 'SUBDOMAIN_INSTALL' ) && ! SUBDOMAIN_INSTALL ) {
44 return $this->config_dir . '/config.php';
45 }
46
47 $host = SuperGlobals::get_server_var( 'HTTP_HOST' );
48
49 return "{$this->config_dir}/{$host}/config.php";
50 }
51 }
52