Setup.php
696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace AC\Service;
use AC\Plugin;
use AC\Registerable;
final class Setup implements Registerable
{
public const PARAM_FORCE_INSTALL = 'ac-force-install';
private $setup;
public function __construct(Plugin\Setup $setup)
{
$this->setup = $setup;
}
public function register(): void
{
add_action('init', [$this, 'run'], 1000);
}
public function run(): void
{
if (wp_doing_ajax()) {
return;
}
if ( ! is_blog_installed()) {
return;
}
$force_install = '1' === filter_input(INPUT_GET, self::PARAM_FORCE_INSTALL);
$this->setup->run($force_install);
}
}