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
Cli.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Hostinger; |
| 4 | |
| 5 | use WP_CLI; |
| 6 | |
| 7 | defined( 'ABSPATH' ) || exit; |
| 8 | |
| 9 | class Cli { |
| 10 | /** |
| 11 | * Load required files and hooks to make the CLI work. |
| 12 | */ |
| 13 | public function __construct() { |
| 14 | $this->hooks(); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Sets up and hooks WP CLI to our CLI code. |
| 19 | * |
| 20 | * @return void |
| 21 | */ |
| 22 | private function hooks(): void { |
| 23 | |
| 24 | if ( ! class_exists( '\WP_CLI' ) ) { |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | if ( class_exists( '\Hostinger\Cli\Commands\Maintenance' ) ) { |
| 29 | WP_CLI::add_hook( 'after_wp_load', array( 'Hostinger\Cli\Commands\Maintenance', 'define_command' ) ); |
| 30 | } |
| 31 | |
| 32 | if ( class_exists( '\Hostinger\Cli\Commands\AI' ) ) { |
| 33 | WP_CLI::add_hook( 'after_wp_load', array( 'Hostinger\Cli\Commands\AI', 'define_command' ) ); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 |