PluginProbe
YayMail – WooCommerce Email Customizer / 4.3.3
YayMail – WooCommerce Email Customizer v4.3.3
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 All 58 releases
← All changes | src/Initialize.php +16 -53 4.4.6 → 4.3.3 View file →
@@ -1,9 +1,10 @@
1 1 <?php
2 2 namespace YayMail;
3 3
4 -use YayMail\Utils\Helpers;
4 +use YayMail\Elements\ElementsLoader;
5 5 use YayMail\Emails\EmailsLoader;
6 +use YayMail\Engine\ActDeact;
6 7 use YayMail\Engine\Backend\SettingsPage;
7 8 use YayMail\Engine\RestAPI;
8 9 use YayMail\Integrations\IntegrationsLoader;
9 10 use YayMail\PostTypes\TemplatePostType;
@@ -12,11 +13,9 @@
12 13 use YayMail\TemplatePatterns\PatternsLoader;
13 14 use YayMail\TemplatePatterns\SectionTemplatesLoader;
14 15 use YayMail\PreviewEmail\PreviewEmailsLoader;
15 16 use YayMail\Notices\NoticeMain;
16 -use YayMail\SocialIcons\SocialIconEndpoint;
17 -use YayMail\TemplateLibrary\LibraryTemplateSchema;
18 -use YayMail\TemplateLibrary\TemplateLibraryLoader;
17 +
19 18 /**
20 19 * YayMail Plugin Initializer
21 20 *
22 21 * @method static Initialize get_instance()
@@ -28,13 +27,8 @@
28 27 /**
29 28 * The Constructor that load the engine classes
30 29 */
31 30 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 -
37 31 I18n::get_instance();
38 32
39 33 /**
40 34 * Handle init core
@@ -53,8 +47,9 @@
53 47 add_action( 'init', [ $this, 'init_modules' ] );
54 48 }
55 49
56 50 public function init_core() {
51 + require_once YAYMAIL_PLUGIN_PATH . 'src/Functions.php';
57 52 do_action( 'yaymail_init_start' );
58 53
59 54 /**
60 55 * Core Integrations
@@ -61,30 +56,30 @@
61 56 */
62 57 IntegrationsLoader::get_instance();
63 58
64 59 EmailsLoader::get_instance();
60 + ElementsLoader::get_instance();
65 61 ShortcodesLoader::get_instance();
66 62 }
67 63
68 64 public function init_modules() {
69 65
70 - $version_current = yaymail_version();
66 + $version_current = YAYMAIL_VERSION;
71 67 $version_old = get_option( 'yaymail_version' );
72 68 $version_current_backup = get_option( 'yaymail_version_backup' );
73 69
74 - if ( $version_current !== $version_old && yaymail_is_wc_installed() ) {
70 + if ( $version_current !== $version_old ) {
75 71 if ( $version_current_backup !== $version_current ) {
76 72 \YayMail\Migrations\MainMigration::get_instance()->migrate();
77 73
78 - update_option( 'yaymail_version', $version_current );
79 - update_option( 'yaymail_version_backup', $version_current );
74 + update_option( 'yaymail_version', YAYMAIL_VERSION );
75 + update_option( 'yaymail_version_backup', YAYMAIL_VERSION );
80 76 }
81 77 }
82 78
83 - if ( yaymail_is_wc_installed() ) {
84 - WooHandler::get_instance();
85 - }
79 + ActDeact::get_instance();
86 80
81 + WooHandler::get_instance();
87 82 /**
88 83 * Preview Email loader
89 84 */
90 85
@@ -90,8 +85,13 @@
90 85
91 86 PreviewEmailsLoader::get_instance();
92 87
93 88 /**
89 + * Supported templates
90 + */
91 + SupportedPlugins::get_instance();
92 +
93 + /**
94 94 * Core core filters
95 95 */
96 96
97 97 SectionTemplatesLoader::get_instance();
@@ -96,18 +96,8 @@
96 96
97 97 SectionTemplatesLoader::get_instance();
98 98 PatternsLoader::get_instance();
99 99
100 - // Template Library only ships WooCommerce order-email designs (Completed,
101 - // RefundedOrder, NewOrder, ...). Skip its directory scan/class instantiation
102 - // (41 files, ~23k lines) and the per-request "SHOW TABLES" check when
103 - // WooCommerce isn't active -- it noticeably slows down every admin page load
104 - // on WP-only (yaymagic-email-builder) sites for a feature they can't use.
105 - if ( yaymail_is_wc_installed() ) {
106 - TemplateLibraryLoader::get_instance();
107 - LibraryTemplateSchema::maybe_create_table();
108 - }
109 -
110 100 /**
111 101 * Initialize rest api
112 102 */
113 103 RestAPI::get_instance();
@@ -124,34 +114,7 @@
124 114 * Notices
125 115 */
126 116 NoticeMain::get_instance();
127 117
128 - /**
129 - * Social icon dynamic tint endpoint
130 - */
131 - SocialIconEndpoint::get_instance();
132 -
133 118 do_action( 'yaymail_loaded' );
134 - }
135 -
136 - public function current_yaymail_version() {
137 - $version = 'yaymail/yaymail.php';
138 - if ( ! function_exists( 'is_plugin_active' ) ) {
139 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
140 - }
141 -
142 - $yaymail_files = [
143 - 'yaymail/yaymail.php',
144 - 'yaymail-pro/yaymail.php',
145 - 'email-customizer-for-woocommerce/yaymail.php',
146 - ];
147 -
148 - foreach ( $yaymail_files as $file ) {
149 - if ( is_plugin_active( $file ) || is_plugin_active_for_network( $file ) ) {
150 - $version = $file;
151 - break;
152 - }
153 - }
154 -
155 - return $version;
156 119 }
157 120 }