PluginProbe
Hostinger Tools / 3.0.78
Hostinger Tools v3.0.78
3.0.78 3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 All 109 releases
hostinger / vendor / hostinger / hostinger-wp-helper / src / Config.php

Config.php in Hostinger Tools 3.0.78, at vendor/hostinger/hostinger-wp-helper/src/Config.php

35 lines 879 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Hostinger\WpHelper;
4
5 defined('ABSPATH') || exit;
6
7 class Config
8 {
9 private array $config = array();
10 public const TOKEN_HEADER = 'X-Hpanel-Order-Token';
11 public const DOMAIN_HEADER = 'X-Hpanel-Domain';
12 public const CONFIG_PATH = ABSPATH . '.private/config.json';
13 public function __construct()
14 {
15 $this->decodeConfig(self::CONFIG_PATH);
16 }
17
18 private function decodeConfig(string $path): void
19 {
20 if (file_exists($path)) {
21 $config_content = file_get_contents($path);
22 $this->config = json_decode($config_content, true);
23 }
24 }
25
26 public function getConfigValue(string $key, $default): string
27 {
28 if ($this->config && isset($this->config[ $key ]) && ! empty($this->config[ $key ])) {
29 return $this->config[ $key ];
30 }
31
32 return $default;
33 }
34 }
35