PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.01
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.01
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
← All changes | app/Services/Libs/EmailComposer.php +27 -10 2.4.01 → 2.10.01 View file →
@@ -74,31 +74,35 @@
74 74 }
75 75
76 76 if ($block['type'] == 'button') {
77 77 return (string)App::make('view')->make('email.Default._button', [
78 - 'link' => Arr::get($block['options'], 'link'),
79 - 'btnText' => $block['content']
78 + 'link' => Arr::get($block['options'], 'link'),
79 + 'btnText' => $block['content'],
80 + 'linkColor' => Utility::getThemeColor(),
81 + 'btnTextColor' => Utility::getThemeColor('theme_button_text')
80 82 ]);
81 83 }
82 84
83 85 if ($block['type'] == 'boxed_content') {
84 86 return (string)App::make('view')->make('email.Default._user_box_content', [
85 - 'user_name' => $block['options']['user']->display_name,
87 + 'user_name' => $block['options']['user']->getPublicDisplayName(),
86 88 'user_avatar' => !(empty($block['options']['user']->xprofile->avatar)) ? $block['options']['user']->xprofile->avatar : $block['options']['user']->photo,
87 89 'content' => $block['content'],
88 90 'permalink' => $block['options']['permalink'],
89 - 'post_content' => $block['options']['post_content']
91 + 'post_content' => $block['options']['post_content'],
92 + 'linkColor' => Utility::getThemeColor()
90 93 ]);
91 94 }
92 95
93 96 if ($block['type'] == 'post_boxed_content') {
94 97 return (string)App::make('view')->make('email.Default._user_post_content', [
95 - 'user_name' => $block['options']['user']->display_name,
98 + 'user_name' => $block['options']['user']->getPublicDisplayName(),
96 99 'user_avatar' => !(empty($block['options']['user']->xprofile->avatar)) ? $block['options']['user']->xprofile->avatar : $block['options']['user']->photo,
97 100 'content' => $block['content'],
98 101 'title' => Arr::get($block['options'], 'title'),
99 102 'permalink' => $block['options']['permalink'],
100 - 'space_name' => $block['options']['space_name']
103 + 'space_name' => $block['options']['space_name'],
104 + 'linkColor' => Utility::getThemeColor()
101 105 ]);
102 106 }
103 107
104 108 if ($block['type'] == 'html_content') {
@@ -152,10 +156,12 @@
152 156 }
153 157
154 158 $generalSettings = Helper::generalSettings();
155 159
160 + $themeColor = Utility::getThemeColor();
161 +
156 162 $replaces = [
157 - '{{site_name_with_url}}' => '<a target="_blank" href="' . Helper::baseUrl('/') . '">' . Arr::get($generalSettings, 'site_title') . '</a>',
163 + '{{site_name_with_url}}' => '<a target="_blank" href="' . Helper::baseUrl('/') . '" style="color: ' . esc_attr($themeColor) . '; text-decoration: none;">' . Arr::get($generalSettings, 'site_title') . '</a>',
158 164 '{{site_name}}' => Arr::get($generalSettings, 'site_title')
159 165 ];
160 166
161 167 $footerTextHtml = str_replace(array_keys($replaces), array_values($replaces), $footerTextHtml);
@@ -160,9 +166,9 @@
160 166
161 167 $footerTextHtml = str_replace(array_keys($replaces), array_values($replaces), $footerTextHtml);
162 168
163 169 // find pattern like this: {{manage_email_notification_url|Manage Your Email Notifications Preference}}
164 - $footerTextHtml = preg_replace_callback('/{{(.*?)\|(.*?)}}/', function ($matches) use ($withPlaceHolder) {
170 + $footerTextHtml = preg_replace_callback('/{{(.*?)\|(.*?)}}/', function ($matches) use ($withPlaceHolder, $themeColor) {
165 171 $match1 = $matches[1];
166 172 if ($match1 != 'manage_email_notification_url') {
167 173 return $matches[0];
168 174 }
@@ -173,9 +179,9 @@
173 179 $url = Helper::baseUrl('fcom_route?route=user_notification_settings&auth=yes');
174 180 }
175 181
176 182 $text = $matches[2];
177 - return '<a target="_blank" rel="noopener noreferrer" href="' . $url . '">' . $text . '</a>';
183 + return '<a target="_blank" rel="noopener noreferrer" style="color: ' . esc_attr($themeColor) . '; text-decoration: underline;" href="' . $url . '">' . $text . '</a>';
178 184 }, $footerTextHtml);
179 185
180 186 $this->addFooterLine('paragraph', $footerTextHtml);
181 187
@@ -214,8 +220,19 @@
214 220 if ($this->headingBlocks) {
215 221 $data['headingContent'] = $this->complileHeadingBlocks();
216 222 }
217 223
218 - return (string)App::make('view')->make('email.template', $data);
224 + $html = (string)App::make('view')->make('email.template', $data);
225 +
226 + // Inline the <head><style> rules onto each element so they survive clients and
227 + // log viewers that strip the document head (Outlook, FluentSMTP's DOMPurify
228 + // preview). @media/:hover rules can't be inlined and are kept in a <style> tag.
229 + try {
230 + $html = (new Emogrifier\Emogrifier($html))->emogrify();
231 + } catch (\Throwable $e) {
232 + // Fall back to the un-inlined HTML; the <head><style> still covers Gmail.
233 + }
234 +
235 + return $html;
219 236 }
220 237
221 238 }