| @@ -1,11 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace YayMail; |
| 3 | 3 | |
| 4 | 4 | use YayMail\Utils\Helpers; |
| 5 | -use YayMail\Elements\ElementsLoader; | |
| 6 | 5 | use YayMail\Emails\EmailsLoader; |
| 7 | -use YayMail\Engine\ActDeact; | |
| 8 | 6 | use YayMail\Engine\Backend\SettingsPage; |
| 9 | 7 | use YayMail\Engine\RestAPI; |
| 10 | 8 | use YayMail\Integrations\IntegrationsLoader; |
| 11 | 9 | use YayMail\PostTypes\TemplatePostType; |
| @@ -30,8 +28,13 @@ | ||
| 30 | 28 | /** |
| 31 | 29 | * The Constructor that load the engine classes |
| 32 | 30 | */ |
| 33 | 31 | protected function __construct() { |
| 32 | + // Procedural helpers (yaymail_version(), yaymail_is_wc_installed(), ...) are used by | |
| 33 | + // every hook callback below, so load them here rather than inside init_core(), whose | |
| 34 | + // hook is filterable and may run after init_modules(). | |
| 35 | + require_once Helpers::get_plugin_path() . 'src/Functions.php'; | |
| 36 | + | |
| 34 | 37 | I18n::get_instance(); |
| 35 | 38 | |
| 36 | 39 | /** |
| 37 | 40 | * Handle init core |
| @@ -50,9 +53,8 @@ | ||
| 50 | 53 | add_action( 'init', [ $this, 'init_modules' ] ); |
| 51 | 54 | } |
| 52 | 55 | |
| 53 | 56 | public function init_core() { |
| 54 | - require_once Utils\Helpers::get_plugin_path() . 'src/Functions.php'; | |
| 55 | 57 | do_action( 'yaymail_init_start' ); |
| 56 | 58 | |
| 57 | 59 | /** |
| 58 | 60 | * Core Integrations |
| @@ -59,9 +61,8 @@ | ||
| 59 | 61 | */ |
| 60 | 62 | IntegrationsLoader::get_instance(); |
| 61 | 63 | |
| 62 | 64 | EmailsLoader::get_instance(); |
| 63 | - ElementsLoader::get_instance(); | |
| 64 | 65 | ShortcodesLoader::get_instance(); |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | 68 | public function init_modules() { |
| @@ -78,10 +79,8 @@ | ||
| 78 | 79 | update_option( 'yaymail_version_backup', $version_current ); |
| 79 | 80 | } |
| 80 | 81 | } |
| 81 | 82 | |
| 82 | - ActDeact::get_instance(); | |
| 83 | - | |
| 84 | 83 | if ( yaymail_is_wc_installed() ) { |
| 85 | 84 | WooHandler::get_instance(); |
| 86 | 85 | } |
| 87 | 86 | |
| @@ -91,13 +90,8 @@ | ||
| 91 | 90 | |
| 92 | 91 | PreviewEmailsLoader::get_instance(); |
| 93 | 92 | |
| 94 | 93 | /** |
| 95 | - * Supported templates | |
| 96 | - */ | |
| 97 | - SupportedPlugins::get_instance(); | |
| 98 | - | |
| 99 | - /** | |
| 100 | 94 | * Core core filters |
| 101 | 95 | */ |
| 102 | 96 | |
| 103 | 97 | SectionTemplatesLoader::get_instance(); |
| @@ -106,9 +100,9 @@ | ||
| 106 | 100 | // Template Library only ships WooCommerce order-email designs (Completed, |
| 107 | 101 | // RefundedOrder, NewOrder, ...). Skip its directory scan/class instantiation |
| 108 | 102 | // (41 files, ~23k lines) and the per-request "SHOW TABLES" check when |
| 109 | 103 | // WooCommerce isn't active -- it noticeably slows down every admin page load |
| 110 | - // on WP-only (email-builder) sites for a feature they can't use. | |
| 104 | + // on WP-only (yaymagic-email-builder) sites for a feature they can't use. | |
| 111 | 105 | if ( yaymail_is_wc_installed() ) { |
| 112 | 106 | TemplateLibraryLoader::get_instance(); |
| 113 | 107 | LibraryTemplateSchema::maybe_create_table(); |
| 114 | 108 | } |