PluginProbe
BeyondWords – AI audio for publishers / 4.5.0
BeyondWords – AI audio for publishers v4.5.0
7.2.0 7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 All 44 releases
speechkit / src / Plugin.php

Plugin.php in BeyondWords – AI audio for publishers 4.5.0, at src/Plugin.php

113 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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\Player\LegacyPlayer;
11 use Beyondwords\Wordpress\Core\Player\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\PlayerStyle\PlayerStyle;
21 use Beyondwords\Wordpress\Component\Post\SelectVoice\SelectVoice;
22 use Beyondwords\Wordpress\Component\Posts\Column\Column;
23 use Beyondwords\Wordpress\Component\Posts\BulkEdit\BulkEdit;
24 use Beyondwords\Wordpress\Component\Posts\BulkEdit\Notices as BulkEditNotices;
25 use Beyondwords\Wordpress\Component\Settings\Settings;
26 use Beyondwords\Wordpress\Component\Settings\SettingsUtils;
27 use Beyondwords\Wordpress\Component\SiteHealth\SiteHealth;
28
29 /**
30 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
31 */
32 class Plugin
33 {
34 /**
35 * Public property required so that we can run bulk edit actions like this:
36 * $beyondwords_wordpress_plugin->core->generateAudioForPost($postId);
37 *
38 * @see \Beyondwords\Wordpress\Component\Posts\BulkEdit\BulkEdit
39 */
40 public $core;
41
42 /**
43 * Public property required so that we can run bulk edit actions like this:
44 * $beyondwords_wordpress_plugin->player->getBody;
45 *
46 * @see \Beyondwords\Wordpress\Component\Post\PostContentUtils
47 */
48 public $player;
49
50 /**
51 * The API client - this enables various components to access the API.
52 *
53 * @todo Consider switching from dependency injection to singleton or another
54 * pattern so that components can perform API calls without DI.
55 */
56 public $apiClient;
57
58 /**
59 * Constructor.
60 */
61 public function __construct()
62 {
63 $this->apiClient = new ApiClient();
64 }
65
66 /**
67 * Constructor.
68 */
69 public function init()
70 {
71 // First, run plugin update checks
72 (new Updater())->run();
73
74 // Elementor
75 (new Elementor())->init();
76
77 // 1. Core
78 $this->core = new Core($this->apiClient);
79 $this->core->init();
80
81 // 2. Player
82 if (SettingsUtils::useLegacyPlayer()) {
83 (new LegacyPlayer())->init();
84 } else {
85 (new Player())->init();
86 }
87
88 // 3. Settings
89 (new Settings($this->apiClient))->init();
90
91 // 4. Posts screen
92 (new Column())->init();
93 (new BulkEdit())->init();
94 (new BulkEditNotices())->init();
95
96 // 5. Post screen
97 (new AddPlayer())->init();
98 (new BlockAttributes())->init();
99 (new ErrorNotice())->init();
100 (new Inspect())->init();
101
102 // 6. Post screen Metabox
103 (new GenerateAudio())->init();
104 (new DisplayPlayer())->init();
105 (new SelectVoice($this->apiClient))->init();
106 (new PlayerStyle())->init();
107 (new Metabox($this->apiClient))->init();
108
109 // 7. Site Health
110 (new SiteHealth())->init();
111 }
112 }
113