File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
app/code/Magento/Email/Model
lib/internal/Magento/Framework/Mail Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -319,6 +319,16 @@ public function loadDefault($templateId)
319
319
$ modulesDirectory = $ this ->_filesystem ->getDirectoryRead (DirectoryList::MODULES );
320
320
$ templateText = $ modulesDirectory ->readFile ($ modulesDirectory ->getRelativePath ($ templateFile ));
321
321
322
+ /**
323
+ * trim copyright message for text templates
324
+ */
325
+ if ('html ' != $ templateType
326
+ && preg_match ('/^<!--[\w\W]+?-->/m ' , $ templateText , $ matches )
327
+ && strpos ($ matches [0 ], 'Copyright ' ) > 0
328
+ ) {
329
+ $ templateText = str_replace ($ matches [0 ], '' , $ templateText );
330
+ }
331
+
322
332
if (preg_match ('/<!--@subject\s*(.*?)\s*@-->/u ' , $ templateText , $ matches )) {
323
333
$ this ->setTemplateSubject ($ matches [1 ]);
324
334
$ templateText = str_replace ($ matches [0 ], '' , $ templateText );
@@ -335,9 +345,9 @@ public function loadDefault($templateId)
335
345
}
336
346
337
347
/**
338
- * Remove comment lines
348
+ * Remove comment lines and extra spaces
339
349
*/
340
- $ templateText = preg_replace ('#\{\*.*\*\}#suU ' , '' , $ templateText );
350
+ $ templateText = trim ( preg_replace ('#\{\*.*\*\}#suU ' , '' , $ templateText) );
341
351
342
352
$ this ->setTemplateText ($ templateText );
343
353
$ this ->setId ($ templateId );
Original file line number Diff line number Diff line change 9
9
10
10
class Message extends \Zend_Mail implements MessageInterface
11
11
{
12
+ /**
13
+ * @param string $charset
14
+ */
15
+ public function __construct ($ charset = 'utf-8 ' )
16
+ {
17
+ parent ::__construct ($ charset );
18
+ }
19
+
12
20
/**
13
21
* Message type
14
22
*
You can’t perform that action at this time.
0 commit comments