PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-format.php +246 -200 5.0.1 → 6.2.1 View file →
@@ -6,203 +6,248 @@
6 6 */
7 7
8 8 namespace MainWP\Dashboard;
9 9
10 +// Exit if accessed directly.
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
14 +
10 15 /**
11 16 * Class MainWP_Format
12 17 *
13 18 * @package MainWP\Dashboard
14 19 */
15 -class MainWP_Format {
20 +class MainWP_Format { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.
16 21
17 - /**
18 - * Method get_class_name()
19 - *
20 - * Get Class Name.
21 - *
22 - * @return object
23 - */
24 - public static function get_class_name() {
25 - return __CLASS__;
26 - }
22 + /**
23 + * Method get_class_name()
24 + *
25 + * Get Class Name.
26 + *
27 + * @return object
28 + */
29 + public static function get_class_name() {
30 + return __CLASS__;
31 + }
27 32
28 - /**
29 - * Method get_update_plugins_items().
30 - *
31 - * Get plugins update.
32 - *
33 - * @return array $update_items Plugins update items.
34 - *
35 - * @uses \MainWP\Dashboard\MainWP_Utility::array_merge()
36 - */
37 - public static function get_update_plugins_items() {
33 + /**
34 + * Method get_update_plugins_items().
35 + *
36 + * Get plugins update.
37 + *
38 + * @return array $update_items Plugins update items.
39 + *
40 + * @uses \MainWP\Dashboard\MainWP_Utility::array_merge()
41 + */
42 + public static function get_update_plugins_items() {
38 43
39 - $pluginsNewUpdate = get_option( 'mainwp_updatescheck_mail_update_plugins_new' );
40 - if ( ! is_array( $pluginsNewUpdate ) ) {
41 - $pluginsNewUpdate = array();
42 - }
43 - $pluginsToUpdate = get_option( 'mainwp_updatescheck_mail_update_plugins' );
44 - if ( ! is_array( $pluginsToUpdate ) ) {
45 - $pluginsToUpdate = array();
46 - }
47 - $notTrustedPluginsNewUpdate = get_option( 'mainwp_updatescheck_mail_ignore_plugins_new' );
48 - if ( ! is_array( $notTrustedPluginsNewUpdate ) ) {
49 - $notTrustedPluginsNewUpdate = array();
50 - }
51 - $notTrustedPluginsToUpdate = get_option( 'mainwp_updatescheck_mail_ignore_plugins' );
52 - if ( ! is_array( $notTrustedPluginsToUpdate ) ) {
53 - $notTrustedPluginsToUpdate = array();
54 - }
44 + $pluginsNewUpdate = get_option( 'mainwp_updatescheck_mail_update_plugins_new' );
45 + if ( ! is_array( $pluginsNewUpdate ) ) {
46 + $pluginsNewUpdate = array();
47 + }
48 + $pluginsToUpdate = get_option( 'mainwp_updatescheck_mail_update_plugins' );
49 + if ( ! is_array( $pluginsToUpdate ) ) {
50 + $pluginsToUpdate = array();
51 + }
52 + $notTrustedPluginsNewUpdate = get_option( 'mainwp_updatescheck_mail_ignore_plugins_new' );
53 + if ( ! is_array( $notTrustedPluginsNewUpdate ) ) {
54 + $notTrustedPluginsNewUpdate = array();
55 + }
56 + $notTrustedPluginsToUpdate = get_option( 'mainwp_updatescheck_mail_ignore_plugins' );
57 + if ( ! is_array( $notTrustedPluginsToUpdate ) ) {
58 + $notTrustedPluginsToUpdate = array();
59 + }
55 60
56 - $update_items = array();
57 - $update_items = MainWP_Utility::array_merge( $pluginsNewUpdate, $pluginsToUpdate );
58 - $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedPluginsNewUpdate );
59 - $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedPluginsToUpdate );
61 + $pluginsNewUpdate = static::remove_duplicate_updates( $pluginsNewUpdate, $pluginsToUpdate );
62 + $pluginsToUpdate = static::remove_duplicate_updates( $pluginsToUpdate );
63 + $notTrustedPluginsNewUpdate = static::remove_duplicate_updates( $notTrustedPluginsNewUpdate, $notTrustedPluginsToUpdate );
64 + $notTrustedPluginsToUpdate = static::remove_duplicate_updates( $notTrustedPluginsToUpdate );
60 65
61 - return $update_items;
62 - }
66 + $update_items = array();
67 + $update_items = MainWP_Utility::array_merge( $pluginsNewUpdate, $pluginsToUpdate );
68 + $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedPluginsNewUpdate );
69 + $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedPluginsToUpdate );
63 70
64 - /**
65 - * Method get_update_themes_items().
66 - *
67 - * Get themes update items to email.
68 - *
69 - * @return array $update_items Update themes.
70 - *
71 - * @uses \MainWP\Dashboard\MainWP_Utility::array_merge()
72 - */
73 - public static function get_update_themes_items() {
71 + return $update_items;
72 + }
74 73
75 - $themesNewUpdate = get_option( 'mainwp_updatescheck_mail_update_themes_new' );
76 - if ( ! is_array( $themesNewUpdate ) ) {
77 - $themesNewUpdate = array();
78 - }
79 - $themesToUpdate = get_option( 'mainwp_updatescheck_mail_update_themes' );
80 - if ( ! is_array( $themesToUpdate ) ) {
81 - $themesToUpdate = array();
82 - }
83 - $notTrustedThemesNewUpdate = get_option( 'mainwp_updatescheck_mail_ignore_themes_new' );
84 - if ( ! is_array( $notTrustedThemesNewUpdate ) ) {
85 - $notTrustedThemesNewUpdate = array();
86 - }
87 - $notTrustedThemesToUpdate = get_option( 'mainwp_updatescheck_mail_ignore_themes' );
88 - if ( ! is_array( $notTrustedThemesToUpdate ) ) {
89 - $notTrustedThemesToUpdate = array();
90 - }
91 74
92 - $update_items = array();
75 + /**
76 + * Method remove_duplicate_updates
77 + *
78 + * @param array $checks checks.
79 + * @param array $inputs inputs.
80 + * @return mixed
81 + */
82 + public static function remove_duplicate_updates( $checks, $inputs = array() ) {
83 + $tmp = array();
84 + $filters = array();
85 + $done = false;
86 + if ( is_array( $inputs ) ) {
87 + foreach ( $inputs as $item ) {
88 + if ( isset( $item['slug'] ) && isset( $item['id'] ) && isset( $item['current'] ) && ! isset( $filters[ $item['id'] . '_' . $item['slug'] . '_' . $item['current'] ] ) ) {
89 + $filters[ $item['id'] . '_' . $item['slug'] . '_' . $item['current'] ] = 1;
90 + $done = true;
91 + }
92 + }
93 + }
94 + // check not duplicate item in both arrays, for $checks array.
95 + foreach ( $checks as $item ) {
96 + if ( isset( $item['slug'] ) && isset( $item['id'] ) && isset( $item['current'] ) && ! isset( $filters[ $item['id'] . '_' . $item['slug'] . '_' . $item['current'] ] ) ) {
97 + $filters[ $item['id'] . '_' . $item['slug'] . '_' . $item['current'] ] = 1;
98 + $tmp[] = $item;
99 + $done = true;
100 + }
101 + }
102 + return $done ? $tmp : $checks; // to prevent bad format data.
103 + }
93 104
94 - $update_items = MainWP_Utility::array_merge( $themesNewUpdate, $themesToUpdate );
95 - $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedThemesNewUpdate );
96 - $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedThemesToUpdate );
105 + /**
106 + * Method get_update_themes_items().
107 + *
108 + * Get themes update items to email.
109 + *
110 + * @return array $update_items Update themes.
111 + *
112 + * @uses \MainWP\Dashboard\MainWP_Utility::array_merge()
113 + */
114 + public static function get_update_themes_items() {
97 115
98 - return $update_items;
99 - }
116 + $themesNewUpdate = get_option( 'mainwp_updatescheck_mail_update_themes_new' );
117 + if ( ! is_array( $themesNewUpdate ) ) {
118 + $themesNewUpdate = array();
119 + }
120 + $themesToUpdate = get_option( 'mainwp_updatescheck_mail_update_themes' );
121 + if ( ! is_array( $themesToUpdate ) ) {
122 + $themesToUpdate = array();
123 + }
124 + $notTrustedThemesNewUpdate = get_option( 'mainwp_updatescheck_mail_ignore_themes_new' );
125 + if ( ! is_array( $notTrustedThemesNewUpdate ) ) {
126 + $notTrustedThemesNewUpdate = array();
127 + }
128 + $notTrustedThemesToUpdate = get_option( 'mainwp_updatescheck_mail_ignore_themes' );
129 + if ( ! is_array( $notTrustedThemesToUpdate ) ) {
130 + $notTrustedThemesToUpdate = array();
131 + }
100 132
101 - /**
102 - * Method get_update_wp_items().
103 - *
104 - * Get WP update to email.
105 - *
106 - * @return array $update_items WP update items.
107 - *
108 - * @uses \MainWP\Dashboard\MainWP_Utility::array_merge()
109 - */
110 - public static function get_update_wp_items() {
133 + $themesNewUpdate = static::remove_duplicate_updates( $themesNewUpdate, $themesToUpdate );
134 + $themesToUpdate = static::remove_duplicate_updates( $themesToUpdate );
135 + $notTrustedThemesNewUpdate = static::remove_duplicate_updates( $notTrustedThemesNewUpdate, $notTrustedThemesToUpdate );
136 + $notTrustedThemesToUpdate = static::remove_duplicate_updates( $notTrustedThemesToUpdate );
111 137
112 - $coreNewUpdate = get_option( 'mainwp_updatescheck_mail_update_core_new' );
113 - if ( ! is_array( $coreNewUpdate ) ) {
114 - $coreNewUpdate = array();
115 - }
116 - $coreToUpdate = get_option( 'mainwp_updatescheck_mail_update_core' );
117 - if ( ! is_array( $coreToUpdate ) ) {
118 - $coreToUpdate = array();
119 - }
120 - $ignoredCoreNewUpdate = get_option( 'mainwp_updatescheck_mail_ignore_core_new' );
121 - if ( ! is_array( $ignoredCoreNewUpdate ) ) {
122 - $ignoredCoreNewUpdate = array();
123 - }
124 - $ignoredCoreToUpdate = get_option( 'mainwp_updatescheck_mail_ignore_core' );
125 - if ( ! is_array( $ignoredCoreToUpdate ) ) {
126 - $ignoredCoreToUpdate = array();
127 - }
138 + $update_items = array();
128 139
129 - $update_items = array();
140 + $update_items = MainWP_Utility::array_merge( $themesNewUpdate, $themesToUpdate );
141 + $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedThemesNewUpdate );
142 + $update_items = MainWP_Utility::array_merge( $update_items, $notTrustedThemesToUpdate );
130 143
131 - $update_items = MainWP_Utility::array_merge( $coreNewUpdate, $coreToUpdate );
132 - $update_items = MainWP_Utility::array_merge( $update_items, $ignoredCoreNewUpdate );
133 - $update_items = MainWP_Utility::array_merge( $update_items, $ignoredCoreToUpdate );
144 + return $update_items;
145 + }
134 146
135 - return $update_items;
136 - }
147 + /**
148 + * Method get_update_wp_items().
149 + *
150 + * Get WP update to email.
151 + *
152 + * @return array $update_items WP update items.
153 + *
154 + * @uses \MainWP\Dashboard\MainWP_Utility::array_merge()
155 + */
156 + public static function get_update_wp_items() {
137 157
138 - /**
139 - * Method get_site_updates_items().
140 - *
141 - * Get Updates items of websites.
142 - *
143 - * @param string $what values: plugin, theme, wpcore.
144 - * @param array $sites_ids Websites ids filter (option).
145 - *
146 - * @return array $update_items WP update items.
147 - */
148 - public static function get_site_updates_items( $what, $sites_ids = false ) {
158 + $coreNewUpdate = get_option( 'mainwp_updatescheck_mail_update_core_new' );
159 + if ( ! is_array( $coreNewUpdate ) ) {
160 + $coreNewUpdate = array();
161 + }
162 + $coreToUpdate = get_option( 'mainwp_updatescheck_mail_update_core' );
163 + if ( ! is_array( $coreToUpdate ) ) {
164 + $coreToUpdate = array();
165 + }
166 + $ignoredCoreNewUpdate = get_option( 'mainwp_updatescheck_mail_ignore_core_new' );
167 + if ( ! is_array( $ignoredCoreNewUpdate ) ) {
168 + $ignoredCoreNewUpdate = array();
169 + }
170 + $ignoredCoreToUpdate = get_option( 'mainwp_updatescheck_mail_ignore_core' );
171 + if ( ! is_array( $ignoredCoreToUpdate ) ) {
172 + $ignoredCoreToUpdate = array();
173 + }
149 174
150 - $items = array();
151 - if ( 'plugin' === $what ) {
152 - $items = self::get_update_plugins_items();
153 - } elseif ( 'theme' === $what ) {
154 - $items = self::get_update_themes_items();
155 - } elseif ( 'wpcore' === $what ) {
156 - $items = self::get_update_wp_items();
157 - }
175 + $update_items = array();
158 176
159 - $filters = array();
160 - foreach ( $items as $item ) {
161 - if ( isset( $item['id'] ) ) { // to valid and compatible data.
162 - if ( ! empty( $sites_ids ) ) { // if filter by sites ids.
163 - if ( ! in_array( $item['id'], $sites_ids ) ) {
164 - continue;
165 - }
166 - }
167 - $filters[] = $item;
168 - }
169 - }
170 - return $filters;
171 - }
177 + $update_items = MainWP_Utility::array_merge( $coreNewUpdate, $coreToUpdate );
178 + $update_items = MainWP_Utility::array_merge( $update_items, $ignoredCoreNewUpdate );
179 + $update_items = MainWP_Utility::array_merge( $update_items, $ignoredCoreToUpdate );
172 180
173 - /**
174 - * Method format_email()
175 - *
176 - * Format email.
177 - *
178 - * @param string $to_email Send to emails.
179 - * @param string $body Email's body.
180 - * @param string $title Email's title.
181 - * @param bool $plain_text text format.
182 - *
183 - * @return string Formatted content
184 - */
185 - public static function format_email( $to_email = null, $body = '', $title = '', $plain_text = false ) {
181 + return $update_items;
182 + }
186 183
187 - $current_year = gmdate( 'Y' );
188 - if ( $plain_text ) {
189 - $mail_send['header'] = '';
190 - $mail_send['body'] = 'Hi,' . "\r\n\r\n" .
191 - ( ( ! empty( $title ) ) ? $title . "\r\n\r\n" : '' ) .
192 - $body . "\r\n\r\n";
193 - $mail_send['footer'] = 'MainWP: https://mainwp.com' . "\r\n" .
194 - 'Extensions: https://mainwp.com/mainwp-extensions/' . "\r\n" .
195 - 'Documentation: https://kb.mainwp.com/' . "\r\n" .
196 - 'Blog: https://mainwp.com/mainwp-blog/' . "\r\n" .
197 - 'Codex: https://mainwp.dev/' . "\r\n" .
198 - 'Support: https://mainwp.com/support/' . "\r\n\r\n" .
199 - 'Follow us on Twitter: https://twitter.com/mymainwp' . "\r\n" .
200 - 'Friend us on Facebook: https://www.facebook.com/mainwp' . "\r\n\r\n" .
201 - "Copyright {$current_year} MainWP, All rights reserved.";
202 - } else {
203 - $mail_send['header'] = <<<EOT
204 - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
184 + /**
185 + * Method get_site_updates_items().
186 + *
187 + * Get Updates items of websites.
188 + *
189 + * @param string $what values: plugin, theme, wpcore.
190 + * @param array $sites_ids Websites ids filter (option).
191 + *
192 + * @return array $update_items WP update items.
193 + */
194 + public static function get_site_updates_items( $what, $sites_ids = false ) {
195 +
196 + $items = array();
197 + if ( 'plugin' === $what ) {
198 + $items = static::get_update_plugins_items();
199 + } elseif ( 'theme' === $what ) {
200 + $items = static::get_update_themes_items();
201 + } elseif ( 'wpcore' === $what ) {
202 + $items = static::get_update_wp_items();
203 + }
204 +
205 + $filters = array();
206 + foreach ( $items as $item ) {
207 + if ( isset( $item['id'] ) ) { // to valid and compatible data.
208 + if ( ! empty( $sites_ids ) && ! in_array( $item['id'], $sites_ids ) ) {
209 + continue;
210 + }
211 + $filters[] = $item;
212 + }
213 + }
214 + return $filters;
215 + }
216 +
217 + /**
218 + * Method format_email()
219 + *
220 + * Format email.
221 + *
222 + * @param string $to_email Send to emails.
223 + * @param string $body Email's body.
224 + * @param string $title Email's title.
225 + * @param bool $plain_text text format.
226 + *
227 + * @return string Formatted content
228 + */
229 + public static function format_email( $to_email = null, $body = '', $title = '', $plain_text = false ) { //phpcs:ignore -- NOSONAR - long function.
230 + unset( $to_email );
231 + $current_year = gmdate( 'Y' );
232 + if ( $plain_text ) {
233 + $mail_send['header'] = '';
234 + $mail_send['body'] = 'Hi,' . "\r\n\r\n" .
235 + ( ( ! empty( $title ) ) ? $title . "\r\n\r\n" : '' ) .
236 + $body . "\r\n\r\n";
237 + $mail_send['footer'] = 'MainWP: https://mainwp.com' . "\r\n" .
238 + 'Add-ons: https://mainwp.com/mainwp-add-ons/' . "\r\n" .
239 + 'Documentation: https://docs.mainwp.com/' . "\r\n" .
240 + 'Blog: https://mainwp.com/mainwp-blog/' . "\r\n" .
241 + 'Codex: https://mainwp.dev/' . "\r\n" .
242 + 'Support: https://mainwp.com/support/' . "\r\n\r\n" .
243 + 'Follow us on X: https://x.com/mymainwp' . "\r\n" .
244 + 'Friend us on Facebook: https://www.facebook.com/mainwp' . "\r\n\r\n" .
245 + "Copyright {$current_year} MainWP, All rights reserved.";
246 + } else {
247 + // phpcs:disable PluginCheck.CodeAnalysis.Heredoc.NotAllowed -- Email HTML templates; refactoring 250+ lines of HTML to string concatenation carries high regression risk with no security benefit as content is not browser-rendered.
248 + $mail_send['header'] = <<<EOT
249 + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
205 250 <html>
206 251 <head>
207 252 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
208 253 <title> {$title} </title>
@@ -385,28 +430,28 @@
385 430 max-width:190px;
386 431 }
387 432 </style>
388 433 </head>
389 - <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="-webkit-text-size-adjust: none;margin: 0;padding: 0;background-color: #FAFAFA;width: 100% !important;">
434 + <body offset="0" style="-webkit-text-size-adjust: none;margin: 0;padding: 0;background-color: #FAFAFA;width: 100% !important;">
390 435 <center>
391 - <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="backgroundTable" style="margin: 0;padding:0;background-color: #FAFAFA;height: 100% !important;width: 100% !important;">
436 + <table id="backgroundTable" style="margin 0;border-spacing:0;width:100%;height:100%;padding:0;background-color: #FAFAFA;height: 100% !important;width: 100% !important;">
392 437 <tr>
393 - <td align="center" valign="top" style="border-collapse: collapse;">
438 + <td style="text-align:center;border-collapse: collapse;vertical-align:top;">
394 439
395 440 <!-- // Begin: Template Pre-header \\ -->
396 441
397 - <table border="0" cellpadding="10" cellspacing="0" width="600" id="templatePreheader" style="background-color: #FAFAFA;">
442 + <table id="templatePreheader" style="padding:10px;border-spacing:0;width:600px;background-color: #FAFAFA;">
398 443 <tr>
399 - <td valign="top" class="preheaderContent" style="border-collapse: collapse;">
444 + <td class="preheaderContent" style="border-collapse: collapse;vertical-align:top;">
400 445
401 446 <!-- // Begin: Standard Preheader \ -->
402 447
403 - <table border="0" cellpadding="10" cellspacing="0" width="100%">
448 + <table style="border:0;padding:10px;border-spacing:0;width:100%">
404 449 <tr>
405 - <td valign="top" style="border-collapse: collapse;">
450 + <td style="border-collapse: collapse;vertical-align:top;">
406 451 <div style="color: #505050;font-family: Arial;font-size: 10px;line-height: 100%;text-align: left;"></div>
407 452 </td>
408 - <td valign="top" width="190" style="border-collapse: collapse;">
453 + <td style="border-collapse: collapse;vertical-align:top;width:190px;">
409 454 <div style="color: #505050;font-family: Arial;font-size: 10px;line-height: 100%;text-align: left;"></div>
410 455 </td>
411 456 </tr>
412 457 </table>
@@ -418,15 +463,15 @@
418 463 </table>
419 464
420 465 <!-- // End: Template Preheader \\ -->
421 466
422 - <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateContainer" style="border: 1px solid #DDDDDD;background-color: #FFFFFF;">
467 + <table id="templateContainer" style="width:600px;padding:0;border-spacing:0;border: 1px solid #DDDDDD;background-color: #FFFFFF;">
423 468 <tr>
424 - <td align="center" valign="top" style="border-collapse: collapse;">
469 + <td style="text-align:center;vertical-align:top;border-collapse: collapse;">
425 470
426 471 <!-- // Begin: Template Header \\ -->
427 472
428 - <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateHeader" style="background-color: #FFFFFF;border-bottom: 0;">
473 + <table id="templateHeader" style="width:600px;padding:0;border-spacing:0;background-color: #FFFFFF;border-bottom: 0;">
429 474 <tr>
430 475 <td class="headerContent" style="border-collapse: collapse;color: #202020;font-family: Arial;font-size: 34px;font-weight: bold;line-height: 100%;padding: 0;text-align: center;vertical-align: middle;">
431 476
432 477 <!-- // Begin: Standard Header Image \\ -->
@@ -443,25 +488,25 @@
443 488
444 489 </td>
445 490 </tr>
446 491 <tr>
447 - <td align="center" valign="top" style="border-collapse: collapse;">
492 + <td style="align:center;vertical-align:top;border-collapse: collapse;">
448 493
449 494 <!-- // Begin: Template Body \\ -->
450 495
451 - <table border="0" cellpadding="0" cellspacing="0" width="600" id="templateBody">
496 + <tableid="templateBody" style="border:0;padding:0;border-spacing:0;width:600px;">
452 497 <tr>
453 - <td valign="top" class="bodyContent" style="border-collapse: collapse;background-color: #FFFFFF;">
498 + <td class="bodyContent" style="vertical-align:top;border-collapse: collapse;background-color: #FFFFFF;">
454 499
455 500 <!-- // Begin: Standard Content \\ -->
456 501 EOT;
457 502
458 - $title_content = ! empty( $title ) ? '<b style="color: rgb(127, 177, 0); font-family: Helvetica, Sans; font-size: medium; line-height: normal;"> ' . $title . ' </b><br>' : '';
503 + $title_content = ! empty( $title ) ? '<b style="color: rgb(127, 177, 0); font-family: Helvetica, Sans; font-size: medium; line-height: normal;"> ' . $title . ' </b><br>' : '';
459 504
460 - $mail_send['body'] = <<<EOT
461 - <table border="0" cellpadding="20" cellspacing="0" width="100%">
505 + $mail_send['body'] = <<<EOT
506 + <table style="vertical-align:top;border:0;padding:20px;border-spacing:0;width:100%;">
462 507 <tr>
463 - <td valign="top" style="border-collapse: collapse;">
508 + <td style="vertical-align:top;border-collapse: collapse;">
464 509 <div style="color: #505050;font-family: Arial;font-size: 14px;line-height: 150%;text-align: left;"> Hi, <br><br>
465 510 {$title_content}
466 511 <br>{$body}<br>
467 512 </div>
@@ -469,9 +514,9 @@
469 514 </tr>
470 515 </table>
471 516 EOT;
472 517
473 - $mail_send['footer'] = <<<EOT
518 + $mail_send['footer'] = <<<EOT
474 519 <!-- // End: Standard Content \\ -->
475 520
476 521 </td>
477 522 </tr>
@@ -481,19 +526,19 @@
481 526
482 527 </td>
483 528 </tr>
484 529 <tr>
485 - <td align="center" valign="top" style="border-collapse: collapse;">
530 + <td style="text-align:center;vertical-align:top;border-collapse: collapse;">
486 531
487 532 <!-- // Begin: Template Footer \\ -->
488 533
489 - <table border="0" cellpadding="10" cellspacing="0" width="600" id="templateFooter" style="background-color: #1d1b1c;border-top: 4px solid #7fb100;">
534 + <table id="templateFooter" style="padding:10px;border-spacing:0;width:600px;background-color: #1d1b1c;border-top: 4px solid #7fb100;">
490 535 <tr>
491 - <td valign="top" class="footerContent" style="border-collapse: collapse;">
536 + <td class="footerContent" style="vertical-align:top;border-collapse: collapse;">
492 537
493 538 <!-- // Begin: Standard Footer \\ -->
494 539
495 - <table border="0" cellpadding="10" cellspacing="0" width="100%">
540 + <table width="100%" style="border:0;padding:10px;border-spacing:0;width:100%;">
496 541 <tr>
497 542 <td valign="middle" id="social" style="border-collapse: collapse;background-color: #1d1b1c;border: 0;">
498 543 <div style="color: #b8b8b8;font-family: Arial;font-size: 12px;line-height: 125%;text-align: center;">
499 544 <style type="text/css">
@@ -503,16 +548,16 @@
503 548 color: #7fb100 ;
504 549 }
505 550 </style>
506 551 <div class="tpl-content-highlight" id="mainwp-links" style="color: #b8b8b8;font-family: Arial;font-size: 12px;line-height: 125%;text-align: center;">
507 - <a href="https://mainwp.com" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">MainWP</a> | <a href="https://mainwp.com/mainwp-extensions/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Extensions</a> | <a href="https://kb.mainwp.com/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration:none;text-transform: uppercase;">Documentation</a> | <a href="https://mainwp.com/mainwp-blog/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Blog</a> | <a href="http://codex.mainwp.com" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Codex</a> | <a href="https://mainwp.com/support/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Support</a></div>
552 + <a href="https://mainwp.com" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">MainWP</a> | <a href="https://mainwp.com/mainwp-add-ons/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Add-ons</a> | <a href="https://docs.mainwp.com/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration:none;text-transform: uppercase;">Documentation</a> | <a href="https://mainwp.com/mainwp-blog/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Blog</a> | <a href="https://mainwp.dev/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Codex</a> | <a href="https://mainwp.com/support/" target="_self" style="color: #7fb100;font-weight: normal;text-decoration: none;text-transform: uppercase;">Support</a></div>
508 553
509 554 <hr><br>
510 - <a href="https://twitter.com/mymainwp" target="_blank" style="color: #336699;font-weight: normal;text-decoration: underline;">Follow us on Twitter</a> | <a href="https://www.facebook.com/mainwp" style="color:#336699;font-weight: normal;text-decoration: underline;">Friend us on Facebook</a>
555 + <a href="https://x.com/mymainwp" target="_blank" style="color: #336699;font-weight: normal;text-decoration: underline;">Follow us on X</a> | <a href="https://www.facebook.com/mainwp" style="color:#336699;font-weight: normal;text-decoration: underline;">Friend us on Facebook</a>
511 556 </td>
512 557 </tr>
513 558 <tr>
514 - <td valign="top" style="border-collapse: collapse;">
559 + <td style="vertical-align:top;border-collapse: collapse;">
515 560 <div style="color: #b8b8b8;font-family: Arial;font-size: 12px;line-height: 125%;text-align: center;"><div style="text-align: left;color: #b8b8b8;font-family: Arial;font-size: 12px;line-height: 125%;"><em>Copyright &copy; {$current_year} MainWP, All rights reserved.</em><br></div></div>
516 561 </td>
517 562 </tr>
518 563 </table>
@@ -535,9 +580,10 @@
535 580 </center>
536 581 </body>
537 582 </html>
538 583 EOT;
539 - }
540 - $mail_send = apply_filters( 'mainwp_format_email', $mail_send );
541 - return $mail_send['header'] . $mail_send['body'] . $mail_send['footer'];
542 - }
584 + // phpcs:enable PluginCheck.CodeAnalysis.Heredoc.NotAllowed
585 + }
586 + $mail_send = apply_filters( 'mainwp_format_email', $mail_send );
587 + return $mail_send['header'] . $mail_send['body'] . $mail_send['footer'];
588 + }
543 589 }