| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Beyondwords\Wordpress; |
| 6 |
|
| 7 |
use Beyondwords\Wordpress\Compatibility\Elementor\Elementor; |
| 8 |
use Beyondwords\Wordpress\Core\ApiClient; |
| 9 |
use Beyondwords\Wordpress\Core\Core; |
| 10 |
use Beyondwords\Wordpress\Core\LegacyPlayer; |
| 11 |
use Beyondwords\Wordpress\Core\Player; |
| 12 |
use Beyondwords\Wordpress\Core\Updater; |
| 13 |
use Beyondwords\Wordpress\Component\Post\AddPlayer\AddPlayer; |
| 14 |
use Beyondwords\Wordpress\Component\Post\BlockAttributes\BlockAttributes; |
| 15 |
use Beyondwords\Wordpress\Component\Post\DisplayPlayer\DisplayPlayer; |
| 16 |
use Beyondwords\Wordpress\Component\Post\ErrorNotice\ErrorNotice; |
| 17 |
use Beyondwords\Wordpress\Component\Post\GenerateAudio\GenerateAudio; |
| 18 |
use Beyondwords\Wordpress\Component\Post\Metabox\Metabox; |
| 19 |
use Beyondwords\Wordpress\Component\Post\Panel\Inspect\Inspect; |
| 20 |
use Beyondwords\Wordpress\Component\Post\SelectVoice\SelectVoice; |
| 21 |
use Beyondwords\Wordpress\Component\Posts\Column\Column; |
| 22 |
use Beyondwords\Wordpress\Component\Posts\BulkEdit\BulkEdit; |
| 23 |
use Beyondwords\Wordpress\Component\Settings\ApiKey\ApiKey; |
| 24 |
use Beyondwords\Wordpress\Component\Settings\Languages\Languages; |
| 25 |
use Beyondwords\Wordpress\Component\Settings\Preselect\Preselect; |
| 26 |
use Beyondwords\Wordpress\Component\Settings\PrependExcerpt\PrependExcerpt; |
| 27 |
use Beyondwords\Wordpress\Component\Settings\PlayerUI\PlayerUI; |
| 28 |
use Beyondwords\Wordpress\Component\Settings\PlayerVersion\PlayerVersion; |
| 29 |
use Beyondwords\Wordpress\Component\Settings\ProjectId\ProjectId; |
| 30 |
use Beyondwords\Wordpress\Component\Settings\SettingsUpdated\SettingsUpdated; |
| 31 |
use Beyondwords\Wordpress\Component\Settings\Settings; |
| 32 |
use Beyondwords\Wordpress\Component\Settings\SettingsUtils; |
| 33 |
use Beyondwords\Wordpress\Component\SiteHealth\SiteHealth; |
| 34 |
|
| 35 |
/** |
| 36 |
* Temprarily suppress some PHPMD warnings, these are fixed in the post-v4 |
| 37 |
* refactor branch anyway. |
| 38 |
* |
| 39 |
* @SuppressWarnings(PHPMD.TooManyFields) |
| 40 |
* @SuppressWarnings(PHPMD.LongVariable) |
| 41 |
*/ |
| 42 |
class Plugin |
| 43 |
{ |
| 44 |
public $updater; |
| 45 |
|
| 46 |
public $elementor; |
| 47 |
|
| 48 |
public $core; |
| 49 |
|
| 50 |
public $player; |
| 51 |
|
| 52 |
public $settings; |
| 53 |
|
| 54 |
public $settingsApiKey; |
| 55 |
|
| 56 |
public $settingsProjectId; |
| 57 |
|
| 58 |
public $settingsPreselect; |
| 59 |
|
| 60 |
public $settingsPrependExcerpt; |
| 61 |
|
| 62 |
public $settingsPlayerVersion; |
| 63 |
|
| 64 |
public $settingsPlayerUI; |
| 65 |
|
| 66 |
public $settingsLanguages; |
| 67 |
|
| 68 |
public $settingsSettingsUpdated; |
| 69 |
|
| 70 |
public $column; |
| 71 |
|
| 72 |
public $bulkEdit; |
| 73 |
|
| 74 |
public $addPlayer; |
| 75 |
|
| 76 |
public $blockAttributes; |
| 77 |
|
| 78 |
public $errorNotice; |
| 79 |
|
| 80 |
public $inspect; |
| 81 |
|
| 82 |
public $metabox; |
| 83 |
|
| 84 |
public $selectVoice; |
| 85 |
|
| 86 |
public $siteHealth; |
| 87 |
|
| 88 |
/** |
| 89 |
* Constructor. |
| 90 |
* |
| 91 |
* @todo Replace properties like $this->updater with (new Updater())->init(). |
| 92 |
* Check PHP version support for this first. |
| 93 |
*/ |
| 94 |
public function __construct() |
| 95 |
{ |
| 96 |
// First, run plugin update checks |
| 97 |
$this->updater = new Updater(); |
| 98 |
|
| 99 |
// Elementor |
| 100 |
$this->elementor = new Elementor(); |
| 101 |
|
| 102 |
// 1. Core |
| 103 |
$apiClient = new ApiClient(); |
| 104 |
$this->core = new Core($apiClient); |
| 105 |
|
| 106 |
// 2. Player |
| 107 |
if (SettingsUtils::useLegacyPlayer()) { |
| 108 |
$this->player = new LegacyPlayer(); |
| 109 |
} else { |
| 110 |
$this->player = new Player(); |
| 111 |
} |
| 112 |
|
| 113 |
// 3. Settings |
| 114 |
$this->settings = new Settings($apiClient); |
| 115 |
$this->settingsApiKey = new ApiKey(); |
| 116 |
$this->settingsProjectId = new ProjectId(); |
| 117 |
$this->settingsSettingsUpdated = new SettingsUpdated(); |
| 118 |
$this->settingsPreselect = new Preselect(); |
| 119 |
$this->settingsPrependExcerpt = new PrependExcerpt(); |
| 120 |
$this->settingsPlayerVersion = new PlayerVersion($apiClient); |
| 121 |
$this->settingsPlayerUI = new PlayerUI(); |
| 122 |
$this->settingsLanguages = new Languages($apiClient); |
| 123 |
|
| 124 |
// 4. Posts screen |
| 125 |
$this->column = new Column(); |
| 126 |
$this->bulkEdit = new BulkEdit(); |
| 127 |
|
| 128 |
// 5. Post screen |
| 129 |
$this->addPlayer = new AddPlayer(); |
| 130 |
$this->blockAttributes = new BlockAttributes(); |
| 131 |
$this->errorNotice = new ErrorNotice(); |
| 132 |
$this->inspect = new Inspect(); |
| 133 |
|
| 134 |
// 6. Post screen Metabox |
| 135 |
$generateAudio = new GenerateAudio(); |
| 136 |
$displayPlayer = new DisplayPlayer(); |
| 137 |
$selectVoice = new SelectVoice($apiClient); |
| 138 |
$this->metabox = new Metabox($generateAudio, $displayPlayer, $selectVoice); |
| 139 |
|
| 140 |
// 7. Site Health |
| 141 |
$this->siteHealth = new SiteHealth(); |
| 142 |
} |
| 143 |
} |
| 144 |
|