SendGrid - Version 1.3

Version Description

  • Added support for Wordpress 3.8, fixed visual issues for Wordpress 3.7

=

Download this release

Release Info

Developer team-rs
Plugin Icon 128x128 SendGrid
Version 1.3
Comparing to
See all releases

Code changes from version 1.2 to 1.3

lib/SendGridSettings.php CHANGED
@@ -1,154 +1,154 @@
1
- <?php
2
- class wpSendGridSettings
3
- {
4
- public function __construct()
5
- {
6
- add_action('admin_menu', array(__CLASS__, 'sendgridPluginMenu'));
7
- }
8
-
9
- /**
10
- * Add settings page
11
- */
12
- public function sendgridPluginMenu()
13
- {
14
- add_options_page(__('SendGrid'), __('SendGrid'), 'manage_options', 'sendgrid-settings.php',
15
- array(__CLASS__, 'show_settings_page'));
16
- }
17
-
18
- /**
19
- * Check username/password
20
- *
21
- * @param string $username sendgrid username
22
- * @param string $password sendgrid password
23
- * @return bool
24
- */
25
- public static function checkUsernamePassword($username, $password)
26
- {
27
- $url = "https://sendgrid.com/api/profile.get.json?";
28
- $url .= "api_user=". $username . "&api_key=" . $password;
29
-
30
- $ch = curl_init();
31
- curl_setopt($ch, CURLOPT_URL, $url);
32
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
33
-
34
- $data = curl_exec($ch);
35
- curl_close($ch);
36
-
37
- $response = json_decode($data, true);
38
-
39
- if (isset($response['error']))
40
- {
41
- return false;
42
- }
43
-
44
- return true;
45
- }
46
-
47
- /**
48
- * Display settings page
49
- */
50
- public function show_settings_page()
51
- {
52
- if ($_SERVER['REQUEST_METHOD'] == 'POST')
53
- {
54
- if ($_POST['email_test'])
55
- {
56
- $to = $_POST['sendgrid_to'];
57
- $subject = $_POST['sendgrid_subj'];
58
- $body = $_POST['sendgrid_body'];
59
- $headers = $_POST['sendgrid_headers'];
60
- $sent = wp_mail($to, $subject, $body, $headers);
61
- if (get_option('sendgrid_api') == 'api')
62
- {
63
- $sent = json_decode($sent);
64
- if ($sent->message == "success")
65
- {
66
- $message = 'Email sent.';
67
- $status = 'send-success';
68
- }
69
- else
70
- {
71
- $errors = ($sent->errors[0]) ? $sent->errors[0] : $sent;
72
- $message = 'Email not sent. ' . $errors;
73
- $status = 'send-failed';
74
- }
75
-
76
- }
77
- elseif (get_option('sendgrid_api') == 'smtp')
78
- {
79
- if ($sent === true)
80
- {
81
- $message = 'Email sent.';
82
- $status = 'send-success';
83
- }
84
- else
85
- {
86
- $message = 'Email not sent. ' . $sent;
87
- $status = 'send-failed';
88
- }
89
- }
90
- }
91
- else
92
- {
93
- $message = 'Options saved.';
94
- $status = 'save-success';
95
-
96
- $user = $_POST['sendgrid_user'];
97
- update_option('sendgrid_user', $user);
98
-
99
- $password = $_POST['sendgrid_pwd'];
100
- update_option('sendgrid_pwd', $password);
101
-
102
- $method = $_POST['sendgrid_api'];
103
- if ($method == 'smtp' and !class_exists('Swift'))
104
- {
105
- $message = 'You must have <a href="http://wordpress.org/plugins/swift-mailer/" target="_blank">' .
106
- 'Swift-mailer plugin</a> installed and activated';
107
- $status = 'save-error';
108
- update_option('sendgrid_api', 'api');
109
- }
110
- else
111
- {
112
- update_option('sendgrid_api', $method);
113
- }
114
-
115
- $name = $_POST['sendgrid_name'];
116
- update_option('sendgrid_from_name', $name);
117
-
118
- $email = $_POST['sendgrid_email'];
119
- update_option('sendgrid_from_email', $email);
120
-
121
- $reply_to = $_POST['sendgrid_reply_to'];
122
- update_option('sendgrid_reply_to', $reply_to);
123
- }
124
- }
125
-
126
- $user = get_option('sendgrid_user');
127
- $password = get_option('sendgrid_pwd');
128
- $method = get_option('sendgrid_api');
129
- $name = get_option('sendgrid_from_name');
130
- $email = get_option('sendgrid_from_email');
131
- $reply_to = get_option('sendgrid_reply_to');
132
-
133
- if ($user and $password)
134
- {
135
- if (in_array('curl', get_loaded_extensions()))
136
- {
137
- $valid_credentials = self::checkUsernamePassword($user, $password);
138
-
139
- if (!$valid_credentials)
140
- {
141
- $message = 'Invalid username/password';
142
- $status = 'save-error';
143
- }
144
- }
145
- else
146
- {
147
- $message = 'You must have PHP-curl extension enabled';
148
- $status = 'save-error';
149
- }
150
- }
151
-
152
- require_once dirname(__FILE__) . '/../view/sendgrid_settings.php';
153
- }
154
  }
