1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* ____ _ _ _ _ |
5
|
|
|
* | _ \| |__ | |_ ___ _ __ ___ __ _(_) | |
6
|
|
|
* | |_) | '_ \| __/ _ \ '_ ` _ \ / _` | | | |
7
|
|
|
* | __/| | | | || __/ | | | | | (_| | | | |
8
|
|
|
* |_| |_| |_|\__\___|_| |_| |_|\__,_|_|_| |
9
|
|
|
* |
10
|
|
|
* This file is part of Kristuff\Phtemail. |
11
|
|
|
* |
12
|
|
|
* (c) Kristuff <[email protected]> |
13
|
|
|
* |
14
|
|
|
* For the full copyright and license information, please view the LICENSE |
15
|
|
|
* file that was distributed with this source code. |
16
|
|
|
* |
17
|
|
|
* @version 0.2.0 |
18
|
|
|
* @copyright 2017-2020 Kristuff |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace Kristuff\Phtemail\Core; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Allow to set container padding, removing top and/or bottom padding |
25
|
|
|
*/ |
26
|
|
|
trait ContainerPaddingTrait |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* The cell padding in pixels. Default is 30 pixels |
30
|
|
|
* |
31
|
|
|
* @access protected |
32
|
|
|
* @var int $cellPadding |
33
|
|
|
*/ |
34
|
|
|
protected $cellPadding = 30; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* True to remove top padding. Default is false |
38
|
|
|
* |
39
|
|
|
* @access protected |
40
|
|
|
* @var bool $removePaddingTop |
41
|
|
|
*/ |
42
|
|
|
protected $removePaddingTop = false; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* True to remove bottom padding. Default is false |
46
|
|
|
* |
47
|
|
|
* @access protected |
48
|
|
|
* @var bool $removePaddingTop |
49
|
|
|
*/ |
50
|
|
|
protected $removePaddingBottom = false; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Sets the container padding |
54
|
|
|
* |
55
|
|
|
* @access public |
56
|
|
|
* @param int $value The padding in pixels |
57
|
|
|
* |
58
|
|
|
* @return void |
59
|
|
|
*/ |
60
|
|
|
public function setPadding(int $value) |
61
|
|
|
{ |
62
|
|
|
$this->cellPadding = $value; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Remove container top padding |
67
|
|
|
* |
68
|
|
|
* @access public |
69
|
|
|
* |
70
|
|
|
* @return void |
71
|
|
|
*/ |
72
|
|
|
public function removePaddingTop() |
73
|
|
|
{ |
74
|
|
|
$this->removePaddingTop = true; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Remove container bottom padding |
79
|
|
|
* |
80
|
|
|
* @access public |
81
|
|
|
* |
82
|
|
|
* @return void |
83
|
|
|
*/ |
84
|
|
|
public function removePaddingBottom() |
85
|
|
|
{ |
86
|
|
|
$this->removePaddingBottom = true; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Gets html style for tr element when using removePadding |
91
|
|
|
* |
92
|
|
|
* @access public |
93
|
|
|
* |
94
|
|
|
* @return string The style string content |
95
|
|
|
*/ |
96
|
|
|
protected function getRowStyle() |
97
|
|
|
{ |
98
|
|
|
return ($this->removePaddingTop || $this->removePaddingBottom ) ? |
99
|
|
|
'style="'. |
100
|
|
|
($this->removePaddingTop ? 'padding-top:0;' : '') . |
101
|
|
|
($this->removePaddingBottom ? 'padding-bottom:0;' : ''). |
102
|
|
|
'"' : ''; |
103
|
|
|
} |
104
|
|
|
} |