admin
1 year ago
lib
1 year ago
captcha.php
2 years ago
cloudsecure-wp.php
1 year ago
common.php
1 year ago
config.php
2 years ago
disable-access-system-file.php
1 year ago
disable-author-query.php
2 years ago
disable-login.php
1 year ago
disable-restapi.php
2 years ago
disable-xmlrpc.php
2 years ago
htaccess.php
1 year ago
login-log.php
1 year ago
login-notification.php
1 year ago
rename-login-page.php
2 years ago
restrict-admin-page.php
1 year ago
server-error-notification.php
1 year ago
two-factor-authentication.php
1 year ago
unify-messages.php
2 years ago
update-notice.php
2 years ago
waf-engine.php
1 year ago
waf.php
1 year ago
config.php
61 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | class CloudSecureWP_Config extends CloudSecureWP_Common { |
| 8 | private const OPTION_KEY = 'cloudsecurewp_config'; |
| 9 | private $conf; |
| 10 | |
| 11 | function __construct( array $info ) { |
| 12 | parent::__construct( $info ); |
| 13 | $this->load_option(); |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * optionを取得 |
| 18 | */ |
| 19 | public function load_option(): void { |
| 20 | $conf_tmp = get_option( self::OPTION_KEY ); |
| 21 | $this->conf = ( empty( $conf_tmp ) || $conf_tmp === false ) ? array() : $conf_tmp; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * 指定の設定値を取得 |
| 26 | * |
| 27 | * @param string $key |
| 28 | * @return |
| 29 | */ |
| 30 | public function get( string $key ) { |
| 31 | return $this->conf[ $key ] ?? ''; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * 設定値の指定 |
| 36 | * |
| 37 | * @param string $key |
| 38 | * @param $val |
| 39 | * @return void |
| 40 | */ |
| 41 | public function set( string $key, $val ): void { |
| 42 | $this->conf[ $key ] = $val; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * 設定値の保存 |
| 47 | * |
| 48 | * @return void |
| 49 | */ |
| 50 | public function save(): void { |
| 51 | update_option( self::OPTION_KEY, $this->conf ); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * 削除 |
| 56 | */ |
| 57 | public function rm(): void { |
| 58 | $this->conf = array(); |
| 59 | } |
| 60 | } |
| 61 |