summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-11-20 22:02:17 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-11-20 22:02:17 +0000
commit86ae306841efdb92000cfed72736b947448b3413 (patch)
treed4588eeb10d37ff8cc77162d6efd7abd9ea9a246
parentd3af3c0a69efd84bba9ed15faa0e81f851779c15 (diff)
downloadPost-SMTP-86ae306841efdb92000cfed72736b947448b3413.zip
* Fixed: misspled false
* Fixed: feedback form * Fixed: Some localization strings * Removed: deprecated function * New: Option to input emails when resend email * Added: explain message on email log filter git-svn-id: https://plugins.svn.wordpress.org/post-smtp/trunk@1771856 b8457f37-d9ea-0310-8a92-e5e31aec5664
-rw-r--r--Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php364
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogController.php18
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogView.php10
-rw-r--r--Postman/PostmanInputSanitizer.php192
-rw-r--r--Postman/PostmanPluginFeedback.php62
-rw-r--r--Postman/PostmanViewController.php15
-rw-r--r--postman-smtp.php4
-rw-r--r--readme.txt11
-rw-r--r--script/feedback/feedback.js58
-rw-r--r--script/postman_resend_email_sript.js58
10 files changed, 442 insertions, 350 deletions
diff --git a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php
index 7a837f3..9915850 100644
--- a/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php
+++ b/Postman/Postman-Configuration/PostmanRegisterConfigurationSettings.php
@@ -2,212 +2,210 @@
class PostmanSettingsRegistry {
private $options;
-
+
public function __construct() {
$this->options = PostmanOptions::getInstance();
}
-
+
/**
* Fires on the admin_init method
*/
public function on_admin_init() {
- //
- $this->registerSettings ();
+ $this->registerSettings();
}
-
+
/**
* Register and add settings
*/
private function registerSettings() {
-
+
// only administrators should be able to trigger this
- if (PostmanUtils::isAdmin ()) {
- //
- $sanitizer = new PostmanInputSanitizer ();
- register_setting ( PostmanAdminController::SETTINGS_GROUP_NAME, PostmanOptions::POSTMAN_OPTIONS, array (
+ if ( PostmanUtils::isAdmin() ) {
+ $sanitizer = new PostmanInputSanitizer();
+ register_setting( PostmanAdminController::SETTINGS_GROUP_NAME, PostmanOptions::POSTMAN_OPTIONS, array(
$sanitizer,
- 'sanitize'
+ 'sanitize',
) );
-
+
// Sanitize
- add_settings_section ( 'transport_section', __ ( 'Transport', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( 'transport_section', __( 'Transport', Postman::TEXT_DOMAIN ), array(
$this,
- 'printTransportSectionInfo'
+ 'printTransportSectionInfo',
), 'transport_options' );
-
- add_settings_field ( PostmanOptions::TRANSPORT_TYPE, _x ( 'Type', '(i.e.) What kind is it?', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::TRANSPORT_TYPE, _x( 'Type', '(i.e.) What kind is it?', Postman::TEXT_DOMAIN ), array(
$this,
- 'transport_type_callback'
+ 'transport_type_callback',
), 'transport_options', 'transport_section' );
-
+
// the Message From section
- add_settings_section ( PostmanAdminController::MESSAGE_FROM_SECTION, _x ( 'From Address', 'The Message Sender Email Address', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( PostmanAdminController::MESSAGE_FROM_SECTION, _x( 'From Address', 'The Message Sender Email Address', Postman::TEXT_DOMAIN ), array(
$this,
- 'printMessageFromSectionInfo'
+ 'printMessageFromSectionInfo',
), PostmanAdminController::MESSAGE_FROM_OPTIONS );
-
- add_settings_field ( PostmanOptions::MESSAGE_SENDER_EMAIL, __ ( 'Email Address', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::MESSAGE_SENDER_EMAIL, __( 'Email Address', Postman::TEXT_DOMAIN ), array(
$this,
- 'from_email_callback'
+ 'from_email_callback',
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
-
- add_settings_field ( PostmanOptions::PREVENT_MESSAGE_SENDER_EMAIL_OVERRIDE, '', array (
+
+ add_settings_field( PostmanOptions::PREVENT_MESSAGE_SENDER_EMAIL_OVERRIDE, '', array(
$this,
- 'prevent_from_email_override_callback'
+ 'prevent_from_email_override_callback',
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
-
- add_settings_field ( PostmanOptions::MESSAGE_SENDER_NAME, __ ( 'Name', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::MESSAGE_SENDER_NAME, __( 'Name', Postman::TEXT_DOMAIN ), array(
$this,
- 'sender_name_callback'
+ 'sender_name_callback',
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
-
- add_settings_field ( PostmanOptions::PREVENT_MESSAGE_SENDER_NAME_OVERRIDE, '', array (
+
+ add_settings_field( PostmanOptions::PREVENT_MESSAGE_SENDER_NAME_OVERRIDE, '', array(
$this,
- 'prevent_from_name_override_callback'
+ 'prevent_from_name_override_callback',
), PostmanAdminController::MESSAGE_FROM_OPTIONS, PostmanAdminController::MESSAGE_FROM_SECTION );
-
+
// the Additional Addresses section
- add_settings_section ( PostmanAdminController::MESSAGE_SECTION, __ ( 'Additional Email Addresses', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( PostmanAdminController::MESSAGE_SECTION, __( 'Additional Email Addresses', Postman::TEXT_DOMAIN ), array(
$this,
- 'printMessageSectionInfo'
+ 'printMessageSectionInfo',
), PostmanAdminController::MESSAGE_OPTIONS );
-
- add_settings_field ( PostmanOptions::REPLY_TO, __ ( 'Reply-To', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::REPLY_TO, __( 'Reply-To', Postman::TEXT_DOMAIN ), array(
$this,
- 'reply_to_callback'
+ 'reply_to_callback',
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
-
- add_settings_field ( PostmanOptions::FORCED_TO_RECIPIENTS, __ ( 'To Recipient(s)', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::FORCED_TO_RECIPIENTS, __( 'To Recipient(s)', Postman::TEXT_DOMAIN ), array(
$this,
- 'to_callback'
+ 'to_callback',
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
-
- add_settings_field ( PostmanOptions::FORCED_CC_RECIPIENTS, __ ( 'Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::FORCED_CC_RECIPIENTS, __( 'Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array(
$this,
- 'cc_callback'
+ 'cc_callback',
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
-
- add_settings_field ( PostmanOptions::FORCED_BCC_RECIPIENTS, __ ( 'Blind Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::FORCED_BCC_RECIPIENTS, __( 'Blind Carbon Copy Recipient(s)', Postman::TEXT_DOMAIN ), array(
$this,
- 'bcc_callback'
+ 'bcc_callback',
), PostmanAdminController::MESSAGE_OPTIONS, PostmanAdminController::MESSAGE_SECTION );
-
+
// the Additional Headers section
- add_settings_section ( PostmanAdminController::MESSAGE_HEADERS_SECTION, __ ( 'Additional Headers', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( PostmanAdminController::MESSAGE_HEADERS_SECTION, __( 'Additional Headers', Postman::TEXT_DOMAIN ), array(
$this,
- 'printAdditionalHeadersSectionInfo'
+ 'printAdditionalHeadersSectionInfo',
), PostmanAdminController::MESSAGE_HEADERS_OPTIONS );
-
- add_settings_field ( PostmanOptions::ADDITIONAL_HEADERS, __ ( 'Custom Headers', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::ADDITIONAL_HEADERS, __( 'Custom Headers', Postman::TEXT_DOMAIN ), array(
$this,
- 'headers_callback'
+ 'headers_callback',
), PostmanAdminController::MESSAGE_HEADERS_OPTIONS, PostmanAdminController::MESSAGE_HEADERS_SECTION );
-
+
// the Email Validation section
- add_settings_section ( PostmanAdminController::EMAIL_VALIDATION_SECTION, __ ( 'Validation', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( PostmanAdminController::EMAIL_VALIDATION_SECTION, __( 'Validation', Postman::TEXT_DOMAIN ), array(
$this,
- 'printEmailValidationSectionInfo'
+ 'printEmailValidationSectionInfo',
), PostmanAdminController::EMAIL_VALIDATION_OPTIONS );
-
- add_settings_field ( PostmanOptions::ENVELOPE_SENDER, __ ( 'Email Address', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::ENVELOPE_SENDER, __( 'Email Address', Postman::TEXT_DOMAIN ), array(
$this,
- 'disable_email_validation_callback'
+ 'disable_email_validation_callback',
), PostmanAdminController::EMAIL_VALIDATION_OPTIONS, PostmanAdminController::EMAIL_VALIDATION_SECTION );
-
+
// the Logging section
- add_settings_section ( PostmanAdminController::LOGGING_SECTION, __ ( 'Email Log Settings', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( PostmanAdminController::LOGGING_SECTION, __( 'Email Log Settings', Postman::TEXT_DOMAIN ), array(
$this,
- 'printLoggingSectionInfo'
+ 'printLoggingSectionInfo',
), PostmanAdminController::LOGGING_OPTIONS );
-
- add_settings_field ( 'logging_status', __ ( 'Enable Logging', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( 'logging_status', __( 'Enable Logging', Postman::TEXT_DOMAIN ), array(
$this,
- 'loggingStatusInputField'
+ 'loggingStatusInputField',
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
-
- add_settings_field ( 'logging_max_entries', __ ( 'Maximum Log Entries', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( 'logging_max_entries', __( 'Maximum Log Entries', Postman::TEXT_DOMAIN ), array(
$this,
- 'loggingMaxEntriesInputField'
+ 'loggingMaxEntriesInputField',
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
-
- add_settings_field ( PostmanOptions::TRANSCRIPT_SIZE, __ ( 'Maximum Transcript Size', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::TRANSCRIPT_SIZE, __( 'Maximum Transcript Size', Postman::TEXT_DOMAIN ), array(
$this,
- 'transcriptSizeInputField'
+ 'transcriptSizeInputField',
), PostmanAdminController::LOGGING_OPTIONS, PostmanAdminController::LOGGING_SECTION );
-
+
// the Network section
- add_settings_section ( PostmanAdminController::NETWORK_SECTION, __ ( 'Network Settings', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( PostmanAdminController::NETWORK_SECTION, __( 'Network Settings', Postman::TEXT_DOMAIN ), array(
$this,
- 'printNetworkSectionInfo'
+ 'printNetworkSectionInfo',
), PostmanAdminController::NETWORK_OPTIONS );
-
- add_settings_field ( 'connection_timeout', _x ( 'TCP Connection Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( 'connection_timeout', _x( 'TCP Connection Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
$this,
- 'connection_timeout_callback'
+ 'connection_timeout_callback',
), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION );
-
- add_settings_field ( 'read_timeout', _x ( 'TCP Read Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( 'read_timeout', _x( 'TCP Read Timeout (sec)', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
$this,
- 'read_timeout_callback'
+ 'read_timeout_callback',
), PostmanAdminController::NETWORK_OPTIONS, PostmanAdminController::NETWORK_SECTION );
-
+
// the Advanced section
- add_settings_section ( PostmanAdminController::ADVANCED_SECTION, _x ( 'Miscellaneous Settings', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array (
+ add_settings_section( PostmanAdminController::ADVANCED_SECTION, _x( 'Miscellaneous Settings', 'Configuration Section Title', Postman::TEXT_DOMAIN ), array(
$this,
- 'printAdvancedSectionInfo'
+ 'printAdvancedSectionInfo',
), PostmanAdminController::ADVANCED_OPTIONS );
-
- add_settings_field ( PostmanOptions::LOG_LEVEL, _x ( 'PHP Log Level', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::LOG_LEVEL, _x( 'PHP Log Level', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
$this,
- 'log_level_callback'
+ 'log_level_callback',
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
-
- add_settings_field ( PostmanOptions::RUN_MODE, _x ( 'Delivery Mode', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::RUN_MODE, _x( 'Delivery Mode', 'Configuration Input Field', Postman::TEXT_DOMAIN ), array(
$this,
- 'runModeCallback'
+ 'runModeCallback',
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
-
- add_settings_field ( PostmanOptions::STEALTH_MODE, _x ( 'Stealth Mode', 'This mode removes the Postman X-Mailer signature from emails', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::STEALTH_MODE, _x( 'Stealth Mode', 'This mode removes the Postman X-Mailer signature from emails', Postman::TEXT_DOMAIN ), array(
$this,
- 'stealthModeCallback'
+ 'stealthModeCallback',
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
-
- add_settings_field ( PostmanOptions::TEMPORARY_DIRECTORY, __ ( 'Temporary Directory', Postman::TEXT_DOMAIN ), array (
+
+ add_settings_field( PostmanOptions::TEMPORARY_DIRECTORY, __( 'Temporary Directory', Postman::TEXT_DOMAIN ), array(
$this,
- 'temporaryDirectoryCallback'
+ 'temporaryDirectoryCallback',
), PostmanAdminController::ADVANCED_OPTIONS, PostmanAdminController::ADVANCED_SECTION );
}
}
-
+
/**
* Print the Transport section info
*/
public function printTransportSectionInfo() {
- print __ ( 'Choose SMTP or a vendor-specific API:', Postman::TEXT_DOMAIN );
+ print __( 'Choose SMTP or a vendor-specific API:', Postman::TEXT_DOMAIN );
}
public function printLoggingSectionInfo() {
- print __ ( 'Configure the delivery audit log:', Postman::TEXT_DOMAIN );
+ print __( 'Configure the delivery audit log:', Postman::TEXT_DOMAIN );
}
-
+
/**
* Print the Section text
*/
public function printMessageFromSectionInfo() {
- 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' );
+ 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' );
}
-
+
/**
* Print the Section text
*/
public function printMessageSectionInfo() {
- print __ ( 'Separate multiple <b>to</b>/<b>cc</b>/<b>bcc</b> recipients with commas.', Postman::TEXT_DOMAIN );
+ print __( 'Separate multiple <b>to</b>/<b>cc</b>/<b>bcc</b> recipients with commas.', Postman::TEXT_DOMAIN );
}
-
+
/**
* Print the Section text
*/
public function printNetworkSectionInfo() {
- 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 );
+ 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 );
}
/**
* Print the Section text
@@ -218,190 +216,190 @@ class PostmanSettingsRegistry {
* Print the Section text
*/
public function printAdditionalHeadersSectionInfo() {
- 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 );
+ 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 );
}
-
+
/**
* Print the Email Validation Description
*/
public function printEmailValidationSectionInfo() {
- print __ ( 'E-mail addresses can be validated before sending e-mail, however this may fail with some newer domains.', Postman::TEXT_DOMAIN );
+ print __( 'E-mail addresses can be validated before sending e-mail, however this may fail with some newer domains.', Postman::TEXT_DOMAIN );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function transport_type_callback() {
- $transportType = $this->options->getTransportType ();
- printf ( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TRANSPORT_TYPE );
- foreach ( PostmanTransportRegistry::getInstance ()->getTransports () as $transport ) {
- printf ( '<option class="input_tx_type_%1$s" value="%1$s" %3$s>%2$s</option>', $transport->getSlug (), $transport->getName (), $transportType == $transport->getSlug () ? 'selected="selected"' : '' );
+ $transportType = $this->options->getTransportType();
+ printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::TRANSPORT_TYPE );
+ foreach ( PostmanTransportRegistry::getInstance()->getTransports() as $transport ) {
+ printf( '<option class="input_tx_type_%1$s" value="%1$s" %3$s>%2$s</option>', $transport->getSlug(), $transport->getName(), $transportType == $transport->getSlug() ? 'selected="selected"' : '' );
}
print '</select>';
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function sender_name_callback() {
- printf ( '<input type="text" id="input_sender_name" name="postman_options[sender_name]" value="%s" size="40" />', null !== $this->options->getMessageSenderName () ? esc_attr ( $this->options->getMessageSenderName () ) : '' );
+ printf( '<input type="text" id="input_sender_name" name="postman_options[sender_name]" value="%s" size="40" />', null !== $this->options->getMessageSenderName() ? esc_attr( $this->options->getMessageSenderName() ) : '' );
}
-
+
/**
*/
public function prevent_from_name_override_callback() {
- $enforced = $this->options->isPluginSenderNameEnforced ();
- 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 ) );
+ $enforced = $this->options->isPluginSenderNameEnforced();
+ 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 ) );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function from_email_callback() {
- 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 ) );
+ 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 ) );
}
-
+
/**
* Print the Section text
*/
public function printMessageSenderSectionInfo() {
- 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' );
+ 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' );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function prevent_from_email_override_callback() {
- $enforced = $this->options->isPluginSenderEmailEnforced ();
- 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 ) );
+ $enforced = $this->options->isPluginSenderEmailEnforced();
+ 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 ) );
}
-
+
/**
* Shows the Mail Logging enable/disabled option
*/
public function loggingStatusInputField() {
// isMailLoggingAllowed
- $disabled = "";
- if (! $this->options->isMailLoggingAllowed ()) {
+ $disabled = '';
+ if ( ! $this->options->isMailLoggingAllowed() ) {
$disabled = 'disabled="disabled" ';
}
- printf ( '<select ' . $disabled . 'id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::MAIL_LOG_ENABLED_OPTION );
- printf ( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_YES, $this->options->isMailLoggingEnabled () ? 'selected="selected"' : '', __ ( 'Yes', Postman::TEXT_DOMAIN ) );
- printf ( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_NO, ! $this->options->isMailLoggingEnabled () ? 'selected="selected"' : '', __ ( 'No', Postman::TEXT_DOMAIN ) );
- printf ( '</select>' );
+ printf( '<select ' . $disabled . 'id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::MAIL_LOG_ENABLED_OPTION );
+ printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_YES, $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'Yes', Postman::TEXT_DOMAIN ) );
+ printf( '<option value="%s" %s>%s</option>', PostmanOptions::MAIL_LOG_ENABLED_OPTION_NO, ! $this->options->isMailLoggingEnabled() ? 'selected="selected"' : '', __( 'No', Postman::TEXT_DOMAIN ) );
+ printf( '</select>' );
}
public function loggingMaxEntriesInputField() {
- printf ( '<input type="text" id="input_logging_max_entries" name="postman_options[%s]" value="%s"/>', PostmanOptions::MAIL_LOG_MAX_ENTRIES, $this->options->getMailLoggingMaxEntries () );
+ printf( '<input type="text" id="input_logging_max_entries" name="postman_options[%s]" value="%s"/>', PostmanOptions::MAIL_LOG_MAX_ENTRIES, $this->options->getMailLoggingMaxEntries() );
}
public function transcriptSizeInputField() {
$inputOptionsSlug = PostmanOptions::POSTMAN_OPTIONS;
$inputTranscriptSlug = PostmanOptions::TRANSCRIPT_SIZE;
- $inputValue = $this->options->getTranscriptSize ();
- $inputDescription = __ ( 'Change this value if you can\'t see the beginning of the transcript because your messages are too big.', Postman::TEXT_DOMAIN );
- 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 );
+ $inputValue = $this->options->getTranscriptSize();
+ $inputDescription = __( 'Change this value if you can\'t see the beginning of the transcript because your messages are too big.', Postman::TEXT_DOMAIN );
+ 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 );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function reply_to_callback() {
- printf ( '<input type="text" id="input_reply_to" name="%s[%s]" value="%s" size="40" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::REPLY_TO, null !== $this->options->getReplyTo () ? esc_attr ( $this->options->getReplyTo () ) : '' );
+ printf( '<input type="text" id="input_reply_to" name="%s[%s]" value="%s" size="40" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::REPLY_TO, null !== $this->options->getReplyTo() ? esc_attr( $this->options->getReplyTo() ) : '' );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function to_callback() {
- printf ( '<input type="text" id="input_to" name="%s[%s]" value="%s" size="60" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::FORCED_TO_RECIPIENTS, null !== $this->options->getForcedToRecipients () ? esc_attr ( $this->options->getForcedToRecipients () ) : '' );
+ printf( '<input type="text" id="input_to" name="%s[%s]" value="%s" size="60" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::FORCED_TO_RECIPIENTS, null !== $this->options->getForcedToRecipients() ? esc_attr( $this->options->getForcedToRecipients() ) : '' );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function cc_callback() {
- printf ( '<input type="text" id="input_cc" name="%s[%s]" value="%s" size="60" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::FORCED_CC_RECIPIENTS, null !== $this->options->getForcedCcRecipients () ? esc_attr ( $this->options->getForcedCcRecipients () ) : '' );
+ printf( '<input type="text" id="input_cc" name="%s[%s]" value="%s" size="60" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::FORCED_CC_RECIPIENTS, null !== $this->options->getForcedCcRecipients() ? esc_attr( $this->options->getForcedCcRecipients() ) : '' );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function bcc_callback() {
- printf ( '<input type="text" id="input_bcc" name="%s[%s]" value="%s" size="60" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::FORCED_BCC_RECIPIENTS, null !== $this->options->getForcedBccRecipients () ? esc_attr ( $this->options->getForcedBccRecipients () ) : '' );
+ printf( '<input type="text" id="input_bcc" name="%s[%s]" value="%s" size="60" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::FORCED_BCC_RECIPIENTS, null !== $this->options->getForcedBccRecipients() ? esc_attr( $this->options->getForcedBccRecipients() ) : '' );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function headers_callback() {
- printf ( '<textarea id="input_headers" name="%s[%s]" cols="60" rows="5" >%s</textarea>', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::ADDITIONAL_HEADERS, null !== $this->options->getAdditionalHeaders () ? esc_attr ( $this->options->getAdditionalHeaders () ) : '' );
+ printf( '<textarea id="input_headers" name="%s[%s]" cols="60" rows="5" >%s</textarea>', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::ADDITIONAL_HEADERS, null !== $this->options->getAdditionalHeaders() ? esc_attr( $this->options->getAdditionalHeaders() ) : '' );
}
-
+
/**
*/
public function disable_email_validation_callback() {
- $disabled = $this->options->isEmailValidationDisabled ();
- 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 ) );
+ $disabled = $this->options->isEmailValidationDisabled();
+ 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 ) );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function log_level_callback() {
- $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/' );
- printf ( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::LOG_LEVEL );
- $currentKey = $this->options->getLogLevel ();
- $this->printSelectOption ( __ ( 'Off', Postman::TEXT_DOMAIN ), PostmanLogger::OFF_INT, $currentKey );
- $this->printSelectOption ( __ ( 'Trace', Postman::TEXT_DOMAIN ), PostmanLogger::TRACE_INT, $currentKey );
- $this->printSelectOption ( __ ( 'Debug', Postman::TEXT_DOMAIN ), PostmanLogger::DEBUG_INT, $currentKey );
- $this->printSelectOption ( __ ( 'Info', Postman::TEXT_DOMAIN ), PostmanLogger::INFO_INT, $currentKey );
- $this->printSelectOption ( __ ( 'Warning', Postman::TEXT_DOMAIN ), PostmanLogger::WARN_INT, $currentKey );
- $this->printSelectOption ( __ ( 'Error', Postman::TEXT_DOMAIN ), PostmanLogger::ERROR_INT, $currentKey );
- printf ( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
- }
- private function printSelectOption($label, $optionKey, $currentKey) {
+ $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/' );
+ printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::LOG_LEVEL );
+ $currentKey = $this->options->getLogLevel();
+ $this->printSelectOption( __( 'Off', Postman::TEXT_DOMAIN ), PostmanLogger::OFF_INT, $currentKey );
+ $this->printSelectOption( __( 'Trace', Postman::TEXT_DOMAIN ), PostmanLogger::TRACE_INT, $currentKey );
+ $this->printSelectOption( __( 'Debug', Postman::TEXT_DOMAIN ), PostmanLogger::DEBUG_INT, $currentKey );
+ $this->printSelectOption( __( 'Info', Postman::TEXT_DOMAIN ), PostmanLogger::INFO_INT, $currentKey );
+ $this->printSelectOption( __( 'Warning', Postman::TEXT_DOMAIN ), PostmanLogger::WARN_INT, $currentKey );
+ $this->printSelectOption( __( 'Error', Postman::TEXT_DOMAIN ), PostmanLogger::ERROR_INT, $currentKey );
+ printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
+ }
+ private function printSelectOption( $label, $optionKey, $currentKey ) {
$optionPattern = '<option value="%1$s" %2$s>%3$s</option>';
- printf ( $optionPattern, $optionKey, $optionKey == $currentKey ? 'selected="selected"' : '', $label );
+ printf( $optionPattern, $optionKey, $optionKey == $currentKey ? 'selected="selected"' : '', $label );
}
public function runModeCallback() {
- $inputDescription = __ ( 'Delivery mode offers options useful for developing or testing.', Postman::TEXT_DOMAIN );
- printf ( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::RUN_MODE );
- $currentKey = $this->options->getRunMode ();
- $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 );
- $this->printSelectOption ( __ ( 'Log Email and Delete', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_LOG_ONLY, $currentKey );
- $this->printSelectOption ( __ ( 'Delete All Emails', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_IGNORE, $currentKey );
- printf ( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
+ $inputDescription = __( 'Delivery mode offers options useful for developing or testing.', Postman::TEXT_DOMAIN );
+ printf( '<select id="input_%2$s" class="input_%2$s" name="%1$s[%2$s]">', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::RUN_MODE );
+ $currentKey = $this->options->getRunMode();
+ $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 );
+ $this->printSelectOption( __( 'Log Email and Delete', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_LOG_ONLY, $currentKey );
+ $this->printSelectOption( __( 'Delete All Emails', Postman::TEXT_DOMAIN ), PostmanOptions::RUN_MODE_IGNORE, $currentKey );
+ printf( '</select><br/><span class="postman_input_description">%s</span>', $inputDescription );
}
public function stealthModeCallback() {
- 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 ) );
+ 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 ) );
}
public function temporaryDirectoryCallback() {
- $inputDescription = __ ( 'Lockfiles are written here to prevent users from triggering an OAuth 2.0 token refresh at the same time.' );
- 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 () );
- if (PostmanState::getInstance ()->isFileLockingEnabled ()) {
- printf ( ' <span style="color:green">%s</span></br><span class="postman_input_description">%s</span>', __ ( 'Valid', Postman::TEXT_DOMAIN ), $inputDescription );
+ $inputDescription = __( 'Lockfiles are written here to prevent users from triggering an OAuth 2.0 token refresh at the same time.' );
+ 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() );
+ if ( PostmanState::getInstance()->isFileLockingEnabled() ) {
+ printf( ' <span style="color:green">%s</span></br><span class="postman_input_description">%s</span>', __( 'Valid', Postman::TEXT_DOMAIN ), $inputDescription );
} else {
- printf ( ' <span style="color:red">%s</span></br><span class="postman_input_description">%s</span>', __ ( 'Invalid', Postman::TEXT_DOMAIN ), $inputDescription );
+ printf( ' <span style="color:red">%s</span></br><span class="postman_input_description">%s</span>', __( 'Invalid', Postman::TEXT_DOMAIN ), $inputDescription );
}
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function connection_timeout_callback() {
- printf ( '<input type="text" id="input_connection_timeout" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::CONNECTION_TIMEOUT, $this->options->getConnectionTimeout () );
+ printf( '<input type="text" id="input_connection_timeout" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::CONNECTION_TIMEOUT, $this->options->getConnectionTimeout() );
}
-
+
/**
* Get the settings option array and print one of its values
*/
public function read_timeout_callback() {
- printf ( '<input type="text" id="input_read_timeout" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::READ_TIMEOUT, $this->options->getReadTimeout () );
+ printf( '<input type="text" id="input_read_timeout" name="%s[%s]" value="%s" />', PostmanOptions::POSTMAN_OPTIONS, PostmanOptions::READ_TIMEOUT, $this->options->getReadTimeout() );
}
-
+
/**
* Get the settings option array and print one of its values
*/
- public function port_callback($args) {
- 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 ) );
+ public function port_callback( $args ) {
+ 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 ) );
}
-} \ No newline at end of file
+}
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php
index a7bd78a..efb19ae 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogController.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php
@@ -70,13 +70,22 @@ class PostmanEmailLogController {
/**
*/
public function resendMail() {
+ check_ajax_referer( 'resend', 'security' );
+
// get the email address of the recipient from the HTTP Request
$postid = $this->getRequestParameter( 'email' );
if ( ! empty( $postid ) ) {
$post = get_post( $postid );
$meta_values = get_post_meta( $postid );
- $success = wp_mail( $meta_values ['original_to'] [0], $meta_values ['original_subject'] [0], $meta_values ['original_message'] [0], $meta_values ['original_headers'] [0] );
+ if ( isset( $_POST['mail_to'] ) && ! empty( $_POST['mail_to'] ) ) {
+ $emails = explode( ',', $_POST['mail_to'] );
+ $to = array_map( 'sanitize_email', $emails );
+ } else {
+ $to = $meta_values ['original_to'] [0];
+ }
+
+ $success = wp_mail( $to, $meta_values ['original_subject'] [0], $meta_values ['original_message'] [0], $meta_values ['original_headers'] [0] );
// Postman API: retrieve the result of sending this message from Postman
$result = apply_filters( 'postman_wp_mail_result', null );
@@ -288,7 +297,7 @@ class PostmanEmailLogController {
$this->logger->trace( 'created PostmanEmailLog admin menu item' );
/*
Translators where (%s) is the name of the plugin */
- $pageTitle = sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) );
+ $pageTitle = sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) );
$pluginName = _x( 'Email Log', 'The log of Emails that have been delivered', Postman::TEXT_DOMAIN );
$page = add_submenu_page( PostmanViewController::POSTMAN_MENU_SLUG, $pageTitle, $pluginName, 'read_private_posts', 'postman_email_log', array( $this, 'postman_render_email_page' ) );
@@ -338,7 +347,7 @@ class PostmanEmailLogController {
</div>
<h2><?php
/* Translators where (%s) is the name of the plugin */
- echo sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) )?></h2>
+ echo sprintf( __( '%s Email Log', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) )?></h2>
<div
style="background: #ECECEC; border: 1px solid #CCC; padding: 0 10px; margin-top: 5px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;">
@@ -374,7 +383,8 @@ class PostmanEmailLogController {
<div class="form-control">
<!-- <button type="submit" name="export_email_logs" class="button button-primary">Export To CSV</button> -->
</div>
- </div>
+ </div>
+ <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>
</form>
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogView.php b/Postman/Postman-Email-Log/PostmanEmailLogView.php
index f8f4fac..fe0fdfe 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogView.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogView.php
@@ -105,7 +105,9 @@ class PostmanEmailLogView extends WP_List_Table {
}
if ( ! (empty( $meta_values ['original_to'] [0] ) && empty( $meta_values ['originalHeaders'] [0] )) ) {
// $actions ['resend'] = sprintf ( '<a href="%s">%s</a>', $resendUrl, __ ( 'Resend', Postman::TEXT_DOMAIN ) );
- $actions ['resend'] = sprintf( '<span id="%3$s"><a href="javascript:postman_resend_email(%1$s);">%2$s</a></span>', $item ['ID'], __( 'Resend', Postman::TEXT_DOMAIN ), 'resend-' . $item ['ID'] );
+ $emails = maybe_unserialize( $meta_values ['original_to'] [0] );
+ $to = is_array( $emails ) ? implode( ',', $emails ) : $emails;
+ $actions ['resend'] = sprintf( '<span id="%3$s"><a class="postman-open-resend" href="#">%2$s</a></span><div style="display:none;"><input type="hidden" name="security" value="%6$s"><input type="text" name="mail_to" class="regular-text ltr" data-id="%1$s" value="%4$s"><button class="postman-resend button button-primary">%2$s</button><i style="color: black;">%5$s</i></div>', $item ['ID'], __( 'Resend', Postman::TEXT_DOMAIN ), 'resend-' . $item ['ID'], esc_attr( $to ), __( 'comma-separated for multiple emails', Postman::TEXT_DOMAIN ), wp_create_nonce( 'resend' ) );
} else {
$actions ['resend'] = sprintf( '%2$s', $resendUrl, __( 'Resend', Postman::TEXT_DOMAIN ) );
}
@@ -317,6 +319,7 @@ class PostmanEmailLogView extends WP_List_Table {
$from_date = sanitize_text_field( $_POST['from_date'] );
$args['date_query']['after'] = $from_date;
+ $args['date_query']['column'] = 'post_date';
$args['date_query']['inclusive'] = false;
}
@@ -324,6 +327,7 @@ class PostmanEmailLogView extends WP_List_Table {
$to_date = sanitize_text_field( $_POST['to_date'] );
$args['date_query']['before'] = $to_date;
+ $args['date_query']['column'] = 'post_date';
$args['date_query']['inclusive'] = true;
}
@@ -336,6 +340,8 @@ class PostmanEmailLogView extends WP_List_Table {
}
$posts = new WP_query( $args );
+ $date_format = get_option( 'date_format' );
+ $time_format = get_option( 'time_format' );
foreach ( $posts->posts as $post ) {
$date = $post->post_date;
@@ -351,7 +357,7 @@ class PostmanEmailLogView extends WP_List_Table {
'title' => esc_html( $post->post_title ),
// the post status must be escaped as they are displayed in the HTML output
'status' => ($post->post_excerpt != null ? esc_html( $post->post_excerpt ) : __( 'Sent', Postman::TEXT_DOMAIN )),
- 'date' => $date,
+ 'date' => date( "$date_format $time_format", strtotime( $post->post_date ) ),
'ID' => $post->ID,
);
array_push( $data, $flattenedPost );
diff --git a/Postman/PostmanInputSanitizer.php b/Postman/PostmanInputSanitizer.php
index 008b3c9..d8b6e49 100644
--- a/Postman/PostmanInputSanitizer.php
+++ b/Postman/PostmanInputSanitizer.php
@@ -1,154 +1,154 @@
<?php
-if (! class_exists ( 'PostmanInputSanitizer' )) {
+if ( ! class_exists( 'PostmanInputSanitizer' ) ) {
class PostmanInputSanitizer {
private $logger;
private $options;
const VALIDATION_SUCCESS = 'validation_success';
const VALIDATION_FAILED = 'validation_failed';
public function __construct() {
- $this->logger = new PostmanLogger ( get_class ( $this ) );
+ $this->logger = new PostmanLogger( get_class( $this ) );
$this->options = PostmanOptions::getInstance();
}
-
+
/**
* Sanitize each setting field as needed
*
* @param array $input
* Contains all settings fields as array keys
*/
- public function sanitize($input) {
- $this->logger->debug ( "Sanitizing data before storage" );
-
- $new_input = array ();
+ public function sanitize( $input ) {
+ $this->logger->debug( 'Sanitizing data before storage' );
+
+ $new_input = array();
$success = true;
-
- $this->sanitizeString ( 'Encryption Type', PostmanOptions::SECURITY_TYPE, $input, $new_input );
- $this->sanitizeString ( 'Hostname', PostmanOptions::HOSTNAME, $input, $new_input );
- if (! empty ( $input [PostmanOptions::PORT] )) {
- $port = absint ( $input [PostmanOptions::PORT] );
- if ($port > 0) {
- $this->sanitizeInt ( 'Port', PostmanOptions::PORT, $input, $new_input );
+
+ $this->sanitizeString( 'Encryption Type', PostmanOptions::SECURITY_TYPE, $input, $new_input );
+ $this->sanitizeString( 'Hostname', PostmanOptions::HOSTNAME, $input, $new_input );
+ if ( ! empty( $input [ PostmanOptions::PORT ] ) ) {
+ $port = absint( $input [ PostmanOptions::PORT ] );
+ if ( $port > 0 ) {
+ $this->sanitizeInt( 'Port', PostmanOptions::PORT, $input, $new_input );
} else {
- $new_input [PostmanOptions::PORT] = $this->options->getPort ();
- add_settings_error ( PostmanOptions::PORT, PostmanOptions::PORT, 'Invalid TCP Port', 'error' );
+ $new_input [ PostmanOptions::PORT ] = $this->options->getPort();
+ add_settings_error( PostmanOptions::PORT, PostmanOptions::PORT, 'Invalid TCP Port', 'error' );
$success = false;
}
}
// check the auth type AFTER the hostname because we reset the hostname if auth is bad
- $this->sanitizeString ( 'From Email', PostmanOptions::MESSAGE_SENDER_EMAIL, $input, $new_input );
+ $this->sanitizeString( 'From Email', PostmanOptions::MESSAGE_SENDER_EMAIL, $input, $new_input );
// the wizard doesn't set an envelope sender, so we'll default it to From Email
- $new_input [PostmanOptions::ENVELOPE_SENDER] = $new_input [PostmanOptions::MESSAGE_SENDER_EMAIL];
- $this->sanitizeString ( 'Sender Email', PostmanOptions::ENVELOPE_SENDER, $input, $new_input );
- $this->sanitizeString ( 'Transport Type', PostmanOptions::TRANSPORT_TYPE, $input, $new_input );
- $this->sanitizeString ( 'Authorization Type', PostmanOptions::AUTHENTICATION_TYPE, $input, $new_input );
- $this->sanitizeString ( 'From Name', PostmanOptions::MESSAGE_SENDER_NAME, $input, $new_input );
- $this->sanitizeString ( 'Client ID', PostmanOptions::CLIENT_ID, $input, $new_input );
- $this->sanitizeString ( 'Client Secret', PostmanOptions::CLIENT_SECRET, $input, $new_input );
- $this->sanitizeString ( 'Username', PostmanOptions::BASIC_AUTH_USERNAME, $input, $new_input );
- $this->sanitizePassword ( 'Password', PostmanOptions::BASIC_AUTH_PASSWORD, $input, $new_input, $this->options->getPassword () );
- $this->sanitizePassword ( 'Mandrill API Key', PostmanOptions::MANDRILL_API_KEY, $input, $new_input, $this->options->getMandrillApiKey () );
- $this->sanitizePassword ( 'SendGrid API Key', PostmanOptions::SENDGRID_API_KEY, $input, $new_input, $this->options->getSendGridApiKey () );
- $this->sanitizeString ( 'Reply-To', PostmanOptions::REPLY_TO, $input, $new_input );
- $this->sanitizeString ( 'From Name Override', PostmanOptions::PREVENT_MESSAGE_SENDER_NAME_OVERRIDE, $input, $new_input );
- $this->sanitizeString ( 'From Email Override', PostmanOptions::PREVENT_MESSAGE_SENDER_EMAIL_OVERRIDE, $input, $new_input );
- $this->sanitizeString ( 'Disable Email Validation', PostmanOptions::DISABLE_EMAIL_VALIDAITON, $input, $new_input );
- $this->sanitizeString ( 'Forced To Recipients', PostmanOptions::FORCED_TO_RECIPIENTS, $input, $new_input );
- $this->sanitizeString ( 'Forced CC Recipients', PostmanOptions::FORCED_CC_RECIPIENTS, $input, $new_input );
- $this->sanitizeString ( 'Forced BCC Recipients', PostmanOptions::FORCED_BCC_RECIPIENTS, $input, $new_input );
- $this->sanitizeString ( 'Additional Headers', PostmanOptions::ADDITIONAL_HEADERS, $input, $new_input );
- $this->sanitizeInt ( 'Read Timeout', PostmanOptions::READ_TIMEOUT, $input, $new_input );
- $this->sanitizeInt ( 'Conenction Timeout', PostmanOptions::CONNECTION_TIMEOUT, $input, $new_input );
- $this->sanitizeInt ( 'Log Level', PostmanOptions::LOG_LEVEL, $input, $new_input );
- $this->sanitizeString ( 'Email Log Enabled', PostmanOptions::MAIL_LOG_ENABLED_OPTION, $input, $new_input );
- $this->sanitizeLogMax ( 'Email Log Max Entries', PostmanOptions::MAIL_LOG_MAX_ENTRIES, $input, $new_input );
- $this->sanitizeString ( 'Run Mode', PostmanOptions::RUN_MODE, $input, $new_input );
- $this->sanitizeString ( 'Stealth Mode', PostmanOptions::STEALTH_MODE, $input, $new_input );
- $this->sanitizeInt ( 'Transcript Size', PostmanOptions::TRANSCRIPT_SIZE, $input, $new_input );
- $this->sanitizeString ( 'Temporary Directory', PostmanOptions::TEMPORARY_DIRECTORY, $input, $new_input );
-
- if ($new_input [PostmanOptions::CLIENT_ID] != $this->options->getClientId () || $new_input [PostmanOptions::CLIENT_SECRET] != $this->options->getClientSecret () || $new_input [PostmanOptions::HOSTNAME] != $this->options->getHostname ()) {
- $this->logger->debug ( "Recognized new Client ID" );
+ $new_input [ PostmanOptions::ENVELOPE_SENDER ] = $new_input [ PostmanOptions::MESSAGE_SENDER_EMAIL ];
+ $this->sanitizeString( 'Sender Email', PostmanOptions::ENVELOPE_SENDER, $input, $new_input );
+ $this->sanitizeString( 'Transport Type', PostmanOptions::TRANSPORT_TYPE, $input, $new_input );
+ $this->sanitizeString( 'Authorization Type', PostmanOptions::AUTHENTICATION_TYPE, $input, $new_input );
+ $this->sanitizeString( 'From Name', PostmanOptions::MESSAGE_SENDER_NAME, $input, $new_input );
+ $this->sanitizeString( 'Client ID', PostmanOptions::CLIENT_ID, $input, $new_input );
+ $this->sanitizeString( 'Client Secret', PostmanOptions::CLIENT_SECRET, $input, $new_input );
+ $this->sanitizeString( 'Username', PostmanOptions::BASIC_AUTH_USERNAME, $input, $new_input );
+ $this->sanitizePassword( 'Password', PostmanOptions::BASIC_AUTH_PASSWORD, $input, $new_input, $this->options->getPassword() );
+ $this->sanitizePassword( 'Mandrill API Key', PostmanOptions::MANDRILL_API_KEY, $input, $new_input, $this->options->getMandrillApiKey() );
+ $this->sanitizePassword( 'SendGrid API Key', PostmanOptions::SENDGRID_API_KEY, $input, $new_input, $this->options->getSendGridApiKey() );
+ $this->sanitizeString( 'Reply-To', PostmanOptions::REPLY_TO, $input, $new_input );
+ $this->sanitizeString( 'From Name Override', PostmanOptions::PREVENT_MESSAGE_SENDER_NAME_OVERRIDE, $input, $new_input );
+ $this->sanitizeString( 'From Email Override', PostmanOptions::PREVENT_MESSAGE_SENDER_EMAIL_OVERRIDE, $input, $new_input );
+ $this->sanitizeString( 'Disable Email Validation', PostmanOptions::DISABLE_EMAIL_VALIDAITON, $input, $new_input );
+ $this->sanitizeString( 'Forced To Recipients', PostmanOptions::FORCED_TO_RECIPIENTS, $input, $new_input );
+ $this->sanitizeString( 'Forced CC Recipients', PostmanOptions::FORCED_CC_RECIPIENTS, $input, $new_input );
+ $this->sanitizeString( 'Forced BCC Recipients', PostmanOptions::FORCED_BCC_RECIPIENTS, $input, $new_input );
+ $this->sanitizeString( 'Additional Headers', PostmanOptions::ADDITIONAL_HEADERS, $input, $new_input );
+ $this->sanitizeInt( 'Read Timeout', PostmanOptions::READ_TIMEOUT, $input, $new_input );
+ $this->sanitizeInt( 'Conenction Timeout', PostmanOptions::CONNECTION_TIMEOUT, $input, $new_input );
+ $this->sanitizeInt( 'Log Level', PostmanOptions::LOG_LEVEL, $input, $new_input );
+ $this->sanitizeString( 'Email Log Enabled', PostmanOptions::MAIL_LOG_ENABLED_OPTION, $input, $new_input );
+ $this->sanitizeLogMax( 'Email Log Max Entries', PostmanOptions::MAIL_LOG_MAX_ENTRIES, $input, $new_input );
+ $this->sanitizeString( 'Run Mode', PostmanOptions::RUN_MODE, $input, $new_input );
+ $this->sanitizeString( 'Stealth Mode', PostmanOptions::STEALTH_MODE, $input, $new_input );
+ $this->sanitizeInt( 'Transcript Size', PostmanOptions::TRANSCRIPT_SIZE, $input, $new_input );
+ $this->sanitizeString( 'Temporary Directory', PostmanOptions::TEMPORARY_DIRECTORY, $input, $new_input );
+
+ if ( $new_input [ PostmanOptions::CLIENT_ID ] != $this->options->getClientId() || $new_input [ PostmanOptions::CLIENT_SECRET ] != $this->options->getClientSecret() || $new_input [ PostmanOptions::HOSTNAME ] != $this->options->getHostname() ) {
+ $this->logger->debug( 'Recognized new Client ID' );
// the user entered a new client id and we should destroy the stored auth token
- delete_option ( PostmanOAuthToken::OPTIONS_NAME );
+ delete_option( PostmanOAuthToken::OPTIONS_NAME );
}
-
+
// can we create a tmp file? - this code is duplicated in ActivationHandler
- PostmanUtils::deleteLockFile ( $new_input [PostmanOptions::TEMPORARY_DIRECTORY] );
- $lockSuccess = PostmanUtils::createLockFile ( $new_input [PostmanOptions::TEMPORARY_DIRECTORY] );
+ PostmanUtils::deleteLockFile( $new_input [ PostmanOptions::TEMPORARY_DIRECTORY ] );
+ $lockSuccess = PostmanUtils::createLockFile( $new_input [ PostmanOptions::TEMPORARY_DIRECTORY ] );
// &= does not work as expected in my PHP
- $lockSuccess = $lockSuccess && PostmanUtils::deleteLockFile ( $new_input [PostmanOptions::TEMPORARY_DIRECTORY] );
- $this->logger->debug ( 'FileLocking=' . $lockSuccess );
- PostmanState::getInstance ()->setFileLockingEnabled ( $lockSuccess );
-
- if ($success) {
- PostmanSession::getInstance ()->setAction ( self::VALIDATION_SUCCESS );
+ $lockSuccess = $lockSuccess && PostmanUtils::deleteLockFile( $new_input [ PostmanOptions::TEMPORARY_DIRECTORY ] );
+ $this->logger->debug( 'FileLocking=' . $lockSuccess );
+ PostmanState::getInstance()->setFileLockingEnabled( $lockSuccess );
+
+ if ( $success ) {
+ PostmanSession::getInstance()->setAction( self::VALIDATION_SUCCESS );
} else {
- PostmanSession::getInstance ()->setAction ( self::VALIDATION_FAILED );
+ PostmanSession::getInstance()->setAction( self::VALIDATION_FAILED );
}
-
+
return $new_input;
}
- private function sanitizeString($desc, $key, $input, &$new_input) {
- if (isset ( $input [$key] )) {
- $this->logSanitize ( $desc, $input [$key] );
- $new_input [$key] = trim ( $input [$key] );
+ private function sanitizeString( $desc, $key, $input, &$new_input ) {
+ if ( isset( $input [ $key ] ) ) {
+ $this->logSanitize( $desc, $input [ $key ] );
+ $new_input [ $key ] = trim( $input [ $key ] );
}
}
-
+
/**
* Sanitize a Basic Auth password, and base64-encode it
*
- * @param unknown $desc
- * @param unknown $key
- * @param unknown $input
- * @param unknown $new_input
+ * @param unknown $desc
+ * @param unknown $key
+ * @param unknown $input
+ * @param unknown $new_input
*/
- private function sanitizePassword($desc, $key, $input, &$new_input, $existingPassword) {
+ private function sanitizePassword( $desc, $key, $input, &$new_input, $existingPassword ) {
// WordPress calling Sanitize twice is a known issue
// https://core.trac.wordpress.org/ticket/21989
- $action = PostmanSession::getInstance ()->getAction ();
+ $action = PostmanSession::getInstance()->getAction();
// if $action is not empty, then sanitize has already run
- if (! empty ( $action )) {
+ if ( ! empty( $action ) ) {
// use the already encoded password in the $input
- $new_input [$key] = $input [$key];
+ $new_input [ $key ] = $input [ $key ];
// log it
- $this->logger->debug ( 'Warning, second sanitizePassword attempt detected' );
- } else if (isset ( $input [$key] )) {
- if (strlen ( $input [$key] ) > 0 && preg_match ( '/^\**$/', $input [$key] )) {
+ $this->logger->debug( 'Warning, second sanitizePassword attempt detected' );
+ } else if ( isset( $input [ $key ] ) ) {
+ if ( strlen( $input [ $key ] ) > 0 && preg_match( '/^\**$/', $input [ $key ] ) ) {
// if the password is all stars, then keep the existing password
- $new_input [$key] = $existingPassword;
+ $new_input [ $key ] = $existingPassword;
} else {
// otherwise the password is new, so trim it
- $new_input [$key] = trim ( $input [$key] );
+ $new_input [ $key ] = trim( $input [ $key ] );
}
// log it
- $this->logSanitize ( $desc, $new_input [$key] );
+ $this->logSanitize( $desc, $new_input [ $key ] );
// base-64 scramble password
- $new_input [$key] = base64_encode ( $new_input [$key] );
+ $new_input [ $key ] = base64_encode( $new_input [ $key ] );
}
- $this->logger->debug ( sprintf ( 'Encoding %s as %s', $desc, $new_input [$key] ) );
+ $this->logger->debug( sprintf( 'Encoding %s as %s', $desc, $new_input [ $key ] ) );
}
- private function sanitizeLogMax($desc, $key, $input, &$new_input) {
- if (isset ( $input [$key] )) {
- $value = absint ( $input [$key] );
- if ($value <= 0) {
- $new_input [$key] = PostmanOptions::getInstance ()->getMailLoggingMaxEntries ();
- $h = new PostmanMessageHandler ();
- $h->addError ( sprintf ( '%s %s', __ ( 'Maximum Log Entries', 'Configuration Input Field', Postman::TEXT_DOMAIN ), __ ( 'must be greater than 0', Postman::TEXT_DOMAIN ) ) );
+ private function sanitizeLogMax( $desc, $key, $input, &$new_input ) {
+ if ( isset( $input [ $key ] ) ) {
+ $value = absint( $input [ $key ] );
+ if ( $value <= 0 ) {
+ $new_input [ $key ] = PostmanOptions::getInstance()->getMailLoggingMaxEntries();
+ $h = new PostmanMessageHandler();
+ $h->addError( sprintf( '%s %s', __( 'Maximum Log Entries', Postman::TEXT_DOMAIN ), __( 'must be greater than 0', Postman::TEXT_DOMAIN ) ) );
} else {
- $this->logSanitize ( $desc, $input [$key] );
- $new_input [$key] = $value;
+ $this->logSanitize( $desc, $input [ $key ] );
+ $new_input [ $key ] = $value;
}
}
}
- private function sanitizeInt($desc, $key, $input, &$new_input) {
- if (isset ( $input [$key] )) {
- $this->logSanitize ( $desc, $input [$key] );
- $new_input [$key] = absint ( $input [$key] );
+ private function sanitizeInt( $desc, $key, $input, &$new_input ) {
+ if ( isset( $input [ $key ] ) ) {
+ $this->logSanitize( $desc, $input [ $key ] );
+ $new_input [ $key ] = absint( $input [ $key ] );
}
}
- private function logSanitize($desc, $value) {
- $this->logger->trace ( 'Sanitize ' . $desc . ' ' . $value );
+ private function logSanitize( $desc, $value ) {
+ $this->logger->trace( 'Sanitize ' . $desc . ' ' . $value );
}
}
}
diff --git a/Postman/PostmanPluginFeedback.php b/Postman/PostmanPluginFeedback.php
index de7d73f..3ac985d 100644
--- a/Postman/PostmanPluginFeedback.php
+++ b/Postman/PostmanPluginFeedback.php
@@ -4,7 +4,6 @@ class PostmanPluginFeedback {
function __construct() {
add_filter( 'plugin_action_links_' . plugin_basename( POST_BASE ), array( $this, 'insert_deactivate_link_id' ) );
add_action( 'wp_ajax_post_user_feedback', array( $this, 'post_user_feedback' ) );
-
global $pagenow;
if ( 'plugins.php' === $pagenow ) {
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) );
@@ -15,7 +14,7 @@ class PostmanPluginFeedback {
function load_scripts() {
wp_enqueue_style( 'wp-jquery-ui-dialog' );
- wp_register_script( 'post-feedback', plugins_url( 'script/feedback/feedback.js', POST_BASE ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-dialog' ), fasle, true );
+ wp_register_script( 'post-feedback', plugins_url( 'script/feedback/feedback.js', POST_BASE ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-dialog' ), false, true );
wp_localize_script( 'post-feedback', 'post_feedback', array( 'admin_ajax' => admin_url( 'admin-ajax.php' ) ) );
wp_enqueue_script( 'post-feedback' );
}
@@ -27,7 +26,7 @@ class PostmanPluginFeedback {
$payload = array(
'reason' => sanitize_text_field( $_POST['reason'] ),
- 'other_input' => isset( $_POST['other_input'] ) ? sanitize_textarea_field( $_POST['other_input'] ) : '',
+ 'other_input' => isset( $_POST['other_input'] ) ? sanitize_text_field( $_POST['other_input'] ) : '',
);
if ( isset( $_POST['support'] ) ) {
@@ -38,6 +37,7 @@ class PostmanPluginFeedback {
$args = array(
'body' => $payload,
+ 'timeout' => 20,
);
$result = wp_remote_post( 'https://postmansmtp.com/feedback', $args );
die( 'success' );
@@ -50,11 +50,11 @@ class PostmanPluginFeedback {
float: none !important;
}
- #postman-feedback-dialog-skip {
+ #postman-feedback-dialog-go {
float: left;
}
- #postman-feedback-dialog-go, #postman-feedback-dialog-cancel {
+ #postman-feedback-dialog-skip, #postman-feedback-dialog-cancel {
float: right;
}
@@ -62,11 +62,31 @@ class PostmanPluginFeedback {
font-size: 1.1em;
}
- #postman-deactivate-reasons textarea {
+ .postman-reason-input textarea {
margin-top: 10px;
width: 100%;
height: 150px;
}
+
+ .postman-feedback-dialog-form .ui-icon {
+ display: none;
+ }
+
+ #postman-feedback-dialog-go.postman-ajax-progress .ui-icon {
+ text-indent: inherit;
+ display: inline-block !important;
+ vertical-align: middle;
+ animation: rotate 2s infinite linear;
+ }
+
+ #postman-feedback-dialog-go.postman-ajax-progress .ui-button-text {
+ vertical-align: middle;
+ }
+
+ @keyframes rotate {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
</style>
<?php
}
@@ -87,31 +107,32 @@ class PostmanPluginFeedback {
<form>
<?php wp_nonce_field(); ?>
<ul id="postman-deactivate-reasons">
+
+ <li class="postman-reason">
+ <label>
+ <span><input value="bad support" type="radio" name="reason" checked/></span>
+ <span><?php _e( 'Bad Support', 'postman' ); ?></span>
+ </label>
+ </li>
<li class="postman-reason postman-custom-input">
<label>
<span><input value="Found a better plugin" type="radio" name="reason" /></span>
<span><?php _e( 'Found a better plugin', 'postman' ); ?></span>
- </label>
- <div class="postman-reason-input" style="display: none;">
- <textarea name="other_input"></textarea>
- </div>
+ </label>
</li>
- <li class="postman-reason">
+ <li class="postman-reason postman-custom-input">
<label>
- <span><input value="The plugin didn't work" type="radio" name="reason" /></span>
+ <span><input value="<?php echo esc_attr( "The plugin didn't work" ); ?>" type="radio" name="reason" /></span>
<span><?php _e( 'The plugin didn\'t work', 'postman' ); ?></span>
- </label>
- </li>
+ </label>
+ </li>
<li class="postman-reason postman-custom-input">
<label>
<span><input value="Other Reason" type="radio" name="reason" /></span>
<span><?php _e( 'Other Reason', 'postman' ); ?></span>
</label>
- <div class="postman-reason-input" style="display: none;">
- <textarea name="other_input"></textarea>
- </div>
</li>
- <li class="postman-reason postman-custom-input">
+ <li class="postman-reason postman-support-input">
<label>
<span><input value="Support Ticket" type="radio" name="reason" /></span>
<span><?php _e( 'Open A support ticket for me', 'postman' ); ?></span>
@@ -121,8 +142,11 @@ class PostmanPluginFeedback {
<input type="text" name="support[title]" placeholder="The Title" required>
<textarea name="support[text]" placeholder="Describe the issue" required></textarea>
</div>
- </li>
+ </li>
</ul>
+ <div class="postman-reason-input" style="display: none;">
+ <input type="text" class="regular-text" name="other_input" placeholder="Do you mind help and give more detailes?">
+ </div>
</form>
</div>
<?php
diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php
index 9dd901d..99c3018 100644
--- a/Postman/PostmanViewController.php
+++ b/Postman/PostmanViewController.php
@@ -49,8 +49,8 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
*/
public function generateDefaultContent() {
// This page will be under "Settings"
- $pageTitle = sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) );
- $pluginName = __( 'Postman SMTP', Postman::TEXT_DOMAIN );
+ $pageTitle = sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) );
+ $pluginName = __( 'Post SMTP', Postman::TEXT_DOMAIN );
$uniqueId = self::POSTMAN_MENU_SLUG;
$pageOptions = array(
$this,
@@ -72,7 +72,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
* Register the Email Test screen
*/
public function addPurgeDataSubmenu() {
- $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, PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG, array(
+ $page = add_submenu_page( null, sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ), __( 'Post SMTP', Postman::TEXT_DOMAIN ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG, array(
$this,
'outputPurgeDataContent',
) );
@@ -182,7 +182,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
* @param string $slug
*/
public static function outputChildPageHeader( $title, $slug = '' ) {
- printf( '<h2>%s</h2>', sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ) );
+ printf( '<h2>%s</h2>', sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ) );
printf( '<div id="postman-main-menu" class="welcome-panel %s">', $slug );
print '<div class="welcome-panel-content">';
print '<div class="welcome-panel-column-container">';
@@ -253,15 +253,14 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
/**
*/
private function displayTopNavigation() {
- screen_icon();
- printf( '<h2>%s</h2>', sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Postman SMTP', Postman::TEXT_DOMAIN ) ) );
+ printf( '<h2>%s</h2>', sprintf( __( '%s Setup', Postman::TEXT_DOMAIN ), __( 'Post SMTP', Postman::TEXT_DOMAIN ) ) );
print '<div id="postman-main-menu" class="welcome-panel">';
print '<div class="welcome-panel-content">';
print '<div class="welcome-panel-column-container">';
print '<div class="welcome-panel-column">';
printf( '<h4>%s</h4>', __( 'Configuration', Postman::TEXT_DOMAIN ) );
printf( '<a class="button button-primary button-hero" href="%s">%s</a>', $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ), __( 'Start the Wizard', Postman::TEXT_DOMAIN ) );
- printf( '<p class="">or <a href="%s" class="configure_manually">%s</a></p>', $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ), __( 'Show All Settings', Postman::TEXT_DOMAIN ) );
+ printf( '<p class="">%s <a href="%s" class="configure_manually">%s</a></p>', __( 'or', Postman::TEXT_DOMAIN ), $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ), __( 'Show All Settings', Postman::TEXT_DOMAIN ) );
print '</div>';
print '<div class="welcome-panel-column">';
printf( '<h4>%s</h4>', _x( 'Actions', 'Main Menu', Postman::TEXT_DOMAIN ) );
@@ -295,7 +294,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanConnectivityTestController::PORT_TEST_SLUG ), __( 'Connectivity Test', Postman::TEXT_DOMAIN ) );
printf( '<li><a href="%s" class="welcome-icon run-port-test">%s</a></li>', $this->getPageUrl( PostmanDiagnosticTestController::DIAGNOSTICS_SLUG ), __( 'Diagnostic Test', Postman::TEXT_DOMAIN ) );
printf( '<li><a href="https://postmansmtp.com/forums/" class="welcome-icon postman_support">%s</a></li>', __( 'Online Support', Postman::TEXT_DOMAIN ) );
- printf( '<li><img class="align-middle" src="' . plugins_url( 'style/images/new.gif', dirname( __DIR__ ) . '/postman-smtp.php' ) . '"><a class="align-middle" href="https://postmansmtp.com/category/guides/" class="welcome-icon postman_guides">%s</a></li>', __( 'Guides', Postman::TEXT_DOMAIN ) );
+ printf( '<li><img class="align-middle" src="' . plugins_url( 'style/images/new.gif', dirname( __DIR__ ) . '/postman-smtp.php' ) . '"><a target="blank" class="align-middle" href="https://postmansmtp.com/category/guides/" class="welcome-icon postman_guides">%s</a></li>', __( 'Guides', Postman::TEXT_DOMAIN ) );
print '</ul></div></div></div></div>';
}
}
diff --git a/postman-smtp.php b/postman-smtp.php
index 04b8e16..b394b23 100644
--- a/postman-smtp.php
+++ b/postman-smtp.php
@@ -4,7 +4,7 @@
* Plugin Name: Post SMTP
* Plugin URI: https://wordpress.org/plugins/post-smtp/
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
- * Version: 1.7.8
+ * Version: 1.7.9
* Author: Jason Hendriks, Yehuda Hassine
* Text Domain: post-smtp
* Author URI: https://postmansmtp.com
@@ -71,5 +71,5 @@ function post_start( $startingMemory ) {
*/
function post_setupPostman() {
require_once 'Postman/Postman.php';
- $kevinCostner = new Postman( __FILE__, '1.7.8' );
+ $kevinCostner = new Postman( __FILE__, '1.7.9' );
}
diff --git a/readme.txt b/readme.txt
index cea73c2..6250eee 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,7 +3,7 @@ Contributors: yehudah, jasonhendriks
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email
Requires at least: 3.9
Tested up to: 4.9
-Stable tag: 1.7.8
+Stable tag: 1.7.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -277,10 +277,19 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
1. Emai Log screen
1. Connectivity Test utility screen
1. Diagnostic Information screen
+1. Email Log Filter
== Changelog ==
+
+= 1.7.9 - 2017-11-20
+* Fixed: misspled false
+* Fixed: feedback form
+* Fixed: Some localization strings
+* Added: explain message on email log filter
+* Removed: deprecated function
+
= 1.7.8 - 2017-11-17
* = Menu Items grouping =
* Fixed: IP detection error in some web hosts
diff --git a/script/feedback/feedback.js b/script/feedback/feedback.js
index 97940cf..a151f3b 100644
--- a/script/feedback/feedback.js
+++ b/script/feedback/feedback.js
@@ -13,24 +13,17 @@ jQuery(document).ready(function($) {
minWidth: 400,
minHeight: 300,
modal: true,
- buttons: {
- 'skip' : {
- text: 'Skip',
- id: 'postman-feedback-dialog-skip',
- click: function() {
- $( this ).dialog( "close" );
-
- location.href = deactivateLink;
- }
- },
+ buttons: {
'go' : {
text: 'Continue',
+ icons: { primary: "dashicons dashicons-update" },
id: 'postman-feedback-dialog-go',
class: 'button',
click: function() {
- $( this ).dialog( "close" );
- var form = $( this ).find( 'form' ).serializeArray(),
+ var dialog = $(this),
+ go = $('#postman-feedback-dialog-go'),
+ form = dialog.find( 'form' ).serializeArray(),
result = {};
$.each( form, function() {
@@ -41,13 +34,26 @@ jQuery(document).ready(function($) {
if ( ! jQuery.isEmptyObject( result ) ) {
result.action = 'post_user_feedback';
- $.post( post_feedback.admin_ajax, result, function(result) {
-
- });
+ $.ajax({
+ url: post_feedback.admin_ajax,
+ type: 'POST',
+ data: result,
+ error: function(){},
+ success: function(msg){},
+ beforeSend: function() {
+ go.addClass('postman-ajax-progress');
+ },
+ complete: function() {
+ go.removeClass('postman-ajax-progress');
+
+ dialog.dialog( "close" );
+ location.href = deactivateLink;
+ }
+ });
+
}
- // Remove this comment to deactivate plugin
- location.href = deactivateLink;
+
},
},
'cancel' : {
@@ -57,7 +63,16 @@ jQuery(document).ready(function($) {
click: function() {
$( this ).dialog( "close" );
}
- }
+ },
+ 'skip' : {
+ text: 'Skip',
+ id: 'postman-feedback-dialog-skip',
+ click: function() {
+ $( this ).dialog( "close" );
+
+ location.href = deactivateLink;
+ }
+ },
}
});
@@ -65,8 +80,13 @@ jQuery(document).ready(function($) {
$( '.postman-reason-input' ).hide();
if ( $( this ).hasClass( 'postman-custom-input' ) ) {
- $( this ).find( '.postman-reason-input' ).show();
+ $( '#postman-deactivate-reasons' ).next( '.postman-reason-input' ).show();
}
+
+ if ( $( this ).hasClass( 'postman-support-input' ) ) {
+ console.log($(this));
+ $( this ).find( '.postman-reason-input' ).show();
+ }
});
});
diff --git a/script/postman_resend_email_sript.js b/script/postman_resend_email_sript.js
index 1905bc5..c6d218a 100644
--- a/script/postman_resend_email_sript.js
+++ b/script/postman_resend_email_sript.js
@@ -1,17 +1,43 @@
-function postman_resend_email(emailId) {
- var data = {
- 'action' : 'postman_resend_mail',
- 'email' : emailId
- };
-
- jQuery.post(ajaxurl, data, function(response) {
- if (response.success) {
- alert(response.data.message);
-// jQuery('span#resend-' + emailId).text(postman_js_resend_label);
- } else {
- alert(sprintf(postman_js_email_not_resent, response.data.message));
- }
- }).fail(function(response) {
- ajaxFailed(response);
+jQuery(document).ready(function($) {
+ $('.postman-open-resend').on('click', function(e) {
+ e.preventDefault();
+
+ $(this).parent().next('div').fadeToggle();
});
-}
+
+ $('.postman-resend').on('click', function(e) {
+ e.preventDefault();
+
+ var parent = $(this).closest('div'),
+ mailField = $(this).prev('input'),
+ emailId = mailField.data('id'),
+ mail_to = mailField.val(),
+ security = parent.find('input[name="security"]').val();
+
+
+ postman_resend_email(emailId, mail_to, security);
+
+ });
+
+ function postman_resend_email(emailId, mail_to, security ) {
+ var data = {
+ 'action' : 'postman_resend_mail',
+ 'email' : emailId,
+ 'mail_to' : mail_to,
+ 'security' : security
+ };
+
+ jQuery.post(ajaxurl, data, function(response) {
+ if (response.success) {
+ alert(response.data.message);
+ // jQuery('span#resend-' + emailId).text(postman_js_resend_label);
+ } else {
+ alert(sprintf(postman_js_email_not_resent, response.data.message));
+ }
+ }).fail(function(response) {
+ ajaxFailed(response);
+ });
+ }
+
+})
+