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