1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Email Header |
4
|
|
|
* |
5
|
|
|
* @author WooThemes |
6
|
|
|
* @package Sensei/Templates/Emails |
7
|
|
|
* @version 1.6.0 |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
11
|
|
|
|
12
|
|
|
// Get data for email content |
13
|
|
|
global $sensei_email_data; |
14
|
|
|
extract( $sensei_email_data ); |
15
|
|
|
|
16
|
|
|
// Load colours |
17
|
|
|
$bg = '#f5f5f5'; |
18
|
|
View Code Duplication |
if( isset( Sensei()->settings->settings['email_background_color'] ) && '' != Sensei()->settings->settings['email_background_color'] ) { |
|
|
|
|
19
|
|
|
$bg = Sensei()->settings->settings['email_background_color']; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
$body = '#fdfdfd'; |
23
|
|
View Code Duplication |
if( isset( Sensei()->settings->settings['email_body_background_color'] ) && '' != Sensei()->settings->settings['email_body_background_color'] ) { |
|
|
|
|
24
|
|
|
$body = Sensei()->settings->settings['email_body_background_color']; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
$base = '#557da1'; |
28
|
|
View Code Duplication |
if( isset( Sensei()->settings->settings['email_base_color'] ) && '' != Sensei()->settings->settings['email_base_color'] ) { |
|
|
|
|
29
|
|
|
$base = Sensei()->settings->settings['email_base_color']; |
30
|
|
|
} |
31
|
|
|
$base_text = sensei_light_or_dark( $base, '#202020', '#ffffff' ); |
32
|
|
|
|
33
|
|
|
$text = '#505050'; |
34
|
|
View Code Duplication |
if( isset( Sensei()->settings->settings['email_text_color'] ) && '' != Sensei()->settings->settings['email_text_color'] ) { |
|
|
|
|
35
|
|
|
$text = Sensei()->settings->settings['email_text_color']; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
$bg_darker_10 = sensei_hex_darker( $bg, 10 ); |
39
|
|
|
$base_lighter_20 = sensei_hex_lighter( $base, 20 ); |
40
|
|
|
$text_lighter_20 = sensei_hex_lighter( $text, 20 ); |
41
|
|
|
|
42
|
|
|
// For gmail compatibility, including CSS styles in head/body are stripped out therefore styles need to be inline. These variables contain rules which are added to the template inline. !important; is a gmail hack to prevent styles being stripped if it doesn't like something. |
43
|
|
|
$wrapper = " |
44
|
|
|
background-color: " . esc_attr( $bg ) . "; |
45
|
|
|
width:100%; |
46
|
|
|
-webkit-text-size-adjust:none !important; |
47
|
|
|
margin:0; |
48
|
|
|
padding: 70px 0 70px 0; |
49
|
|
|
"; |
50
|
|
|
$template_container = " |
51
|
|
|
-webkit-box-shadow:0 0 0 3px rgba(0,0,0,0.025) !important; |
52
|
|
|
box-shadow:0 0 0 3px rgba(0,0,0,0.025) !important; |
53
|
|
|
-webkit-border-radius:6px !important; |
54
|
|
|
border-radius:6px !important; |
55
|
|
|
background-color: " . esc_attr( $body ) . "; |
56
|
|
|
border: 1px solid $bg_darker_10; |
57
|
|
|
-webkit-border-radius:6px !important; |
58
|
|
|
border-radius:6px !important; |
59
|
|
|
"; |
60
|
|
|
$template_header = " |
61
|
|
|
background-color: " . esc_attr( $base ) ."; |
62
|
|
|
color: $base_text; |
63
|
|
|
-webkit-border-top-left-radius:6px !important; |
64
|
|
|
-webkit-border-top-right-radius:6px !important; |
65
|
|
|
border-top-left-radius:6px !important; |
66
|
|
|
border-top-right-radius:6px !important; |
67
|
|
|
border-bottom: 0; |
68
|
|
|
font-family:Arial; |
69
|
|
|
font-weight:bold; |
70
|
|
|
line-height:100%; |
71
|
|
|
vertical-align:middle; |
72
|
|
|
"; |
73
|
|
|
$body_content = " |
74
|
|
|
background-color: " . esc_attr( $body ) . "; |
75
|
|
|
-webkit-border-radius:6px !important; |
76
|
|
|
border-radius:6px !important; |
77
|
|
|
"; |
78
|
|
|
$body_content_inner = " |
79
|
|
|
color: $text_lighter_20; |
80
|
|
|
font-family:Arial; |
81
|
|
|
font-size:14px; |
82
|
|
|
line-height:150%; |
83
|
|
|
text-align:left; |
84
|
|
|
"; |
85
|
|
|
$header_content_h1 = " |
86
|
|
|
color: " . esc_attr( $base_text ) . "; |
87
|
|
|
margin:0; |
88
|
|
|
padding: 28px 24px; |
89
|
|
|
text-shadow: 0 1px 0 $base_lighter_20; |
90
|
|
|
display:block; |
91
|
|
|
font-family:Arial; |
92
|
|
|
font-size:30px; |
93
|
|
|
font-weight:bold; |
94
|
|
|
text-align:left; |
95
|
|
|
line-height: 150%; |
96
|
|
|
"; |
97
|
|
|
?> |
98
|
|
|
<!DOCTYPE html> |
99
|
|
|
<html> |
100
|
|
|
<head> |
101
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
102
|
|
|
<title><?php echo get_bloginfo( 'name' ); ?></title> |
103
|
|
|
</head> |
104
|
|
|
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"> |
105
|
|
|
<div style="<?php echo $wrapper; ?>"> |
106
|
|
|
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%"> |
107
|
|
|
<tr> |
108
|
|
|
<td align="center" valign="top"> |
109
|
|
|
<?php |
110
|
|
|
if ( isset( Sensei()->settings->settings['email_header_image'] ) && '' != Sensei()->settings->settings['email_header_image'] ) { |
111
|
|
|
$img = Sensei()->settings->settings['email_header_image']; |
112
|
|
|
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name' ) . '" /></p>'; |
113
|
|
|
} |
114
|
|
|
?> |
115
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container" style="<?php echo $template_container; ?>"> |
116
|
|
|
<tr> |
117
|
|
|
<td align="center" valign="top"> |
118
|
|
|
<!-- Header --> |
119
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_header" style="<?php echo $template_header; ?>" bgcolor="<?php echo $base; ?>"> |
120
|
|
|
<tr> |
121
|
|
|
<td> |
122
|
|
|
<h1 style="<?php echo $header_content_h1; ?>"><?php echo $heading; ?></h1> |
123
|
|
|
|
124
|
|
|
</td> |
125
|
|
|
</tr> |
126
|
|
|
</table> |
127
|
|
|
<!-- End Header --> |
128
|
|
|
</td> |
129
|
|
|
</tr> |
130
|
|
|
<tr> |
131
|
|
|
<td align="center" valign="top"> |
132
|
|
|
<!-- Body --> |
133
|
|
|
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_body"> |
134
|
|
|
<tr> |
135
|
|
|
<td valign="top" style="<?php echo $body_content; ?>"> |
136
|
|
|
<!-- Content --> |
137
|
|
|
<table border="0" cellpadding="20" cellspacing="0" width="100%"> |
138
|
|
|
<tr> |
139
|
|
|
<td valign="top"> |
140
|
|
|
<div style="<?php echo $body_content_inner; ?>"> |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.