| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Beyondwords\Wordpress; |
| 6 |
|
| 7 |
use Beyondwords\Wordpress\Compatibility\WPGraphQL\WPGraphQL; |
| 8 |
use Beyondwords\Wordpress\Core\Core; |
| 9 |
use Beyondwords\Wordpress\Core\Player\Player; |
| 10 |
use Beyondwords\Wordpress\Core\Updater; |
| 11 |
use Beyondwords\Wordpress\Component\Post\AddPlayer\AddPlayer; |
| 12 |
use Beyondwords\Wordpress\Component\Post\BlockAttributes\BlockAttributes; |
| 13 |
use Beyondwords\Wordpress\Component\Post\DisplayPlayer\DisplayPlayer; |
| 14 |
use Beyondwords\Wordpress\Component\Post\ErrorNotice\ErrorNotice; |
| 15 |
use Beyondwords\Wordpress\Component\Post\GenerateAudio\GenerateAudio; |
| 16 |
use Beyondwords\Wordpress\Component\Post\Metabox\Metabox; |
| 17 |
use Beyondwords\Wordpress\Component\Post\Panel\Inspect\Inspect; |
| 18 |
use Beyondwords\Wordpress\Component\Post\PlayerContent\PlayerContent; |
| 19 |
use Beyondwords\Wordpress\Component\Post\PlayerStyle\PlayerStyle; |
| 20 |
use Beyondwords\Wordpress\Component\Post\Post; |
| 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 |
* Constructor. |
| 36 |
* |
| 37 |
* @since 3.0.0 |
| 38 |
* @since 4.5.1 Disable plugin features if we don't have valid API settings. |
| 39 |
* @since 6.0.0 Make static. |
| 40 |
*/ |
| 41 |
public static function init() |
| 42 |
{ |
| 43 |
// Run plugin update checks before anything else |
| 44 |
Updater::run(); |
| 45 |
|
| 46 |
// Third-party plugin/theme compatibility |
| 47 |
WPGraphQL::init(); |
| 48 |
|
| 49 |
// Core |
| 50 |
Core::init(); |
| 51 |
|
| 52 |
// Site health |
| 53 |
SiteHealth::init(); |
| 54 |
|
| 55 |
// Player |
| 56 |
Player::init(); |
| 57 |
|
| 58 |
// Post |
| 59 |
Post::init(); |
| 60 |
|
| 61 |
// Settings |
| 62 |
Settings::init(); |
| 63 |
|
| 64 |
/** |
| 65 |
* To prevent browser JS errors we skip adding admin UI components until |
| 66 |
* we have a valid REST API connection. |
| 67 |
*/ |
| 68 |
if (SettingsUtils::hasValidApiConnection()) { |
| 69 |
// Posts screen |
| 70 |
BulkEdit::init(); |
| 71 |
BulkEditNotices::init(); |
| 72 |
Column::init(); |
| 73 |
|
| 74 |
// Post screen |
| 75 |
AddPlayer::init(); |
| 76 |
BlockAttributes::init(); |
| 77 |
ErrorNotice::init(); |
| 78 |
Inspect::init(); |
| 79 |
|
| 80 |
// Post screen metabox |
| 81 |
GenerateAudio::init(); |
| 82 |
DisplayPlayer::init(); |
| 83 |
SelectVoice::init(); |
| 84 |
PlayerContent::init(); |
| 85 |
PlayerStyle::init(); |
| 86 |
PlayerContent::init(); |
| 87 |
Metabox::init(); |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
|