Post SMTP Mailer/Email Log - Version 2.0

Version Description

  • 2019-05-15
  • New: Mailer Type - Added an option to send without overwrite the 'wp_mail' function, better compability to WordPress delivery. hopefully will be the default in the future.
  • Updated: Sendgrid API was upgraded and rewritten to the new version.
  • Fixed: Message-Id header was missing on SMTP
  • Fixed: Email logger optimization - better query for large amount of records.
  • Fixed: The localization was fixed to match translate.wordpress.org translation system ( Thanks to Niels de Blaauw from Level-Level ).
  • Fixed: Code and optimization ( Thanks to Niels de Blaauw from Level-Level ).
Download this release

Release Info

Developer yehudah
Plugin Icon 128x128 Post SMTP Mailer/Email Log
Version 2.0
Comparing to
See all releases

Code changes from version 1.9.8 to 2.0

Files changed (62) hide show
  1. Postman/Phpmailer/PostsmtpMailer.php +122 -0
  2. Postman/Postman-Auth/PostmanAbstractAuthenticationManager.php +2 -2
  3. Postman/Postman-Configuration/PostmanConfigurationController.php +91 -82
  4. Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php +93 -72
  5. Postman/Postman-Configuration/PostmanSmtpDiscovery.php +7 -7
  6. Postman/Postman-Connectivity-Test/Postman-PortTest.php +2 -2
  7. Postman/Postman-Connectivity-Test/PostmanConnectivityTestController.php +29 -29
  8. Postman/Postman-Controller/PostmanAdminPointer.php +2 -2
  9. Postman/Postman-Controller/PostmanDashboardWidgetController.php +12 -12
  10. Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php +1 -1
  11. Postman/Postman-Controller/PostmanWelcomeController.php +35 -35
  12. Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php +14 -15
  13. Postman/Postman-Email-Log/PostmanEmailLogController.php +38 -36
  14. Postman/Postman-Email-Log/PostmanEmailLogPostType.php +2 -2
  15. Postman/Postman-Email-Log/PostmanEmailLogService.php +18 -18
  16. Postman/Postman-Email-Log/PostmanEmailLogView.php +18 -16
  17. Postman/Postman-Mail/PostmanDefaultModuleTransport.php +2 -2
  18. Postman/Postman-Mail/PostmanEmailAddress.php +2 -2
  19. Postman/Postman-Mail/PostmanGmailApiModuleTransport.php +5 -5
  20. Postman/Postman-Mail/PostmanGmailApiModuleZendMailTransport.php +2 -2
  21. Postman/Postman-Mail/PostmanMailgunMailEngine.php +2 -2
  22. Postman/Postman-Mail/PostmanMailgunTransport.php +21 -21
  23. Postman/Postman-Mail/PostmanMandrillMailEngine.php +2 -2
  24. Postman/Postman-Mail/PostmanMandrillTransport.php +12 -12
  25. Postman/Postman-Mail/PostmanMessage.php +12 -12
  26. Postman/Postman-Mail/PostmanModuleTransport.php +24 -23
  27. Postman/Postman-Mail/PostmanMyMailConnector.php +4 -5
  28. Postman/Postman-Mail/PostmanSendGridMailEngine.php +48 -75
  29. Postman/Postman-Mail/PostmanSendGridTransport.php +15 -15
  30. Postman/Postman-Mail/PostmanSmtpModuleTransport.php +42 -42
  31. Postman/Postman-Mail/PostmanTransportRegistry.php +11 -11
  32. Postman/Postman-Mail/PostmanWooCommerce.php +21 -21
  33. Postman/Postman-Mail/PostmanZendMailEngine.php +3 -3
  34. Postman/Postman-Mail/PostmanZendMailTransportConfigurationFactory.php +9 -9
  35. Postman/Postman-Mail/Zend-1.12.10/Mail.php +2 -2
  36. Postman/Postman-Mail/Zend-1.12.10/Validate/EmailAddress.php +1 -1
  37. Postman/Postman-Mail/sendgrid/composer.json +2 -2
  38. Postman/Postman-Send-Test-Email/PostmanSendTestEmailController.php +26 -26
  39. Postman/Postman.php +71 -24
  40. Postman/PostmanAdminController.php +21 -20
  41. Postman/PostmanAjaxController.php +5 -5
  42. Postman/PostmanConfigTextHelper.php +33 -33
  43. Postman/PostmanEmailLogs.php +111 -0
  44. Postman/PostmanInputSanitizer.php +6 -5
  45. Postman/PostmanInstaller.php +3 -4
  46. Postman/PostmanLogger.php +2 -2
  47. Postman/PostmanMessageHandler.php +8 -8
  48. Postman/PostmanOptions.php +17 -4
  49. Postman/PostmanSession.php +3 -3
  50. Postman/PostmanUtils.php +30 -37
  51. Postman/PostmanViewController.php +99 -79
  52. Postman/PostmanWpMail.php +54 -21
  53. Postman/PostmanWpMailBinder.php +2 -4
  54. Postman/extra/donation.php +19 -0
  55. Postman/notifications/PostmanMailNotify.php +1 -1
  56. README.md +217 -104
  57. postman-smtp.php +5 -3
  58. readme.txt +12 -5
  59. script/postman.js +12 -0
  60. style/images/mailer-type.gif +0 -0
  61. style/jquery-steps/jquery.steps.css +0 -1
  62. style/postman.css +20 -1