1
+ <?php
2
+ class wpSendGridSettings
3
+ {
4
+ public function __construct()
5
+ {
6
+ add_action('admin_menu', array(__CLASS__, 'sendgridPluginMenu'));
7
+ }
8
+
9
+ /**
10
+ * Add settings page
11
+ */
12
+ public function sendgridPluginMenu()
13
+ {
14
+ add_options_page(__('SendGrid'), __('SendGrid'), 'manage_options', 'sendgrid-settings.php',
15
+ array(__CLASS__, 'show_settings_page'));
16
+ }
17
+
18
+ /**
19
+ * Check username/password
20
+ *
21
+ * @param string $username sendgrid username
22
+ * @param string $password sendgrid password
23
+ * @return bool
24
+ */
25
+ public static function checkUsernamePassword($username, $password)
26
+ {
27
+ $url = "https://sendgrid.com/api/profile.get.json?";
28
+ $url .= "api_user=". $username . "&api_key=" . $password;
29
+
30
+ $ch = curl_init();
31
+ curl_setopt($ch, CURLOPT_URL, $url);
32
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
33
+
34
+ $data = curl_exec($ch);
35
+ curl_close($ch);
36
+
37
+ $response = json_decode($data, true);
38
+
39
+ if (isset($response['error']))
40
+ {
41
+ return false;
42
+ }
43
+
44
+ return true;
45
+ }
46
+
47
+ /**
48
+ * Display settings page
49
+ */
50
+ public function show_settings_page()
51
+ {
52
+ if ($_SERVER['REQUEST_METHOD'] == 'POST')
53
+ {
54
+ if (isset($_POST['email_test']) and $_POST['email_test'])
55
+ {
56
+ $to = $_POST['sendgrid_to'];
57
+ $subject = $_POST['sendgrid_subj'];
58
+ $body = $_POST['sendgrid_body'];
59
+ $headers = $_POST['sendgrid_headers'];
60
+ $sent = wp_mail($to, $subject, $body, $headers);
61
+ if (get_option('sendgrid_api') == 'api')
62
+ {
63
+ $sent = json_decode($sent);
64
+ if ($sent->message == "success")
65
+ {
66
+ $message = 'Email sent.';
67
+ $status = 'updated';
68
+ }
69
+ else
70
+ {
71
+ $errors = ($sent->errors[0]) ? $sent->errors[0] : $sent;
72
+ $message = 'Email not sent. ' . $errors;
73
+ $status = 'error';
74
+ }
75
+
76
+ }
77
+ elseif (get_option('sendgrid_api') == 'smtp')
78
+ {
79
+ if ($sent === true)
80
+ {
81
+ $message = 'Email sent.';
82
+ $status = 'updated';
83
+ }
84
+ else
85
+ {
86
+ $message = 'Email not sent. ' . $sent;
87
+ $status = 'error';
88
+ }
89
+ }
90
+ }
91
+ else
92
+ {
93
+ $message = 'Options saved.';
94
+ $status = 'updated';
95
+
96
+ $user = $_POST['sendgrid_user'];
97
+ update_option('sendgrid_user', $user);
98
+
99
+ $password = $_POST['sendgrid_pwd'];
100
+ update_option('sendgrid_pwd', $password);
101
+
102
+ $method = $_POST['sendgrid_api'];
103
+ if ($method == 'smtp' and !class_exists('Swift'))
104
+ {
105
+ $message = 'You must have <a href="http://wordpress.org/plugins/swift-mailer/" target="_blank">' .
106
+ 'Swift-mailer plugin</a> installed and activated';
107
+ $status = 'error';
108
+ update_option('sendgrid_api', 'api');
109
+ }
110
+ else
111
+ {
112
+ update_option('sendgrid_api', $method);
113
+ }
114
+
115
+ $name = $_POST['sendgrid_name'];
116
+ update_option('sendgrid_from_name', $name);
117
+
118
+ $email = $_POST['sendgrid_email'];
119
+ update_option('sendgrid_from_email', $email);
120
+
121
+ $reply_to = $_POST['sendgrid_reply_to'];
122
+ update_option('sendgrid_reply_to', $reply_to);
123
+ }
124
+ }
125
+
126
+ $user = get_option('sendgrid_user');
127
+ $password = get_option('sendgrid_pwd');
128
+ $method = get_option('sendgrid_api');
129
+ $name = get_option('sendgrid_from_name');
130
+ $email = get_option('sendgrid_from_email');
131
+ $reply_to = get_option('sendgrid_reply_to');
132
+
133
+ if ($user and $password)
134
+ {
135
+ if (in_array('curl', get_loaded_extensions()))
136
+ {
137
+ $valid_credentials = self::checkUsernamePassword($user, $password);
138
+
139
+ if (!$valid_credentials)
140
+ {
141
+ $message = 'Invalid username/password';
142
+ $status = 'error';
143
+ }
144
+ }
145
+ else
146
+ {
147
+ $message = 'You must have PHP-curl extension enabled';
148
+ $status = 'error';
149
+ }
150
+ }
151
+
152
+ require_once dirname(__FILE__) . '/../view/sendgrid_settings.php';
153
+ }
154
  }
lib/SendGridStats.php CHANGED
@@ -12,7 +12,7 @@
12
  function my_custom_dashboard_widgets()
