Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Plugin | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| init | |
100.00% |
22 / 22 |
|
100.00% |
1 / 1 |
2 | |||
| 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 | defined('ABSPATH') || exit; |
| 33 | |
| 34 | class Plugin |
| 35 | { |
| 36 | /** |
| 37 | * Constructor. |
| 38 | * |
| 39 | * @since 3.0.0 |
| 40 | * @since 4.5.1 Disable plugin features if we don't have valid API settings. |
| 41 | * @since 6.0.0 Make static. |
| 42 | */ |
| 43 | public static function init() |
| 44 | { |
| 45 | // Run plugin update checks before anything else |
| 46 | Updater::run(); |
| 47 | |
| 48 | // Third-party plugin/theme compatibility |
| 49 | WPGraphQL::init(); |
| 50 | |
| 51 | // Core |
| 52 | Core::init(); |
| 53 | |
| 54 | // Site health |
| 55 | SiteHealth::init(); |
| 56 | |
| 57 | // Player |
| 58 | Player::init(); |
| 59 | |
| 60 | // Post |
| 61 | Post::init(); |
| 62 | |
| 63 | // Settings |
| 64 | Settings::init(); |
| 65 | |
| 66 | /** |
| 67 | * To prevent browser JS errors we skip adding admin UI components until |
| 68 | * we have a valid REST API connection. |
| 69 | */ |
| 70 | if (SettingsUtils::hasValidApiConnection()) { |
| 71 | // Posts screen |
| 72 | BulkEdit::init(); |
| 73 | BulkEditNotices::init(); |
| 74 | Column::init(); |
| 75 | |
| 76 | // Post screen |
| 77 | AddPlayer::init(); |
| 78 | BlockAttributes::init(); |
| 79 | ErrorNotice::init(); |
| 80 | Inspect::init(); |
| 81 | |
| 82 | // Post screen metabox |
| 83 | GenerateAudio::init(); |
| 84 | DisplayPlayer::init(); |
| 85 | SelectVoice::init(); |
| 86 | PlayerContent::init(); |
| 87 | PlayerStyle::init(); |
| 88 | PlayerContent::init(); |
| 89 | Metabox::init(); |
| 90 | } |
| 91 | } |
| 92 | } |