PluginProbe
YayMail – WooCommerce Email Customizer / 4.3.3
YayMail – WooCommerce Email Customizer v4.3.3
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 3.4.1 3.4.2 3.4.3 All 55 releases
← All changes | src/Initialize.php +7 -50 trunk4.3.3 View file →
@@ -1,8 +1,7 @@
1 1 <?php
2 2 namespace YayMail;
3 3
4 -use YayMail\Utils\Helpers;
5 4 use YayMail\Elements\ElementsLoader;
6 5 use YayMail\Emails\EmailsLoader;
7 6 use YayMail\Engine\ActDeact;
8 7 use YayMail\Engine\Backend\SettingsPage;
@@ -14,11 +13,9 @@
14 13 use YayMail\TemplatePatterns\PatternsLoader;
15 14 use YayMail\TemplatePatterns\SectionTemplatesLoader;
16 15 use YayMail\PreviewEmail\PreviewEmailsLoader;
17 16 use YayMail\Notices\NoticeMain;
18 -use YayMail\SocialIcons\SocialIconEndpoint;
19 -use YayMail\TemplateLibrary\LibraryTemplateSchema;
20 -use YayMail\TemplateLibrary\TemplateLibraryLoader;
17 +
21 18 /**
22 19 * YayMail Plugin Initializer
23 20 *
24 21 * @method static Initialize get_instance()
@@ -50,9 +47,9 @@
50 47 add_action( 'init', [ $this, 'init_modules' ] );
51 48 }
52 49
53 50 public function init_core() {
54 - require_once Utils\Helpers::get_plugin_path() . 'src/Functions.php';
51 + require_once YAYMAIL_PLUGIN_PATH . 'src/Functions.php';
55 52 do_action( 'yaymail_init_start' );
56 53
57 54 /**
58 55 * Core Integrations
@@ -65,27 +62,24 @@
65 62 }
66 63
67 64 public function init_modules() {
68 65
69 - $version_current = yaymail_version();
66 + $version_current = YAYMAIL_VERSION;
70 67 $version_old = get_option( 'yaymail_version' );
71 68 $version_current_backup = get_option( 'yaymail_version_backup' );
72 69
73 - if ( $version_current !== $version_old && yaymail_is_wc_installed() ) {
70 + if ( $version_current !== $version_old ) {
74 71 if ( $version_current_backup !== $version_current ) {
75 72 \YayMail\Migrations\MainMigration::get_instance()->migrate();
76 73
77 - update_option( 'yaymail_version', $version_current );
78 - update_option( 'yaymail_version_backup', $version_current );
74 + update_option( 'yaymail_version', YAYMAIL_VERSION );
75 + update_option( 'yaymail_version_backup', YAYMAIL_VERSION );
79 76 }
80 77 }
81 78
82 79 ActDeact::get_instance();
83 80
84 - if ( yaymail_is_wc_installed() ) {
85 - WooHandler::get_instance();
86 - }
87 -
81 + WooHandler::get_instance();
88 82 /**
89 83 * Preview Email loader
90 84 */
91 85
@@ -102,18 +96,8 @@
102 96
103 97 SectionTemplatesLoader::get_instance();
104 98 PatternsLoader::get_instance();
105 99
106 - // Template Library only ships WooCommerce order-email designs (Completed,
107 - // RefundedOrder, NewOrder, ...). Skip its directory scan/class instantiation
108 - // (41 files, ~23k lines) and the per-request "SHOW TABLES" check when
109 - // 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.
111 - if ( yaymail_is_wc_installed() ) {
112 - TemplateLibraryLoader::get_instance();
113 - LibraryTemplateSchema::maybe_create_table();
114 - }
115 -
116 100 /**
117 101 * Initialize rest api
118 102 */
119 103 RestAPI::get_instance();
@@ -130,34 +114,7 @@
130 114 * Notices
131 115 */
132 116 NoticeMain::get_instance();
133 117
134 - /**
135 - * Social icon dynamic tint endpoint
136 - */
137 - SocialIconEndpoint::get_instance();
138 -
139 118 do_action( 'yaymail_loaded' );
140 - }
141 -
142 - public function current_yaymail_version() {
143 - $version = 'yaymail/yaymail.php';
144 - if ( ! function_exists( 'is_plugin_active' ) ) {
145 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
146 - }
147 -
148 - $yaymail_files = [
149 - 'yaymail/yaymail.php',
150 - 'yaymail-pro/yaymail.php',
151 - 'email-customizer-for-woocommerce/yaymail.php',
152 - ];
153 -
154 - foreach ( $yaymail_files as $file ) {
155 - if ( is_plugin_active( $file ) || is_plugin_active_for_network( $file ) ) {
156 - $version = $file;
157 - break;
158 - }
159 - }
160 -
161 - return $version;
162 119 }
163 120 }