Admin
2 months ago
Cli
2 weeks ago
LlmsTxtGenerator
2 weeks ago
Mcp
11 months ago
Preview
1 year ago
Rest
10 months ago
Views
1 year ago
Activator.php
1 year ago
Bootstrap.php
9 months ago
Cli.php
9 months ago
ComingSoon.php
2 months ago
Deactivator.php
1 year ago
DefaultOptions.php
2 months ago
Errors.php
1 year ago
Helper.php
9 months ago
Hooks.php
2 months ago
Hostinger.php
2 months ago
I18n.php
1 year ago
LlmsTxtGenerator.php
1 year ago
Loader.php
1 year ago
Settings.php
1 year ago
Activator.php
32 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Hostinger; |
| 4 | |
| 5 | defined( 'ABSPATH' ) || exit; |
| 6 | |
| 7 | class Activator { |
| 8 | public const INSTALLATION_OPTION_NAME = 'hts_new_installation'; |
| 9 | /** |
| 10 | * @return void |
| 11 | */ |
| 12 | public static function activate(): void { |
| 13 | $options = new DefaultOptions(); |
| 14 | $options->add_options(); |
| 15 | |
| 16 | self::update_installation_state_on_activation(); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Saves installation state. |
| 21 | * |
| 22 | * @return void |
| 23 | */ |
| 24 | public static function update_installation_state_on_activation(): void { |
| 25 | $installation_state = get_option( self::INSTALLATION_OPTION_NAME, false ); |
| 26 | |
| 27 | if ( $installation_state !== 'old' ) { |
| 28 | add_option( self::INSTALLATION_OPTION_NAME, 'new' ); |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 |