Postman/Phpmailer/PostsmtpMailer.php ADDED
@@ -0,0 +1,122 @@
1
+ <?php
2
+ require_once ABSPATH . WPINC . '/class-phpmailer.php';
3
+ require_once ABSPATH . WPINC . '/class-smtp.php';
4
+
5
+ add_action('plugins_loaded', function() {
6
+ global $phpmailer;
7
+
8
+ $phpmailer = new PostsmtpMailer(true);
9
+ });
10
+
11
+ class PostsmtpMailer extends PHPMailer {
12
+
13
+ private $options;
14
+
15
+ private $error;
16
+
17
+ public function __construct($exceptions = null)
18
+ {
19
+ parent::__construct($exceptions);
20
+
21
+ $this->options = PostmanOptions::getInstance();
22
+ add_filter( 'postman_wp_mail_result', [ $this, 'postman_wp_mail_result' ] );
23
+ }
24
+
25
+ public function send()
26
+ {
27
+ require_once dirname(__DIR__) . '/PostmanWpMail.php';
28
+
29
+ // create a PostmanWpMail instance
30
+ $postmanWpMail = new PostmanWpMail();
31
+ $postmanWpMail->init();
32
+
33
+ $senderEmail = $this->options->getMessageSenderEmail();
34
+ $senderName = $this->options->getMessageSenderName();
35
+
36
+ // create a PostmanMessage instance
37
+ $message = $postmanWpMail->createNewMessage();
38
+
39
+ $message->setFrom( $senderEmail, $senderName );
40
+ $message->addHeaders( $this->getHeaders() );
41
+ $message->setBodyTextPart( $this->AltBody );
42
+ $message->setBodyHtmlPart( $this->Body );
43
+ $message->setBody( $this->Body );
44
+ $message->setSubject( $this->Subject );
45
+ $message->addTo( $this->flatArray($this->getToAddresses() ) );
46
+ $message->setReplyTo( $this->flatArray( $this->getReplyToAddresses() ) );
47
+ $message->addCc( $this->flatArray($this->getCcAddresses() ) );
48
+ $message->addBCc( $this->flatArray( $this->getBccAddresses() ) );
49
+ $message->setReplyTo( $this->flatArray( $this->getReplyToAddresses() ) );
50
+ $message->setAttachments( $this->getAttachments() );
51
+
52
+ // create a PostmanEmailLog instance
53
+ $log = new PostmanEmailLog();
54
+
55
+ $log->originalTo = $this->flatArray($this->getToAddresses() );
56
+ $log->originalSubject = $this->Subject;
57
+ $log->originalMessage = $this->Body;
58
+ $log->originalHeaders = $this->getCustomHeaders();
59
+
60
+ try {
61
+ return $postmanWpMail->sendMessage( $message, $log );
62
+ } catch (phpmailerException $exc) {
63
+
64
+ $this->error = $exc;
65
+
66
+ $this->mailHeader = '';
67
+ $this->setError($exc->getMessage());
68
+ if ($this->exceptions) {
69
+ throw $exc;
70
+ }
71
+ return false;
72
+ }
73
+
74
+ }
75
+
76
+ public function getAttachments() {
77
+ $attachments = parent::getAttachments();
78
+
79
+ $data = array();
80
+ foreach ( $attachments as $attachment ) {
81
+ $data[] = $attachment[0];
82
+ }
83
+
84
+ return $data;
85
+ }
86
+
87
+ private function getHeaders() {
88
+ $headers = array();
89
+ foreach ( $this->getCustomHeaders() as $header ) {
90
+ $headers[] = "{$header[0]}: {$header[1]}";
91
+ }
92
+
93
+ return $headers;
94
+ }
95
+
96
+ public function postman_wp_mail_result() {
97
+ $result = [
98
+ 'time' => '',
99
+ 'exception' => $this->error,
100
+ 'transcript' => '',
101
+ ];
102
+ return $result;
103
+ }
104
+
105
+ private function flatArray($arr) {
106
+ $result = [];
107
+ foreach ( $arr as $key => $value ) {
108
+ if ( is_array( $value ) ) {
109
+ foreach ($value as $k => $v ) {
110
+ if ( empty( $v ) ) {
111
+ continue;
112
+ }
113
+ $value = $v;
114
+ }
115
+ }
116
+
117
+ $result[] = $value;
118
+ }
119
+
120
+ return implode(',', $result );
121
+ }
122
+ }
Postman/Postman-Auth/PostmanAbstractAuthenticationManager.php CHANGED
@@ -69,7 +69,7 @@ if (! class_exists ( "PostmanAbstractAuthenticationManager" )) {
69
* Decoded the received token
70
* This code is identical for Google and Hotmail
71
*
72
- * @param unknown $response
73
* @throws Exception
74
*/
75
protected function processResponse($response) {
@@ -99,7 +99,7 @@ if (! class_exists ( "PostmanAbstractAuthenticationManager" )) {
99
*
100
* This code is identical for Google and Hotmail
101
*
102
- * @param unknown $client
103
*/
104
protected function decodeReceivedAuthorizationToken($newtoken) {
105
assert ( ! empty ( $newtoken ) );
69
* Decoded the received token
70
* This code is identical for Google and Hotmail
71
*
72
+ * @param mixed $response
73
* @throws Exception
74
*/
75
protected function processResponse($response) {
99
*
100
* This code is identical for Google and Hotmail
101
*
102
+ * @param mixed $client
103
*/
104
protected function decodeReceivedAuthorizationToken($newtoken) {
105
assert ( ! empty ( $newtoken ) );
Postman/Postman-Configuration/PostmanConfigurationController.php CHANGED
@@ -12,10 +12,12 @@ class PostmanConfigurationController {
12
// Holds the values to be used in the fields callbacks
13
private $rootPluginFilenameAndPath;
14
15
/**
16
* Constructor
17
*
18
- * @param unknown $rootPluginFilenameAndPath
19
*/
20
public function __construct( $rootPluginFilenameAndPath ) {
21
assert( ! empty( $rootPluginFilenameAndPath ) );
@@ -94,11 +96,11 @@ class PostmanConfigurationController {
94
/**
95
*/
96
private function addLocalizeScriptsToPage() {
97
- $warning = __( 'Warning', Postman::TEXT_DOMAIN );
98
/* translators: where %s is the name of the SMTP server */
99
- wp_localize_script( 'postman_wizard_script', 'postman_smtp_mitm', sprintf( '%s: %s', $warning, __( 'connected to %1$s instead of %2$s.', Postman::TEXT_DOMAIN ) ) );
100
/* translators: where %d is a port number */
101
- wp_localize_script( 'postman_wizard_script', 'postman_wizard_bad_redirect_url', __( 'You are about to configure OAuth 2.0 with an IP address instead of a domain name. This is not permitted. Either assign a real domain name to your site or add a fake one in your local host file.', Postman::TEXT_DOMAIN ) );
102
103
// user input
104
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_input_sender_email', '#input_' . PostmanOptions::MESSAGE_SENDER_EMAIL );
@@ -131,7 +133,7 @@ class PostmanConfigurationController {
131
* Register the Configuration screen
132
*/
133
public function addConfigurationSubmenu() {
134
- $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_SLUG, array(
135
$this,
136
'outputManualConfigurationContent',
137
) );
@@ -155,7 +157,7 @@ class PostmanConfigurationController {
155
* Register the Setup Wizard screen
156
*/
157
public function addSetupWizardSubmenu() {
158
- $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG, array(
159
$this,
160
'outputWizardContent',
161
) );
@@ -194,14 +196,14 @@ class PostmanConfigurationController {
194
public function outputManualConfigurationContent() {
195
print '<div class="wrap">';
196
197
- PostmanViewController::outputChildPageHeader( __( 'Settings', Postman::TEXT_DOMAIN ), 'advanced_config' );
198
print '<div id="config_tabs"><ul>';
199
- print sprintf( '<li><a href="#account_config">%s</a></li>', __( 'Account', Postman::TEXT_DOMAIN ) );
200
- print sprintf( '<li><a href="#fallback">%s</a></li>', __( 'Fallback', Postman::TEXT_DOMAIN ) );
201
- print sprintf( '<li><a href="#message_config">%s</a></li>', __( 'Message', Postman::TEXT_DOMAIN ) );
202
- print sprintf( '<li><a href="#logging_config">%s</a></li>', __( 'Logging', Postman::TEXT_DOMAIN ) );
203
- print sprintf( '<li><a href="#advanced_options_config">%s</a></li>', __( 'Advanced', Postman::TEXT_DOMAIN ) );
204
- print sprintf( '<li><a href="#notifications">%s</a></li>', __( 'Notifications', Postman::TEXT_DOMAIN ) );
205
print '</ul>';
206
207
print '<form method="post" action="options.php">';
@@ -239,29 +241,29 @@ class PostmanConfigurationController {
239
240
<!-- Fallback Start -->
241
<section id="fallback">
242
- <h2><?php esc_html_e( 'Failed emails fallback', Postman::TEXT_DOMAIN ); ?></h2>
243
- <p><?php esc_html_e( 'By enable this option, if your email is fail to send Post SMTP will try to use the SMTP service you define here.', Postman::TEXT_DOMAIN ); ?></p>
244
<table class="form-table">
245
<tr valign="">
246
- <th scope="row"><?php _e( 'Use Fallback?', Postman::TEXT_DOMAIN ); ?></th>
247
<td>
248
<label>
249
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_ENABLED; ?>]" type="radio"
250
value="no"<?php echo checked( $this->options->getFallbackIsEnabled(), 'no' ); ?>>
251
- <?php _e( 'No', Postman::TEXT_DOMAIN ); ?>
252
</label>
253
&nbsp;
254
<label>
255
<?php $checked = checked( $this->options->getFallbackIsEnabled(), 'yes', false ); ?>
256
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_ENABLED; ?>]" type="radio"
257
value="yes"<?php echo checked( $this->options->getFallbackIsEnabled(), 'yes' ); ?>>
258
- <?php _e( 'Yes', Postman::TEXT_DOMAIN ); ?>
259
</label>
260
</td>
261
</tr>
262
263
<tr>
264
- <th scope="row"><?php _e('Outgoing Mail Server', Postman::TEXT_DOMAIN ); ?></th>
265
<?php $host = $this->options->getFallbackHostname(); ?>
266
<td>
267
<input type="text" id="fallback-smtp-host" name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_HOSTNAME; ?>]"
@@ -270,7 +272,7 @@ class PostmanConfigurationController {
270
</tr>
271
272
<tr>
273
- <th scope="row"><?php _e('Mail Server Port', Postman::TEXT_DOMAIN ); ?></th>
274
<?php $port = $this->options->getFallbackPort(); ?>
275
<td>
276
<input type="number" id="fallback-smtp-port" name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_PORT; ?>]"
@@ -279,12 +281,12 @@ class PostmanConfigurationController {
279
</tr>
280
281
<tr>
282
- <th scope="row"><?php _e('Security', Postman::TEXT_DOMAIN ); ?></th>
283
<?php
284
$security_options = array(
285
- 'none' => __( 'None', Postman::TEXT_DOMAIN ),
286
- 'ssl' => __( 'SSL', Postman::TEXT_DOMAIN ),
287
- 'tls' => __( 'TLS', Postman::TEXT_DOMAIN ),
288
);
289
?>
290
<td>
@@ -302,36 +304,36 @@ class PostmanConfigurationController {
302
</tr>
303
304
<tr>
305
- <th scope="row"><?php _e('From Email', Postman::TEXT_DOMAIN ); ?></th>
306
<td>
307
<input type="email" id="fallback-smtp-from-email"
308
value="<?php echo $this->options->getFallbackFromEmail(); ?>"
309
name="postman_options[<?php echo PostmanOptions::FALLBACK_FROM_EMAIL; ?>]"
310
>
311
<br>
312
- <small><?php _e( "Use allowed email, for example: If you are using Gmail, type your Gmail adress.", Postman::TEXT_DOMAIN ); ?></small>
313
</td>
314
</tr>
315
316
<tr valign="">
317
- <th scope="row"><?php _e( 'Use SMTP Authentication?', Postman::TEXT_DOMAIN ); ?></th>
318
<td>
319
<label>
320
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_USE_AUTH; ?>]"
321
type="radio" value="none"<?php checked( $this->options->getFallbackAuth(), 'none' ); ?>>
322
- <?php _e( 'No', Postman::TEXT_DOMAIN ); ?>
323
</label>
324
&nbsp;
325
<label>
326
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_USE_AUTH; ?>]"
327
type="radio" value="login"<?php checked( $this->options->getFallbackAuth(), 'login' ); ?>>
328
- <?php _e( 'Yes', Postman::TEXT_DOMAIN ); ?>
329
</label>
330
</td>
331
</tr>
332
333
<tr>
334
- <th scope="row"><?php _e('User name', Postman::TEXT_DOMAIN ); ?></th>
335
<td>
336
<input type="text" id="fallback-smtp-username"
337
value="<?php echo $this->options->getFallbackUsername(); ?>"
@@ -341,7 +343,7 @@ class PostmanConfigurationController {
341
</tr>
342
343
<tr>
344
- <th scope="row"><?php _e('Password', Postman::TEXT_DOMAIN ); ?></th>
345
<td>
346
<input type="password" id="fallback-smtp-password"
347
value="<?php echo PostmanUtils::obfuscatePassword( $this->options->getFallbackPassword() ); ?>"
@@ -408,7 +410,7 @@ class PostmanConfigurationController {
408
// construct Wizard
409
print '<div class="wrap">';
410
411
- PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', Postman::TEXT_DOMAIN ) );
412
413
print '<form id="postman_wizard" method="post" action="options.php">';
414
@@ -440,12 +442,12 @@ class PostmanConfigurationController {
440
settings_fields( PostmanAdminController::SETTINGS_GROUP_NAME );
441
442
// Wizard Step 0
443
- printf( '<h5>%s</h5>', _x( 'Import Configuration', 'Wizard Step Title', Postman::TEXT_DOMAIN ) );
444
print '<fieldset>';
445
- printf( '<legend>%s</legend>', _x( 'Import configuration from another plugin?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) );
446
- printf( '<p>%s</p>', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', Postman::TEXT_DOMAIN ) );
447
print '<table class="input_auth_type">';
448
- printf( '<tr><td><input type="radio" id="import_none" name="input_plugin" value="%s" checked="checked"></input></td><td><label> %s</label></td></tr>', 'none', __( 'None', Postman::TEXT_DOMAIN ) );
449
450
if ( $this->importableConfiguration->isImportAvailable() ) {
451
foreach ( $this->importableConfiguration->getAvailableOptions() as $options ) {
@@ -456,20 +458,20 @@ class PostmanConfigurationController {
456
print '</fieldset>';
457
458
// Wizard Step 1
459
- printf( '<h5>%s</h5>', _x( 'Sender Details', 'Wizard Step Title', Postman::TEXT_DOMAIN ) );
460
print '<fieldset>';
461
- printf( '<legend>%s</legend>', _x( 'Who is the mail coming from?', 'Wizard Step Title', Postman::TEXT_DOMAIN ) );
462
- printf( '<p>%s</p>', __( 'Enter the email address and name you\'d like to send mail as.', Postman::TEXT_DOMAIN ) );
463
- printf( '<p>%s</p>', __( 'Please note that to prevent abuse, many email services will <em>not</em> let you send from an email address other than the one you authenticate with.', Postman::TEXT_DOMAIN ) );
464
- printf( '<label for="postman_options[sender_email]">%s</label>', __( 'Email Address', Postman::TEXT_DOMAIN ) );
465
print $this->settingsRegistry->from_email_callback();
466
print '<br/>';
467
- printf( '<label for="postman_options[sender_name]">%s</label>', __( 'Name', Postman::TEXT_DOMAIN ) );
468
print $this->settingsRegistry->sender_name_callback();
469
print '</fieldset>';
470
471
// Wizard Step 2
472
- printf( '<h5>%s</h5>', __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ) );
473
print '<fieldset>';
474
foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) {
475
$transport->printWizardMailServerHostnameStep();
@@ -477,11 +479,11 @@ class PostmanConfigurationController {
477
print '</fieldset>';
478
479
// Wizard Step 3
480
- printf( '<h5>%s</h5>', __( 'Connectivity Test', Postman::TEXT_DOMAIN ) );
481
print '<fieldset>';
482
- printf( '<legend>%s</legend>', __( 'How will the connection to the mail server be established?', Postman::TEXT_DOMAIN ) );
483
- printf( '<p>%s</p>', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', Postman::TEXT_DOMAIN ) );
484
- printf( '<p id="connectivity_test_status">%s: <span id="port_test_status">%s</span></p>', __( 'Connectivity Test', Postman::TEXT_DOMAIN ), _x( 'Ready', 'TCP Port Test Status', Postman::TEXT_DOMAIN ) );
485
printf( '<p class="ajax-loader" style="display:none"><img src="%s"/></p>', plugins_url( 'post-smtp/style/ajax-loader.gif' ) );
486
printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TRANSPORT_TYPE );
487
printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::PORT );
@@ -489,27 +491,27 @@ class PostmanConfigurationController {
489
printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::AUTHENTICATION_TYPE );
490
print '<p id="wizard_recommendation"></p>';
491
/* Translators: Where %1$s is the socket identifier and %2$s is the authentication type */
492
- printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_socket_override" class="user_override"></table></p>', _x( 'Socket', 'A socket is the network term for host and port together', Postman::TEXT_DOMAIN ) );
493
- printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_auth_override" class="user_override"></table></p>', __( 'Authentication', Postman::TEXT_DOMAIN ) );
494
print ('<p><span id="smtp_mitm" style="display:none; background-color:yellow"></span></p>') ;
495
- $warning = __( 'Warning', Postman::TEXT_DOMAIN );
496
- $clearCredentialsWarning = __( 'This configuration option will send your authorization credentials in the clear.', Postman::TEXT_DOMAIN );
497
printf( '<p id="smtp_not_secure" style="display:none"><span style="background-color:yellow">%s: %s</span></p>', $warning, $clearCredentialsWarning );
498
print '</fieldset>';
499
500
// Wizard Step 4
501
- printf( '<h5>%s</h5>', __( 'Authentication', Postman::TEXT_DOMAIN ) );
502
print '<fieldset>';
503
- printf( '<legend>%s</legend>', __( 'How will you prove your identity to the mail server?', Postman::TEXT_DOMAIN ) );
504
foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) {
505
$transport->printWizardAuthenticationStep();
506
}
507
print '</fieldset>';
508
509
// Wizard Step 5 - Notificiations
510
- printf( '<h5>%s</h5>', __( 'Notifications', Postman::TEXT_DOMAIN ) );
511
print '<fieldset>';
512
- printf( '<legend>%s</legend>', __( 'Select a notify service to notify you when an email is failed to delivered.', Postman::TEXT_DOMAIN ) );
513
514
?>
515
<select id="input_notification_service" class="input_notification_service" name="postman_options[notification_service]">
@@ -518,17 +520,17 @@ class PostmanConfigurationController {
518
<option value="slack">Slack</option>
519
</select>
520
<div id="pushover_cred" style="display: none;">
521
- <h2><?php _e( 'Pushover Credentials', Postman::TEXT_DOMAIN ); ?></h2>
522
<table class="form-table">
523
<tbody>
524
<tr>
525
- <th scope="row"><?php _e( 'Pushover User Key', Postman::TEXT_DOMAIN ); ?></th>
526
<td>
527
<input type="password" id="pushover_user" name="postman_options[pushover_user]" value="">
528
</td>
529
</tr>
530
<tr>
531
- <th scope="row"><?php _e( 'Pushover App Token', Postman::TEXT_DOMAIN ); ?></th>
532
<td>
533
<input type="password" id="pushover_token" name="postman_options[pushover_token]" value="">
534
</td>
@@ -537,15 +539,15 @@ class PostmanConfigurationController {
537
</table>
538
</div>
539
<div id="slack_cred" style="display: none;">
540
- <h2><?php _e( 'Slack Credentials', Postman::TEXT_DOMAIN ); ?></h2>
541
<table class="form-table">
542
<tbody>
543
<tr>
544
- <th scope="row"><?php _e( 'Slack webhook', Postman::TEXT_DOMAIN ); ?></th>
545
<td>
546
<input type="password" id="slack_token" name="postman_options[slack_token]" value="">
547
<a target="_blank" class="" href="https://slack.postmansmtp.com/">
548
- <?php _e( 'Get your webhook URL here.', Postman::TEXT_DOMAIN ); ?>
549
</a>
550
</td>
551
</tr>
@@ -554,20 +556,20 @@ class PostmanConfigurationController {
554
</div>
555
556
<div id="use-chrome-extension">
557
- <h2><?php _e( 'Push To Chrome Extension', Postman::TEXT_DOMAIN ); ?></h2>
558
<table class="form-table">
559
<tbody>
560
<tr>
561
- <th scope="row"><?php _e( 'This is an extra notification to the selection above', Postman::TEXT_DOMAIN ); ?></th>
562
<td>
563
<input type="checkbox" id="notification_use_chrome" name="postman_options[notification_use_chrome]">
564
<a target="_blank" class="" href="https://chrome.google.com/webstore/detail/npklmbkpbknkmbohdbpikeidiaekjoch">
565
- <?php _e( 'You can download the chrome extensiom here.', Postman::TEXT_DOMAIN ); ?>
566
</a>
567
</td>
568
</tr>
569
<tr>
570
- <th scope="row"><?php _e( 'Your UID as you see in the extension.', Postman::TEXT_DOMAIN ); ?></th>
571
<td>
572
<input type="password" id="notification_chrome_uid" name="postman_options[notification_chrome_uid]" value="">
573
</td>
@@ -580,15 +582,22 @@ class PostmanConfigurationController {
580
print '</fieldset>';
581
582
// Wizard Step 6
583
- printf( '<h5>%s</h5>', _x( 'Finish', 'The final step of the Wizard', Postman::TEXT_DOMAIN ) );
584
print '<fieldset>';
585
- printf( '<legend>%s</legend>', _x( 'You\'re Done!', 'Wizard Step Title', Postman::TEXT_DOMAIN ) );
586
print '<section>';
587
- printf( '<p>%s</p>', __( 'Click Finish to save these settings, then:', Postman::TEXT_DOMAIN ) );
588
print '<ul style="margin-left: 20px">';
589
- printf( '<li class="wizard-auth-oauth2">%s</li>', __( 'Grant permission with the Email Provider for Postman to send email and', Postman::TEXT_DOMAIN ) );
590
- printf( '<li>%s</li>', __( 'Send yourself a Test Email to make sure everything is working!', Postman::TEXT_DOMAIN ) );
591
print '</ul>';
592
print '</section>';
593
print '</fieldset>';
594
print '</form>';
@@ -730,7 +739,7 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler {
730
wp_send_json_success( $response );
731
} else {
732
/* translators: where %s is the URL to the Connectivity Test page */
733
- $configuration ['message'] = sprintf( __( 'Postman can\'t find any way to send mail on your system. Run a <a href="%s">connectivity test</a>.', Postman::TEXT_DOMAIN ), PostmanViewController::getPageUrl( PostmanViewController::PORT_TEST_SLUG ) );
734
$response ['configuration'] = $configuration;
735
if ( $this->logger->isTrace() ) {
736
$this->logger->trace( 'configuration:' );
@@ -745,8 +754,8 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler {
745
* // ask a transport if they support it, and if they do at what priority is it
746
* // configure for the highest priority you find
747
*
748
- * @param unknown $queryHostData
749
- * @return unknown
750
*/
751
private function getWinningRecommendation( $sockets, $userSocketOverride, $userAuthOverride, $originalSmtpServer ) {
752
foreach ( $sockets as $socket ) {
@@ -758,11 +767,11 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler {
758
759
/**
760
*
761
- * @param PostmanSocket $socket
762
- * @param unknown $userSocketOverride
763
- * @param unknown $userAuthOverride
764
- * @param unknown $originalSmtpServer
765
- * @return Ambigous <NULL, unknown, string>
766
*/
767
private function getWin( PostmanWizardSocket $socket, $userSocketOverride, $userAuthOverride, $originalSmtpServer ) {
768
static $recommendationPriority = - 1;
@@ -790,7 +799,7 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler {
790
791
/**
792
*
793
- * @param unknown $queryHostData
794
* @return multitype:
795
*/
796
private function createOverrideMenus( $sockets, $winningRecommendation, $userSocketOverride, $userAuthOverride ) {
@@ -815,9 +824,9 @@ class PostmanManageConfigurationAjaxHandler extends PostmanAbstractAjaxHandler {
815
/**
816
*
817
* @param PostmanWizardSocket $socket
818
- * @param unknown $winningRecommendation
819
- * @param unknown $userSocketOverride
820
- * @param unknown $userAuthOverride
821
*/
822
private function createOverrideMenu( PostmanWizardSocket $socket, $winningRecommendation, $userSocketOverride, $userAuthOverride ) {
823
if ( $socket->success ) {
12
// Holds the values to be used in the fields callbacks
13
private $rootPluginFilenameAndPath;
14
15
+ private $importableConfiguration;
16
+
17
/**
18
* Constructor
19
*
20
+ * @param mixed $rootPluginFilenameAndPath
21
*/
22
public function __construct( $rootPluginFilenameAndPath ) {
23
assert( ! empty( $rootPluginFilenameAndPath ) );
96
/**
97
*/
98
private function addLocalizeScriptsToPage() {
99
+ $warning = __( 'Warning', 'post-smtp' );
100
/* translators: where %s is the name of the SMTP server */
101
+ wp_localize_script( 'postman_wizard_script', 'postman_smtp_mitm', sprintf( '%s: %s', $warning, __( 'connected to %1$s instead of %2$s.', 'post-smtp' ) ) );
102
/* translators: where %d is a port number */
103
+ wp_localize_script( 'postman_wizard_script', 'postman_wizard_bad_redirect_url', __( 'You are about to configure OAuth 2.0 with an IP address instead of a domain name. This is not permitted. Either assign a real domain name to your site or add a fake one in your local host file.', 'post-smtp' ) );
104
105
// user input
106
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_input_sender_email', '#input_' . PostmanOptions::MESSAGE_SENDER_EMAIL );
133
* Register the Configuration screen
134
*/
135
public function addConfigurationSubmenu() {
136
+ $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_SLUG, array(
137
$this,
138
'outputManualConfigurationContent',
139
) );
157
* Register the Setup Wizard screen
158
*/
159
public function addSetupWizardSubmenu() {
160
+ $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG, array(
161
$this,
162
'outputWizardContent',
163
) );
196
public function outputManualConfigurationContent() {
197
print '<div class="wrap">';
198
199
+ PostmanViewController::outputChildPageHeader( __( 'Settings', 'post-smtp' ), 'advanced_config' );
200
print '<div id="config_tabs"><ul>';
201
+ print sprintf( '<li><a href="#account_config">%s</a></li>', __( 'Account', 'post-smtp' ) );
202
+ print sprintf( '<li><a href="#fallback">%s</a></li>', __( 'Fallback', 'post-smtp' ) );
203
+ print sprintf( '<li><a href="#message_config">%s</a></li>', __( 'Message', 'post-smtp' ) );
204
+ print sprintf( '<li><a href="#logging_config">%s</a></li>', __( 'Logging', 'post-smtp' ) );
205
+ print sprintf( '<li><a href="#advanced_options_config">%s</a></li>', __( 'Advanced', 'post-smtp' ) );
206
+ print sprintf( '<li><a href="#notifications">%s</a></li>', __( 'Notifications', 'post-smtp' ) );
207
print '</ul>';
208
209
print '<form method="post" action="options.php">';
241
242
<!-- Fallback Start -->
243
<section id="fallback">
244
+ <h2><?php esc_html_e( 'Failed emails fallback', 'post-smtp' ); ?></h2>
245
+ <p><?php esc_html_e( 'By enable this option, if your email is fail to send Post SMTP will try to use the SMTP service you define here.', 'post-smtp' ); ?></p>
246
<table class="form-table">
247
<tr valign="">
248
+ <th scope="row"><?php _e( 'Use Fallback?', 'post-smtp' ); ?></th>
249
<td>
250
<label>
251
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_ENABLED; ?>]" type="radio"
252
value="no"<?php echo checked( $this->options->getFallbackIsEnabled(), 'no' ); ?>>
253
+ <?php _e( 'No', 'post-smtp' ); ?>
254
</label>
255
&nbsp;
256
<label>
257
<?php $checked = checked( $this->options->getFallbackIsEnabled(), 'yes', false ); ?>
258
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_ENABLED; ?>]" type="radio"
259
value="yes"<?php echo checked( $this->options->getFallbackIsEnabled(), 'yes' ); ?>>
260
+ <?php _e( 'Yes', 'post-smtp' ); ?>
261
</label>
262
</td>
263
</tr>
264
265
<tr>
266
+ <th scope="row"><?php _e('Outgoing Mail Server', 'post-smtp' ); ?></th>
267
<?php $host = $this->options->getFallbackHostname(); ?>
268
<td>
269
<input type="text" id="fallback-smtp-host" name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_HOSTNAME; ?>]"
272
</tr>
273
274
<tr>
275
+ <th scope="row"><?php _e('Mail Server Port', 'post-smtp' ); ?></th>
276
<?php $port = $this->options->getFallbackPort(); ?>
277
<td>
278
<input type="number" id="fallback-smtp-port" name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_PORT; ?>]"
281
</tr>
282
283
<tr>
284
+ <th scope="row"><?php _e('Security', 'post-smtp' ); ?></th>
285
<?php
286
$security_options = array(
287
+ 'none' => __( 'None', 'post-smtp' ),
288
+ 'ssl' => __( 'SSL', 'post-smtp' ),
289
+ 'tls' => __( 'TLS', 'post-smtp' ),
290
);
291
?>
292
<td>
304
</tr>
305
306
<tr>
307
+ <th scope="row"><?php _e('From Email', 'post-smtp' ); ?></th>
308
<td>
309
<input type="email" id="fallback-smtp-from-email"
310
value="<?php echo $this->options->getFallbackFromEmail(); ?>"
311
name="postman_options[<?php echo PostmanOptions::FALLBACK_FROM_EMAIL; ?>]"
312
>
313
<br>
314
+ <small><?php _e( "Use allowed email, for example: If you are using Gmail, type your Gmail adress.", 'post-smtp' ); ?></small>
315
</td>
316
</tr>
317
318
<tr valign="">
319
+ <th scope="row"><?php _e( 'Use SMTP Authentication?', 'post-smtp' ); ?></th>
320
<td>
321
<label>
322
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_USE_AUTH; ?>]"
323
type="radio" value="none"<?php checked( $this->options->getFallbackAuth(), 'none' ); ?>>
324
+ <?php _e( 'No', 'post-smtp' ); ?>
325
</label>
326
&nbsp;
327
<label>
328
<input name="postman_options[<?php echo PostmanOptions::FALLBACK_SMTP_USE_AUTH; ?>]"
329
type="radio" value="login"<?php checked( $this->options->getFallbackAuth(), 'login' ); ?>>
330
+ <?php _e( 'Yes', 'post-smtp' ); ?>
331
</label>
332
</td>
333
</tr>
334
335
<tr>
336
+ <th scope="row"><?php _e('User name', 'post-smtp' ); ?></th>
337
<td>
338
<input type="text" id="fallback-smtp-username"
339
value="<?php echo $this->options->getFallbackUsername(); ?>"
343
</tr>
344
345
<tr>
346
+ <th scope="row"><?php _e('Password', 'post-smtp' ); ?></th>
347
<td>
348
<input type="password" id="fallback-smtp-password"
349
value="<?php echo PostmanUtils::obfuscatePassword( $this->options->getFallbackPassword() ); ?>"
410
// construct Wizard
411
print '<div class="wrap">';
412
413
+ PostmanViewController::outputChildPageHeader( __( 'Setup Wizard', 'post-smtp' ) );
414
415
print '<form id="postman_wizard" method="post" action="options.php">';
416
442
settings_fields( PostmanAdminController::SETTINGS_GROUP_NAME );
443
444
// Wizard Step 0
445
+ printf( '<h5>%s</h5>', _x( 'Import Configuration', 'Wizard Step Title', 'post-smtp' ) );
446
print '<fieldset>';
447
+ printf( '<legend>%s</legend>', _x( 'Import configuration from another plugin?', 'Wizard Step Title', 'post-smtp' ) );
448
+ printf( '<p>%s</p>', __( 'If you had a working configuration with another Plugin, the Setup Wizard can begin with those settings.', 'post-smtp' ) );
449
print '<table class="input_auth_type">';
450
+ printf( '<tr><td><input type="radio" id="import_none" name="input_plugin" value="%s" checked="checked"></input></td><td><label> %s</label></td></tr>', 'none', __( 'None', 'post-smtp' ) );
451
452
if ( $this->importableConfiguration->isImportAvailable() ) {
453
foreach ( $this->importableConfiguration->getAvailableOptions() as $options ) {
458
print '</fieldset>';
459
460
// Wizard Step 1
461
+ printf( '<h5>%s</h5>', _x( 'Sender Details', 'Wizard Step Title', 'post-smtp' ) );
462
print '<fieldset>';
463
+ printf( '<legend>%s</legend>', _x( 'Who is the mail coming from?', 'Wizard Step Title', 'post-smtp' ) );
464
+ printf( '<p>%s</p>', __( 'Enter the email address and name you\'d like to send mail as.', 'post-smtp' ) );
465
+ printf( '<p>%s</p>', __( 'Please note that to prevent abuse, many email services will <em>not</em> let you send from an email address other than the one you authenticate with.', 'post-smtp' ) );
466
+ printf( '<label for="postman_options[sender_email]">%s</label>', __( 'Email Address', 'post-smtp' ) );
467
print $this->settingsRegistry->from_email_callback();
468
print '<br/>';
469
+ printf( '<label for="postman_options[sender_name]">%s</label>', __( 'Name', 'post-smtp' ) );
470
print $this->settingsRegistry->sender_name_callback();
471
print '</fieldset>';
472
473
// Wizard Step 2
474
+ printf( '<h5>%s</h5>', __( 'Outgoing Mail Server Hostname', 'post-smtp' ) );
475
print '<fieldset>';
476
foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) {
477
$transport->printWizardMailServerHostnameStep();
479
print '</fieldset>';
480
481
// Wizard Step 3
482
+ printf( '<h5>%s</h5>', __( 'Connectivity Test', 'post-smtp' ) );
483
print '<fieldset>';
484
+ printf( '<legend>%s</legend>', __( 'How will the connection to the mail server be established?', 'post-smtp' ) );
485
+ printf( '<p>%s</p>', __( 'Your connection settings depend on what your email service provider offers, and what your WordPress host allows.', 'post-smtp' ) );
486
+ printf( '<p id="connectivity_test_status">%s: <span id="port_test_status">%s</span></p>', __( 'Connectivity Test', 'post-smtp' ), _x( 'Ready', 'TCP Port Test Status', 'post-smtp' ) );
487
printf( '<p class="ajax-loader" style="display:none"><img src="%s"/></p>', plugins_url( 'post-smtp/style/ajax-loader.gif' ) );
488
printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TRANSPORT_TYPE );
489
printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::PORT );
491
printf( '<input type="hidden" id="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::AUTHENTICATION_TYPE );
492
print '<p id="wizard_recommendation"></p>';
493
/* Translators: Where %1$s is the socket identifier and %2$s is the authentication type */
494
+ printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_socket_override" class="user_override"></table></p>', _x( 'Socket', 'A socket is the network term for host and port together', 'post-smtp' ) );
495
+ printf( '<p class="user_override" style="display:none"><label><span>%s:</span></label> <table id="user_auth_override" class="user_override"></table></p>', __( 'Authentication', 'post-smtp' ) );
496
print ('<p><span id="smtp_mitm" style="display:none; background-color:yellow"></span></p>') ;
497
+ $warning = __( 'Warning', 'post-smtp' );
498
+ $clearCredentialsWarning = __( 'This configuration option will send your authorization credentials in the clear.', 'post-smtp' );
499
printf( '<p id="smtp_not_secure" style="display:none"><span style="background-color:yellow">%s: %s</span></p>', $warning, $clearCredentialsWarning );
500
print '</fieldset>';
501
502
// Wizard Step 4
503
+ printf( '<h5>%s</h5>', __( 'Authentication', 'post-smtp' ) );
504
print '<fieldset>';
505
+ printf( '<legend>%s</legend>', __( 'How will you prove your identity to the mail server?', 'post-smtp' ) );
506
foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) {
507
$transport->printWizardAuthenticationStep();
508
}
509
print '</fieldset>';
510
511
// Wizard Step 5 - Notificiations
512
+ printf( '<h5>%s</h5>', __( 'Notifications', 'post-smtp' ) );
513
print '<fieldset>';
514
+ printf( '<legend>%s</legend>', __( 'Select a notify service to notify you when an email is failed to delivered.', 'post-smtp' ) );
515
516
?>
517
<select id="input_notification_service" class="input_notification_service" name="postman_options[notification_service]">
520
<option value="slack">Slack</option>
521
</select>
522
<div id="pushover_cred" style="display: none;">
523
+ <h2><?php _e( 'Pushover Credentials', 'post-smtp' ); ?></h2>
524
<table class="form-table">
525
<tbody>
526
<tr>
527
+ <th scope="row"><?php _e( 'Pushover User Key', 'post-smtp' ); ?></th>
528
<td>
529
<input type="password" id="pushover_user" name="postman_options[pushover_user]" value="">
530
</td>
531
</tr>
532
<tr>
533
+ <th scope="row"><?php _e( 'Pushover App Token', 'post-smtp' ); ?></th>
534
<td>
535
<input type="password" id="pushover_token" name="postman_options[pushover_token]" value="">
536
</td>
539
</table>
540
</div>
541
<div id="slack_cred" style="display: none;">
542
+ <h2><?php _e( 'Slack Credentials', 'post-smtp' ); ?></h2>
543
<table class="form-table">
544
<tbody>
545
<tr>
546
+ <th scope="row"><?php _e( 'Slack webhook', 'post-smtp' ); ?></th>
547
<td>
548
<input type="password" id="slack_token" name="postman_options[slack_token]" value="">
549
<a target="_blank" class="" href="https://slack.postmansmtp.com/">
550
+ <?php _e( 'Get your webhook URL here.', 'post-smtp' ); ?>
551
</a>
552
</td>
553
</tr>
556
</div>
557
558
<div id="use-chrome-extension">
559
+ <h2><?php _e( 'Push To Chrome Extension', 'post-smtp' ); ?></h2>
560
<table class="form-table">
561
<tbody>
562
<tr>
563
+ <th scope="row"><?php _e( 'This is an extra notification to the selection above', 'post-smtp' ); ?></th>
564
<td>
565
<input type="checkbox" id="notification_use_chrome" name="postman_options[notification_use_chrome]">
566
<a target="_blank" class="" href="https://chrome.google.com/webstore/detail/npklmbkpbknkmbohdbpikeidiaekjoch">
567
+ <?php _e( 'You can download the chrome extension here.', 'post-smtp' ); ?>
568
</a>
569
</td>
570
</tr>
571
<tr>
572
+ <th scope="row"><?php _e( 'Your UID as you see in the extension.', 'post-smtp' ); ?></th>
573
<td>
574
<input type="password" id="notification_chrome_uid" name="postman_options[notification_chrome_uid]" value="">
575
</td>
582
print '</fieldset>';
583
584
// Wizard Step 6
585
+ printf( '<h5>%s</h5>', _x( 'Finish', 'The final step of the Wizard', 'post-smtp' ) );
586
print '<fieldset>';
587
+ printf( '<legend>%s</legend>', _x( 'You\'re Done!', 'Wizard Step Title', 'post-smtp' ) );
588
print '<section>';
589
+ printf( '<p>%s</p>', __( 'Click Finish to save these settings, then:', 'post-smtp' ) );
590
print '<ul style="margin-left: 20px">';
591
+ printf( '<li class="wizard-auth-oauth2">%s</li>', __( 'Grant permission with the Email Provider for Postman to send email and', 'post-smtp' ) );
592
+ printf( '<li>%s</li>', __( 'Send yourself a Test Email to make sure everything is working!', 'post-smtp' ) );
593
print '</ul>';
594
+
595
+ // Get PHPmailer recommendation
596
+ Postman::getMailerTypeRecommend();
597
+
598
+ $in_wizard = true;
599
+ include_once POST_PATH . '/Postman/extra/donation.php';
600
+
601
print '</section>';
602
print '</fieldset>';
603
print '</form>';
739
wp_send_json_success( $response );
740
} else {
741
/* translators: where %s is the URL to the Connectivity Test page */
742
+ $configuration ['message'] = sprintf( __( 'Postman can\'t find any way to send mail on your system. Run a <a href="%s">connectivity test</a>.', 'post-smtp' ), PostmanViewController::getPageUrl( PostmanViewController::PORT_TEST_SLUG ) );
743
$response ['configuration'] = $configuration;
744
if ( $this->logger->isTrace() ) {
745
$this->logger->trace( 'configuration:' );
754
* // ask a transport if they support it, and if they do at what priority is it
755
* // configure for the highest priority you find
756
*
757
+ * @param mixed $queryHostData
758
+ * @return mixed
759
*/
760
private function getWinningRecommendation( $sockets, $userSocketOverride, $userAuthOverride, $originalSmtpServer ) {
761
foreach ( $sockets as $socket ) {
767
768
/**
769
*
770
+ * @param PostmanWizardSocket $socket
771
+ * @param mixed $userSocketOverride
772
+ * @param mixed $userAuthOverride
773
+ * @param mixed $originalSmtpServer
774
+ * @return mixed
775
*/
776
private function getWin( PostmanWizardSocket $socket, $userSocketOverride, $userAuthOverride, $originalSmtpServer ) {
777
static $recommendationPriority = - 1;
799
800
/**
801
*
802
+ * @param mixed $queryHostData
803
* @return multitype:
804
*/
805
private function createOverrideMenus( $sockets, $winningRecommendation, $userSocketOverride, $userAuthOverride ) {
824
/**
825
*
826
* @param PostmanWizardSocket $socket
827
+ * @param mixed $winningRecommendation
828
+ * @param mixed $userSocketOverride
829
+ * @param mixed $userAuthOverride
830
*/
831
private function createOverrideMenu( PostmanWizardSocket $socket, $winningRecommendation, $userSocketOverride, $userAuthOverride ) {
832
if ( $socket->success ) {
Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php CHANGED
@@ -28,23 +28,28 @@ class PostmanSettingsRegistry {
28
) );
29
30
// Sanitize
31
- add_settings_section( 'transport_section', __( 'Transport', Postman::TEXT_DOMAIN ), array(
32
$this,
33
'printTransportSectionInfo',
34
), 'transport_options' );
35
36
- add_settings_field( PostmanOptions::TRANSPORT_TYPE, _x( 'Type', '(i.e.) What kind is it?', Postman::TEXT_DOMAIN ), array(
37
- $this,
38
- 'transport_type_callback',
39
- ), 'transport_options', 'transport_section' );
40
41
// the Message From section
42
- add_settings_section( PostmanAdminController::MESSAGE_FROM_SECTION, _x( 'From Address', 'The Message Sender Email Address', Postman::TEXT_DOMAIN ), array(
43
$this,
44
'printMessageFromSectionInfo',
45
), PostmanAdminController::MESSAGE_FROM_OPTIONS );
46
47
- add_settings_field( PostmanOptions::MESSAGE_SENDER_EMAIL, __( 'Email Address', Postman::TEXT_DOMAIN ), array(
48
$this,
49
'from_email_callback',
50
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
@@ -54,7 +59,7 @@ class PostmanSettingsRegistry {
54
'prevent_from_email_override_callback',
55
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
56
57
- add_settings_field( PostmanOptions::MESSAGE_SENDER_NAME, __( 'Name', Postman::TEXT_DOMAIN ), array(
58
$this,
59
'sender_name_callback',
60
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
@@ -65,38 +70,38 @@ class PostmanSettingsRegistry {
65
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
66
67
// the Additional Addresses section
68
- add_settings_section( PostmanAdminController::MESSAGE_SECTION, __( 'Additional Email Addresses', Postman::TEXT_DOMAIN ), array(
69
$this,
70
'printMessageSectionInfo',
71
), PostmanAdminController::MESSAGE_OPTIONS );
72
73
- add_settings_field( PostmanOptions::REPLY_TO, __( 'Reply-To', Postman::TEXT_DOMAIN ), array(
74
$this,
75
'reply_to_callback',
76
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
77
78
- add_settings_field( PostmanOptions::FORCED_TO_RECIPIENTS, __( 'To Recipient(s)', Postman::TEXT_DOMAIN ), array(
79
$this,
80
'to_callback',
81
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
82
83
- add_settings_field( PostmanOptions::FORCED_CC_RECIPIENTS, __( 'Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array(
84
$this,
85
'cc_callback',
86
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
87
88
- add_settings_field( PostmanOptions::FORCED_BCC_RECIPIENTS, __( 'Blind Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array(
89
$this,
90
'bcc_callback',
91
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
92
93
// the Additional Headers section
94
- add_settings_section( PostmanAdminController::MESSAGE_HEADERS_SECTION, __( 'Additional Headers', Postman::TEXT_DOMAIN ), array(
95
$this,
96
'printAdditionalHeadersSectionInfo',
97
), PostmanAdminController::MESSAGE_HEADERS_OPTIONS );
98
99
- add_settings_field( PostmanOptions::ADDITIONAL_HEADERS, __( 'Custom Headers', Postman::TEXT_DOMAIN ), array(
100
$this,
101
'headers_callback',
102
), PostmanAdminController::MESSAGE_HEADERS_OPTIONS, PostmanAdminController::MESSAGE_HEADERS_SECTION );
@@ -104,123 +109,123 @@ class PostmanSettingsRegistry {
104
// Fallback
105
106
// the Email Validation section
107
- add_settings_section( PostmanAdminController::EMAIL_VALIDATION_SECTION, __( 'Validation', Postman::TEXT_DOMAIN ), array(
108
$this,
109
'printEmailValidationSectionInfo',
110
), PostmanAdminController::EMAIL_VALIDATION_OPTIONS );
111
112
- add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Email Address', Postman::TEXT_DOMAIN ), array(
113
$this,
114
'disable_email_validation_callback',
115
), PostmanAdminController::EMAIL_VALIDATION_OPTIONS, PostmanAdminController::EMAIL_VALIDATION_SECTION );
116
117
// the Logging section
118
- add_settings_section( PostmanAdminController::LOGGING_SECTION, __( 'Email Log Settings', Postman::TEXT_DOMAIN ), array(
119
$this,
120
'printLoggingSectionInfo',
121
), PostmanAdminController::LOGGING_OPTIONS );
122
123
- add_settings_field( 'logging_status', __( 'Enable Logging', Postman::TEXT_DOMAIN ), array(
124
$this,
125
'loggingStatusInputField',
126
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
127
128
- add_settings_field( 'logging_max_entries', __( 'Maximum Log Entries', Postman::TEXT_DOMAIN ), array(
129
$this,
130
'loggingMaxEntriesInputField',
131
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
132
133
- add_settings_field( PostmanOptions::TRANSCRIPT_SIZE, __( 'Maximum Transcript Size', Postman::TEXT_DOMAIN ), array(
134
$this,
135
'transcriptSizeInputField',
136
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
137
138
// the Network section
139
- add_settings_section( PostmanAdminController::NETWORK_SECTION, __( 'Network Settings', Postman::TEXT_DOMAIN ), array(
140
$this,
141
'printNetworkSectionInfo',
142
), PostmanAdminController::NETWORK_OPTIONS );
143
144
- add_settings_field( 'connection_timeout', _x( 'TCP Connection Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
145
$this,
146
'connection_timeout_callback',
147
), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION );
148
149
- add_settings_field( 'read_timeout', _x( 'TCP Read Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
150
$this,
151
'read_timeout_callback',
152
), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION );
153
154
// the Advanced section
155
- add_settings_section( PostmanAdminController::ADVANCED_SECTION, _x( 'Miscellaneous Settings', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array(
156
$this,
157
'printAdvancedSectionInfo',
158
), PostmanAdminController::ADVANCED_OPTIONS );
159
160
- add_settings_field( PostmanOptions::LOG_LEVEL, _x( 'PHP Log Level', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
161
$this,
162
'log_level_callback',
163
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
164
165
- add_settings_field( PostmanOptions::RUN_MODE, _x( 'Delivery Mode', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
166
$this,
167
'runModeCallback',
168
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
169
170
- add_settings_field( PostmanOptions::STEALTH_MODE, _x( 'Stealth Mode', 'This mode removes the Postman X-Mailer signature from emails', Postman::TEXT_DOMAIN ), array(
171
$this,
172
'stealthModeCallback',
173
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
174
175
- add_settings_field( PostmanOptions::TEMPORARY_DIRECTORY, __( 'Temporary Directory', Postman::TEXT_DOMAIN ), array(
176
$this,
177
'temporaryDirectoryCallback',
178
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
179
180
// Notifications
181
- add_settings_section( PostmanAdminController::NOTIFICATIONS_SECTION, _x( 'Notifications Settings', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array(
182
$this,
183
'printNotificationsSectionInfo',
184
), PostmanAdminController::NOTIFICATIONS_OPTIONS );
185
186
- add_settings_field( PostmanOptions::NOTIFICATION_SERVICE, _x( 'Notification Service', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
187
$this,
188
'notification_service_callback',
189
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
190
191
// Pushover
192
- add_settings_section( 'pushover_credentials', _x( 'Pushover Credentials', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array(
193
$this,
194
'printNotificationsSectionInfo',
195
), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED );
196
197
- add_settings_field( PostmanOptions::PUSHOVER_USER, _x( 'Pushover User Key', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
198
$this,
199
'pushover_user_callback',
200
), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED, 'pushover_credentials' );
201
202
- add_settings_field( PostmanOptions::PUSHOVER_TOKEN, _x( 'Pushover App Token', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
203
$this,
204
'pushover_token_callback',
205
), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED, 'pushover_credentials' );
206
207
// Slack
208
- add_settings_section( 'slack_credentials', _x( 'Slack Credentials', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array(
209
$this,
210
'printNotificationsSectionInfo',
211
), PostmanAdminController::NOTIFICATIONS_SLACK_CRED );
212
213
- add_settings_field( PostmanOptions::SLACK_TOKEN, _x( 'Slack Webhook', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
214
$this,
215
'slack_token_callback',
216
), PostmanAdminController::NOTIFICATIONS_SLACK_CRED, 'slack_credentials' );
217
218
- add_settings_field( PostmanOptions::NOTIFICATION_USE_CHROME, _x( 'Push to chrome extension', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
219
$this,
220
'notification_use_chrome_callback',
221
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
222
223
- add_settings_field( PostmanOptions::NOTIFICATION_CHROME_UID, _x( 'Chrome Extension UID', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
224
$this,
225
'notification_chrome_uid_callback',
226
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
@@ -232,31 +237,31 @@ class PostmanSettingsRegistry {
232
* Print the Transport section info
233
*/
234
public function printTransportSectionInfo() {
235
- print __( 'Choose SMTP or a vendor-specific API:', Postman::TEXT_DOMAIN );
236
}
237
public function printLoggingSectionInfo() {
238
- print __( 'Configure the delivery audit log:', Postman::TEXT_DOMAIN );
239
}
240
241
/**
242
* Print the Section text
243
*/
244
public function printMessageFromSectionInfo() {
245
- print sprintf( __( 'This address, like the <b>letterhead</b> printed on a letter, identifies the sender to the recipient. Change this when you are sending on behalf of someone else, for example to use Google\'s <a href="%s">Send Mail As</a> feature. Other plugins, especially Contact Forms, may override this field to be your visitor\'s address.', Postman::TEXT_DOMAIN ), 'https://support.google.com/mail/answer/22370?hl=en' );
246
}
247
248
/**
249
* Print the Section text
250
*/
251
public function printMessageSectionInfo() {
252
- print __( 'Separate multiple <b>to</b>/<b>cc</b>/<b>bcc</b> recipients with commas.', Postman::TEXT_DOMAIN );
253
}
254
255
/**
256
* Print the Section text
257
*/
258
public function printNetworkSectionInfo() {
259
- print __( 'Increase the timeouts if your host is intermittenly failing to send mail. Be careful, this also correlates to how long your user must wait if the mail server is unreachable.', Postman::TEXT_DOMAIN );
260
}
261
262
/**
@@ -275,14 +280,14 @@ class PostmanSettingsRegistry {
275
* Print the Section text
276
*/
277
public function printAdditionalHeadersSectionInfo() {
278
- print __( 'Specify custom headers (e.g. <code>X-MC-Tags: wordpress-site-A</code>), one per line. Use custom headers with caution as they can negatively affect your Spam score.', Postman::TEXT_DOMAIN );
279
}
280
281
/**
282
* Print the Email Validation Description
283
*/
284
public function printEmailValidationSectionInfo() {
285
- print __( 'E-mail addresses can be validated before sending e-mail, however this may fail with some newer domains.', Postman::TEXT_DOMAIN );
286
}
287
288
/**
@@ -297,6 +302,22 @@ class PostmanSettingsRegistry {
297
print '</select>';
298
}
299
300
/**
301
* Get the settings option array and print one of its values
302
*/
@@ -308,21 +329,21 @@ class PostmanSettingsRegistry {
308
*/
309
public function prevent_from_name_override_callback() {
310
$enforced = $this->options->isPluginSenderNameEnforced();
311
- printf( '<input type="checkbox" id="input_prevent_sender_name_override" name="postman_options[prevent_sender_name_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', Postman::TEXT_DOMAIN ) );
312
}
313
314
/**
315
* Get the settings option array and print one of its values
316
*/
317
public function from_email_callback() {
318
- printf( '<input type="email" id="input_sender_email" name="postman_options[sender_email]" value="%s" size="40" class="required" placeholder="%s"/>', null !== $this->options->getMessageSenderEmail() ? esc_attr( $this->options->getMessageSenderEmail() ) : '', __( 'Required', Postman::TEXT_DOMAIN ) );
319
}
320
321
/**
322
* Print the Section text
323
*/
324
public function printMessageSenderSectionInfo() {
325
- print sprintf( __( 'This address, like the <b>return address</b> printed on an envelope, identifies the account owner to the SMTP server.', Postman::TEXT_DOMAIN ), 'https://support.google.com/mail/answer/22370?hl=en' );
326
}
327
328
/**
@@ -330,7 +351,7 @@ class PostmanSettingsRegistry {
330
*/
331
public function prevent_from_email_override_callback() {
332
$enforced = $this->options->isPluginSenderEmailEnforced();
333
- printf( '<input type="checkbox" id="input_prevent_sender_email_override" name="postman_options[prevent_sender_email_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', Postman::TEXT_DOMAIN ) );
334
}
335
336
/**
@@ -343,8 +364,8 @@ class PostmanSettingsRegistry {
343
$disabled = 'disabled="disabled" ';
344
}
345
printf( '<select ' . $disabled . 'id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::MAIL_LOG_ENABLED_OPTION );
346
- printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_YES, $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'Yes', Postman::TEXT_DOMAIN ) );
347
- printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_NO, ! $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'No', Postman::TEXT_DOMAIN ) );
348
printf( '</select>' );
349
}
350
public function loggingMaxEntriesInputField() {
@@ -354,7 +375,7 @@ class PostmanSettingsRegistry {
354
$inputOptionsSlug = PostmanOptions::POSTMAN_OPTIONS;
355
$inputTranscriptSlug = PostmanOptions::TRANSCRIPT_SIZE;
356
$inputValue = $this->options->getTranscriptSize();
357
- $inputDescription = __( 'Change this value if you can\'t see the beginning of the transcript because your messages are too big.', Postman::TEXT_DOMAIN );
358
printf( '<input type="text" id="input%2$s" name="%1$s[%2$s]" value="%3$s"/><br/><span class="postman_input_description">%4$s</span>', $inputOptionsSlug, $inputTranscriptSlug, $inputValue, $inputDescription );
359
}
360
@@ -397,22 +418,22 @@ class PostmanSettingsRegistry {
397
*/
398
public function disable_email_validation_callback() {
399
$disabled = $this->options->isEmailValidationDisabled();
400
- printf( '<input type="checkbox" id="%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::DISABLE_EMAIL_VALIDAITON, $disabled ? 'checked="checked"' : '', __( 'Disable e-mail validation', Postman::TEXT_DOMAIN ) );
401
}
402
403
/**
404
* Get the settings option array and print one of its values
405
*/
406
public function log_level_callback() {
407
- $inputDescription = sprintf( __( 'Log Level specifies the level of detail written to the <a target="_blank" href="%s">WordPress Debug log</a> - view the log with <a target-"_new" href="%s">Debug</a>.', Postman::TEXT_DOMAIN ), 'https://codex.wordpress.org/Debugging_in_WordPress', 'https://wordpress.org/plugins/debug/' );
408
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::LOG_LEVEL );
409
$currentKey = $this->options->getLogLevel();
410
- $this->printSelectOption( __( 'Off', Postman::TEXT_DOMAIN ), PostmanLogger::OFF_INT, $currentKey );
411
- $this->printSelectOption( __( 'Trace', Postman::TEXT_DOMAIN ), PostmanLogger::TRACE_INT, $currentKey );
412
- $this->printSelectOption( __( 'Debug', Postman::TEXT_DOMAIN ), PostmanLogger::DEBUG_INT, $currentKey );
413
- $this->printSelectOption( __( 'Info', Postman::TEXT_DOMAIN ), PostmanLogger::INFO_INT, $currentKey );
414
- $this->printSelectOption( __( 'Warning', Postman::TEXT_DOMAIN ), PostmanLogger::WARN_INT, $currentKey );
415
- $this->printSelectOption( __( 'Error', Postman::TEXT_DOMAIN ), PostmanLogger::ERROR_INT, $currentKey );
416
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
417
}
418
@@ -421,9 +442,9 @@ class PostmanSettingsRegistry {
421
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::NOTIFICATION_SERVICE );
422
$currentKey = $this->options->getNotificationService();
423
424
- $this->printSelectOption( __( 'Email', Postman::TEXT_DOMAIN ), 'default', $currentKey );
425
- $this->printSelectOption( __( 'Pushover', Postman::TEXT_DOMAIN ), 'pushover', $currentKey );
426
- $this->printSelectOption( __( 'Slack', Postman::TEXT_DOMAIN ), 'slack', $currentKey );
427
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
428
}
429
@@ -446,7 +467,7 @@ class PostmanSettingsRegistry {
446
447
public function slack_token_callback() {
448
printf( '<input type="password" id="slack_token" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::SLACK_TOKEN, $this->options->getSlackToken() );
449
- echo '<a target="_blank" href="https://slack.postmansmtp.com/">' . __( 'Get your webhook URL here', Postman::TEXT_DOMAIN ) . '</a>';
450
451
}
452
@@ -455,26 +476,26 @@ class PostmanSettingsRegistry {
455
printf( $optionPattern, $optionKey, $optionKey == $currentKey ? 'selected="selected"' : '', $label );
456
}
457
public function runModeCallback() {
458
- $inputDescription = __( 'Delivery mode offers options useful for developing or testing.', Postman::TEXT_DOMAIN );
459
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::RUN_MODE );
460
$currentKey = $this->options->getRunMode();
461
- $this->printSelectOption( _x( 'Log Email and Send', 'When the server is online to the public, this is "Production" mode', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_PRODUCTION, $currentKey );
462
- $this->printSelectOption( __( 'Log Email and Delete', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_LOG_ONLY, $currentKey );
463
- $this->printSelectOption( __( 'Delete All Emails', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_IGNORE, $currentKey );
464
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
465
}
466
467
public function stealthModeCallback() {
468
- printf( '<input type="checkbox" id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::STEALTH_MODE, $this->options->isStealthModeEnabled() ? 'checked="checked"' : '', __( 'Remove the Postman X-Header signature from messages', Postman::TEXT_DOMAIN ) );
469
}
470
471
public function temporaryDirectoryCallback() {
472
$inputDescription = __( 'Lockfiles are written here to prevent users from triggering an OAuth 2.0 token refresh at the same time.' );
473
printf( '<input type="text" id="input_%2$s" name="%1$s[%2$s]" value="%3$s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TEMPORARY_DIRECTORY, $this->options->getTempDirectory() );
474
if ( PostmanState::getInstance()->isFileLockingEnabled() ) {
475
- printf( ' <span style="color:green">%s</span></br><span class="postman_input_description">%s</span>', __( 'Valid', Postman::TEXT_DOMAIN ), $inputDescription );
476
} else {
477
- printf( ' <span style="color:red">%s</span></br><span class="postman_input_description">%s</span>', __( 'Invalid', Postman::TEXT_DOMAIN ), $inputDescription );
478
}
479
}
480
@@ -496,6 +517,6 @@ class PostmanSettingsRegistry {
496
* Get the settings option array and print one of its values
497
*/
498
public function port_callback( $args ) {
499
- printf( '<input type="text" id="input_port" name="postman_options[port]" value="%s" %s placeholder="%s"/>', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', Postman::TEXT_DOMAIN ) );
500
}
501
}
28
) );
29
30
// Sanitize
31
+ add_settings_section( 'transport_section', __( 'Transport', 'post-smtp' ), array(
32
$this,
33
'printTransportSectionInfo',
34
), 'transport_options' );
35
36
+ add_settings_field( PostmanOptions::TRANSPORT_TYPE, _x( 'Type', '(i.e.) What kind is it?', 'post-smtp' ), array(
37
+ $this,
38
+ 'transport_type_callback',
39
+ ), 'transport_options', 'transport_section' );
40
+
41
+ add_settings_field( 'smtp_mailers', __( 'Mailer Type', 'post-smtp' ), array(
42
+ $this,
43
+ 'smtp_mailer_callback',
44
+ ), 'transport_options', 'transport_section' );
45
46
// the Message From section
47
+ add_settings_section( PostmanAdminController::MESSAGE_FROM_SECTION, _x( 'From Address', 'The Message Sender Email Address', 'post-smtp' ), array(
48
$this,
49
'printMessageFromSectionInfo',
50
), PostmanAdminController::MESSAGE_FROM_OPTIONS );
51
52
+ add_settings_field( PostmanOptions::MESSAGE_SENDER_EMAIL, __( 'Email Address', 'post-smtp' ), array(
53
$this,
54
'from_email_callback',
55
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
59
'prevent_from_email_override_callback',
60
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
61
62
+ add_settings_field( PostmanOptions::MESSAGE_SENDER_NAME, __( 'Name', 'post-smtp' ), array(
63
$this,
64
'sender_name_callback',
65
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
70
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
71
72
// the Additional Addresses section
73
+ add_settings_section( PostmanAdminController::MESSAGE_SECTION, __( 'Additional Email Addresses', 'post-smtp' ), array(
74
$this,
75
'printMessageSectionInfo',
76
), PostmanAdminController::MESSAGE_OPTIONS );
77
78
+ add_settings_field( PostmanOptions::REPLY_TO, __( 'Reply-To', 'post-smtp' ), array(
79
$this,
80
'reply_to_callback',
81
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
82
83
+ add_settings_field( PostmanOptions::FORCED_TO_RECIPIENTS, __( 'To Recipient(s)', 'post-smtp' ), array(
84
$this,
85
'to_callback',
86
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
87
88
+ add_settings_field( PostmanOptions::FORCED_CC_RECIPIENTS, __( 'Carbon Copy Recipient(s)', 'post-smtp' ), array(
89
$this,
90
'cc_callback',
91
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
92
93
+ add_settings_field( PostmanOptions::FORCED_BCC_RECIPIENTS, __( 'Blind Carbon Copy Recipient(s)', 'post-smtp' ), array(
94
$this,
95
'bcc_callback',
96
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
97
98
// the Additional Headers section
99
+ add_settings_section( PostmanAdminController::MESSAGE_HEADERS_SECTION, __( 'Additional Headers', 'post-smtp' ), array(
100
$this,
101
'printAdditionalHeadersSectionInfo',
102
), PostmanAdminController::MESSAGE_HEADERS_OPTIONS );
103
104
+ add_settings_field( PostmanOptions::ADDITIONAL_HEADERS, __( 'Custom Headers', 'post-smtp' ), array(
105
$this,
106
'headers_callback',
107
), PostmanAdminController::MESSAGE_HEADERS_OPTIONS, PostmanAdminController::MESSAGE_HEADERS_SECTION );
109
// Fallback
110
111
// the Email Validation section
112
+ add_settings_section( PostmanAdminController::EMAIL_VALIDATION_SECTION, __( 'Validation', 'post-smtp' ), array(
113
$this,
114
'printEmailValidationSectionInfo',
115
), PostmanAdminController::EMAIL_VALIDATION_OPTIONS );
116
117
+ add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Email Address', 'post-smtp' ), array(
118
$this,
119
'disable_email_validation_callback',
120
), PostmanAdminController::EMAIL_VALIDATION_OPTIONS, PostmanAdminController::EMAIL_VALIDATION_SECTION );
121
122
// the Logging section
123
+ add_settings_section( PostmanAdminController::LOGGING_SECTION, __( 'Email Log Settings', 'post-smtp' ), array(
124
$this,
125
'printLoggingSectionInfo',
126
), PostmanAdminController::LOGGING_OPTIONS );
127
128
+ add_settings_field( 'logging_status', __( 'Enable Logging', 'post-smtp' ), array(
129
$this,
130
'loggingStatusInputField',
131
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
132
133
+ add_settings_field( 'logging_max_entries', __( 'Maximum Log Entries', 'post-smtp' ), array(
134
$this,
135
'loggingMaxEntriesInputField',
136
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
137
138
+ add_settings_field( PostmanOptions::TRANSCRIPT_SIZE, __( 'Maximum Transcript Size', 'post-smtp' ), array(
139
$this,
140
'transcriptSizeInputField',
141
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
142
143
// the Network section
144
+ add_settings_section( PostmanAdminController::NETWORK_SECTION, __( 'Network Settings', 'post-smtp' ), array(
145
$this,
146
'printNetworkSectionInfo',
147
), PostmanAdminController::NETWORK_OPTIONS );
148
149
+ add_settings_field( 'connection_timeout', _x( 'TCP Connection Timeout (sec)', 'Configuration Input Field', 'post-smtp' ), array(
150
$this,
151
'connection_timeout_callback',
152
), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION );
153
154
+ add_settings_field( 'read_timeout', _x( 'TCP Read Timeout (sec)', 'Configuration Input Field', 'post-smtp' ), array(
155
$this,
156
'read_timeout_callback',
157
), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION );
158
159
// the Advanced section
160
+ add_settings_section( PostmanAdminController::ADVANCED_SECTION, _x( 'Miscellaneous Settings', 'Configuration Section Title', 'post-smtp' ), array(
161
$this,
162
'printAdvancedSectionInfo',
163
), PostmanAdminController::ADVANCED_OPTIONS );
164
165
+ add_settings_field( PostmanOptions::LOG_LEVEL, _x( 'PHP Log Level', 'Configuration Input Field', 'post-smtp' ), array(
166
$this,
167
'log_level_callback',
168
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
169
170
+ add_settings_field( PostmanOptions::RUN_MODE, _x( 'Delivery Mode', 'Configuration Input Field', 'post-smtp' ), array(
171
$this,
172
'runModeCallback',
173
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
174
175
+ add_settings_field( PostmanOptions::STEALTH_MODE, _x( 'Stealth Mode', 'This mode removes the Postman X-Mailer signature from emails', 'post-smtp' ), array(
176
$this,
177
'stealthModeCallback',
178
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
179
180
+ add_settings_field( PostmanOptions::TEMPORARY_DIRECTORY, __( 'Temporary Directory', 'post-smtp' ), array(
181
$this,
182
'temporaryDirectoryCallback',
183
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
184
185
// Notifications
186
+ add_settings_section( PostmanAdminController::NOTIFICATIONS_SECTION, _x( 'Notifications Settings', 'Configuration Section Title', 'post-smtp' ), array(
187
$this,
188
'printNotificationsSectionInfo',
189
), PostmanAdminController::NOTIFICATIONS_OPTIONS );
190
191
+ add_settings_field( PostmanOptions::NOTIFICATION_SERVICE, _x( 'Notification Service', 'Configuration Input Field', 'post-smtp' ), array(
192
$this,
193
'notification_service_callback',
194
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
195
196
// Pushover
197
+ add_settings_section( 'pushover_credentials', _x( 'Pushover Credentials', 'Configuration Section Title', 'post-smtp' ), array(
198
$this,
199
'printNotificationsSectionInfo',
200
), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED );
201
202
+ add_settings_field( PostmanOptions::PUSHOVER_USER, _x( 'Pushover User Key', 'Configuration Input Field', 'post-smtp' ), array(
203
$this,
204
'pushover_user_callback',
205
), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED, 'pushover_credentials' );
206
207
+ add_settings_field( PostmanOptions::PUSHOVER_TOKEN, _x( 'Pushover App Token', 'Configuration Input Field', 'post-smtp' ), array(
208
$this,
209
'pushover_token_callback',
210
), PostmanAdminController::NOTIFICATIONS_PUSHOVER_CRED, 'pushover_credentials' );
211
212
// Slack
213
+ add_settings_section( 'slack_credentials', _x( 'Slack Credentials', 'Configuration Section Title', 'post-smtp' ), array(
214
$this,
215
'printNotificationsSectionInfo',
216
), PostmanAdminController::NOTIFICATIONS_SLACK_CRED );
217
218
+ add_settings_field( PostmanOptions::SLACK_TOKEN, _x( 'Slack Webhook', 'Configuration Input Field', 'post-smtp' ), array(
219
$this,
220
'slack_token_callback',
221
), PostmanAdminController::NOTIFICATIONS_SLACK_CRED, 'slack_credentials' );
222
223
+ add_settings_field( PostmanOptions::NOTIFICATION_USE_CHROME, _x( 'Push to chrome extension', 'Configuration Input Field', 'post-smtp' ), array(
224
$this,
225
'notification_use_chrome_callback',
226
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
227
228
+ add_settings_field( PostmanOptions::NOTIFICATION_CHROME_UID, _x( 'Chrome Extension UID', 'Configuration Input Field', 'post-smtp' ), array(
229
$this,
230
'notification_chrome_uid_callback',
231
), PostmanAdminController::NOTIFICATIONS_OPTIONS, PostmanAdminController::NOTIFICATIONS_SECTION );
237
* Print the Transport section info
238
*/
239
public function printTransportSectionInfo() {
240
+ print __( 'Choose SMTP or a vendor-specific API:', 'post-smtp' );
241
}
242
public function printLoggingSectionInfo() {
243
+ print __( 'Configure the delivery audit log:', 'post-smtp' );
244
}
245
246
/**
247
* Print the Section text
248
*/
249
public function printMessageFromSectionInfo() {
250
+ print sprintf( __( 'This address, like the <b>letterhead</b> printed on a letter, identifies the sender to the recipient. Change this when you are sending on behalf of someone else, for example to use Google\'s <a href="%s">Send Mail As</a> feature. Other plugins, especially Contact Forms, may override this field to be your visitor\'s address.', 'post-smtp' ), 'https://support.google.com/mail/answer/22370?hl=en' );
251
}
252
253
/**
254
* Print the Section text
255
*/
256
public function printMessageSectionInfo() {
257
+ print __( 'Separate multiple <b>to</b>/<b>cc</b>/<b>bcc</b> recipients with commas.', 'post-smtp' );
258
}
259
260
/**
261
* Print the Section text
262
*/
263
public function printNetworkSectionInfo() {
264
+ print __( 'Increase the timeouts if your host is intermittenly failing to send mail. Be careful, this also correlates to how long your user must wait if the mail server is unreachable.', 'post-smtp' );
265
}
266
267
/**
280
* Print the Section text
281
*/
282
public function printAdditionalHeadersSectionInfo() {
283
+ print __( 'Specify custom headers (e.g. <code>X-MC-Tags: wordpress-site-A</code>), one per line. Use custom headers with caution as they can negatively affect your Spam score.', 'post-smtp' );
284
}
285
286
/**
287
* Print the Email Validation Description
288
*/
289
public function printEmailValidationSectionInfo() {
290
+ print __( 'E-mail addresses can be validated before sending e-mail, however this may fail with some newer domains.', 'post-smtp' );
291
}
292
293
/**
302
print '</select>';
303
}
304
305
+ /**
306
+ * Get the settings option array and print one of its values
307
+ */
308
+ public function smtp_mailer_callback() {
309
+ $smtp_mailers = PostmanOptions::SMTP_MAILERS;
310
+ $current_smtp_mailer = $this->options->getSmtpMailer();
311
+ printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, 'smtp_mailers' );
312
+ foreach ( $smtp_mailers as $key => $smtp_mailer ) {
313
+ printf( '<option class="input_tx_type_%1$s" value="%1$s" %3$s>%2$s</option>', $key, $smtp_mailer, $current_smtp_mailer == $key ? 'selected="selected"' : '' );
314
+ }
315
+ print '</select>';
316
+ ?>
317
+ <p class="description" id="mailer-type-description"><?php _e( 'Beta Feature: Change this to <strong>PHPMailer</strong> only if you see <code>wp_mail</code> conflict message, conflicts when another plugin is activated, and <strong><u>sometimes</u></strong> spam issues.', 'post-smtp' ); ?></p>
318
+ <?php
319
+ }
320
+
321
/**
322
* Get the settings option array and print one of its values
323
*/
329
*/
330
public function prevent_from_name_override_callback() {
331
$enforced = $this->options->isPluginSenderNameEnforced();
332
+ printf( '<input type="checkbox" id="input_prevent_sender_name_override" name="postman_options[prevent_sender_name_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', 'post-smtp' ) );
333
}
334
335
/**
336
* Get the settings option array and print one of its values
337
*/
338
public function from_email_callback() {
339
+ printf( '<input type="email" id="input_sender_email" name="postman_options[sender_email]" value="%s" size="40" class="required" placeholder="%s"/>', null !== $this->options->getMessageSenderEmail() ? esc_attr( $this->options->getMessageSenderEmail() ) : '', __( 'Required', 'post-smtp' ) );
340
}
341
342
/**
343
* Print the Section text
344
*/
345
public function printMessageSenderSectionInfo() {
346
+ print sprintf( __( 'This address, like the <b>return address</b> printed on an envelope, identifies the account owner to the SMTP server.', 'post-smtp' ), 'https://support.google.com/mail/answer/22370?hl=en' );
347
}
348
349
/**
351
*/
352
public function prevent_from_email_override_callback() {
353
$enforced = $this->options->isPluginSenderEmailEnforced();
354
+ printf( '<input type="checkbox" id="input_prevent_sender_email_override" name="postman_options[prevent_sender_email_override]" %s /> %s', $enforced ? 'checked="checked"' : '', __( 'Prevent <b>plugins</b> and <b>themes</b> from changing this', 'post-smtp' ) );
355
}
356
357
/**
364
$disabled = 'disabled="disabled" ';
365
}
366
printf( '<select ' . $disabled . 'id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::MAIL_LOG_ENABLED_OPTION );
367
+ printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_YES, $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'Yes', 'post-smtp' ) );
368
+ printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_NO, ! $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'No', 'post-smtp' ) );
369
printf( '</select>' );
370
}
371
public function loggingMaxEntriesInputField() {
375
$inputOptionsSlug = PostmanOptions::POSTMAN_OPTIONS;
376
$inputTranscriptSlug = PostmanOptions::TRANSCRIPT_SIZE;
377
$inputValue = $this->options->getTranscriptSize();
378
+ $inputDescription = __( 'Change this value if you can\'t see the beginning of the transcript because your messages are too big.', 'post-smtp' );
379
printf( '<input type="text" id="input%2$s" name="%1$s[%2$s]" value="%3$s"/><br/><span class="postman_input_description">%4$s</span>', $inputOptionsSlug, $inputTranscriptSlug, $inputValue, $inputDescription );
380
}
381
418
*/
419
public function disable_email_validation_callback() {
420
$disabled = $this->options->isEmailValidationDisabled();
421
+ printf( '<input type="checkbox" id="%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::DISABLE_EMAIL_VALIDAITON, $disabled ? 'checked="checked"' : '', __( 'Disable e-mail validation', 'post-smtp' ) );
422
}
423
424
/**
425
* Get the settings option array and print one of its values
426
*/
427
public function log_level_callback() {
428
+ $inputDescription = sprintf( __( 'Log Level specifies the level of detail written to the <a target="_blank" href="%s">WordPress Debug log</a> - view the log with <a target-"_new" href="%s">Debug</a>.', 'post-smtp' ), 'https://codex.wordpress.org/Debugging_in_WordPress', 'https://wordpress.org/plugins/debug/' );
429
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::LOG_LEVEL );
430
$currentKey = $this->options->getLogLevel();
431
+ $this->printSelectOption( __( 'Off', 'post-smtp' ), PostmanLogger::OFF_INT, $currentKey );
432
+ $this->printSelectOption( __( 'Trace', 'post-smtp' ), PostmanLogger::TRACE_INT, $currentKey );
433
+ $this->printSelectOption( __( 'Debug', 'post-smtp' ), PostmanLogger::DEBUG_INT, $currentKey );
434
+ $this->printSelectOption( __( 'Info', 'post-smtp' ), PostmanLogger::INFO_INT, $currentKey );
435
+ $this->printSelectOption( __( 'Warning', 'post-smtp' ), PostmanLogger::WARN_INT, $currentKey );
436
+ $this->printSelectOption( __( 'Error', 'post-smtp' ), PostmanLogger::ERROR_INT, $currentKey );
437
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
438
}
439
442
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::NOTIFICATION_SERVICE );
443
$currentKey = $this->options->getNotificationService();
444
445
+ $this->printSelectOption( __( 'Email', 'post-smtp' ), 'default', $currentKey );
446
+ $this->printSelectOption( __( 'Pushover', 'post-smtp' ), 'pushover', $currentKey );
447
+ $this->printSelectOption( __( 'Slack', 'post-smtp' ), 'slack', $currentKey );
448
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
449
}
450
467
468
public function slack_token_callback() {
469
printf( '<input type="password" id="slack_token" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::SLACK_TOKEN, $this->options->getSlackToken() );
470
+ echo '<a target="_blank" href="https://slack.postmansmtp.com/">' . __( 'Get your webhook URL here', 'post-smtp' ) . '</a>';
471
472
}
473
476
printf( $optionPattern, $optionKey, $optionKey == $currentKey ? 'selected="selected"' : '', $label );
477
}
478
public function runModeCallback() {
479
+ $inputDescription = __( 'Delivery mode offers options useful for developing or testing.', 'post-smtp' );
480
printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::RUN_MODE );
481
$currentKey = $this->options->getRunMode();
482
+ $this->printSelectOption( _x( 'Log Email and Send', 'When the server is online to the public, this is "Production" mode', 'post-smtp' ), PostmanOptions::RUN_MODE_PRODUCTION, $currentKey );
483
+ $this->printSelectOption( __( 'Log Email and Delete', 'post-smtp' ), PostmanOptions::RUN_MODE_LOG_ONLY, $currentKey );
484
+ $this->printSelectOption( __( 'Delete All Emails', 'post-smtp' ), PostmanOptions::RUN_MODE_IGNORE, $currentKey );
485
printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
486
}
487
488
public function stealthModeCallback() {
489
+ printf( '<input type="checkbox" id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]" %3$s /> %4$s', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::STEALTH_MODE, $this->options->isStealthModeEnabled() ? 'checked="checked"' : '', __( 'Remove the Postman X-Header signature from messages', 'post-smtp' ) );
490
}
491
492
public function temporaryDirectoryCallback() {
493
$inputDescription = __( 'Lockfiles are written here to prevent users from triggering an OAuth 2.0 token refresh at the same time.' );
494
printf( '<input type="text" id="input_%2$s" name="%1$s[%2$s]" value="%3$s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TEMPORARY_DIRECTORY, $this->options->getTempDirectory() );
495
if ( PostmanState::getInstance()->isFileLockingEnabled() ) {
496
+ printf( ' <span style="color:green">%s</span></br><span class="postman_input_description">%s</span>', __( 'Valid', 'post-smtp' ), $inputDescription );
497
} else {
498
+ printf( ' <span style="color:red">%s</span></br><span class="postman_input_description">%s</span>', __( 'Invalid', 'post-smtp' ), $inputDescription );
499
}
500
}
501
517
* Get the settings option array and print one of its values
518
*/
519
public function port_callback( $args ) {
520
+ printf( '<input type="text" id="input_port" name="postman_options[port]" value="%s" %s placeholder="%s"/>', null !== $this->options->getPort() ? esc_attr( $this->options->getPort() ) : '', isset( $args ['style'] ) ? $args ['style'] : '', __( 'Required', 'post-smtp' ) );
521
}
522
}
Postman/Postman-Configuration/PostmanSmtpDiscovery.php CHANGED
@@ -117,7 +117,7 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) {
117
/**
118
* Constructor
119
*
120
- * @param unknown $email
121
*/
122
public function __construct($email) {
123
$this->email = $email;
@@ -137,8 +137,8 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) {
137
}
138
/**
139
*
140
- * @param unknown $email
141
- * @return Ambigous <number, boolean>
142
*/
143
private function validateEmail($email) {
144
return PostmanUtils::validateEmail ( $email );
@@ -171,7 +171,7 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) {
171
/**
172
* Uses getmxrr to retrieve the MX records of a hostname
173
*
174
- * @param unknown $hostname
175
* @return mixed|boolean
176
*/
177
private function findMxHostViaDns($hostname) {
@@ -201,9 +201,9 @@ if (! class_exists ( 'PostmanSmtpDiscovery' )) {
201
* This is a custom implementation of mxrr for Windows PHP installations
202
* which don't have this method natively.
203
*
204
- * @param unknown $hostname
205
- * @param unknown $mxhosts
206
- * @param unknown $mxweight
207
* @return boolean
208
*/
209
function getmxrr($hostname, &$mxhosts, &$mxweight) {
117
/**
118
* Constructor
119
*
120
+ * @param mixed $email
121
*/
122
public function __construct($email) {
123
$this->email = $email;
137
}
138
/**
139
*
140
+ * @param mixed $email
141
+ * @return string|bool
142
*/
143
private function validateEmail($email) {
144
return PostmanUtils::validateEmail ( $email );
171
/**
172
* Uses getmxrr to retrieve the MX records of a hostname
173
*
174
+ * @param mixed $hostname
175
* @return mixed|boolean
176
*/
177
private function findMxHostViaDns($hostname) {
201
* This is a custom implementation of mxrr for Windows PHP installations
202
* which don't have this method natively.
203
*
204
+ * @param mixed $hostname
205
+ * @param mixed $mxhosts
206
+ * @param mixed $mxweight
207
* @return boolean
208
*/
209
function getmxrr($hostname, &$mxhosts, &$mxweight) {
Postman/Postman-Connectivity-Test/Postman-PortTest.php CHANGED
@@ -50,8 +50,8 @@ class PostmanPortTest {
50
/**
51
* Wrap the regDomain/getRegisteredDomain function
52
*
53
- * @param unknown $domain
54
- * @return unknown|Ambigous <NULL, string, unknown, mixed>
55
*/
56
private function getRegisteredDomain($hostname) {
57
$registeredDomain = getRegisteredDomain ( $hostname );
50
/**
51
* Wrap the regDomain/getRegisteredDomain function
52
*
53
+ * @param mixed $domain
54
+ * @return mixed
55
*/
56
private function getRegisteredDomain($hostname) {
57
$registeredDomain = getRegisteredDomain ( $hostname );
Postman/Postman-Connectivity-Test/PostmanConnectivityTestController.php CHANGED
@@ -13,7 +13,7 @@ class PostmanConnectivityTestController {
13
/**
14
* Constructor
15
*
16
- * @param unknown $rootPluginFilenameAndPath
17
*/
18
public function __construct( $rootPluginFilenameAndPath ) {
19
assert( ! empty( $rootPluginFilenameAndPath ) );
@@ -77,7 +77,7 @@ class PostmanConnectivityTestController {
77
* Register the Email Test screen
78
*/
79
public function addPortTestSubmenu() {
80
- $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConnectivityTestController::PORT_TEST_SLUG, array(
81
$this,
82
'outputPortTestContent',
83
) );
@@ -93,26 +93,26 @@ class PostmanConnectivityTestController {
93
function enqueuePortTestResources() {
94
wp_enqueue_style( PostmanViewController::POSTMAN_STYLE );
95
wp_enqueue_script( 'postman_port_test_script' );
96
- $warning = __( 'Warning', Postman::TEXT_DOMAIN );
97
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_hostname_element_name', '#input_' . PostmanOptions::HOSTNAME );
98
PostmanConnectivityTestController::addLocalizeScriptForPortTest();
99
}
100
static function addLocalizeScriptForPortTest() {
101
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_port_test', array(
102
- 'in_progress' => _x( 'Checking..', 'The "please wait" message', Postman::TEXT_DOMAIN ),
103
- 'open' => _x( 'Open', 'The port is open', Postman::TEXT_DOMAIN ),
104
- 'closed' => _x( 'Closed', 'The port is closed', Postman::TEXT_DOMAIN ),
105
- 'yes' => __( 'Yes', Postman::TEXT_DOMAIN ),
106
- 'no' => __( 'No', Postman::TEXT_DOMAIN ),
107
/* translators: where %d is a port number */
108
- 'blocked' => __( 'No outbound route between this site and the Internet on Port %d.', Postman::TEXT_DOMAIN ),
109
/* translators: where %d is a port number and %s is a hostname */
110
- 'try_dif_smtp' => __( 'Port %d is open, but not to %s.', Postman::TEXT_DOMAIN ),
111
/* translators: where %d is the port number and %s is the hostname */
112
- 'success' => __( 'Port %d can be used for SMTP to %s.', Postman::TEXT_DOMAIN ),
113
- 'mitm' => sprintf( '%s: %s', __( 'Warning', Postman::TEXT_DOMAIN ), __( 'connected to %1$s instead of %2$s.', Postman::TEXT_DOMAIN ) ),
114
/* translators: where %d is a port number and %s is the URL for the Postman Gmail Extension */
115
- 'https_success' => __( 'Port %d can be used with the %s.', Postman::TEXT_DOMAIN ),
116
) );
117
}
118
@@ -132,46 +132,46 @@ class PostmanConnectivityTestController {
132
public function outputPortTestContent() {
133
print '<div class="wrap">';
134
135
- PostmanViewController::outputChildPageHeader( __( 'Connectivity Test', Postman::TEXT_DOMAIN ) );
136
137
print '<p>';
138
- print __( 'This test determines which well-known ports are available for Postman to use.', Postman::TEXT_DOMAIN );
139
print '<form id="port_test_form_id" method="post">';
140
- printf( '<label for="hostname">%s</label>', __( 'Outgoing Mail Server Hostname', Postman::TEXT_DOMAIN ) );
141
$this->port_test_hostname_callback();
142
- submit_button( _x( 'Begin Test', 'Button Label', Postman::TEXT_DOMAIN ), 'primary', 'begin-port-test', true );
143
print '</form>';
144
print '<table id="connectivity_test_table">';
145
- print sprintf( '<tr><th rowspan="2">%s</th><th rowspan="2">%s</th><th rowspan="2">%s</th><th rowspan="2">%s</th><th rowspan="2">%s</th><th colspan="5">%s</th></tr>', __( 'Transport', Postman::TEXT_DOMAIN ), _x( 'Socket', 'A socket is the network term for host and port together', Postman::TEXT_DOMAIN ), __( 'Status', Postman::TEXT_DOMAIN ) . '<sup>*</sup>', __( 'Service Available', Postman::TEXT_DOMAIN ), __( 'Server ID', Postman::TEXT_DOMAIN ), __( 'Authentication', Postman::TEXT_DOMAIN ) );
146
print sprintf( '<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>', 'None', 'Login', 'Plain', 'CRAM-MD5', 'OAuth 2.0' );
147
$sockets = PostmanTransportRegistry::getInstance()->getSocketsForSetupWizardToProbe();
148
foreach ( $sockets as $socket ) {
149
if ( $socket ['smtp'] ) {
150
print sprintf( '<tr id="%s"><th class="name">%s</th><td class="socket">%s:%s</td><td class="firewall resettable">-</td><td class="service resettable">-</td><td class="reported_id resettable">-</td><td class="auth_none resettable">-</td><td class="auth_login resettable">-</td><td class="auth_plain resettable">-</td><td class="auth_crammd5 resettable">-</td><td class="auth_xoauth2 resettable">-</td></tr>', $socket ['id'], $socket ['transport_name'], $socket ['host'], $socket ['port'] );
151
} else {
152
- print sprintf( '<tr id="%s"><th class="name">%s</th><td class="socket">%s:%s</td><td class="firewall resettable">-</td><td class="service resettable">-</td><td class="reported_id resettable">-</td><td colspan="5">%s</td></tr>', $socket ['id'], $socket ['transport_name'], $socket ['host'], $socket ['port'], __( 'n/a', Postman::TEXT_DOMAIN ) );
153
}
154
}
155
print '</table>';
156
/* Translators: Where %s is the name of the service providing Internet connectivity test */
157
- printf( '<p class="portquiz" style="display:none; font-size:0.8em">* %s</p>', sprintf( __( 'According to %s', Postman::TEXT_DOMAIN ), '<a target="_blank" href="https://downor.me/portquiz.net">portquiz.net</a>' ) );
158
printf( '<p class="ajax-loader" style="display:none"><img src="%s"/></p>', plugins_url( 'post-smtp/style/ajax-loader.gif' ) );
159
print '<section id="conclusion" style="display:none">';
160
- print sprintf( '<h3>%s:</h3>', __( 'Summary', Postman::TEXT_DOMAIN ) );
161
print '<ol class="conclusion">';
162
print '</ol>';
163
print '</section>';
164
print '<section id="blocked-port-help" style="display:none">';
165
- print sprintf( '<p><b>%s</b></p>', __( 'A test with <span style="color:red">"No"</span> Service Available indicates one or more of these issues:', Postman::TEXT_DOMAIN ) );
166
print '<ol>';
167
- printf( '<li>%s</li>', __( 'Your web host has placed a firewall between this site and the Internet', Postman::TEXT_DOMAIN ) );
168
- printf( '<li>%s</li>', __( 'The SMTP hostname is wrong or the mail server does not provide service on this port', Postman::TEXT_DOMAIN ) );
169
/* translators: where (1) is the URL and (2) is the system */
170
- $systemBlockMessage = __( 'Your <a href="%1$s">%2$s configuration</a> is preventing outbound connections', Postman::TEXT_DOMAIN );
171
printf( '<li>%s</li>', sprintf( $systemBlockMessage, 'http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen', 'PHP' ) );
172
printf( '<li>%s</li>', sprintf( $systemBlockMessage, 'http://wp-mix.com/disable-external-url-requests/', 'WordPress' ) );
173
print '</ol></p>';
174
- print sprintf( '<p><b>%s</b></p>', __( 'If the issues above can not be resolved, your last option is to configure Postman to use an email account managed by your web host with an SMTP server managed by your web host.', Postman::TEXT_DOMAIN ) );
175
print '</section>';
176
print '</div>';
177
}
@@ -271,9 +271,9 @@ class PostmanPortTestAjaxController {
271
272
/**
273
*
274
- * @param unknown $hostname
275
- * @param unknown $port
276
- * @param unknown $success
277
*/
278
private function buildResponse( $hostname, $port, PostmanPortTest $portTest, $success, $transport = '' ) {
279
$this->logger->debug( sprintf( 'testing port result for %s:%s success=%s', $hostname, $port, $success ) );
13
/**
14
* Constructor
15
*
16
+ * @param mixed $rootPluginFilenameAndPath
17
*/
18
public function __construct( $rootPluginFilenameAndPath ) {
19
assert( ! empty( $rootPluginFilenameAndPath ) );
77
* Register the Email Test screen
78
*/
79
public function addPortTestSubmenu() {
80
+ $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanConnectivityTestController::PORT_TEST_SLUG, array(
81
$this,
82
'outputPortTestContent',
83
) );
93
function enqueuePortTestResources() {
94
wp_enqueue_style( PostmanViewController::POSTMAN_STYLE );
95
wp_enqueue_script( 'postman_port_test_script' );
96
+ $warning = __( 'Warning', 'post-smtp' );
97
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_hostname_element_name', '#input_' . PostmanOptions::HOSTNAME );
98
PostmanConnectivityTestController::addLocalizeScriptForPortTest();
99
}
100
static function addLocalizeScriptForPortTest() {
101
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_port_test', array(
102
+ 'in_progress' => _x( 'Checking..', 'The "please wait" message', 'post-smtp' ),
103
+ 'open' => _x( 'Open', 'The port is open', 'post-smtp' ),
104
+ 'closed' => _x( 'Closed', 'The port is closed', 'post-smtp' ),
105
+ 'yes' => __( 'Yes', 'post-smtp' ),
106
+ 'no' => __( 'No', 'post-smtp' ),
107
/* translators: where %d is a port number */
108
+ 'blocked' => __( 'No outbound route between this site and the Internet on Port %d.', 'post-smtp' ),
109
/* translators: where %d is a port number and %s is a hostname */
110
+ 'try_dif_smtp' => __( 'Port %d is open, but not to %s.', 'post-smtp' ),
111
/* translators: where %d is the port number and %s is the hostname */
112
+ 'success' => __( 'Port %d can be used for SMTP to %s.', 'post-smtp' ),
113
+ 'mitm' => sprintf( '%s: %s', __( 'Warning', 'post-smtp' ), __( 'connected to %1$s instead of %2$s.', 'post-smtp' ) ),
114
/* translators: where %d is a port number and %s is the URL for the Postman Gmail Extension */
115
+ 'https_success' => __( 'Port %d can be used with the %s.', 'post-smtp' ),
116
) );
117
}
118
132
public function outputPortTestContent() {
133
print '<div class="wrap">';
134
135
+ PostmanViewController::outputChildPageHeader( __( 'Connectivity Test', 'post-smtp' ) );
136
137
print '<p>';
138
+ print __( 'This test determines which well-known ports are available for Postman to use.', 'post-smtp' );
139
print '<form id="port_test_form_id" method="post">';
140
+ printf( '<label for="hostname">%s</label>', __( 'Outgoing Mail Server Hostname', 'post-smtp' ) );
141
$this->port_test_hostname_callback();
142
+ submit_button( _x( 'Begin Test', 'Button Label', 'post-smtp' ), 'primary', 'begin-port-test', true );
143
print '</form>';
144
print '<table id="connectivity_test_table">';
145
+ print sprintf( '<tr><th rowspan="2">%s</th><th rowspan="2">%s</th><th rowspan="2">%s</th><th rowspan="2">%s</th><th rowspan="2">%s</th><th colspan="5">%s</th></tr>', __( 'Transport', 'post-smtp' ), _x( 'Socket', 'A socket is the network term for host and port together', 'post-smtp' ), __( 'Status', 'post-smtp' ) . '<sup>*</sup>', __( 'Service Available', 'post-smtp' ), __( 'Server ID', 'post-smtp' ), __( 'Authentication', 'post-smtp' ) );
146
print sprintf( '<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>', 'None', 'Login', 'Plain', 'CRAM-MD5', 'OAuth 2.0' );
147
$sockets = PostmanTransportRegistry::getInstance()->getSocketsForSetupWizardToProbe();
148
foreach ( $sockets as $socket ) {
149
if ( $socket ['smtp'] ) {
150
print sprintf( '<tr id="%s"><th class="name">%s</th><td class="socket">%s:%s</td><td class="firewall resettable">-</td><td class="service resettable">-</td><td class="reported_id resettable">-</td><td class="auth_none resettable">-</td><td class="auth_login resettable">-</td><td class="auth_plain resettable">-</td><td class="auth_crammd5 resettable">-</td><td class="auth_xoauth2 resettable">-</td></tr>', $socket ['id'], $socket ['transport_name'], $socket ['host'], $socket ['port'] );
151
} else {
152
+ print sprintf( '<tr id="%s"><th class="name">%s</th><td class="socket">%s:%s</td><td class="firewall resettable">-</td><td class="service resettable">-</td><td class="reported_id resettable">-</td><td colspan="5">%s</td></tr>', $socket ['id'], $socket ['transport_name'], $socket ['host'], $socket ['port'], __( 'n/a', 'post-smtp' ) );
153
}
154
}
155
print '</table>';
156
/* Translators: Where %s is the name of the service providing Internet connectivity test */
157
+ printf( '<p class="portquiz" style="display:none; font-size:0.8em">* %s</p>', sprintf( __( 'According to %s', 'post-smtp' ), '<a target="_blank" href="https://downor.me/portquiz.net">portquiz.net</a>' ) );
158
printf( '<p class="ajax-loader" style="display:none"><img src="%s"/></p>', plugins_url( 'post-smtp/style/ajax-loader.gif' ) );
159
print '<section id="conclusion" style="display:none">';
160
+ print sprintf( '<h3>%s:</h3>', __( 'Summary', 'post-smtp' ) );
161
print '<ol class="conclusion">';
162
print '</ol>';
163
print '</section>';
164
print '<section id="blocked-port-help" style="display:none">';
165
+ print sprintf( '<p><b>%s</b></p>', __( 'A test with <span style="color:red">"No"</span> Service Available indicates one or more of these issues:', 'post-smtp' ) );
166
print '<ol>';
167
+ printf( '<li>%s</li>', __( 'Your web host has placed a firewall between this site and the Internet', 'post-smtp' ) );
168
+ printf( '<li>%s</li>', __( 'The SMTP hostname is wrong or the mail server does not provide service on this port', 'post-smtp' ) );
169
/* translators: where (1) is the URL and (2) is the system */
170
+ $systemBlockMessage = __( 'Your <a href="%1$s">%2$s configuration</a> is preventing outbound connections', 'post-smtp' );
171
printf( '<li>%s</li>', sprintf( $systemBlockMessage, 'http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen', 'PHP' ) );
172
printf( '<li>%s</li>', sprintf( $systemBlockMessage, 'http://wp-mix.com/disable-external-url-requests/', 'WordPress' ) );
173
print '</ol></p>';
174
+ print sprintf( '<p><b>%s</b></p>', __( 'If the issues above can not be resolved, your last option is to configure Postman to use an email account managed by your web host with an SMTP server managed by your web host.', 'post-smtp' ) );
175
print '</section>';
176
print '</div>';
177
}
271
272
/**
273
*
274
+ * @param mixed $hostname
275
+ * @param mixed $port
276
+ * @param mixed $success
277
*/
278
private function buildResponse( $hostname, $port, PostmanPortTest $portTest, $success, $transport = '' ) {
279
$this->logger->debug( sprintf( 'testing port result for %s:%s success=%s', $hostname, $port, $success ) );
Postman/Postman-Controller/PostmanAdminPointer.php CHANGED
@@ -13,7 +13,7 @@ if (! class_exists ( 'PostmanAdminPointer' )) {
13
14
/**
15
*
16
- * @param unknown $rootPluginFilenameAndPath
17
*/
18
function __construct($rootPluginFilenameAndPath) {
19
$this->logger = new PostmanLogger ( get_class ( $this ) );
@@ -35,7 +35,7 @@ if (! class_exists ( 'PostmanAdminPointer' )) {
35
36
/**
37
*
38
- * @param unknown $hook_suffix
39
*/
40
function wptuts_pointer_load($hook_suffix) {
41
// only do this for administrators
13
14
/**
15
*
16
+ * @param mixed $rootPluginFilenameAndPath
17
*/
18
function __construct($rootPluginFilenameAndPath) {
19
$this->logger = new PostmanLogger ( get_class ( $this ) );
35
36
/**
37
*
38
+ * @param mixed $hook_suffix
39
*/
40
function wptuts_pointer_load($hook_suffix) {
41
// only do this for administrators
Postman/Postman-Controller/PostmanDashboardWidgetController.php CHANGED
@@ -54,7 +54,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) {
54
public function addDashboardWidget() {
55
// only display to the widget to administrator
56
if (PostmanUtils::isAdmin ()) {
57
- wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', Postman::TEXT_DOMAIN ), array (
58
$this,
59
'printDashboardWidget'
60
) ); // Display function.
@@ -67,7 +67,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) {
67
public function addNetworkDashboardWidget() {
68
// only display to the widget to administrator
69
if (PostmanUtils::isAdmin ()) {
70
- wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', Postman::TEXT_DOMAIN ), array (
71
$this,
72
'printNetworkDashboardWidget'
73
) ); // Display function.
@@ -78,8 +78,8 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) {
78
* Create the function to output the contents of our Dashboard Widget.
79
*/
80
public function printDashboardWidget() {
81
- $goToSettings = sprintf ( '<a href="%s">%s</a>', PostmanUtils::getSettingsPageUrl (), __ ( 'Settings', Postman::TEXT_DOMAIN ) );
82
- $goToEmailLog = sprintf ( '%s', _x ( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN ) );
83
if ($this->options->isMailLoggingEnabled ()) {
84
$goToEmailLog = sprintf ( '<a href="%s">%s</a>', PostmanUtils::getEmailLogPageUrl (), $goToEmailLog );
85
}
@@ -92,16 +92,16 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) {
92
*/
93
public function print_postman_status() {
94
if (! PostmanPreRequisitesCheck::isReady ()) {
95
- printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Error: Postman is missing a required PHP library.', Postman::TEXT_DOMAIN ) );
96
} else if ($this->wpMailBinder->isUnboundDueToException ()) {
97
- printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', Postman::TEXT_DOMAIN ) );
98
} else {
99
if ($this->options->getRunMode () != PostmanOptions::RUN_MODE_PRODUCTION) {
100
- printf ( '<p><span style="background-color:yellow">%s</span></p>', __ ( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', Postman::TEXT_DOMAIN ) );
101
} else if (PostmanTransportRegistry::getInstance ()->getSelectedTransport ()->isConfiguredAndReady ()) {
102
- printf ( '<p class="wp-menu-image dashicons-before dashicons-email"> %s </p>', sprintf ( _n ( '<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> email.', '<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> emails.', PostmanState::getInstance ()->getSuccessfulDeliveries (), Postman::TEXT_DOMAIN ), PostmanState::getInstance ()->getSuccessfulDeliveries () ) );
103
} else {
104
- printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN ) );
105
}
106
$currentTransport = PostmanTransportRegistry::getInstance ()->getActiveTransport ();
107
$deliveryDetails = $currentTransport->getDeliveryDetails ( $this->options );
@@ -113,14 +113,14 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) {
113
* Create the function to output the contents of our Dashboard Widget.
114
*/
115
public function printNetworkDashboardWidget() {
116
- printf ( '<p class="wp-menu-image dashicons-before dashicons-email"> %s</p>', __ ( 'Postman is operating in per-site mode.', Postman::TEXT_DOMAIN ) );
117
}
118
119
/**
120
* From http://www.hughlashbrooke.com/2014/02/wordpress-add-items-glance-widget/
121
* http://coffeecupweb.com/how-to-add-custom-post-types-to-at-a-glance-dashboard-widget-in-wordpress/
122
*
123
- * @param unknown $items
124
* @return string
125
*/
126
function customizeAtAGlanceDashboardWidget($items = array()) {
@@ -143,7 +143,7 @@ if (! class_exists ( "PostmanDashboardWidgetController" )) {
143
$privated = intval ( $num_posts->private );
144
$post_type = get_post_type_object ( $type );
145
146
- $text = _n ( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $privated, Postman::TEXT_DOMAIN );
147
$text = sprintf ( $text, number_format_i18n ( $privated ) );
148
149
$items [] = sprintf ( '<a class="%1$s-count" href="%3$s">%2$s</a>', $type, $text, PostmanUtils::getEmailLogPageUrl () ) . "\n";
54
public function addDashboardWidget() {
55
// only display to the widget to administrator
56
if (PostmanUtils::isAdmin ()) {
57
+ wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array (
58
$this,
59
'printDashboardWidget'
60
) ); // Display function.
67
public function addNetworkDashboardWidget() {
68
// only display to the widget to administrator
69
if (PostmanUtils::isAdmin ()) {
70
+ wp_add_dashboard_widget ( 'example_dashboard_widget', __ ( 'Postman SMTP', 'post-smtp' ), array (
71
$this,
72
'printNetworkDashboardWidget'
73
) ); // Display function.
78
* Create the function to output the contents of our Dashboard Widget.
79
*/
80
public function printDashboardWidget() {
81
+ $goToSettings = sprintf ( '<a href="%s">%s</a>', PostmanUtils::getSettingsPageUrl (), __ ( 'Settings', 'post-smtp' ) );
82
+ $goToEmailLog = sprintf ( '%s', _x ( 'Email Log', 'The log of Emails that have been delivered', 'post-smtp' ) );
83
if ($this->options->isMailLoggingEnabled ()) {
84
$goToEmailLog = sprintf ( '<a href="%s">%s</a>', PostmanUtils::getEmailLogPageUrl (), $goToEmailLog );
85
}
92
*/
93
public function print_postman_status() {
94
if (! PostmanPreRequisitesCheck::isReady ()) {
95
+ printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Error: Postman is missing a required PHP library.', 'post-smtp' ) );
96
} else if ($this->wpMailBinder->isUnboundDueToException ()) {
97
+ printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Postman: wp_mail has been declared by another plugin or theme, so you won\'t be able to use Postman until the conflict is resolved.', 'post-smtp' ) );
98
} else {
99
if ($this->options->getRunMode () != PostmanOptions::RUN_MODE_PRODUCTION) {
100
+ printf ( '<p><span style="background-color:yellow">%s</span></p>', __ ( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', 'post-smtp' ) );
101
} else if (PostmanTransportRegistry::getInstance ()->getSelectedTransport ()->isConfiguredAndReady ()) {
102
+ printf ( '<p class="wp-menu-image dashicons-before dashicons-email"> %s </p>', sprintf ( _n ( '<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> email.', '<span style="color:green">Postman is configured</span> and has delivered <span style="color:green">%d</span> emails.', PostmanState::getInstance ()->getSuccessfulDeliveries (), 'post-smtp' ), PostmanState::getInstance ()->getSuccessfulDeliveries () ) );
103
} else {
104
+ printf ( '<p><span style="color:red">%s</span></p>', __ ( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', 'post-smtp' ) );
105
}
106
$currentTransport = PostmanTransportRegistry::getInstance ()->getActiveTransport ();
107
$deliveryDetails = $currentTransport->getDeliveryDetails ( $this->options );
113
* Create the function to output the contents of our Dashboard Widget.
114
*/
115
public function printNetworkDashboardWidget() {
116
+ printf ( '<p class="wp-menu-image dashicons-before dashicons-email"> %s</p>', __ ( 'Postman is operating in per-site mode.', 'post-smtp' ) );
117
}
118
119
/**
120
* From http://www.hughlashbrooke.com/2014/02/wordpress-add-items-glance-widget/
121
* http://coffeecupweb.com/how-to-add-custom-post-types-to-at-a-glance-dashboard-widget-in-wordpress/
122
*
123
+ * @param mixed $items
124
* @return string
125
*/
126
function customizeAtAGlanceDashboardWidget($items = array()) {
143
$privated = intval ( $num_posts->private );
144
$post_type = get_post_type_object ( $type );
145
146
+ $text = _n ( '%s ' . $post_type->labels->singular_name, '%s ' . $post_type->labels->name, $privated, 'post-smtp' );
147
$text = sprintf ( $text, number_format_i18n ( $privated ) );
148
149
$items [] = sprintf ( '<a class="%1$s-count" href="%3$s">%2$s</a>', $type, $text, PostmanUtils::getEmailLogPageUrl () ) . "\n";
Postman/Postman-Controller/PostmanManageConfigurationAjaxHandler.php CHANGED
@@ -27,7 +27,7 @@ class PostmanWizardSocket {
27
28
/**
29
*
30
- * @param unknown $queryHostData
31
*/
32
function __construct($queryHostData) {
33
$this->hostname = $queryHostData ['hostname'];
27
28
/**
29
*
30
+ * @param mixed $queryHostData
31
*/
32
function __construct($queryHostData) {
33
$this->hostname = $queryHostData ['hostname'];
Postman/Postman-Controller/PostmanWelcomeController.php CHANGED
@@ -19,8 +19,8 @@ class PostmanWelcomeController {
19
20
// About
21
add_dashboard_page(
22
- __( 'Welcome', Postman::TEXT_DOMAIN ),
23
- __( 'Welcome', Postman::TEXT_DOMAIN ),
24
'manage_options',
25
'post-about',
26
array( $this, 'about_screen' )
@@ -28,8 +28,8 @@ class PostmanWelcomeController {
28
29
// Credits
30
add_dashboard_page(
31
- __( 'Credits', Postman::TEXT_DOMAIN ),
32
- __( 'Credits', Postman::TEXT_DOMAIN ),
33
'manage_options',
34
'post-credits',
35
array( $this, 'credits_screen' )
@@ -72,36 +72,36 @@ class PostmanWelcomeController {
72
}
73
</style>
74
<div class="wrap about-wrap">
75
- <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', Postman::TEXT_DOMAIN ), $this->version ); ?></h1>
76
- <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! Post SMTP %s is bundled up and ready to take your SMTP needs to the next level!', Postman::TEXT_DOMAIN ), $this->version ); ?><br>
77
<?php printf( '<strong>%s</strong>','Post SMTP support every SMTP service: Gmail/G-suite, SendGrid, Mandrill, Office365, and more...' ); ?>
78
</div>
79
- <div class="post-badge"><?php printf( esc_html__( 'Version %s', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
80
81
<h2 class="nav-tab-wrapper">
82
<a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>">
83
- <?php esc_html_e( 'What&#8217;s New', Postman::TEXT_DOMAIN ); ?>
84
</a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>">
85
- <?php esc_html_e( 'Credits', Postman::TEXT_DOMAIN ); ?>
86
</a>
87
</h2>
88
89
<div class="changelog">
90
- <h3><?php esc_html_e( 'Email Log', Postman::TEXT_DOMAIN ); ?></h3>
91
92
<div class="feature-section col two-col">
93
<div class="last-feature">
94
- <h4><?php esc_html_e( 'Email log filter', Postman::TEXT_DOMAIN ); ?></h4>
95
<p>
96
- <?php esc_html_e( 'You can easily filter by dates and search in your log.', Postman::TEXT_DOMAIN ); ?>
97
<img src="<?php echo $this->pluginUrl; ?>/images/filter-preview.gif">
98
</p>
99
</div>
100
101
<div>
102
- <h4><?php esc_html_e( 'Multiple emails resend', Postman::TEXT_DOMAIN ); ?></h4>
103
<p>
104
- <?php esc_html_e( 'Resend any email to the original recipient or any other emails you choose.', Postman::TEXT_DOMAIN ); ?>
105
<img src="<?php echo $this->pluginUrl; ?>/images/resend-preview.gif">
106
</p>
107
</div>
@@ -109,7 +109,7 @@ class PostmanWelcomeController {
109
</div>
110
111
<div class="changelog">
112
- <h3><?php esc_html_e( 'The best delivery experience', Postman::TEXT_DOMAIN ); ?></h3>
113
114
<div class="feature-section col one-col">
115
<div class="last-feature">
@@ -120,30 +120,30 @@ class PostmanWelcomeController {
120
Supports forced recipients (cc, bcc, to) and custom email headers,
121
SASL Support: Plain/Login/CRAM-MD5/XOAUTH2 authentication,
122
Security Support: SMTPS and STARTTLS (SSL/TLS),
123
- Copy configuration to other instances of Post.', Postman::TEXT_DOMAIN ); ?></p>
124
</div>
125
</div>
126
127
<div class="feature-section col three-col">
128
<div>
129
- <h4><?php esc_html_e( 'Email log HTML preview', Postman::TEXT_DOMAIN ); ?></h4>
130
- <p><?php esc_html_e( 'You can now see sent emails as HTML.', Postman::TEXT_DOMAIN ); ?></p>
131
</div>
132
133
<div>
134
- <h4><?php esc_html_e( 'Continues email delivery', Postman::TEXT_DOMAIN ); ?></h4>
135
- <p><?php esc_html_e( 'if email fail to sent you will get notified using the local mail system.', Postman::TEXT_DOMAIN ); ?></p>
136
</div>
137
138
<div class="last-feature">
139
- <h4><?php esc_html_e( 'The best debugging tools.', Postman::TEXT_DOMAIN ); ?></h4>
140
- <p><?php esc_html_e( 'Full Transcripts, Connectivity Test, Diagnostic Test.', Postman::TEXT_DOMAIN ); ?></p>
141
</div>
142
</div>
143
</div>
144
145
<div class="return-to-dashboard">
146
- <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', Postman::TEXT_DOMAIN ); ?></a>
147
</div>
148
149
</div>
@@ -170,36 +170,36 @@ class PostmanWelcomeController {
170
}
171
</style>
172
<div class="wrap about-wrap">
173
- <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', Postman::TEXT_DOMAIN ), $this->version ); ?></h1>
174
- <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! bbPress %s is waxed, polished, and ready for you to take it for a lap or two around the block!', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
175
- <div class="post-badge"><?php printf( esc_html__( 'Version %s', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
176
177
<h2 class="nav-tab-wrapper">
178
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
179
- <?php esc_html_e( 'What&#8217;s New', Postman::TEXT_DOMAIN ); ?>
180
</a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
181
- <?php esc_html_e( 'Credits', Postman::TEXT_DOMAIN ); ?>
182
</a>
183
</h2>
184
185
- <p class="about-description"><?php esc_html_e( 'Post SMTP started by Jason Hendriks, Jason left the project and Yehuda Hassine (me) continue his work.', Postman::TEXT_DOMAIN ); ?></p>
186
187
- <h4 class="wp-people-group"><?php esc_html_e( 'Project Leaders', Postman::TEXT_DOMAIN ); ?></h4>
188
<ul class="wp-people-group " id="wp-people-group-project-leaders">
189
<li class="wp-person" id="wp-person-jasonhendriks">
190
<a href="https://profiles.wordpress.org/jasonhendriks"><img src="https://secure.gravatar.com/avatar/8692c7b6084517a592f6cad107f7bcb0?s=60&d=mm&r=g" class="gravatar" alt="Jason Hendriks " /></a>
191
<a class="web" href="http://profiles.wordpress.org/matt">Jason Hendriks</a>
192
- <span class="title"><?php esc_html_e( 'Founding Developer (abandoned)', Postman::TEXT_DOMAIN ); ?></span>
193
</li>
194
<li class="wp-person" id="wp-person-yehudah">
195
<a href="http://profiles.wordpress.org/yehudah"><img src="https://secure.gravatar.com/avatar/c561638d04ea8fef351f974dbb9ece39?s=60&d=mm&r=g" class="gravatar" alt="Yehuda Hassine" /></a>
196
<a class="web" href="http://profiles.wordpress.org/yehudah">Yehuda Hassine</a>
197
- <span class="title"><?php esc_html_e( 'Lead Developer', Postman::TEXT_DOMAIN ); ?></span>
198
</li>
199
</ul>
200
201
- <h4 class="wp-people-group"><?php esc_html_e( 'Top Community Members', Postman::TEXT_DOMAIN ); ?></h4>
202
- <h5><?php esc_html_e( 'Here I will list top users that help Post SMTP grow (bugs, features, etc...)', Postman::TEXT_DOMAIN ); ?>
203
<p class="wp-credits-list">
204
<a href="http://profiles.wordpress.org/diegocanal">diegocanal</a>,
205
<a href="http://profiles.wordpress.org/jyourstone">Johan Yourstone</a>,
@@ -209,7 +209,7 @@ class PostmanWelcomeController {
209
</p>
210
211
<div class="return-to-dashboard">
212
- <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', Postman::TEXT_DOMAIN ); ?></a>
213
</div>
214
215
</div>
19
20
// About
21
add_dashboard_page(
22
+ __( 'Welcome', 'post-smtp' ),
23
+ __( 'Welcome', 'post-smtp' ),
24
'manage_options',
25
'post-about',
26
array( $this, 'about_screen' )
28
29
// Credits
30
add_dashboard_page(
31
+ __( 'Credits', 'post-smtp' ),
32
+ __( 'Credits', 'post-smtp' ),
33
'manage_options',
34
'post-credits',
35
array( $this, 'credits_screen' )
72
}
73
</style>
74
<div class="wrap about-wrap">
75
+ <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', 'post-smtp' ), $this->version ); ?></h1>
76
+ <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! Post SMTP %s is bundled up and ready to take your SMTP needs to the next level!', 'post-smtp' ), $this->version ); ?><br>
77
<?php printf( '<strong>%s</strong>','Post SMTP support every SMTP service: Gmail/G-suite, SendGrid, Mandrill, Office365, and more...' ); ?>
78
</div>
79
+ <div class="post-badge"><?php printf( esc_html__( 'Version %s', 'post-smtp' ), $this->version ); ?></div>
80
81
<h2 class="nav-tab-wrapper">
82
<a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>">
83
+ <?php esc_html_e( 'What&#8217;s New', 'post-smtp' ); ?>
84
</a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>">
85
+ <?php esc_html_e( 'Credits', 'post-smtp' ); ?>
86
</a>
87
</h2>
88
89
<div class="changelog">
90
+ <h3><?php esc_html_e( 'Email Log', 'post-smtp' ); ?></h3>
91
92
<div class="feature-section col two-col">
93
<div class="last-feature">
94
+ <h4><?php esc_html_e( 'Email log filter', 'post-smtp' ); ?></h4>
95
<p>
96
+ <?php esc_html_e( 'You can easily filter by dates and search in your log.', 'post-smtp' ); ?>
97
<img src="<?php echo $this->pluginUrl; ?>/images/filter-preview.gif">
98
</p>
99
</div>
100
101
<div>
102
+ <h4><?php esc_html_e( 'Multiple emails resend', 'post-smtp' ); ?></h4>
103
<p>
104
+ <?php esc_html_e( 'Resend any email to the original recipient or any other emails you choose.', 'post-smtp' ); ?>
105
<img src="<?php echo $this->pluginUrl; ?>/images/resend-preview.gif">
106
</p>
107
</div>
109
</div>
110
111
<div class="changelog">
112
+ <h3><?php esc_html_e( 'The best delivery experience', 'post-smtp' ); ?></h3>
113
114
<div class="feature-section col one-col">
115
<div class="last-feature">
120
Supports forced recipients (cc, bcc, to) and custom email headers,
121
SASL Support: Plain/Login/CRAM-MD5/XOAUTH2 authentication,
122
Security Support: SMTPS and STARTTLS (SSL/TLS),
123
+ Copy configuration to other instances of Post.', 'post-smtp' ); ?></p>
124
</div>
125
</div>
126
127
<div class="feature-section col three-col">
128
<div>
129
+ <h4><?php esc_html_e( 'Email log HTML preview', 'post-smtp' ); ?></h4>
130
+ <p><?php esc_html_e( 'You can now see sent emails as HTML.', 'post-smtp' ); ?></p>
131
</div>
132
133
<div>
134
+ <h4><?php esc_html_e( 'Continues email delivery', 'post-smtp' ); ?></h4>
135
+ <p><?php esc_html_e( 'if email fail to sent you will get notified using the local mail system.', 'post-smtp' ); ?></p>
136
</div>
137
138
<div class="last-feature">
139
+ <h4><?php esc_html_e( 'The best debugging tools.', 'post-smtp' ); ?></h4>
140
+ <p><?php esc_html_e( 'Full Transcripts, Connectivity Test, Diagnostic Test.', 'post-smtp' ); ?></p>
141
</div>
142
</div>
143
</div>
144
145
<div class="return-to-dashboard">
146
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', 'post-smtp' ); ?></a>
147
</div>
148
149
</div>
170
}
171
</style>
172
<div class="wrap about-wrap">
173
+ <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', 'post-smtp' ), $this->version ); ?></h1>
174
+ <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! bbPress %s is waxed, polished, and ready for you to take it for a lap or two around the block!', 'post-smtp' ), $this->version ); ?></div>
175
+ <div class="post-badge"><?php printf( esc_html__( 'Version %s', 'post-smtp' ), $this->version ); ?></div>
176
177
<h2 class="nav-tab-wrapper">
178
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
179
+ <?php esc_html_e( 'What&#8217;s New', 'post-smtp' ); ?>
180
</a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
181
+ <?php esc_html_e( 'Credits', 'post-smtp' ); ?>
182
</a>
183
</h2>
184
185
+ <p class="about-description"><?php esc_html_e( 'Post SMTP started by Jason Hendriks, Jason left the project and Yehuda Hassine (me) continue his work.', 'post-smtp' ); ?></p>
186
187
+ <h4 class="wp-people-group"><?php esc_html_e( 'Project Leaders', 'post-smtp' ); ?></h4>
188
<ul class="wp-people-group " id="wp-people-group-project-leaders">
189
<li class="wp-person" id="wp-person-jasonhendriks">
190
<a href="https://profiles.wordpress.org/jasonhendriks"><img src="https://secure.gravatar.com/avatar/8692c7b6084517a592f6cad107f7bcb0?s=60&d=mm&r=g" class="gravatar" alt="Jason Hendriks " /></a>
191
<a class="web" href="http://profiles.wordpress.org/matt">Jason Hendriks</a>
192
+ <span class="title"><?php esc_html_e( 'Founding Developer (abandoned)', 'post-smtp' ); ?></span>
193
</li>
194
<li class="wp-person" id="wp-person-yehudah">
195
<a href="http://profiles.wordpress.org/yehudah"><img src="https://secure.gravatar.com/avatar/c561638d04ea8fef351f974dbb9ece39?s=60&d=mm&r=g" class="gravatar" alt="Yehuda Hassine" /></a>
196
<a class="web" href="http://profiles.wordpress.org/yehudah">Yehuda Hassine</a>
197
+ <span class="title"><?php esc_html_e( 'Lead Developer', 'post-smtp' ); ?></span>
198
</li>
199
</ul>
200
201
+ <h4 class="wp-people-group"><?php esc_html_e( 'Top Community Members', 'post-smtp' ); ?></h4>
202
+ <h5><?php esc_html_e( 'Here I will list top users that help Post SMTP grow (bugs, features, etc...)', 'post-smtp' ); ?>
203
<p class="wp-credits-list">
204
<a href="http://profiles.wordpress.org/diegocanal">diegocanal</a>,
205
<a href="http://profiles.wordpress.org/jyourstone">Johan Yourstone</a>,
209
</p>
210
211
<div class="return-to-dashboard">
212
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', 'post-smtp' ); ?></a>
213
</div>
214
215
</div>
Postman/Postman-Diagnostic-Test/PostmanDiagnosticTestController.php CHANGED
@@ -12,7 +12,7 @@ class PostmanDiagnosticTestController {
12
/**
13
* Constructor
14
*
15
- * @param unknown $rootPluginFilenameAndPath
16
*/
17
public function __construct( $rootPluginFilenameAndPath ) {
18
assert( ! empty( $rootPluginFilenameAndPath ) );
@@ -77,7 +77,7 @@ class PostmanDiagnosticTestController {
77
* Register the Diagnostics screen
78
*/
79
public function addDiagnosticsSubmenu() {
80
- $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanDiagnosticTestController::DIAGNOSTICS_SLUG, array(
81
$this,
82
'outputDiagnosticsContent',
83
) );
@@ -98,14 +98,14 @@ class PostmanDiagnosticTestController {
98
// test features
99
print '<div class="wrap">';
100
101
- PostmanViewController::outputChildPageHeader( __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) );
102
103
- printf( '<h4>%s</h4>', __( 'Are you having issues with Postman?', Postman::TEXT_DOMAIN ) );
104
/* translators: where %1$s and %2$s are the URLs to the Troubleshooting and Support Forums on WordPress.org */
105
- printf( '<p style="margin:0 10px">%s</p>', sprintf( __( 'Please check the <a href="%1$s">troubleshooting and error messages</a> page and the <a href="%2$s">support forum</a>.', Postman::TEXT_DOMAIN ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) );
106
- printf( '<h4>%s</h4>', __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) );
107
- printf( '<p style="margin:0 10px">%s</p><br/>', sprintf( __( 'If you write for help, please include the following:', Postman::TEXT_DOMAIN ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) );
108
- printf( '<textarea readonly="readonly" id="diagnostic-text" cols="80" rows="15">%s</textarea>', _x( 'Checking..', 'The "please wait" message', Postman::TEXT_DOMAIN ) );
109
print '</div>';
110
}
111
}
@@ -210,6 +210,7 @@ class PostmanGetDiagnosticsViaAjax {
210
public function getDiagnostics() {
211
$curl = curl_version();
212
$transportRegistry = PostmanTransportRegistry::getInstance();
213
$this->addToDiagnostics( 'HostName', PostmanUtils::getServerName() );
214
$this->addToDiagnostics( 'cURL Version', $curl['version'] );
215
$this->addToDiagnostics( 'OpenSSL Version', $curl['ssl_version'] );
@@ -219,17 +220,15 @@ class PostmanGetDiagnosticsViaAjax {
219
$this->addToDiagnostics( 'WordPress', (is_multisite() ? 'Multisite ' : '') . get_bloginfo( 'version' ) . ' ' . get_locale() . ' ' . get_bloginfo( 'charset', 'display' ) );
220
$this->addToDiagnostics( 'WordPress Theme', wp_get_theme() );
221
$this->addToDiagnostics( 'WordPress Plugins', $this->getActivePlugins() );
222
- {
223
- $bindResult = apply_filters( 'postman_wp_mail_bind_status', null );
224
- $wp_mail_file_name = 'n/a';
225
if ( class_exists( 'ReflectionFunction' ) ) {
226
$wp_mail = new ReflectionFunction( 'wp_mail' );
227
$wp_mail_file_name = realpath( $wp_mail->getFileName() );
228
}
229
- if ( ! $bindResult ['bound'] ) {
230
- $this->addToDiagnostics( 'WordPress wp_mail Owner', $wp_mail_file_name );
231
- }
232
- }
233
$this->addToDiagnostics( 'WordPress wp_mail Filter(s)', $this->getFilters( 'wp_mail' ) );
234
$this->addToDiagnostics( 'WordPress wp_mail_from Filter(s)', $this->getFilters( 'wp_mail_from' ) );
235
$this->addToDiagnostics( 'WordPress wp_mail_from_name Filter(s)', $this->getFilters( 'wp_mail_from_name' ) );
12
/**
13
* Constructor
14
*
15
+ * @param mixed $rootPluginFilenameAndPath
16
*/
17
public function __construct( $rootPluginFilenameAndPath ) {
18
assert( ! empty( $rootPluginFilenameAndPath ) );
77
* Register the Diagnostics screen
78
*/
79
public function addDiagnosticsSubmenu() {
80
+ $page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Postman SMTP', 'post-smtp' ) ), __( 'Postman SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanDiagnosticTestController::DIAGNOSTICS_SLUG, array(
81
$this,
82
'outputDiagnosticsContent',
83
) );
98
// test features
99
print '<div class="wrap">';
100
101
+ PostmanViewController::outputChildPageHeader( __( 'Diagnostic Test', 'post-smtp' ) );
102
103
+ printf( '<h4>%s</h4>', __( 'Are you having issues with Postman?', 'post-smtp' ) );
104
/* translators: where %1$s and %2$s are the URLs to the Troubleshooting and Support Forums on WordPress.org */
105
+ printf( '<p style="margin:0 10px">%s</p>', sprintf( __( 'Please check the <a href="%1$s">troubleshooting and error messages</a> page and the <a href="%2$s">support forum</a>.', 'post-smtp' ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) );
106
+ printf( '<h4>%s</h4>', __( 'Diagnostic Test', 'post-smtp' ) );
107
+ printf( '<p style="margin:0 10px">%s</p><br/>', sprintf( __( 'If you write for help, please include the following:', 'post-smtp' ), 'https://wordpress.org/plugins/post-smtp/other_notes/', 'https://wordpress.org/support/plugin/post-smtp' ) );
108
+ printf( '<textarea readonly="readonly" id="diagnostic-text" cols="80" rows="15">%s</textarea>', _x( 'Checking..', 'The "please wait" message', 'post-smtp' ) );
109
print '</div>';
110
}
111
}
210
public function getDiagnostics() {
211
$curl = curl_version();
212
$transportRegistry = PostmanTransportRegistry::getInstance();
213
+ $this->addToDiagnostics( 'Mailer', PostmanOptions::getInstance()->getSmtpMailer() );
214
$this->addToDiagnostics( 'HostName', PostmanUtils::getServerName() );
215
$this->addToDiagnostics( 'cURL Version', $curl['version'] );
216
$this->addToDiagnostics( 'OpenSSL Version', $curl['ssl_version'] );
220
$this->addToDiagnostics( 'WordPress', (is_multisite() ? 'Multisite ' : '') . get_bloginfo( 'version' ) . ' ' . get_locale() . ' ' . get_bloginfo( 'charset', 'display' ) );
221
$this->addToDiagnostics( 'WordPress Theme', wp_get_theme() );
222
$this->addToDiagnostics( 'WordPress Plugins', $this->getActivePlugins() );
223
+
224
+ $bindResult = apply_filters( 'postman_wp_mail_bind_status', null );
225
+ $wp_mail_file_name = 'n/a';
226
if ( class_exists( 'ReflectionFunction' ) ) {
227
$wp_mail = new ReflectionFunction( 'wp_mail' );
228
$wp_mail_file_name = realpath( $wp_mail->getFileName() );
229
}
230
+
231
+ $this->addToDiagnostics( 'WordPress wp_mail Owner', $wp_mail_file_name );
232
$this->addToDiagnostics( 'WordPress wp_mail Filter(s)', $this->getFilters( 'wp_mail' ) );
233
$this->addToDiagnostics( 'WordPress wp_mail_from Filter(s)', $this->getFilters( 'wp_mail_from' ) );
234
$this->addToDiagnostics( 'WordPress wp_mail_from_name Filter(s)', $this->getFilters( 'wp_mail_from_name' ) );
Postman/Postman-Email-Log/PostmanEmailLogController.php CHANGED
@@ -1,4 +1,5 @@
1
<?php
2
require_once 'PostmanEmailLogService.php';
3
require_once 'PostmanEmailLogView.php';
4
@@ -77,8 +78,7 @@ class PostmanEmailLogController {
77
// get the email address of the recipient from the HTTP Request
78
$postid = $this->getRequestParameter( 'email' );
79
if ( ! empty( $postid ) ) {
80
- $post = get_post( $postid );
81
- $meta_values = get_post_meta( $postid );
82
83
if ( isset( $_POST['mail_to'] ) && ! empty( $_POST['mail_to'] ) ) {
84
$emails = explode( ',', $_POST['mail_to'] );
@@ -87,7 +87,7 @@ class PostmanEmailLogController {
87
$to = $meta_values ['original_to'] [0];
88
}
89
90
- $success = wp_mail( $to, $meta_values ['original_subject'] [0], $meta_values ['original_message'] [0], $meta_values ['original_headers'] [0] );
91
92
// Postman API: retrieve the result of sending this message from Postman
93
$result = apply_filters( 'postman_wp_mail_result', null );
@@ -97,7 +97,7 @@ class PostmanEmailLogController {
97
if ( $success ) {
98
$this->logger->debug( 'Email was successfully re-sent' );
99
// the message was sent successfully, generate an appropriate message for the user
100
- $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', Postman::TEXT_DOMAIN ), $result ['time'] );
101
102
// compose the JSON response for the caller
103
$response = array(
@@ -134,8 +134,8 @@ class PostmanEmailLogController {
134
/**
135
* TODO move this somewhere reusable
136
*
137
- * @param unknown $parameterName
138
- * @return unknown
139
*/
140
private function getRequestParameter( $parameterName ) {
141
if ( isset( $_POST [ $parameterName ] ) ) {
@@ -163,7 +163,7 @@ class PostmanEmailLogController {
163
$purger->verifyLogItemExistsAndRemove( $postid );
164
}
165
$mh = new PostmanMessageHandler();
166
- $mh->addMessage( __( 'Mail Log Entries were deleted.', Postman::TEXT_DOMAIN ) );
167
} else {
168
$this->logger->warn( sprintf( 'action "%s" not recognized', $_REQUEST ['action'] ) );
169
}
@@ -186,7 +186,7 @@ class PostmanEmailLogController {
186
$purger = new PostmanEmailLogPurger();
187
$purger->verifyLogItemExistsAndRemove( $postid );
188
$mh = new PostmanMessageHandler();
189
- $mh->addMessage( __( 'Mail Log Entry was deleted.', Postman::TEXT_DOMAIN ) );
190
} else {
191
$this->logger->warn( sprintf( 'nonce "%s" failed validation', $_REQUEST ['_wpnonce'] ) );
192
}
@@ -202,7 +202,7 @@ class PostmanEmailLogController {
202
$this->logger->trace( 'handling view item' );
203
$postid = $_REQUEST ['email'];
204
$post = get_post( $postid );
205
- $meta_values = get_post_meta( $postid );
206
// https://css-tricks.com/examples/hrs/
207
print '<html><head><style>body {font-family: monospace;} hr {
208
border: 0;
@@ -211,29 +211,29 @@ class PostmanEmailLogController {
211
}</style></head><body>';
212
print '<table>';
213
if ( ! empty( $meta_values ['from_header'] [0] ) ) {
214
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'From', 'Who is this message From?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['from_header'] [0] ) );
215
}
216
// show the To header (it's optional)
217
if ( ! empty( $meta_values ['to_header'] [0] ) ) {
218
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'To', 'Who is this message To?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['to_header'] [0] ) );
219
}
220
// show the Cc header (it's optional)
221
if ( ! empty( $meta_values ['cc_header'] [0] ) ) {
222
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Cc', 'Who is this message Cc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['cc_header'] [0] ) );
223
}
224
// show the Bcc header (it's optional)
225
if ( ! empty( $meta_values ['bcc_header'] [0] ) ) {
226
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Bcc', 'Who is this message Bcc\'d to?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['bcc_header'] [0] ) );
227
}
228
// show the Reply-To header (it's optional)
229
if ( ! empty( $meta_values ['reply_to_header'] [0] ) ) {
230
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', __( 'Reply-To', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['reply_to_header'] [0] ) );
231
}
232
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Date', 'What is the date today?', Postman::TEXT_DOMAIN ), $post->post_date );
233
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Subject', 'What is the subject of this message?', Postman::TEXT_DOMAIN ), esc_html( $post->post_title ) );
234
// The Transport UI is always there, in more recent versions that is
235
if ( ! empty( $meta_values ['transport_uri'] [0] ) ) {
236
- printf( '<tr><th style="text-align:right">%s:</th><td>%s</td></tr>', _x( 'Delivery-URI', 'What is the unique URI of the configuration?', Postman::TEXT_DOMAIN ), esc_html( $meta_values ['transport_uri'] [0] ) );
237
}
238
print '</table>';
239
print '<hr/>';
@@ -260,21 +260,21 @@ class PostmanEmailLogController {
260
$this->logger->trace( 'handling view transcript item' );
261
$postid = $_REQUEST ['email'];
262
$post = get_post( $postid );
263
- $meta_values = get_post_meta( $postid );
264
// https://css-tricks.com/examples/hrs/
265
print '<html><head><style>body {font-family: monospace;} hr {
266
border: 0;
267
border-bottom: 1px dashed #ccc;
268
background: #bbb;
269
}</style></head><body>';
270
- printf( '<p>%s</p>', __( 'This is the conversation between Postman and the mail server. It can be useful for diagnosing problems. <b>DO NOT</b> post it on-line, it may contain your account password.', Postman::TEXT_DOMAIN ) );
271
print '<hr/>';
272
print '<pre>';
273
if ( ! empty( $meta_values ['session_transcript'] [0] ) ) {
274
print esc_html( $meta_values ['session_transcript'] [0] );
275
} else {
276
/* Translators: Meaning "Not Applicable" */
277
- print __( 'n/a', Postman::TEXT_DOMAIN );
278
}
279
print '</pre>';
280
print '</body></html>';
@@ -299,8 +299,8 @@ class PostmanEmailLogController {
299
$this->logger->trace( 'created PostmanEmailLog admin menu item' );
300
/*
301
Translators where (%s) is the name of the plugin */
302
- $pageTitle = sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) );
303
- $pluginName = _x( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN );
304
305
$page = add_submenu_page( PostmanViewController::POSTMAN_MENU_SLUG, $pageTitle, $pluginName, Postman::MANAGE_POSTMAN_CAPABILITY_LOGS, 'postman_email_log', array( $this, 'postman_render_email_page' ) );
306
@@ -317,10 +317,10 @@ class PostmanEmailLogController {
317
wp_enqueue_style( 'postman_email_log' );
318
wp_enqueue_script( 'postman_resend_email_script' );
319
wp_enqueue_script( 'sprintf' );
320
- wp_localize_script( 'postman_resend_email_script', 'postman_js_email_was_resent', __( 'Email was successfully resent (but without attachments)', Postman::TEXT_DOMAIN ) );
321
/* Translators: Where %s is an error message */
322
- wp_localize_script( 'postman_resend_email_script', 'postman_js_email_not_resent', __( 'Email could not be resent. Error: %s', Postman::TEXT_DOMAIN ) );
323
- wp_localize_script( 'postman_resend_email_script', 'postman_js_resend_label', __( 'Resend', Postman::TEXT_DOMAIN ) );
324
}
325
326
/**
@@ -349,13 +349,15 @@ class PostmanEmailLogController {
349
</div>
350
<h2><?php
351
/* Translators where (%s) is the name of the plugin */
352
- echo sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) )?></h2>
353
354
<div
355
style="background: #ECECEC; border: 1px solid #CCC; padding: 0 10px; margin-top: 5px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;">
356
<p><?php
357
358
- echo __( 'This is a record of deliveries made to the mail server. It does not neccessarily indicate sucessful delivery to the recipient.', Postman::TEXT_DOMAIN )?></p>
359
</div>
360
361
<?php
@@ -369,19 +371,19 @@ class PostmanEmailLogController {
369
<form id="postman-email-log-filter" method="post">
370
<div id="email-log-filter" class="postman-log-row">
371
<div class="form-control">
372
- <label for="from_date"><?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?></label>
373
- <input id="from_date" class="email-log-date" value="<?php echo $from_date; ?>" type="text" name="from_date" placeholder="<?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?>">
374
</div>
375
<div class="form-control">
376
- <label for="to_date"><?php _e( 'To Date', Postman::TEXT_DOMAIN ); ?></label>
377
- <input id="to_date" class="email-log-date" value="<?php echo $to_date; ?>" type="text" name="to_date" placeholder="<?php _e( 'To Date', Postman::TEXT_DOMAIN ); ?>">
378
</div>
379
<div class="form-control">
380
- <label for="search"><?php _e( 'Search', Postman::TEXT_DOMAIN ); ?></label>
381
- <input id="search" type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php _e( 'Search', Postman::TEXT_DOMAIN ); ?>">
382
</div>
383
<div class="form-control">
384
- <label id="postman_page_records"><?php _e( 'Records per page', Postman::TEXT_DOMAIN ); ?></label>
385
<select id="postman_page_records" name="postman_page_records">
386
<?php
387
foreach ( $page_records as $value ) {
@@ -392,10 +394,10 @@ class PostmanEmailLogController {
392
</select>
393
</div>
394
<div class="form-control" style="padding: 0 5px 0 5px;">
395
- <button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter/Search', Postman::TEXT_DOMAIN ); ?></button>
396
</div>
397
<div class="form-control">
398
- <button type="submit" id="postman_trash_all" name="postman_trash_all" class="button button-primary"><?php _e( 'Trash All', Postman::TEXT_DOMAIN ); ?></button>
399
</div>
400
</div>
401
<div class="error">Please notice: when you select a date for example 11/20/2017, behind the scene the query select <b>11/20/2017 00:00:00</b>.<br>So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the <b>From Date</b> and 11/21/2017 as the <b>To Date</b>.</div>
1
<?php
2
+ require_once dirname(__DIR__) . '/PostmanEmailLogs.php';
3
require_once 'PostmanEmailLogService.php';
4
require_once 'PostmanEmailLogView.php';
5
78
// get the email address of the recipient from the HTTP Request
79
$postid = $this->getRequestParameter( 'email' );
80
if ( ! empty( $postid ) ) {
81
+ $meta_values = PostmanEmailLogs::get_data( $postid );
82
83
if ( isset( $_POST['mail_to'] ) && ! empty( $_POST['mail_to'] ) ) {
84
$emails = explode( ',', $_POST['mail_to'] );
87
$to = $meta_values ['original_to'] [0];
88
}
89
90
+ $success = wp_mail( $to, $meta_values ['original_subject'] [0], maybe_unserialize( $meta_values ['original_message'] [0] ), $meta_values ['original_headers'] [0] );
91
92
// Postman API: retrieve the result of sending this message from Postman
93
$result = apply_filters( 'postman_wp_mail_result', null );
97
if ( $success ) {
98
$this->logger->debug( 'Email was successfully re-sent' );
99
// the message was sent successfully, generate an appropriate message for the user
100
+ $statusMessage = sprintf( __( 'Your message was delivered (%d ms) to the SMTP server! Congratulations :)', 'post-smtp' ), $result ['time'] );
101
102
// compose the JSON response for the caller
103
$response = array(
134
/**
135
* TODO move this somewhere reusable
136
*
137
+ * @param mixed $parameterName
138
+ * @return mixed
139
*/
140
private function getRequestParameter( $parameterName ) {
141
if ( isset( $_POST [ $parameterName ] ) ) {
163
$purger->verifyLogItemExistsAndRemove( $postid );
164
}
165
$mh = new PostmanMessageHandler();
166
+ $mh->addMessage( __( 'Mail Log Entries were deleted.', 'post-smtp' ) );
167
} else {
168
$this->logger->warn( sprintf( 'action "%s" not recognized', $_REQUEST ['action'] ) );
169