@@ -27,17 +27,17 @@ |
||
27 | 27 | class RowImage extends Row |
28 | 28 | { |
29 | 29 | /** |
30 | - * @access private |
|
31 | - * @var Image $image |
|
32 | - */ |
|
30 | + * @access private |
|
31 | + * @var Image $image |
|
32 | + */ |
|
33 | 33 | private $image = null; |
34 | 34 | |
35 | 35 | /** |
36 | - * Constructor |
|
37 | - * |
|
38 | - * @access public |
|
39 | - * @param Image $img |
|
40 | - */ |
|
36 | + * Constructor |
|
37 | + * |
|
38 | + * @access public |
|
39 | + * @param Image $img |
|
40 | + */ |
|
41 | 41 | public function __construct(Image $img) |
42 | 42 | { |
43 | 43 | $this->add($img); |
@@ -70,54 +70,54 @@ |
||
70 | 70 | // html result. start with an empty string or a html comment |
71 | 71 | $html = $this->getBuilder()->getHtmlComment('ROW IMAGE CONTAINER' . ' //', $indent); |
72 | 72 | |
73 | - $html .= $indent . '<tr>'.PHP_EOL; |
|
74 | - $html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
|
73 | + $html .= $indent . '<tr>' . PHP_EOL; |
|
74 | + $html .= $indent . ' <td align="center" valign="top">' . PHP_EOL; |
|
75 | 75 | |
76 | 76 | $html .= $this->getBuilder()->getHtmlComment('CENTERING TABLE //', $indent . ' '); |
77 | 77 | |
78 | - $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="'. $this->getEffectiveStyle('background-color').'">'.PHP_EOL; |
|
79 | - $html .= $indent . ' <tr '.$this->getRowStyle() .'>'.PHP_EOL; |
|
80 | - $html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
|
78 | + $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="' . $this->getEffectiveStyle('background-color') . '">' . PHP_EOL; |
|
79 | + $html .= $indent . ' <tr ' . $this->getRowStyle() . '>' . PHP_EOL; |
|
80 | + $html .= $indent . ' <td align="center" valign="top">' . PHP_EOL; |
|
81 | 81 | |
82 | 82 | $html .= $this->getBuilder()->getHtmlComment('FLEXIBLE CONTAINER //', $indent . ' '); |
83 | 83 | |
84 | 84 | $html .= $indent . ' <table border="0" "cellspacing="0" cellpadding="' . $this->cellPadding . |
85 | - '" bgcolor="'. $this->getEffectiveStyle('background-color'). |
|
86 | - '" width="'. $this->getBuilder()->emailBodyWidth() . |
|
87 | - '" class="flexibleContainer">'.PHP_EOL; |
|
88 | - $html .= $indent . ' <tr>'.PHP_EOL; |
|
89 | - $html .= $indent . ' <td '. $this->getRowStyle() . |
|
90 | - ' align="center" valign="top" width="'. $this->getBuilder()->emailBodyWidth() . |
|
91 | - '" class="flexibleContainerCell">'.PHP_EOL; |
|
85 | + '" bgcolor="' . $this->getEffectiveStyle('background-color') . |
|
86 | + '" width="' . $this->getBuilder()->emailBodyWidth() . |
|
87 | + '" class="flexibleContainer">' . PHP_EOL; |
|
88 | + $html .= $indent . ' <tr>' . PHP_EOL; |
|
89 | + $html .= $indent . ' <td ' . $this->getRowStyle() . |
|
90 | + ' align="center" valign="top" width="' . $this->getBuilder()->emailBodyWidth() . |
|
91 | + '" class="flexibleContainerCell">' . PHP_EOL; |
|
92 | 92 | |
93 | 93 | $html .= $this->getBuilder()->getHtmlComment('CONTENT TABLE //', $indent . ' '); |
94 | 94 | |
95 | - $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'.PHP_EOL; |
|
96 | - $html .= $indent . ' <tr>'.PHP_EOL; |
|
97 | - $html .= $indent . ' <td valign="top" class="imageContent" color="'. $this->getEffectiveStyle('color') . '" bgcolor="'. $this->getEffectiveStyle('background-color') . '">'.PHP_EOL; |
|
95 | + $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">' . PHP_EOL; |
|
96 | + $html .= $indent . ' <tr>' . PHP_EOL; |
|
97 | + $html .= $indent . ' <td valign="top" class="imageContent" color="' . $this->getEffectiveStyle('color') . '" bgcolor="' . $this->getEffectiveStyle('background-color') . '">' . PHP_EOL; |
|
98 | 98 | |
99 | - $html .= $this->image->getHtml($indent . ' ').PHP_EOL;; |
|
99 | + $html .= $this->image->getHtml($indent . ' ') . PHP_EOL; ; |
|
100 | 100 | |
101 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
102 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
103 | - $html .= $indent . ' </table>'.PHP_EOL; |
|
101 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
102 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
103 | + $html .= $indent . ' </table>' . PHP_EOL; |
|
104 | 104 | |
105 | 105 | $html .= $this->getBuilder()->getHtmlComment('// CONTENT TABLE', $indent . ' '); |
106 | 106 | |
107 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
108 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
109 | - $html .= $indent . ' </table>'.PHP_EOL; |
|
107 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
108 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
109 | + $html .= $indent . ' </table>' . PHP_EOL; |
|
110 | 110 | |
111 | 111 | $html .= $this->getBuilder()->getHtmlComment('// FLEXIBLE CONTAINER', $indent . ' '); |
112 | 112 | |
113 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
114 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
115 | - $html .= $indent . ' </table>'.PHP_EOL; |
|
113 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
114 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
115 | + $html .= $indent . ' </table>' . PHP_EOL; |
|
116 | 116 | |
117 | 117 | $html .= $this->getBuilder()->getHtmlComment('// CENTERING TABLE', $indent . ' '); |
118 | 118 | |
119 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
120 | - $html .= $indent . '</tr>'.PHP_EOL; |
|
119 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
120 | + $html .= $indent . '</tr>' . PHP_EOL; |
|
121 | 121 | |
122 | 122 | $html .= $this->getBuilder()->getHtmlComment('// ' . 'ROW IMAGE CONTAINER', $indent); |
123 | 123 | return $html; |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | * @var array $knowStyles |
50 | 50 | */ |
51 | 51 | protected $knowStyles = array( |
52 | - 'color' , |
|
52 | + 'color', |
|
53 | 53 | 'background-color', |
54 | 54 | 'font-family', |
55 | 55 | 'font-size', |
56 | 56 | 'font-weight', |
57 | 57 | 'line-height', |
58 | - 'padding-top' , |
|
59 | - 'padding-left' , |
|
58 | + 'padding-top', |
|
59 | + 'padding-left', |
|
60 | 60 | 'padding-bottom', |
61 | 61 | 'padding-right', |
62 | 62 | 'text-align', |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function setStyles(array $styles = []) |
82 | 82 | { |
83 | - foreach ($styles as $key => $value){ |
|
84 | - if (in_array($key, $this->knowStyles)){ |
|
83 | + foreach ($styles as $key => $value) { |
|
84 | + if (in_array($key, $this->knowStyles)) { |
|
85 | 85 | $this->styles[$key] = $value; |
86 | 86 | } |
87 | 87 | } |
@@ -42,11 +42,11 @@ |
||
42 | 42 | protected $removePaddingTop = false; |
43 | 43 | |
44 | 44 | /** |
45 | - * True to remove bottom padding. Default is false |
|
46 | - * |
|
47 | - * @access protected |
|
48 | - * @var bool $removePaddingTop |
|
49 | - */ |
|
45 | + * True to remove bottom padding. Default is false |
|
46 | + * |
|
47 | + * @access protected |
|
48 | + * @var bool $removePaddingTop |
|
49 | + */ |
|
50 | 50 | protected $removePaddingBottom = false; |
51 | 51 | |
52 | 52 | /** |
@@ -95,10 +95,10 @@ |
||
95 | 95 | */ |
96 | 96 | protected function getRowStyle() |
97 | 97 | { |
98 | - return ($this->removePaddingTop || $this->removePaddingBottom ) ? |
|
99 | - 'style="'. |
|
98 | + return ($this->removePaddingTop || $this->removePaddingBottom) ? |
|
99 | + 'style="' . |
|
100 | 100 | ($this->removePaddingTop ? 'padding-top:0;' : '') . |
101 | - ($this->removePaddingBottom ? 'padding-bottom:0;' : ''). |
|
101 | + ($this->removePaddingBottom ? 'padding-bottom:0;' : '') . |
|
102 | 102 | '"' : ''; |
103 | 103 | } |
104 | 104 | } |
105 | 105 | \ No newline at end of file |
@@ -62,6 +62,6 @@ |
||
62 | 62 | */ |
63 | 63 | public function getHtml(string $indent = '') |
64 | 64 | { |
65 | - return $indent . '<' . $this->tag . $this->getInlineStyles() .'>' . $this->content. '</' . $this->tag . '>'; |
|
65 | + return $indent . '<' . $this->tag . $this->getInlineStyles() . '>' . $this->content . '</' . $this->tag . '>'; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -69,24 +69,24 @@ |
||
69 | 69 | */ |
70 | 70 | public function getHtml(string $indent) |
71 | 71 | { |
72 | - $html = $indent . '<td align="left" valign="top" class="flexibleContainerBox">'. PHP_EOL; |
|
73 | - $html .= $indent . ' <table border="0" cellpadding="'. $this->cellPadding .'" cellspacing="0"' . |
|
72 | + $html = $indent . '<td align="left" valign="top" class="flexibleContainerBox">' . PHP_EOL; |
|
73 | + $html .= $indent . ' <table border="0" cellpadding="' . $this->cellPadding . '" cellspacing="0"' . |
|
74 | 74 | ($this->columnWidth == 0 ? '' : ' width="' . $this->columnWidth . '"') . |
75 | - ' bgcolor="'. $this->getEffectiveStyle('background-color') .'"'. |
|
76 | - ' style="max-width:100%;">'.PHP_EOL; |
|
77 | - $html .= $indent . ' <tr>'.PHP_EOL; |
|
78 | - $html .= $indent . ' <td align="'. $this->horizontalAlign .'" valign="'. $this->verticalAlign .'" class="textContent">'.PHP_EOL; |
|
75 | + ' bgcolor="' . $this->getEffectiveStyle('background-color') . '"' . |
|
76 | + ' style="max-width:100%;">' . PHP_EOL; |
|
77 | + $html .= $indent . ' <tr>' . PHP_EOL; |
|
78 | + $html .= $indent . ' <td align="' . $this->horizontalAlign . '" valign="' . $this->verticalAlign . '" class="textContent">' . PHP_EOL; |
|
79 | 79 | |
80 | 80 | // render child elements collection |
81 | - foreach ($this->elements() as $element){ |
|
81 | + foreach ($this->elements() as $element) { |
|
82 | 82 | $html .= $element->getHtml($indent . ' '); |
83 | - $html .= PHP_EOL ; |
|
83 | + $html .= PHP_EOL; |
|
84 | 84 | } |
85 | 85 | |
86 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
87 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
88 | - $html .= $indent . ' </table>'.PHP_EOL; |
|
89 | - $html .= $indent . '</td>'.PHP_EOL; |
|
86 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
87 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
88 | + $html .= $indent . ' </table>' . PHP_EOL; |
|
89 | + $html .= $indent . '</td>' . PHP_EOL; |
|
90 | 90 | |
91 | 91 | return $html; |
92 | 92 | } |
@@ -63,58 +63,58 @@ |
||
63 | 63 | $html = $this->getBuilder()->getHtmlComment($partName . ' //', $indent); |
64 | 64 | |
65 | 65 | // create a table container |
66 | - $html .= $indent . '<table bgcolor="'. $backgroundColor . '"' |
|
67 | - . ' width="'. $this->getBuilder()->emailBodyWidth() . '"' |
|
68 | - . ' border="0" cellpadding="0" cellspacing="0" id="'. $id .'">' .PHP_EOL; |
|
66 | + $html .= $indent . '<table bgcolor="' . $backgroundColor . '"' |
|
67 | + . ' width="' . $this->getBuilder()->emailBodyWidth() . '"' |
|
68 | + . ' border="0" cellpadding="0" cellspacing="0" id="' . $id . '">' . PHP_EOL; |
|
69 | 69 | |
70 | - $html .= $indent . ' <tr>'.PHP_EOL; |
|
71 | - $html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
|
70 | + $html .= $indent . ' <tr>' . PHP_EOL; |
|
71 | + $html .= $indent . ' <td align="center" valign="top">' . PHP_EOL; |
|
72 | 72 | |
73 | 73 | $html .= $this->getBuilder()->getHtmlComment('CENTERING TABLE //', $indent . ' '); |
74 | 74 | |
75 | - $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'.PHP_EOL; |
|
76 | - $html .= $indent . ' <tr>'.PHP_EOL; |
|
77 | - $html .= $indent . ' <td align="center" valign="top">'.PHP_EOL; |
|
75 | + $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">' . PHP_EOL; |
|
76 | + $html .= $indent . ' <tr>' . PHP_EOL; |
|
77 | + $html .= $indent . ' <td align="center" valign="top">' . PHP_EOL; |
|
78 | 78 | |
79 | 79 | $html .= $this->getBuilder()->getHtmlComment('FLEXIBLE CONTAINER //', $indent . ' '); |
80 | 80 | |
81 | - $html .= $indent . ' <table border="0" cellpadding="' . $this->cellPadding . '" cellspacing="0" width="'. $this->getBuilder()->emailBodyWidth() . '" class="flexibleContainer">'.PHP_EOL; |
|
82 | - $html .= $indent . ' <tr>'.PHP_EOL; |
|
83 | - $html .= $indent . ' <td align="center" valign="top" width="'. $this->getBuilder()->emailBodyWidth() . '" class="flexibleContainerCell">'.PHP_EOL; |
|
81 | + $html .= $indent . ' <table border="0" cellpadding="' . $this->cellPadding . '" cellspacing="0" width="' . $this->getBuilder()->emailBodyWidth() . '" class="flexibleContainer">' . PHP_EOL; |
|
82 | + $html .= $indent . ' <tr>' . PHP_EOL; |
|
83 | + $html .= $indent . ' <td align="center" valign="top" width="' . $this->getBuilder()->emailBodyWidth() . '" class="flexibleContainerCell">' . PHP_EOL; |
|
84 | 84 | |
85 | 85 | $html .= $this->getBuilder()->getHtmlComment('CONTENT TABLE //', $indent . ' '); |
86 | 86 | |
87 | - $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">'.PHP_EOL; |
|
88 | - $html .= $indent . ' <tr>'.PHP_EOL; |
|
89 | - $html .= $indent . ' <td valign="'. $this->verticalAlign .'" align="'. $this->horizontalAlign .'" bgcolor="'. $backgroundColor . '">'.PHP_EOL; |
|
87 | + $html .= $indent . ' <table border="0" cellpadding="0" cellspacing="0" width="100%">' . PHP_EOL; |
|
88 | + $html .= $indent . ' <tr>' . PHP_EOL; |
|
89 | + $html .= $indent . ' <td valign="' . $this->verticalAlign . '" align="' . $this->horizontalAlign . '" bgcolor="' . $backgroundColor . '">' . PHP_EOL; |
|
90 | 90 | |
91 | 91 | // render child elements collection |
92 | - foreach ($this->childElements as $element){ |
|
92 | + foreach ($this->childElements as $element) { |
|
93 | 93 | $html .= $element->getHtml($indent . ' '); |
94 | - $html .= PHP_EOL ; |
|
94 | + $html .= PHP_EOL; |
|
95 | 95 | } |
96 | 96 | |
97 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
98 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
99 | - $html .= $indent . ' </table>'.PHP_EOL; |
|
97 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
98 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
99 | + $html .= $indent . ' </table>' . PHP_EOL; |
|
100 | 100 | |
101 | 101 | $html .= $this->getBuilder()->getHtmlComment('// CONTENT TABLE', $indent . ' '); |
102 | 102 | |
103 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
104 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
105 | - $html .= $indent . ' </table>'.PHP_EOL; |
|
103 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
104 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
105 | + $html .= $indent . ' </table>' . PHP_EOL; |
|
106 | 106 | |
107 | 107 | $html .= $this->getBuilder()->getHtmlComment('// FLEXIBLE CONTAINER', $indent . ' '); |
108 | 108 | |
109 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
110 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
111 | - $html .= $indent . ' </table>'.PHP_EOL; |
|
109 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
110 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
111 | + $html .= $indent . ' </table>' . PHP_EOL; |
|
112 | 112 | |
113 | 113 | $html .= $this->getBuilder()->getHtmlComment('// CENTERING TABLE', $indent . ' '); |
114 | 114 | |
115 | - $html .= $indent . ' </td>'.PHP_EOL; |
|
116 | - $html .= $indent . ' </tr>'.PHP_EOL; |
|
117 | - $html .= $indent . '</table>'.PHP_EOL; |
|
115 | + $html .= $indent . ' </td>' . PHP_EOL; |
|
116 | + $html .= $indent . ' </tr>' . PHP_EOL; |
|
117 | + $html .= $indent . '</table>' . PHP_EOL; |
|
118 | 118 | |
119 | 119 | $html .= $this->getBuilder()->getHtmlComment('// ' . $partName, $indent); |
120 | 120 | $html .= PHP_EOL; |
@@ -120,20 +120,20 @@ |
||
120 | 120 | protected $emailBodyColor = self::COLOR_GRAY_600; |
121 | 121 | |
122 | 122 | /** |
123 | - * Defines the main text color for the email body |
|
124 | - * |
|
125 | - * @access protected |
|
126 | - * @var string $emailBodyColor |
|
127 | - */ |
|
123 | + * Defines the main text color for the email body |
|
124 | + * |
|
125 | + * @access protected |
|
126 | + * @var string $emailBodyColor |
|
127 | + */ |
|
128 | 128 | protected $emailheaddingColor = self::COLOR_GRAY_900; |
129 | 129 | |
130 | 130 | /** |
131 | - * Defines the email body background color |
|
132 | - * Default is #FFFFFF white |
|
133 | - * |
|
134 | - * @access protected |
|
135 | - * @var string $emailBodyBackgroundColor |
|
136 | - */ |
|
131 | + * Defines the email body background color |
|
132 | + * Default is #FFFFFF white |
|
133 | + * |
|
134 | + * @access protected |
|
135 | + * @var string $emailBodyBackgroundColor |
|
136 | + */ |
|
137 | 137 | protected $emailBodyBackgroundColor = self::COLOR_WHITE; |
138 | 138 | |
139 | 139 | /** |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @access public |
44 | 44 | */ |
45 | - public const COLOR_WHITE = '#FFFFFF' ; |
|
46 | - public const COLOR_BLACK = '#000000' ; |
|
47 | - public const COLOR_BLUE = '#2E7BA2' ; |
|
48 | - public const COLOR_GREEN = '#26A85C' ; |
|
49 | - public const COLOR_ORANGE = '#f26522' ; |
|
50 | - public const COLOR_RED = '#c21a1a' ; |
|
51 | - public const COLOR_YELLOW = '#e4c515' ; |
|
52 | - public const COLOR_MAGENTA = '#b64aa9' ; |
|
45 | + public const COLOR_WHITE = '#FFFFFF'; |
|
46 | + public const COLOR_BLACK = '#000000'; |
|
47 | + public const COLOR_BLUE = '#2E7BA2'; |
|
48 | + public const COLOR_GREEN = '#26A85C'; |
|
49 | + public const COLOR_ORANGE = '#f26522'; |
|
50 | + public const COLOR_RED = '#c21a1a'; |
|
51 | + public const COLOR_YELLOW = '#e4c515'; |
|
52 | + public const COLOR_MAGENTA = '#b64aa9'; |
|
53 | 53 | |
54 | 54 | public const COLOR_LIGHTGRAY = '#cccccc'; |
55 | 55 | public const COLOR_DARKGRAY = '#1E1F22'; |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | public const COLOR_GRAY_800 = '#1e1f22'; |
65 | 65 | public const COLOR_GRAY_900 = '#141416'; |
66 | 66 | |
67 | - public const COLOR_STATUS_ERROR = '#c41818' ; |
|
68 | - public const COLOR_STATUS_SUCCESS = '#118a39' ; |
|
69 | - public const COLOR_STATUS_WARNING = '#e79c11' ; |
|
67 | + public const COLOR_STATUS_ERROR = '#c41818'; |
|
68 | + public const COLOR_STATUS_SUCCESS = '#118a39'; |
|
69 | + public const COLOR_STATUS_WARNING = '#e79c11'; |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Gets whether html comments are rendered when calling the calling the HtmlEmailBuilder::getHtml() method. |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | // Must be a valid hex value. |
185 | 185 | $length = mb_strlen($color); |
186 | 186 | |
187 | - if ( ($length === 3 || $length === 6 ) && ctype_xdigit($color) ) { |
|
187 | + if (($length === 3 || $length === 6) && ctype_xdigit($color)) { |
|
188 | 188 | // return prefixed uppercase hex color string |
189 | - return '#'. strtoupper($color); |
|
189 | + return '#' . strtoupper($color); |
|
190 | 190 | }; |
191 | 191 | |
192 | 192 | // something was wrong |
193 | - throw new \InvalidArgumentException('Value passed was not a valid hex color. Value was [' . $color .']'); |
|
193 | + throw new \InvalidArgumentException('Value passed was not a valid hex color. Value was [' . $color . ']'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function renderHtmlComments(bool $value) |
217 | 217 | { |
218 | - $this->renderHtmlComments= $value; |
|
218 | + $this->renderHtmlComments = $value; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | /** |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public function emailBodyFontSize() |
389 | 389 | { |
390 | - return $this->emailBodyFontSize .'px'; |
|
390 | + return $this->emailBodyFontSize . 'px'; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected function getMeta() |
35 | 35 | { |
36 | - $html = ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'.PHP_EOL; |
|
37 | - $html .= ' <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">'.PHP_EOL; |
|
38 | - $html .= ' <meta name="viewport" content="width=device-width, initial-scale=1.0">'.PHP_EOL; |
|
36 | + $html = ' <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' . PHP_EOL; |
|
37 | + $html .= ' <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">' . PHP_EOL; |
|
38 | + $html .= ' <meta name="viewport" content="width=device-width, initial-scale=1.0">' . PHP_EOL; |
|
39 | 39 | $html .= $this->getHtmlComment('Disable auto telephone linking in iOS', ' '); |
40 | - $html .= ' <meta name="format-detection" content="telephone=no" />'.PHP_EOL; |
|
40 | + $html .= ' <meta name="format-detection" content="telephone=no" />' . PHP_EOL; |
|
41 | 41 | |
42 | 42 | // done |
43 | 43 | return $html; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected function getTitle(string $title) |
55 | 55 | { |
56 | - return ' <title>' . $title . '</title>' . PHP_EOL; |
|
56 | + return ' <title>' . $title . '</title>' . PHP_EOL; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -67,41 +67,41 @@ discard block |
||
67 | 67 | protected function getStyles() |
68 | 68 | { |
69 | 69 | // start style tag |
70 | - $html = ' <style type="text/css">'.PHP_EOL; |
|
70 | + $html = ' <style type="text/css">' . PHP_EOL; |
|
71 | 71 | $html .= PHP_EOL; |
72 | 72 | |
73 | 73 | // -- reset styles ---------------------------------------- |
74 | 74 | $html .= $this->getCssComment('--- RESET STYLES ---', ' '); |
75 | - $html .= ' html { background-color:'. $this->backsideBackgroundColor . '; margin:0; padding:0; }'.PHP_EOL; |
|
75 | + $html .= ' html { background-color:' . $this->backsideBackgroundColor . '; margin:0; padding:0; }' . PHP_EOL; |
|
76 | 76 | $html .= ' body, #bodyTable, #bodyCell, #bodyCell{height:100% !important; margin:0; padding:0;'; |
77 | - $html .= ' width:100% !important; font-family:'. $this->emailBodyFont .';}'.PHP_EOL; |
|
78 | - $html .= ' table{border-collapse:collapse;}'.PHP_EOL; |
|
79 | - $html .= ' table[id=bodyTable] {width:100%!important;margin:auto;max-width:500px!important; color:'. $this->emailBodyColor . ';font-weight:normal;}'.PHP_EOL; |
|
80 | - $html .= ' img, a img{border:0; outline:none; text-decoration:none;height:auto; line-height:100%;}'.PHP_EOL; |
|
81 | - $html .= ' a {text-decoration:none !important;border-bottom: 1px solid;}'.PHP_EOL; |
|
77 | + $html .= ' width:100% !important; font-family:' . $this->emailBodyFont . ';}' . PHP_EOL; |
|
78 | + $html .= ' table{border-collapse:collapse;}' . PHP_EOL; |
|
79 | + $html .= ' table[id=bodyTable] {width:100%!important;margin:auto;max-width:500px!important; color:' . $this->emailBodyColor . ';font-weight:normal;}' . PHP_EOL; |
|
80 | + $html .= ' img, a img{border:0; outline:none; text-decoration:none;height:auto; line-height:100%;}' . PHP_EOL; |
|
81 | + $html .= ' a {text-decoration:none !important;border-bottom: 1px solid;}' . PHP_EOL; |
|
82 | 82 | |
83 | 83 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
84 | 84 | // todo custom COLOR !!!!!!!!!!!!!! font size ? line height ? margin ? see |
85 | 85 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
86 | - $html .= ' h1, h2, h3, h4, h5, h6 {color:#5F5F5F; font-weight:normal; font-family:'. $this->emailBodyFont .';'.PHP_EOL; |
|
87 | - $html .= ' font-size:20px; line-height:125%; text-align:Left; letter-spacing:normal;'.PHP_EOL; |
|
88 | - $html .= ' margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;'.PHP_EOL; |
|
89 | - $html .= ' padding-top:0;padding-bottom:10px;padding-left:0;padding-right:0;}'.PHP_EOL; |
|
86 | + $html .= ' h1, h2, h3, h4, h5, h6 {color:#5F5F5F; font-weight:normal; font-family:' . $this->emailBodyFont . ';' . PHP_EOL; |
|
87 | + $html .= ' font-size:20px; line-height:125%; text-align:Left; letter-spacing:normal;' . PHP_EOL; |
|
88 | + $html .= ' margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;' . PHP_EOL; |
|
89 | + $html .= ' padding-top:0;padding-bottom:10px;padding-left:0;padding-right:0;}' . PHP_EOL; |
|
90 | 90 | // custom |
91 | 91 | $html .= ' p {margin-top:0;margin-right:0;margin-bottom:0;margin-left:0;'; |
92 | - $html .= 'padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;}'.PHP_EOL; |
|
93 | - $html .= ' p + p {padding-top:10px;}'.PHP_EOL; |
|
92 | + $html .= 'padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;}' . PHP_EOL; |
|
93 | + $html .= ' p + p {padding-top:10px;}' . PHP_EOL; |
|
94 | 94 | $html .= PHP_EOL; |
95 | 95 | |
96 | 96 | // -- client specific styles ------------------------------------------- |
97 | 97 | $html .= $this->getCssComment('--- CLIENT-SPECIFIC STYLES ---', ' '); |
98 | - $html .= ' .ReadMsgBody{width:100%;} .ExternalClass{width:100%;}'. $this->getCssComment(' Force Hotmail/Outlook.com to display emails at full width.'); |
|
98 | + $html .= ' .ReadMsgBody{width:100%;} .ExternalClass{width:100%;}' . $this->getCssComment(' Force Hotmail/Outlook.com to display emails at full width.'); |
|
99 | 99 | $html .= ' .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div{line-height:100%;}' . $this->getCssComment(' Force Hotmail/Outlook.com to display line heights normally.'); |
100 | 100 | $html .= ' table, td{mso-table-lspace:0pt; mso-table-rspace:0pt;}' . $this->getCssComment(' Remove spacing between tables in Outlook 2007 and up.'); |
101 | - $html .= ' #outlook a{padding:0;}'. $this->getCssComment(' Force Outlook 2007 and up to provide a "view in browser" message.'); |
|
102 | - $html .= ' img{-ms-interpolation-mode: bicubic;display:block;outline:none; text-decoration:none;}'. $this->getCssComment(' Force IE to smoothly render resized images.'); |
|
103 | - $html .= ' body, table, td, p, a, li, blockquote{-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; font-weight:normal!important;}'. $this->getCssComment(' Prevent Windows- and Webkit-based mobile platforms from changing declared text sizes. '); |
|
104 | - $html .= ' .ExternalClass td[class="ecxflexibleContainerBox"] h3 {padding-top: 10px !important;} '. $this->getCssComment(' Force hotmail to push 2-grid sub headers down'); |
|
101 | + $html .= ' #outlook a{padding:0;}' . $this->getCssComment(' Force Outlook 2007 and up to provide a "view in browser" message.'); |
|
102 | + $html .= ' img{-ms-interpolation-mode: bicubic;display:block;outline:none; text-decoration:none;}' . $this->getCssComment(' Force IE to smoothly render resized images.'); |
|
103 | + $html .= ' body, table, td, p, a, li, blockquote{-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; font-weight:normal!important;}' . $this->getCssComment(' Prevent Windows- and Webkit-based mobile platforms from changing declared text sizes. '); |
|
104 | + $html .= ' .ExternalClass td[class="ecxflexibleContainerBox"] h3 {padding-top: 10px !important;} ' . $this->getCssComment(' Force hotmail to push 2-grid sub headers down'); |
|
105 | 105 | $html .= PHP_EOL; |
106 | 106 | |
107 | 107 | // -- our styles -------------------------------------------------------- |
@@ -110,24 +110,24 @@ discard block |
||
110 | 110 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
111 | 111 | // todo custom font size ? line height ? colors .. |
112 | 112 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!#3497D9!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
113 | - $html .= ' h1{display:block;font-size:32px;font-style:normal;font-weight:200!important;line-height:100%;}'.PHP_EOL; |
|
114 | - $html .= ' h2{display:block;font-size:27px;font-style:normal;font-weight:200!important;line-height:120%;}'.PHP_EOL; |
|
115 | - $html .= ' h3{display:block;font-size:24px;font-style:normal;font-weight:200!important;line-height:110%;}'.PHP_EOL; |
|
116 | - $html .= ' h4{display:block;font-size:22px;font-style:normal;font-weight:200!important;line-height:100%;}'.PHP_EOL; |
|
117 | - $html .= ' h5{display:block;font-size:20px;font-style:normal;font-weight:200!important;line-height:110%;}'.PHP_EOL; |
|
118 | - $html .= ' h6{display:block;font-size:18px;font-style:normal;font-weight:200!important;line-height:110%;}'.PHP_EOL; |
|
113 | + $html .= ' h1{display:block;font-size:32px;font-style:normal;font-weight:200!important;line-height:100%;}' . PHP_EOL; |
|
114 | + $html .= ' h2{display:block;font-size:27px;font-style:normal;font-weight:200!important;line-height:120%;}' . PHP_EOL; |
|
115 | + $html .= ' h3{display:block;font-size:24px;font-style:normal;font-weight:200!important;line-height:110%;}' . PHP_EOL; |
|
116 | + $html .= ' h4{display:block;font-size:22px;font-style:normal;font-weight:200!important;line-height:100%;}' . PHP_EOL; |
|
117 | + $html .= ' h5{display:block;font-size:20px;font-style:normal;font-weight:200!important;line-height:110%;}' . PHP_EOL; |
|
118 | + $html .= ' h6{display:block;font-size:18px;font-style:normal;font-weight:200!important;line-height:110%;}' . PHP_EOL; |
|
119 | 119 | |
120 | - $html .= ' .flexibleImage{height:auto;}'.PHP_EOL; |
|
121 | - $html .= ' .linkRemoveBorder{border-bottom:0 !important;}'.PHP_EOL; |
|
122 | - $html .= ' table[class=flexibleContainerCellDivider] {padding-bottom:0 !important;padding-top:0 !important;}'.PHP_EOL; |
|
123 | - |
|
124 | - $html .= ' body, #bodyTable{background-color:'. $this->backsideBackgroundColor . ';}'.PHP_EOL; |
|
125 | - $html .= ' #emailHeader{background-color:' . $this->backsideBackgroundColor . ';}'.PHP_EOL; |
|
126 | - $html .= ' #emailBody{background-color:' . $this->emailBodyBackgroundColor . ';}'.PHP_EOL; |
|
127 | - $html .= ' #emailFooter{background-color:' . $this->backsideBackgroundColor . ';}'.PHP_EOL; |
|
128 | - $html .= ' .emailButton{background-color:#3497D9; border-collapse:separate;}'.PHP_EOL; |
|
129 | - $html .= ' .buttonContent{color:#FFFFFF; font-family:Helvetica; font-size:18px; font-weight:200; line-height:100%; padding:15px; text-align:center;}'.PHP_EOL; |
|
130 | - $html .= ' .buttonContent a{color:#FFFFFF; display:block; text-decoration:none!important; border:0!important;}'.PHP_EOL; |
|
120 | + $html .= ' .flexibleImage{height:auto;}' . PHP_EOL; |
|
121 | + $html .= ' .linkRemoveBorder{border-bottom:0 !important;}' . PHP_EOL; |
|
122 | + $html .= ' table[class=flexibleContainerCellDivider] {padding-bottom:0 !important;padding-top:0 !important;}' . PHP_EOL; |
|
123 | + |
|
124 | + $html .= ' body, #bodyTable{background-color:' . $this->backsideBackgroundColor . ';}' . PHP_EOL; |
|
125 | + $html .= ' #emailHeader{background-color:' . $this->backsideBackgroundColor . ';}' . PHP_EOL; |
|
126 | + $html .= ' #emailBody{background-color:' . $this->emailBodyBackgroundColor . ';}' . PHP_EOL; |
|
127 | + $html .= ' #emailFooter{background-color:' . $this->backsideBackgroundColor . ';}' . PHP_EOL; |
|
128 | + $html .= ' .emailButton{background-color:#3497D9; border-collapse:separate;}' . PHP_EOL; |
|
129 | + $html .= ' .buttonContent{color:#FFFFFF; font-family:Helvetica; font-size:18px; font-weight:200; line-height:100%; padding:15px; text-align:center;}' . PHP_EOL; |
|
130 | + $html .= ' .buttonContent a{color:#FFFFFF; display:block; text-decoration:none!important; border:0!important;}' . PHP_EOL; |
|
131 | 131 | $html .= PHP_EOL; |
132 | 132 | |
133 | 133 | |
@@ -135,49 +135,49 @@ discard block |
||
135 | 135 | // -- mobiles styles ------------------------------------------- |
136 | 136 | // ------------------------------------------------------------- |
137 | 137 | $html .= $this->getCssComment('--- MOBILE STYLES ---', ' '); |
138 | - $html .= ' @media only screen and (max-width: '. strval($this->emailBodyWidth - 20) . 'px) {'.PHP_EOL; |
|
138 | + $html .= ' @media only screen and (max-width: ' . strval($this->emailBodyWidth - 20) . 'px) {' . PHP_EOL; |
|
139 | 139 | $html .= PHP_EOL; |
140 | 140 | |
141 | 141 | // -- client specific styles ------------------------------------------- |
142 | 142 | $html .= $this->getCssComment('--- CLIENT-SPECIFIC STYLES ---', ' '); |
143 | - $html .= ' body{width:100% !important; min-width:100% !important;}'. $this->getCssComment(' Force iOS Mail to render the email at full width.'); |
|
143 | + $html .= ' body{width:100% !important; min-width:100% !important;}' . $this->getCssComment(' Force iOS Mail to render the email at full width.'); |
|
144 | 144 | $html .= PHP_EOL; |
145 | 145 | |
146 | 146 | //todo |
147 | 147 | $html .= $this->getCssComment('--- FRAMEWORK STYLES ---', ' '); |
148 | - $html .= ' table[id="emailHeader"],'.PHP_EOL; |
|
149 | - $html .= ' table[id="emailBody"],'.PHP_EOL; |
|
150 | - $html .= ' table[id="emailFooter"],'.PHP_EOL; |
|
151 | - $html .= ' table[class="flexibleContainer"],'.PHP_EOL; |
|
152 | - $html .= ' td[class="flexibleContainerCell"] {width:100% !important;}'.PHP_EOL; |
|
153 | - $html .= ' td[class="flexibleContainerBox"], '.PHP_EOL; |
|
154 | - $html .= ' td[class="flexibleContainerBox"] table {display: block;width: 100%;text-align: left;}'.PHP_EOL; |
|
148 | + $html .= ' table[id="emailHeader"],' . PHP_EOL; |
|
149 | + $html .= ' table[id="emailBody"],' . PHP_EOL; |
|
150 | + $html .= ' table[id="emailFooter"],' . PHP_EOL; |
|
151 | + $html .= ' table[class="flexibleContainer"],' . PHP_EOL; |
|
152 | + $html .= ' td[class="flexibleContainerCell"] {width:100% !important;}' . PHP_EOL; |
|
153 | + $html .= ' td[class="flexibleContainerBox"], ' . PHP_EOL; |
|
154 | + $html .= ' td[class="flexibleContainerBox"] table {display: block;width: 100%;text-align: left;}' . PHP_EOL; |
|
155 | 155 | |
156 | 156 | //todo |
157 | 157 | |
158 | 158 | $html .= $this->getCssComment('The following style rule makes any image classed with \'flexibleImage\'fluid' . PHP_EOL |
159 | - . ' when the query activates. Make sure you add an inline max-width to those '. PHP_EOL |
|
159 | + . ' when the query activates. Make sure you add an inline max-width to those ' . PHP_EOL |
|
160 | 160 | . ' to prevent them from blowing out.', ' '); |
161 | 161 | |
162 | - $html .= ' td[class="imageContent"] img {height:auto !important; width:100% !important; max-width:100% !important; }'. PHP_EOL; |
|
163 | - $html .= ' img[class="flexibleImage"]{height:auto !important; width:100% !important;max-width:100% !important;}'. PHP_EOL; |
|
164 | - $html .= ' img[class="flexibleImageSmall"]{height:auto !important; width:auto !important;}'. PHP_EOL; |
|
162 | + $html .= ' td[class="imageContent"] img {height:auto !important; width:100% !important; max-width:100% !important; }' . PHP_EOL; |
|
163 | + $html .= ' img[class="flexibleImage"]{height:auto !important; width:100% !important;max-width:100% !important;}' . PHP_EOL; |
|
164 | + $html .= ' img[class="flexibleImageSmall"]{height:auto !important; width:auto !important;}' . PHP_EOL; |
|
165 | 165 | |
166 | 166 | $html .= $this->getCssComment('Create top space for every second element in a block', ' '); |
167 | - $html .= ' table[class="flexibleContainerBoxNext"]{padding-top: 10px !important;}'. PHP_EOL; |
|
167 | + $html .= ' table[class="flexibleContainerBoxNext"]{padding-top: 10px !important;}' . PHP_EOL; |
|
168 | 168 | |
169 | 169 | $html .= $this->getCssComment('Make buttons in the email span the full width of their container, allowing' |
170 | 170 | . 'for left- or right-handed ease of use.', ' '); |
171 | 171 | |
172 | - $html .= ' table[class="emailButton"]{width:100% !important;}'. PHP_EOL; |
|
173 | - $html .= ' td[class="buttonContent"]{padding:0 !important;}'. PHP_EOL; |
|
174 | - $html .= ' td[class="buttonContent"] a{padding:15px !important;}'. PHP_EOL; |
|
175 | - $html .= ' }'.PHP_EOL; |
|
172 | + $html .= ' table[class="emailButton"]{width:100% !important;}' . PHP_EOL; |
|
173 | + $html .= ' td[class="buttonContent"]{padding:0 !important;}' . PHP_EOL; |
|
174 | + $html .= ' td[class="buttonContent"] a{padding:15px !important;}' . PHP_EOL; |
|
175 | + $html .= ' }' . PHP_EOL; |
|
176 | 176 | |
177 | 177 | //todo more ... |
178 | 178 | |
179 | 179 | // close style tag |
180 | - $html .= ' </style>'.PHP_EOL; |
|
180 | + $html .= ' </style>' . PHP_EOL; |
|
181 | 181 | |
182 | 182 | // ------- conditional formatting for outlook -------------------- |
183 | 183 | $html .= $this->getHtmlComment('Outlook Conditional CSS. ' . PHP_EOL |
@@ -185,18 +185,18 @@ discard block |
||
185 | 185 | . ' columns into a single vertical stack as on mobile clients. This is' . PHP_EOL |
186 | 186 | . ' primarily done to avoid the \'page break bug\' and is optional.' . PHP_EOL |
187 | 187 | . ' More information here: https://templates.mailchimp.com/development/css/outlook-conditional-css' . PHP_EOL |
188 | - . ' ',' '); |
|
189 | - |
|
190 | - $html .= ' <!--[if mso 12]>'.PHP_EOL; |
|
191 | - $html .= ' <style type="text/css">'.PHP_EOL; |
|
192 | - $html .= ' .flexibleContainer{display:block !important; width:100% !important;}'.PHP_EOL; |
|
193 | - $html .= ' </style>'.PHP_EOL; |
|
194 | - $html .= ' <![endif]-->'.PHP_EOL; |
|
195 | - $html .= ' <!--[if mso 14]>'.PHP_EOL; |
|
196 | - $html .= ' <style type="text/css">'.PHP_EOL; |
|
197 | - $html .= ' .flexibleContainer{display:block !important; width:100% !important;}'.PHP_EOL; |
|
198 | - $html .= ' </style>'.PHP_EOL; |
|
199 | - $html .= ' <![endif]-->'.PHP_EOL; |
|
188 | + . ' ', ' '); |
|
189 | + |
|
190 | + $html .= ' <!--[if mso 12]>' . PHP_EOL; |
|
191 | + $html .= ' <style type="text/css">' . PHP_EOL; |
|
192 | + $html .= ' .flexibleContainer{display:block !important; width:100% !important;}' . PHP_EOL; |
|
193 | + $html .= ' </style>' . PHP_EOL; |
|
194 | + $html .= ' <![endif]-->' . PHP_EOL; |
|
195 | + $html .= ' <!--[if mso 14]>' . PHP_EOL; |
|
196 | + $html .= ' <style type="text/css">' . PHP_EOL; |
|
197 | + $html .= ' .flexibleContainer{display:block !important; width:100% !important;}' . PHP_EOL; |
|
198 | + $html .= ' </style>' . PHP_EOL; |
|
199 | + $html .= ' <![endif]-->' . PHP_EOL; |
|
200 | 200 | |
201 | 201 | // done |
202 | 202 | return $html; |
@@ -80,15 +80,15 @@ |
||
80 | 80 | public function getHtml(string $indent) |
81 | 81 | { |
82 | 82 | // html result. start with an empty string or a html comment |
83 | - $html = $this->getBuilder()->getHtmlComment('BLOCK', $indent); |
|
83 | + $html = $this->getBuilder()->getHtmlComment('BLOCK', $indent); |
|
84 | 84 | |
85 | 85 | // render child elements collection |
86 | - foreach ($this->elements() as $element){ |
|
86 | + foreach ($this->elements() as $element) { |
|
87 | 87 | $html .= PHP_EOL . $element->getHtml($indent); |
88 | 88 | } |
89 | 89 | |
90 | 90 | // ending comment |
91 | - $html .= $this->getBuilder()->getHtmlComment('END BLOCK', $indent); |
|
91 | + $html .= $this->getBuilder()->getHtmlComment('END BLOCK', $indent); |
|
92 | 92 | |
93 | 93 | // return the build html |
94 | 94 | return $html; |