13
  {
14
  $sendgridSettings = new wpSendGridSettings();
15
- if (!$sendgridSettings->checkUsernamePassword(get_option('sendgrid_user'),get_option('sendgrid_pwd')))
16
  {
17
  return;
18
  }
@@ -38,6 +38,12 @@ function sendgrid_dashboard_statistics()
38
  */
39
  function add_dashboard_menu()
40
  {
 
 
 
 
 
 
41
  add_dashboard_page( "SendGrid Statistics", "SendGrid Statistics", "manage_options", "sendgrid-statistics", "sendgrid_statistics_page");
42
  }
43
  add_action('admin_menu', 'add_dashboard_menu');
12
  function my_custom_dashboard_widgets()
13
  {
14
  $sendgridSettings = new wpSendGridSettings();
15
+ if (!$sendgridSettings->checkUsernamePassword(get_option('sendgrid_user'), get_option('sendgrid_pwd')))
16
  {
17
  return;
18
  }
38
  */
39
  function add_dashboard_menu()
40
  {
41
+ $sendgridSettings = new wpSendGridSettings();
42
+ if (!$sendgridSettings->checkUsernamePassword(get_option('sendgrid_user'), get_option('sendgrid_pwd')))
43
+ {
44
+ return;
45
+ }
46
+
47
  add_dashboard_page( "SendGrid Statistics", "SendGrid Statistics", "manage_options", "sendgrid-statistics", "sendgrid_statistics_page");
48
  }
49
  add_action('admin_menu', 'add_dashboard_menu');
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: team-rs
3
  Donate link: http://sendgrid.com/
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 3.3
6
- Tested up to: 3.7
7
- Stable tag: 1.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -69,6 +69,8 @@ remove_filter('wp_mail_content_type', 'set_html_content_type');`
69
 
70
  == Installation ==
71
 
 
 
72
  To upload the SendGrid Plugin .ZIP file:
73
 
74
  1. Upload the WordPress SendGrid Plugin to the /wp-contents/plugins/ folder.
@@ -114,10 +116,16 @@ Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" tar
114
  * Fix missing argument warning message
115
  = 1.2 =
116
  * Added statistics for emails sent through wordpress plugin
 
 
 
 
117
 
118
  == Upgrade notice ==
119
 
120
  = 1.1 =
121
  * SendGrid Statistics can be used by selecting the time interval for which you want to see your statistics.
122
  = 1.2 =
123
- * Now you can switch between Sendgrid general statistics and Sendgrid wordpress statistics.
 
 
3
  Donate link: http://sendgrid.com/
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 3.3
6
+ Tested up to: 3.8
7
+ Stable tag: 1.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
69
 
70
  == Installation ==
71
 
72
+ Note: requires PHP version >= 5.3.0
73
+
74
  To upload the SendGrid Plugin .ZIP file:
75
 
76
  1. Upload the WordPress SendGrid Plugin to the /wp-contents/plugins/ folder.
116
  * Fix missing argument warning message
117
  = 1.2 =
118
  * Added statistics for emails sent through wordpress plugin
119
+ = 1.2.1 =
120
+ * Fix errors: set_html_content_type error, WP_DEBUG enabled notice, Reply-To header is overwritten by default option
121
+ = 1.3 =
122
+ * Added support for Wordpress 3.8, fixed visual issues for Wordpress 3.7
123
 
124
  == Upgrade notice ==
125
 
126
  = 1.1 =
127
  * SendGrid Statistics can be used by selecting the time interval for which you want to see your statistics.
128
  = 1.2 =
129
+ * Now you can switch between Sendgrid general statistics and Sendgrid wordpress statistics.
130
+ = 1.3 =
131
+ * Added support for Wordpress 3.8, fixed visual issues for Wordpress 3.7
view/css/sendgrid.css CHANGED
@@ -1,50 +1,28 @@
1
- root {
2
- display: block;
3
- }
4
-
5
- h2.title {
6
- text-align: center;
7
- }
8
-
9
- .stuffbox {
10
- margin: 10px;
11
- width: 740px;
12
- display: block;
13
- clear: both;
14
- }
15
 
16
- .stuffbox .button {
17
- margin-top: 10px;
 
 
 
18
  }
19
-
20
- .submit-button {
21
- width: 100%;
22
- text-align: center;
23
  }
24
 
25
- .stuffbox p {
26
- padding: 7px 7px 7px 7px;
27
- }
28
- .stuffbox input, select, textarea {
29
- width: 60%;
30
- padding: 5px 0 5px 0;
31
  }
32
 
33
- .stuffbox h3 {
34
- cursor: default !important;
35
- padding: 3px 3px 3px 10px;
36
  }
37
 
38
- .pull-left {
39
- float: left;
40
- }
41
- .pull-right {
42
- float: right;
43
  }
44
 
45
- .padding5 {
46
- padding: 10px 10px 10px 10px;
47
- }
48
  .clearfix:before, .clearfix:after {
49
  content: ".";
50
  display: block;
@@ -60,30 +38,6 @@ h2.title {
60
  zoom: 1; /* IE < 8 */
61
  }
62
 
63
- .send-failed, .save-error {
64
- text-align: center;
65
- padding: 7px 0 7px 0;
66
- background-color: #ffebe8;
67
- border-color: #c00;
68
- margin: 5px 0 15px;
69
- -webkit-border-radius: 3px;
70
- border-radius: 3px;
71
- border-width: 1px;
72
- border-style: solid;
73
- }
74
-
75
- .send-success, .save-success {
76
- text-align: center;
77
- padding: 7px 0 7px 0;
78
- background-color: #ffffe0;
79
- border-color: #e6db55;
80
- margin: 5px 0 15px;
81
- -webkit-border-radius: 3px;
82
- border-radius: 3px;
83
- border-width: 1px;
84
- border-style: solid;
85
- }
86
-
87
  .code {
88
  background-color: #F8F8F8;
89
  border: 1px solid #DDDDDD;
@@ -94,37 +48,63 @@ h2.title {
94
  padding: 6px 10px;
95
  }
96
 
97
- /* SendGrid stats */
98
- .pull-left.sendgrid-statistics-header {
99
- width: 50%;
100
- margin-bottom: 10px;
101
- }
102
-
103
- .pull-right.sendgrid-statistics-change-type #sendgrid-statistics-change-type {
104
- width: 150px;
105
- margin-top: 12px;
106
  }
107
 
 
 
 
108
  .sendgrid-filters-container {
109
  float:right;
110
- margin-right:2.4%;
 
111
  }
112
 
113
  .sendgrid-filters-container .loading {
114
  float: right;
115
  padding-top: 2px;
116
- margin-top: 4px;
117
  margin-right: 4px;
118
  }
119
 
120
- #sendgrid-filters {
 
 
 
 
121
  float: right;
122
  }
123
 
124
- #sendgrid-start-date, #sendgrid-end-date {
125
- width: 120px;
 
 
 
 
 
 
 
126
  }
127
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  .sendgrid-container {
129
  width: 100%;
130
  position: relative;
@@ -146,21 +126,31 @@ h2.title {
146
  }
147
 
148
  .sendgrid-container .widget {
149
- float:left;
150
  width: 189px;
151
  margin-top: 15px;
152
- margin-left: 15px;
153
  cursor: default;
154
  }
155
 
156
  .sendgrid-container .widget .widget-top {
157
  cursor: default;
 
 
 
 
 
158
  }
159
 
160
  .sendgrid-container .widget .widget-inside {
161
- display:block;
162
  text-align: center;
163
  min-height: 70px;
 
 
 
 
 
 
164
  }
165
 
166
  .sendgrid-container .widget .widget-inside h2 {
@@ -193,6 +183,8 @@ h2.title {
193
 
194
  .sendgrid-container .widget.others .widget-title h4 {
195
  line-height: 15px;
 
 
196
  }
197
 
198
  .sendgrid-container .widget.others .row {
@@ -244,6 +236,142 @@ h2.title {
244
  background: url("../images/logo32.png") no-repeat;
245
  }
246
 
247
- #ui-datepicker-div {
248
- display: none;
249
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* SendGrid stats */
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ /*
4
+ Helpers
5
+ */
6
+ .pull-left {
7
+ float: left;
8
  }
9
+ .pull-right {
10
+ float: right;
 
 
11
  }
12
 
13
+ .pull-left.sendgrid-statistics-header {
14
+ width: 50%;
15
+ margin-bottom: 10px;
 
 
 
16
  }
17
 
18
+ .pull-right.sendgrid-statistics-change-type #sendgrid-statistics-change-type {
19
+ margin-top: 12px;
 
20
  }
21
 
22
+ .clearfix-clear {
23
+ clear: both;
 
 
 
24
  }
25
 
 
 
 
26
  .clearfix:before, .clearfix:after {
27
  content: ".";
28
  display: block;
38
  zoom: 1; /* IE < 8 */
39
  }
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  .code {
42
  background-color: #F8F8F8;
43
  border: 1px solid #DDDDDD;
48
  padding: 6px 10px;
49
  }
50
 
51
+ .full-width {
52
+ width: 100%;
53
+ margin: 0px!important;
 
 
 
 
 
 
54
  }
55
 
56
+ /*
57
+ Filters
58
+ */
59
  .sendgrid-filters-container {
60
  float:right;
61
+ margin-right: 2.4%;
62
+ margin-left: 2.3%;
63
  }
64
 
65
  .sendgrid-filters-container .loading {
66
  float: right;
67
  padding-top: 2px;
68
+ margin-top: 6px;
69
  margin-right: 4px;
70
  }
71
 
72
+ .wordpress-new.sendgrid-filters-container .loading {
73
+ margin-top: 9px;
74
+ }
75
+
76
+ .sendgrid-filters {
77
  float: right;
78
  }
79
 
80
+ .sendgrid-filters label {
81
+ display: inline-block;
82
+ height: 18px;
83
+ width: 60px;
84
+ margin-left: 5px;
85
+ }
86
+
87
+ .wordpress-new.sendgrid-filters-container label {
88
+ height: 24px;
89
  }
90
 
91
+ .sendgrid-filters #sendgrid-start-date, .sendgrid-filters #sendgrid-end-date {
92
+ width: 86px;
93
+ margin-top: 5px;
94
+ }
95
+
96
+ .sendgrid-filters a.button {
97
+ margin-left: 2px;
98
+ margin-top: 5px;
99
+ }
100
+
101
+ #ui-datepicker-div {
102
+ display: none;
103
+ }
104
+
105
+ /*
106
+ Statistics
107
+ */
108
  .sendgrid-container {
109
  width: 100%;
110
  position: relative;
126
  }
127
 
128
  .sendgrid-container .widget {
129
+ float: left;
130
  width: 189px;
131
  margin-top: 15px;
 
132
  cursor: default;
133
  }
134
 
135
  .sendgrid-container .widget .widget-top {
136
  cursor: default;
137
+ height: auto;
138
+ }
139
+
140
+ .sendgrid-container .widget .widget-top .widget-title {
141
+ padding: 0px;
142
  }
143
 
144
  .sendgrid-container .widget .widget-inside {
145
+ display: block;
146
  text-align: center;
147
  min-height: 70px;
148
+ border-top: none!important;
149
+ padding: 10px;
150
+ }
151
+
152
+ .wordpress-new.sendgrid-container .widget .widget-inside {
153
+ min-height: 78px;
154
  }
155
 
156
  .sendgrid-container .widget .widget-inside h2 {
183
 
184
  .sendgrid-container .widget.others .widget-title h4 {
185
  line-height: 15px;
186
+ margin: 0!important;
187
+ padding: 10px!important;
188
  }
189
 
190
  .sendgrid-container .widget.others .row {
236
  background: url("../images/logo32.png") no-repeat;
237
  }
238
 
239
+ /*
240
+ Responsive
241
+ */
242
+ @media (min-width: 1500px) {
243
+ .columns-4 .sendgrid-container .widget.others {
244
+ width: 46%;
245
+ }
246
+
247
+ .wordpress-dashboard-new.sendgrid-container .widget.others {
248
+ width: 46.55%;
249
+ }
250
+
251
+ .columns-4 .sendgrid-container .widget.others:last-of-type,
252
+ .wordpress-dashboard-new.sendgrid-container .widget.others:last-of-type {
253
+ display: block;
254
+ padding: 0px;
255
+ margin-top: 0px;
256
+ margin-right: 2.3%;
257
+ margin-left: 2.3%;
258
+ width: 95.4%;
259
+ }
260
+ }
261
+
262
+ @media (min-width: 1000px) and (max-width: 1800px) {
263
+ .columns-3 .sendgrid-container .widget.others {
264
+ width: 46%;
265
+ }
266
+
267
+ .columns-3 .sendgrid-container .widget.others:last-of-type {
268
+ display: block;
269
+ padding: 0px;
270
+ margin-top: 0px;
271
+ margin-right: 2.3%;
272
+ margin-left: 2.3%;
273
+ width: 95.4%;
274
+ }
275
+ }
276
+
277
+ @media (min-width: 1360px) and (max-width: 1500px) {
278
+ .columns-4 .sendgrid-container .widget.others:first-of-type {
279
+ margin-top: 10px;
280
+ }
281
+
282
+ .columns-4 .sendgrid-container .widget.others {
283
+ display: block;
284
+ padding: 0px;
285
+ margin-top: 0px;
286
+ margin-right: 2.3%;
287
+ margin-left: 2.3%;
288
+ width: 95.4%;
289
+ }
290
+ }
291
+
292
+ @media (min-width: 1000px) and (max-width: 1360px) {
293
+ .columns-2 .sendgrid-container .widget.others,
294
+ .columns-4 .sendgrid-container .widget.others {
295
+ width: 46%;
296
+ }
297
+
298
+ .wordpress-dashboard-new.sendgrid-container .widget.others {
299
+ width: 46.55%;
300
+ }
301
+
302
+ .columns-2 .sendgrid-container .widget.others:last-of-type,
303
+ .columns-4 .sendgrid-container .widget.others:last-of-type,
304
+ .wordpress-dashboard-new.sendgrid-container .widget.others:last-of-type {
305
+ display: block;
306
+ padding: 0px;
307
+ margin-top: 0px;
308
+ margin-right: 2.3%;
309
+ margin-left: 2.3%;
310
+ width: 95.4%;
311
+ }
312
+ }
313
+
314
+ @media (min-width: 800px) and (max-width: 1000px) {
315
+ .columns-2 .sendgrid-container .widget.others:first-of-type,
316
+ .columns-3 .sendgrid-container .widget.others:first-of-type,
317
+ .columns-4 .sendgrid-container .widget.others:first-of-type,
318
+ .wordpress-dashboard-new.sendgrid-container .widget.others:first-of-type {
319
+ margin-top: 10px;
320
+ }
321
+
322
+ .columns-2 .sendgrid-container .widget.others,
323
+ .columns-3 .sendgrid-container .widget.others,
324
+ .columns-4 .sendgrid-container .widget.others,
325
+ .wordpress-dashboard-new.sendgrid-container .widget.others {
326
+ display: block;
327
+ padding: 0px;
328
+ margin-top: 0px;
329
+ margin-right: 2.3%;
330
+ margin-left: 2.3%;
331
+ width: 95.4%;
332
+ }
333
+ }
334
+
335
+ @media (min-width: 560px) and (max-width: 782px) {
336
+ .sendgrid-filters #sendgrid-start-date,
337
+ .sendgrid-filters #sendgrid-end-date {
338
+ width: 110px;
339
+ }
340
+
341
+ .sendgrid-container .widget.others {
342
+ width: 46%;
343
+ }
344
+
345
+ .wordpress-new.sendgrid-container .widget.others {
346
+ width: 46.5%;
347
+ }
348
+
349
+ .sendgrid-container .widget.others:last-of-type {
350
+ display: block;
351
+ padding: 0px;
352
+ margin-top: 0px;
353
+ margin-right: 2.3%;
354
+ margin-left: 2.3%;
355
+ width: 95.4%;
356
+ }
357
+ }
358
+
359
+ @media (max-width: 559px) {
360
+ .sendgrid-filters #sendgrid-start-date,
361
+ .sendgrid-filters #sendgrid-end-date {
362
+ width: 110px;
363
+ }
364
+
365
+ .sendgrid-container .widget.others:first-of-type {
366
+ margin-top: 10px;
367
+ }
368
+
369
+ .sendgrid-container .widget.others {
370
+ display: block;
371
+ padding: 0px;
372
+ margin-top: 0px;
373
+ margin-right: 2.3%;
374
+ margin-left: 2.3%;
375
+ width: 95.4%;
376
+ }
377
+ }
view/partials/sendgrid_stats_compliance.php CHANGED
@@ -1,4 +1,4 @@
1
- <div id="sendgrid_statistics_compliance_widget" class="postbox ">
2
  <h3 class="hndle"><span>SendGrid Compliance</span></h3>
3
  <div class="inside">
4
 
1
+ <div id="sendgrid-statistics-compliance-widget" class="postbox">
2
  <h3 class="hndle"><span>SendGrid Compliance</span></h3>
3
  <div class="inside">
4
 
view/partials/sendgrid_stats_deliveries.php CHANGED
@@ -1,4 +1,4 @@
1
- <div id="sendgrid_statistics_deliveries_widget" class="postbox ">
2
  <h3 class="hndle"><span>SendGrid Deliveries</span></h3>
3
  <div class="inside">
4
 
1
+ <div id="sendgrid_statistics_deliveries_widget" class="postbox">
2
  <h3 class="hndle"><span>SendGrid Deliveries</span></h3>
3
  <div class="inside">
4
 
view/partials/sendgrid_stats_engagement.php CHANGED
@@ -1,4 +1,4 @@
1
- <div id="sendgrid_statistics_engagement_widget" class="postbox ">
2
  <h3 class="hndle"><span>SendGrid Engagement</span></h3>
3
  <div class="inside">
4
 
1
+ <div id="sendgrid_statistics_engagement_widget" class="postbox">
2
  <h3 class="hndle"><span>SendGrid Engagement</span></h3>
3
  <div class="inside">
4
 
view/partials/sendgrid_stats_widget.php CHANGED
@@ -1,15 +1,22 @@
1
- <div class="sendgrid-filters-container">
2
- <div id="sendgrid-filters">
3
  <input type="hidden" id="sendgrid-statistics-type" name="sendgrid-statistics-type" value="wordpress" />
4
- <label for="sendgrid-start-date">Start date</label><input type="text" id="sendgrid-start-date" name="sendgrid-start-date" />
5
- <label for="sendgrid-end-date">End date</label><input type="text" id="sendgrid-end-date" name="sendgrid-end-date" />
6
- <a href="#" id="sendgrid-apply-filter" data-filter="<?php if (mysql_real_escape_string($_GET['page']) == "sendgrid-statistics") { ?>sendgrid-statistics<?php } else { ?>dashboard<?php } ?>" class="button">Apply</a>
 
 
 
 
 
 
7
  </div>
8
  <div class="loading"><img src="<?= plugin_dir_url(__FILE__); ?>../images/loader.gif" style="width: 15px; height: 15px;" /></div>
9
  </div>
10
- <br style="clear:both;"/>
11
- <div class="sendgrid-container" style="position:relative;">
12
-
 
13
  <div class="widget others" id="deliveries">
14
  <div class="widget-top">
15
  <div class="widget-title"><h4>Deliveries</h4></div>
@@ -93,10 +100,10 @@
93
  </div>
94
  </div>
95
  </div>
96
- <br style="clear:both;"/>
97
 
98
- <?php if (mysql_real_escape_string($_GET['page']) != "sendgrid-statistics") { ?>
99
  <a href="index.php?page=sendgrid-statistics" class="more-statistics">See charts</a>
100
- <br style="clear:both;"/>
101
  <?php } ?>
102
  </div>
1
+ <div class="sendgrid-filters-container <?php echo (version_compare(get_bloginfo("version"), '3.7.10', '>') ? "wordpress-new" : ""); ?>">
2
+ <div class="sendgrid-filters">
3
  <input type="hidden" id="sendgrid-statistics-type" name="sendgrid-statistics-type" value="wordpress" />
4
+ <div class="pull-left">
5
+ <label for="sendgrid-start-date">Start date</label>
6
+ <input type="text" id="sendgrid-start-date" name="sendgrid_start_date" />
7
+ </div>
8
+ <div class="pull-left">
9
+ <label for="sendgrid-end-date">End date</label>
10
+ <input type="text" id="sendgrid-end-date" name="sendgrid_end_date" />
11
+ </div>
12
+ <a href="#" id="sendgrid-apply-filter" data-filter="<?php if (isset($_GET['page']) and mysql_real_escape_string($_GET['page']) == "sendgrid-statistics") { ?>sendgrid-statistics<?php } else { ?>dashboard<?php } ?>" class="button button-primary">Apply</a>
13
  </div>
14
  <div class="loading"><img src="<?= plugin_dir_url(__FILE__); ?>../images/loader.gif" style="width: 15px; height: 15px;" /></div>
15
  </div>
16
+ <br class="clearfix-clear"/>
17
+ <div class="sendgrid-container
18
+ <?php echo ((version_compare(get_bloginfo("version"), '3.7.10', '>') and !isset($_GET['page'])) ? "wordpress-dashboard-new" : ""); ?>
19
+ <?php echo (version_compare(get_bloginfo("version"), '3.7.10', '>') ? "wordpress-new" : ""); ?>" style="position:relative;">
20
  <div class="widget others" id="deliveries">
21
  <div class="widget-top">
22
  <div class="widget-title"><h4>Deliveries</h4></div>
100
  </div>
101
  </div>
102
  </div>
103
+ <br class="clearfix-clear"/>
104
 
105
+ <?php if (!isset($_GET['page']) or mysql_real_escape_string($_GET['page']) != "sendgrid-statistics") { ?>
106
  <a href="index.php?page=sendgrid-statistics" class="more-statistics">See charts</a>
107
+ <br class="clearfix-clear"/>
108
  <?php } ?>
109
  </div>
view/sendgrid_settings.php CHANGED
@@ -1,148 +1,113 @@
1
- <link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'css/sendgrid.css'; ?>" type="text/css">
2
-
3
- <div class="wrap">
4
- <div class="stuffbox">
5
- <a href="http://sendgrid.com" target="_blank">
6
- <img src="<?php echo plugins_url('/images/logo.png', __FILE__) ?>" width="100" alt="" />
7
- </a>
8
- <h2 class="title"><?php echo _e('SendGrid Options') ?></h2>
9
- <?php if ($status == 'save-error' or $status == 'save-success'): ?>
10
- <div id="message" class="<?php echo $status ?>">
11
- <strong><?php echo $message ?></strong>
12
- </div>
13
- <?php endif; ?>
14
- <h3><?php echo _e('SendGrid credentials') ?></h3>
15
- <form class="form-table" name="sendgrid_form" method="POST" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>">
16
- <table class="form-table">
17
- <tr class="top">
18
- <th scope="row"><?php _e("Username: "); ?></th>
19
- <td>
20
- <div class="inside">
21
- <input type="text" required="true" name="sendgrid_user" value="<?php echo $user; ?>" size="20">
22
- </div>
23
- </td>
24
- </tr>
25
- <tr class="top">
26
- <th scope="row"><?php _e("Password: "); ?></th>
27
- <td>
28
- <div class="inside">
29
- <input type="password" required="true" name="sendgrid_pwd" value="<?php echo $password; ?>" size="20">
30
- </div>
31
- </td>
32
- </tr>
33
- <tr class="top">
34
- <th scope="row"><?php _e("Send Mail with: "); ?></th>
35
- <td>
36
- <div class="inside">
37
- <select name="sendgrid_api">
38
- <option value="api" id="api" <?php echo ($method == 'api') ? 'selected' : '' ?>><?php _e('API') ?></option>
39
- <option value="smtp" id="smtp" <?php echo ($method == 'smtp') ? 'selected' : '' ?>><?php _e('SMTP') ?></option>
40
- </select>
41
- </div>
42
- </td>
43
- </tr>
44
- </table>
45
- <br />
46
- <h3><?php _e('Mail settings') ?></h3>
47
- <table class="form-table">
48
- <tr class="top">
49
- <th scope="row"><?php _e("Name: "); ?></th>
50
- <td>
51
- <div class="inside">
52
- <?php _e('Name as it will appear in recipient clients.') ?>
53
- <br />
54
- <input type="text" name="sendgrid_name" value="<?php echo $name; ?>" size="20">
55
- </div>
56
- </td>
57
- </tr>
58
- <tr class="top">
59
- <th scope="row"><?php _e("Sending Address: "); ?></th>
60
- <td>
61
- <div class="inside">
62
- <?php _e('Email address from which message will be sent,') ?>
63
- <br />
64
- <input type="email" name="sendgrid_email" value="<?php echo $email; ?>" size="20">
65
- </div>
66
- </td>
67
- </tr>
68
- <tr class="top">
69
- <th scope="row"><?php _e("Reply Address: "); ?></th>
70
- <td>
71
- <div class="inside">
72
- <?php _e('Email address where replies will be returned.') ?>
73
- <br />
74
- <input type="email" name="sendgrid_reply_to" value="<?php echo $reply_to; ?>" size="20">
75
- <br />
76
- <span>
77
- <small>
78
- <em>
79
- <?php _e('Leave blank to use Sending Address.') ?>
80
- </em>
81
- </small>
82
- </span>
83
- </div>
84
- </td>
85
- </tr>
86
- </table>
87
- <div class="submit-button">
88
- <p class="submit">
89
- <input class="button button-primary" type="submit" name="Submit" value="<?php _e('Update Settings') ?>" />
90
- </p>
91
- </div>
92
- </form>
93
- </div>
94
- <br />
95
- <?php if ($valid_credentials): ?>
96
- <div class="stuffbox">
97
- <h2 class="title"><?php _e('SendGrid Test') ?></h2>
98
- <?php if ($status == 'send-failed' or $status == 'send-success'): ?>
99
- <div id="message" class="<?php echo $status ?>">
100
- <strong><?php echo $message ?></strong>
101
- </div>
102
- <?php endif; ?>
103
- <h3><?php _e('Send a test email with these settings') ?></h3>
104
- <form name="sendgrid_test" method="POST" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>">
105
- <table class="form-table">
106
- <tr class="top">
107
- <th scope="row"><?php _e("To: "); ?></th>
108
- <td>
109
- <div class="inside">
110
- <input type="email" name="sendgrid_to" required="true" value="<?php echo $success ? '' : $to; ?>" size="20">
111
- </div>
112
- </td>
113
- </tr>
114
- <tr class="top">
115
- <th scope="row"><?php _e("Subject: "); ?></th>
116
- <td>
117
- <div class="inside">
118
- <input type="text" name="sendgrid_subj" required="true" value="<?php echo $success ? '' : $subject; ?>" size="20">
119
- </div>
120
- </td>
121
- </tr>
122
- <tr class="top">
123
- <th scope="row"><?php _e("Body: "); ?></th>
124
- <td>
125
- <div class="inside">
126
- <textarea name="sendgrid_body" rows="5"><?php echo $success ? '' : $body; ?></textarea>
127
- </div>
128
- </td>
129
- </tr>
130
- <tr class="top">
131
- <th scope="row"><?php _e("Headers: "); ?></th>
132
- <td>
133
- <div class="inside">
134
- <textarea name="sendgrid_headers" rows="3"><?php echo $success ? '' : $headers; ?></textarea>
135
- </div>
136
- </td>
137
- </tr>
138
- </table>
139
- <input type="hidden" name="email_test" value="true"/>
140
- <div class="submit-button">
141
- <p class="submit">
142
- <input class="button button-primary" type="submit" name="Submit" value="<?php _e('Send') ?>" />
143
- </p>
144
- </div>
145
- </form>
146
- </div>
147
- <?php endif; ?>
148
- </div>
1
+ <link rel="stylesheet" href="<?php echo plugin_dir_url(__FILE__) . 'css/sendgrid.css'; ?>" type="text/css">
2
+
3
+ <div class="wrap">
4
+ <a href="http://sendgrid.com" target="_blank">
5
+ <img src="<?php echo plugins_url('/images/logo.png', __FILE__) ?>" width="100" alt="" />
6
+ </a>
7
+ <h2><?php echo _e('SendGrid Options') ?></h2>
8
+ <?php if (isset($status) and ($status == 'updated' or $status == 'error')): ?>
9
+ <div id="message" class="<?php echo $status ?>">
10
+ <p>
11
+ <strong><?php echo $message ?></strong>
12
+ </p>
13
+ </div>
14
+ <?php endif; ?>
15
+ <h3><?php echo _e('SendGrid credentials') ?></h3>
16
+ <form class="form-table" name="sendgrid_form" method="POST" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>">
17
+ <table class="form-table">
18
+ <tbody>
19
+ <tr valign="top">
20
+ <th scope="row"><?php _e("Username: "); ?></th>
21
+ <td>
22
+ <input type="text" required="true" name="sendgrid_user" value="<?php echo $user; ?>" size="20" class="regular-text">
23
+ </td>
24
+ </tr>
25
+ <tr valign="top">
26
+ <th scope="row"><?php _e("Password: "); ?></th>
27
+ <td>
28
+ <input type="password" required="true" name="sendgrid_pwd" value="<?php echo $password; ?>" size="20" class="regular-text">
29
+ </td>
30
+ </tr>
31
+ <tr valign="top">
32
+ <th scope="row"><?php _e("Send Mail with: "); ?></th>
33
+ <td>
34
+ <select name="sendgrid_api">
35
+ <option value="api" id="api" <?php echo ($method == 'api') ? 'selected' : '' ?>><?php _e('API') ?></option>
36
+ <option value="smtp" id="smtp" <?php echo ($method == 'smtp') ? 'selected' : '' ?>><?php _e('SMTP') ?></option>
37
+ </select>
38
+ </td>
39
+ </tr>
40
+ </tbody>
41
+ </table>
42
+ <br />
43
+ <h3><?php _e('Mail settings') ?></h3>
44
+ <table class="form-table">
45
+ <tbody>
46
+ <tr valign="top">
47
+ <th scope="row"><?php _e("Name: "); ?></th>
48
+ <td>
49
+ <input type="text" name="sendgrid_name" value="<?php echo $name; ?>" size="20" class="regular-text">
50
+ <p class="description"><?php _e('Name as it will appear in recipient clients.') ?></p>
51
+ </td>
52
+ </tr>
53
+ <tr valign="top">
54
+ <th scope="row"><?php _e("Sending Address: "); ?></th>
55
+ <td>
56
+ <input type="email" name="sendgrid_email" value="<?php echo $email; ?>" size="20" class="regular-text">
57
+ <p class="description"><?php _e('Email address from which the message will be sent,') ?></p>
58
+ </td>
59
+ </tr>
60
+ <tr valign="top">
61
+ <th scope="row"><?php _e("Reply Address: "); ?></th>
62
+ <td>
63
+ <input type="email" name="sendgrid_reply_to" value="<?php echo $reply_to; ?>" size="20" class="regular-text">
64
+ <span><small><em><?php _e('Leave blank to use Sending Address.') ?></em></small></span>
65
+ <p class="description"><?php _e('Email address where replies will be returned.') ?></p>
66
+ </td>
67
+ </tr>
68
+ </tbody>
69
+ </table>
70
+ <p class="submit">
71
+ <input class="button button-primary" type="submit" name="Submit" value="<?php _e('Update Settings') ?>" />
72
+ </p>
73
+ </form>
74
+ <br />
75
+ <?php if ($valid_credentials): ?>
76
+ <h2><?php _e('SendGrid Test') ?></h2>
77
+ <h3><?php _e('Send a test email with these settings') ?></h3>
78
+ <form name="sendgrid_test" method="POST" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>">
79
+ <table class="form-table">
80
+ <tbody>
81
+ <tr valign="top">
82
+ <th scope="row"><?php _e("To: "); ?></th>
83
+ <td>
84
+ <input type="email" name="sendgrid_to" required="true" value="<?php echo isset($success) ? '' : isset($to) ? $to : '' ; ?>" size="20" class="regular-text">
85
+ </td>
86
+ </tr>
87
+ <tr valign="top">
88
+ <th scope="row"><?php _e("Subject: "); ?></th>
89
+ <td>
90
+ <input type="text" name="sendgrid_subj" required="true" value="<?php echo isset($success) ? '' : isset($subject) ? $subject : '' ; ?>" size="20" class="regular-text">
91
+ </td>
92
+ </tr>
93
+ <tr valign="top">
94
+ <th scope="row"><?php _e("Body: "); ?></th>
95
+ <td>
96
+ <textarea name="sendgrid_body" rows="5" class="large-text"><?php echo isset($success) ? '' : isset($body) ? $body : '' ; ?></textarea>
97
+ </td>
98
+ </tr>
99
+ <tr valign="top">
100
+ <th scope="row"><?php _e("Headers: "); ?></th>
101
+ <td>
102
+ <textarea name="sendgrid_headers" rows="3" class="large-text"><?php echo isset($success) ? '' : isset($headers) ? $headers : ''; ?></textarea>
103
+ </td>
104
+ </tr>
105
+ </table>
106
+ </tbody>
107
+ <input type="hidden" name="email_test" value="true"/>
108
+ <p class="submit">
109
+ <input class="button button-primary" type="submit" name="Submit" value="<?php _e('Send') ?>" />
110
+ </p>
111
+ </form>
112
+ <?php endif; ?>
113
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
view/sendgrid_stats.php CHANGED
@@ -11,24 +11,21 @@
11
  </select>
12
  </div>
13
 
14
- <div id="dashboard-widgets-wrap">
15
  <div id="dashboard-widgets" class="metabox-holder columns-1">
16
- <div id="postbox-container-1" class="postbox-container">
17
- <div id="normal-sortables" class="meta-box-sortables">
18
-
19
- <div id="sendgrid_statistics_widget" class="postbox ">
20
- <h3 class="hndle"><span>SendGrid Statistics</span></h3>
21
- <div class="inside">
22
- <?php require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_widget.php'; ?>
23
- </div>
24
  </div>
25
-
26
- <?php
27
- require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_deliveries.php';
28
- require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_compliance.php';
29
- require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_engagement.php';
30
- ?>
31
  </div>
 
 
 
 
 
 
32
  </div>
33
  </div>
34
  </div>
11
  </select>
12
  </div>
13
 
14
+ <div id="dashboard-widgets-wrap" class="full-width">
15
  <div id="dashboard-widgets" class="metabox-holder columns-1">
16
+ <div class="postbox-container">
17
+ <div id="sendgrid_statistics_widget" class="postbox ">
18
+ <h3 class="hndle"><span>SendGrid Statistics</span></h3>
19
+ <div class="inside">
20
+ <?php require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_widget.php'; ?>
 
 
 
21
  </div>
 
 
 
 
 
 
22
  </div>
23
+
24
+ <?php
25
+ require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_deliveries.php';
26
+ require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_compliance.php';
27
+ require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_engagement.php';
28
+ ?>
29
  </div>
30
  </div>
31
  </div>
wpsendgrid.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
- Version: 1.2
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  License: GPLv2
@@ -15,9 +15,9 @@ require_once plugin_dir_path( __FILE__ ) . '/lib/sendgrid-php/SendGrid_loader.ph
15
 
16
  $sendgridSettings = new wpSendGridSettings();
17
  $plugin = plugin_basename(__FILE__);
18
- define(SENDGRID_CATEGORY, 'wp_sendgrid_plugin');
19
- define(SENDGRID_PLUGIN_SETTINGS, 'settings_page_sendgrid-settings');
20
- define(SENDGRID_PLUGIN_PAGE, 'dashboard_page_sendgrid-statistics');
21
 
22
  if (!function_exists('wp_mail'))
23
  {
@@ -89,6 +89,8 @@ if (!function_exists('wp_mail'))
89
  }
90
 
91
  // Headers
 
 
92
  if (empty($headers)) {
93
  $headers = array();
94
  } else {
@@ -100,8 +102,6 @@ if (!function_exists('wp_mail'))
100
  $tempheaders = $headers;
101
  }
102
  $headers = array();
103
- $cc = array();
104
- $bcc = array();
105
 
106
  // If it's actually got contents
107
  if ( !empty( $tempheaders ) ) {
@@ -165,6 +165,9 @@ if (!function_exists('wp_mail'))
165
  $bcc[$key] = trim($recipient);
166
  }
167
  break;
 
 
 
168
  default:
169
  // Add it to our grand headers array
170
  $headers[trim( $name )] = trim( $content );
@@ -282,9 +285,13 @@ if (!function_exists('wp_mail'))
282
  {
283
  $mail->setBccs($bcc);
284
  }
285
- $reply_to = trim(get_option('sendgrid_reply_to'));
286
- if ($reply_to)
 
 
 
287
  {
 
288
  $mail->setReplyTo($reply_to);
289
  }
290
  // add attachemnts
@@ -418,12 +425,15 @@ function showContextualHelp($contextual_help, $screen_id, $screen)
418
  }
419
  add_filter('contextual_help', 'showContextualHelp', 10, 3);
420
 
421
- /**
422
- * Return the content type used to send html emails
423
- *
424
- * return string Conteny-type needed to send HTML emails
425
- */
426
- function set_html_content_type()
427
  {
428
- return 'text/html';
 
 
 
 
 
 
 
 
429
  }
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
+ Version: 1.3
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  License: GPLv2
15
 
16
  $sendgridSettings = new wpSendGridSettings();
17
  $plugin = plugin_basename(__FILE__);
18
+ define('SENDGRID_CATEGORY', 'wp_sendgrid_plugin');
19
+ define('SENDGRID_PLUGIN_SETTINGS', 'settings_page_sendgrid-settings');
20
+ define('SENDGRID_PLUGIN_PAGE', 'dashboard_page_sendgrid-statistics');
21
 
22
  if (!function_exists('wp_mail'))
23
  {
89
  }
90
 
91
  // Headers
92
+ $cc = array();
93
+ $bcc = array();
94
  if (empty($headers)) {
95
  $headers = array();
96
  } else {
102
  $tempheaders = $headers;
103
  }
104
  $headers = array();
 
 
105
 
106
  // If it's actually got contents
107
  if ( !empty( $tempheaders ) ) {
165
  $bcc[$key] = trim($recipient);
166
  }
167
  break;
168
+ case 'reply-to':
169
+ $replyto = $content;
170
+ break;
171
  default:
172
  // Add it to our grand headers array
173
  $headers[trim( $name )] = trim( $content );
285
  {
286
  $mail->setBccs($bcc);
287
  }
288
+ if (isset($replyto))
289
+ {
290
+ $mail->setReplyTo($replyto);
291
+ }
292
+ else
293
  {
294
+ $reply_to = trim(get_option('sendgrid_reply_to'));
295
  $mail->setReplyTo($reply_to);
296
  }
297
  // add attachemnts
425
  }
426
  add_filter('contextual_help', 'showContextualHelp', 10, 3);
427
 
428
+ if (!function_exists('set_html_content_type'))
 
 
 
 
 
429
  {
430
+ /**
431
+ * Return the content type used to send html emails
432
+ *
433
+ * return string Conteny-type needed to send HTML emails
434
+ */
435
+ function set_html_content_type()
436
+ {
437
+ return 'text/html';
438
+ }
439
  }