Version Description
Download this release
Release Info
Developer | wpexpertsio |
Plugin | Post SMTP Mailer/Email Log |
Version | 2.1.3 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.1.3
- Postman/PostmanViewController.php +718 -712
- postman-smtp.php +2 -2
- readme.txt +31 -48
Postman/PostmanViewController.php
CHANGED
@@ -1,713 +1,719 @@
|
|
1 |
-
<?php
|
2 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
-
exit; // Exit if accessed directly
|
4 |
-
}
|
5 |
-
if ( ! class_exists( 'PostmanViewController' ) ) {
|
6 |
-
class PostmanViewController {
|
7 |
-
private $logger;
|
8 |
-
private $rootPluginFilenameAndPath;
|
9 |
-
private $options;
|
10 |
-
private $authorizationToken;
|
11 |
-
private $oauthScribe;
|
12 |
-
private $importableConfiguration;
|
13 |
-
private $adminController;
|
14 |
-
const POSTMAN_MENU_SLUG = 'postman';
|
15 |
-
|
16 |
-
// style sheets and scripts
|
17 |
-
const POSTMAN_STYLE = 'postman_style';
|
18 |
-
const JQUERY_SCRIPT = 'jquery';
|
19 |
-
const POSTMAN_SCRIPT = 'postman_script';
|
20 |
-
|
21 |
-
/**
|
22 |
-
* Constructor
|
23 |
-
*
|
24 |
-
* @param PostmanOptions $options
|
25 |
-
* @param PostmanOAuthToken $authorizationToken
|
26 |
-
* @param PostmanConfigTextHelper $oauthScribe
|
27 |
-
*/
|
28 |
-
function __construct( $rootPluginFilenameAndPath, PostmanOptions $options, PostmanOAuthToken $authorizationToken, PostmanConfigTextHelper $oauthScribe, PostmanAdminController $adminController ) {
|
29 |
-
$this->options = $options;
|
30 |
-
$this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath;
|
31 |
-
$this->authorizationToken = $authorizationToken;
|
32 |
-
$this->oauthScribe = $oauthScribe;
|
33 |
-
$this->adminController = $adminController;
|
34 |
-
$this->logger = new PostmanLogger( get_class( $this ) );
|
35 |
-
$hostname = PostmanOptions::getInstance()->getHostname();
|
36 |
-
$transportType = PostmanOptions::getInstance()->getTransportType();
|
37 |
-
$auth_type = PostmanOptions::getInstance()->getAuthenticationType();
|
38 |
-
|
39 |
-
PostmanUtils::registerAdminMenu( $this, 'generateDefaultContent' );
|
40 |
-
PostmanUtils::registerAdminMenu( $this, 'addPurgeDataSubmenu' );
|
41 |
-
|
42 |
-
// initialize the scripts, stylesheets and form fields
|
43 |
-
add_action( 'admin_init', array( $this, 'registerStylesAndScripts' ), 0 );
|
44 |
-
add_action( 'wp_ajax_delete_lock_file', array( $this, 'delete_lock_file' ) );
|
45 |
-
add_action( 'wp_ajax_dismiss_version_notify', array( $this, 'dismiss_version_notify' ) );
|
46 |
-
add_action( 'wp_ajax_dismiss_donation_notify', array( $this, 'dismiss_donation_notify' ) );
|
47 |
-
add_action( 'wp_ajax_ps-discard-less-secure-notification', array( $this, 'discard_less_secure_notification' ) );
|
48 |
-
|
49 |
-
$show_less_secure_notification = get_option( 'ps_hide_less_secure' );
|
50 |
-
|
51 |
-
if( !$show_less_secure_notification && $transportType == 'smtp' && $hostname == 'smtp.gmail.com' && ( $auth_type == 'plain' || $auth_type == 'login' ) ) {
|
52 |
-
add_action( 'admin_notices', array( $this, 'google_less_secure_notice' ) );
|
53 |
-
}
|
54 |
-
|
55 |
-
//add_action( 'admin_init', array( $this, 'do_activation_redirect' ) );
|
56 |
-
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
function dismiss_version_notify() {
|
61 |
-
check_admin_referer( 'postsmtp', 'security' );
|
62 |
-
|
63 |
-
$result = update_option('postman_release_version', true );
|
64 |
-
}
|
65 |
-
|
66 |
-
function dismiss_donation_notify() {
|
67 |
-
check_admin_referer( 'postsmtp', 'security' );
|
68 |
-
|
69 |
-
$result = update_option('postman_dismiss_donation', true );
|
70 |
-
}
|
71 |
-
|
72 |
-
function delete_lock_file() {
|
73 |
-
check_admin_referer( 'postman', 'security' );
|
74 |
-
|
75 |
-
if ( ! PostmanUtils::lockFileExists() ) {
|
76 |
-
echo esc_html__('No lock file found.', 'post-smtp' );
|
77 |
-
die();
|
78 |
-
}
|
79 |
-
|
80 |
-
echo PostmanUtils::deleteLockFile() == true ? esc_html__('Success, try to send test email.', 'post-smtp' ) : esc_html__('Failed, try again.', 'post-smtp' );
|
81 |
-
die();
|
82 |
-
}
|
83 |
-
|
84 |
-
function do_activation_redirect() {
|
85 |
-
|
86 |
-
// Bail if no activation redirect
|
87 |
-
if ( ! get_transient( '_post_activation_redirect' ) ) {
|
88 |
-
return;
|
89 |
-
}
|
90 |
-
|
91 |
-
// Delete the redirect transient
|
92 |
-
delete_transient( '_post_activation_redirect' );
|
93 |
-
|
94 |
-
// Bail if activating from network, or bulk
|
95 |
-
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
|
96 |
-
return;
|
97 |
-
}
|
98 |
-
|
99 |
-
// Bail if the current user cannot see the about page
|
100 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
101 |
-
return;
|
102 |
-
}
|
103 |
-
|
104 |
-
// Redirect to bbPress about page
|
105 |
-
wp_safe_redirect( add_query_arg( array( 'page' => 'post-about' ), admin_url( 'index.php' ) ) );
|
106 |
-
}
|
107 |
-
|
108 |
-
public static function getPageUrl( $slug ) {
|
109 |
-
return PostmanUtils::getPageUrl( $slug );
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Add options page
|
114 |
-
*
|
115 |
-
* @since 2.1 Added `add_submenu_page`
|
116 |
-
*/
|
117 |
-
public function generateDefaultContent() {
|
118 |
-
// This page will be under "Settings"
|
119 |
-
$pageTitle = sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) );
|
120 |
-
$pluginName = __( 'Post SMTP', 'post-smtp' );
|
121 |
-
$uniqueId = self::POSTMAN_MENU_SLUG;
|
122 |
-
$pageOptions = array(
|
123 |
-
$this,
|
124 |
-
'outputDefaultContent',
|
125 |
-
);
|
126 |
-
$mainPostmanSettingsPage = add_menu_page( $pageTitle, $pluginName, Postman::MANAGE_POSTMAN_CAPABILITY_NAME, $uniqueId, $pageOptions, 'dashicons-email' );
|
127 |
-
|
128 |
-
//To change the text of top level menu
|
129 |
-
add_submenu_page( $uniqueId, $pageTitle, 'Dashboard', Postman::MANAGE_POSTMAN_CAPABILITY_NAME, $uniqueId, $pageOptions );
|
130 |
-
|
131 |
-
// When the plugin options page is loaded, also load the stylesheet
|
132 |
-
add_action( 'admin_print_styles-' . $mainPostmanSettingsPage, array(
|
133 |
-
$this,
|
134 |
-
'enqueueHomeScreenStylesheet',
|
135 |
-
) );
|
136 |
-
}
|
137 |
-
function enqueueHomeScreenStylesheet() {
|
138 |
-
wp_enqueue_style( PostmanViewController::POSTMAN_STYLE );
|
139 |
-
wp_enqueue_script( PostmanViewController::POSTMAN_SCRIPT );
|
140 |
-
}
|
141 |
-
|
142 |
-
/**
|
143 |
-
* Register the Email Test screen
|
144 |
-
*/
|
145 |
-
public function addPurgeDataSubmenu() {
|
146 |
-
$page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ), __( 'Post SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG, array(
|
147 |
-
$this,
|
148 |
-
'outputPurgeDataContent',
|
149 |
-
) );
|
150 |
-
// When the plugin options page is loaded, also load the stylesheet
|
151 |
-
add_action( 'admin_print_styles-' . $page, array(
|
152 |
-
$this,
|
153 |
-
'enqueueHomeScreenStylesheet',
|
154 |
-
) );
|
155 |
-
}
|
156 |
-
|
157 |
-
/**
|
158 |
-
* Register and add settings
|
159 |
-
*/
|
160 |
-
public function registerStylesAndScripts() {
|
161 |
-
if ( $this->logger->isTrace() ) {
|
162 |
-
$this->logger->trace( 'registerStylesAndScripts()' );
|
163 |
-
}
|
164 |
-
// register the stylesheet and javascript external resources
|
165 |
-
$pluginData = apply_filters( 'postman_get_plugin_metadata', null );
|
166 |
-
wp_register_style( PostmanViewController::POSTMAN_STYLE, plugins_url( 'style/postman.css', $this->rootPluginFilenameAndPath ), null, $pluginData ['version'] );
|
167 |
-
wp_register_style( 'jquery_ui_style', plugins_url( 'style/jquery-steps/jquery-ui.css', $this->rootPluginFilenameAndPath ), PostmanViewController::POSTMAN_STYLE, '1.1.0' );
|
168 |
-
wp_register_style( 'jquery_steps_style', plugins_url( 'style/jquery-steps/jquery.steps.css', $this->rootPluginFilenameAndPath ), PostmanViewController::POSTMAN_STYLE, '1.1.0' );
|
169 |
-
|
170 |
-
wp_register_script( PostmanViewController::POSTMAN_SCRIPT, plugins_url( 'script/postman.js', $this->rootPluginFilenameAndPath ), array(
|
171 |
-
PostmanViewController::JQUERY_SCRIPT,
|
172 |
-
'jquery-ui-core',
|
173 |
-
'jquery-ui-datepicker',
|
174 |
-
), $pluginData ['version'] );
|
175 |
-
wp_register_script( 'sprintf', plugins_url( 'script/sprintf/sprintf.min.js', $this->rootPluginFilenameAndPath ), null, '1.0.2' );
|
176 |
-
wp_register_script( 'jquery_steps_script', plugins_url( 'script/jquery-steps/jquery.steps.min.js', $this->rootPluginFilenameAndPath ), array(
|
177 |
-
PostmanViewController::JQUERY_SCRIPT
|
178 |
-
), '1.1.0' );
|
179 |
-
wp_register_script( 'jquery_validation', plugins_url( 'script/jquery-validate/jquery.validate.min.js', $this->rootPluginFilenameAndPath ), array(
|
180 |
-
PostmanViewController::JQUERY_SCRIPT
|
181 |
-
), '1.13.1' );
|
182 |
-
|
183 |
-
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_ajax_msg', array(
|
184 |
-
'bad_response' => __( 'An unexpected error occurred', 'post-smtp' ),
|
185 |
-
'corrupt_response' => __( 'Unexpected PHP messages corrupted the Ajax response', 'post-smtp' )
|
186 |
-
) );
|
187 |
-
|
188 |
-
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_ajax', array(
|
189 |
-
'lessSecureNotice' => wp_create_nonce( 'less-secure-security' )
|
190 |
-
) );
|
191 |
-
}
|
192 |
-
|
193 |
-
/**
|
194 |
-
* Options page callback
|
195 |
-
*/
|
196 |
-
public function outputDefaultContent() {
|
197 |
-
|
198 |
-
// Set class property
|
199 |
-
print '<div class="wrap">';
|
200 |
-
print '<div class="ps-main-container-wrap">';
|
201 |
-
|
202 |
-
$version = PostmanState::getInstance()->getVersion();
|
203 |
-
|
204 |
-
printf(
|
205 |
-
'<div class="ps-main-header post-smtp-welcome-panel"><h2>%s</h2></div>',
|
206 |
-
esc_html__( 'Post SMTP Setup', 'post-smtp' )
|
207 |
-
);
|
208 |
-
|
209 |
-
//Top Notification message
|
210 |
-
if( !PostmanPreRequisitesCheck::isReady() ) {
|
211 |
-
|
212 |
-
printf(
|
213 |
-
'<div class="ps-config-bar"><span>%s</span><span style="color: red" class="dashicons dashicons-dismiss"></span></div>',
|
214 |
-
esc_html__( 'Postman is unable to run. Email delivery is being handled by WordPress (or another plugin).', 'post-smtp' )
|
215 |
-
);
|
216 |
-
|
217 |
-
}
|
218 |
-
else {
|
219 |
-
|
220 |
-
$ready_messsage = PostmanTransportRegistry::getInstance()->getReadyMessage();
|
221 |
-
$statusMessage = $ready_messsage['message'];
|
222 |
-
|
223 |
-
if ( PostmanTransportRegistry::getInstance()->getActiveTransport()->isConfiguredAndReady() ) {
|
224 |
-
|
225 |
-
if ( $this->options->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) {
|
226 |
-
printf(
|
227 |
-
'<div class="ps-config-bar">
|
228 |
-
<span>%s</span><span style="color: orange;" class="dashicons dashicons-yes-alt"></span>
|
229 |
-
</div>',
|
230 |
-
wp_kses_post( $statusMessage )
|
231 |
-
);
|
232 |
-
} else {
|
233 |
-
printf(
|
234 |
-
'<div class="ps-config-bar">
|
235 |
-
<span>%s</span><span style="color: green" class="dashicons dashicons-yes-alt"></span>
|
236 |
-
<div class="ps-right">
|
237 |
-
What\'s Next? Get Started by Sending a Test Email! <a href="%s" class="ps-btn-orange"> Send a Test Email</a>
|
238 |
-
</div>
|
239 |
-
<div class="clear"></div>
|
240 |
-
</div>',
|
241 |
-
wp_kses_post( $statusMessage ),
|
242 |
-
esc_url( $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ) )
|
243 |
-
);
|
244 |
-
}
|
245 |
-
} else {
|
246 |
-
printf(
|
247 |
-
'<div class="ps-config-bar">
|
248 |
-
<span >%s</span>
|
249 |
-
<span style="color: red" class="dashicons dashicons-dismiss"></span>
|
250 |
-
<div class="ps-right">
|
251 |
-
%s <a href="%s" class="ps-btn-orange">%s</a>
|
252 |
-
</div>
|
253 |
-
</div>',
|
254 |
-
wp_kses_post( $statusMessage ),
|
255 |
-
esc_html__( 'Get Started by Setup Wizard!', 'post-smtp' ),
|
256 |
-
esc_attr( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ) ),
|
257 |
-
esc_html__( 'Start the Wizard', 'post-smtp' )
|
258 |
-
);
|
259 |
-
}
|
260 |
-
|
261 |
-
}
|
262 |
-
|
263 |
-
//Main Content
|
264 |
-
?>
|
265 |
-
<div class="ps-flex ps-home-main">
|
266 |
-
<div class="ps-setting-box">
|
267 |
-
<div>
|
268 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/configuration.png' ) ?>" />
|
269 |
-
<h3 class="ps-ib ps-vm"><?php esc_html_e( 'Configuration', 'post-smtp' ); ?></h3>
|
270 |
-
</div>
|
271 |
-
<div class="ps-wizard">
|
272 |
-
<a href="<?php esc_attr_e( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ) ) ?>" class="ps-btn-orange"><?php esc_html_e( 'Start the Wizard', 'post-smtp' ); ?></a>
|
273 |
-
<h4><?php esc_html_e( 'OR', 'post-smtp' ); ?></h4>
|
274 |
-
<div>
|
275 |
-
<a href="<?php echo esc_url( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ) ) ?>">
|
276 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
277 |
-
<?php esc_html_e( 'Show All Settings', 'post-smtp' ) ?>
|
278 |
-
</a>
|
279 |
-
</div>
|
280 |
-
</div>
|
281 |
-
</div>
|
282 |
-
<div class="ps-setting-box">
|
283 |
-
<img src="<?php echo esc_attr( POST_SMTP_ASSETS . 'images/icons/action.png' ) ?>" />
|
284 |
-
<h3 class="ps-ib ps-vm"><?php esc_html_e( 'Actions', 'post-smtp' ); ?></h3>
|
285 |
-
<div>
|
286 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
287 |
-
<?php
|
288 |
-
// Grant permission with Google
|
289 |
-
ob_start();
|
290 |
-
PostmanTransportRegistry::getInstance()->getSelectedTransport()->printActionMenuItem();
|
291 |
-
$oauth_link = ob_get_clean();
|
292 |
-
$oauth_link = apply_filters( 'post_smtp_oauth_actions', $oauth_link );
|
293 |
-
echo wp_kses_post( $oauth_link );
|
294 |
-
?>
|
295 |
-
</div>
|
296 |
-
<div>
|
297 |
-
<?php
|
298 |
-
if ( PostmanWpMailBinder::getInstance()->isBound() ) {
|
299 |
-
|
300 |
-
echo '
|
301 |
-
<div>
|
302 |
-
<a href="'.esc_url( $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ) ).'">
|
303 |
-
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
304 |
-
'.esc_html__( 'Send a Test Email', 'post-smtp' ).
|
305 |
-
'</a>
|
306 |
-
</div>';
|
307 |
-
|
308 |
-
} else {
|
309 |
-
|
310 |
-
echo '
|
311 |
-
<div>
|
312 |
-
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
313 |
-
'.esc_html__( 'Send a Test Email', 'post-smtp' ) .'
|
314 |
-
</div>
|
315 |
-
';
|
316 |
-
|
317 |
-
}
|
318 |
-
?>
|
319 |
-
</div>
|
320 |
-
<div>
|
321 |
-
<?php
|
322 |
-
if ( ! $this->options->isNew() ) {
|
323 |
-
|
324 |
-
$purgeLinkPattern = '
|
325 |
-
<a href="%1$s">
|
326 |
-
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
327 |
-
%2$s
|
328 |
-
</a>';
|
329 |
-
|
330 |
-
}
|
331 |
-
else {
|
332 |
-
|
333 |
-
$purgeLinkPattern = '
|
334 |
-
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
335 |
-
%2$s
|
336 |
-
';
|
337 |
-
|
338 |
-
}
|
339 |
-
|
340 |
-
$importTitle = __( 'Import', 'post-smtp' );
|
341 |
-
$exportTile = __( 'Export', 'post-smtp' );
|
342 |
-
$resetTitle = __( 'Reset Plugin', 'post-smtp' );
|
343 |
-
$importExportReset = sprintf( '%s/%s/%s', $importTitle, $exportTile, $resetTitle );
|
344 |
-
|
345 |
-
printf(
|
346 |
-
wp_kses_post( $purgeLinkPattern ),
|
347 |
-
esc_url( $this->getPageUrl( PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG ) ),
|
348 |
-
sprintf( '%s', esc_html( $importExportReset ) )
|
349 |
-
);
|
350 |
-
|
351 |
-
do_action( 'post_smtp_extension_reset_link' );
|
352 |
-
?>
|
353 |
-
</div>
|
354 |
-
</div>
|
355 |
-
<div class="ps-setting-box">
|
356 |
-
<div>
|
357 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/extentions.png' ) ?>" />
|
358 |
-
<h3 class="ps-ib ps-vm"><?php esc_html_e( 'Extensions', 'post-smtp' ); ?></h3>
|
359 |
-
</div>
|
360 |
-
<div>
|
361 |
-
<a href="<?php echo esc_url( 'https://postmansmtp.com/extensions/office-365-for-post-smtp-extension/' ); ?>">
|
362 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
363 |
-
<?php echo esc_html( 'Office 365' ); ?>
|
364 |
-
</a>
|
365 |
-
</div>
|
366 |
-
<div>
|
367 |
-
<a href="<?php echo esc_url( 'https://postmansmtp.com/extensions/post-smtp-extension-for-amazon-ses/' ); ?>">
|
368 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
369 |
-
<?php echo esc_html( 'Amazon SES' ); ?>
|
370 |
-
</a>
|
371 |
-
</div>
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
</div>
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
</div>
|
384 |
-
<div>
|
385 |
-
<a href="<?php echo
|
386 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
387 |
-
<?php echo esc_html( '
|
388 |
-
</a>
|
389 |
-
</div>
|
390 |
-
<div>
|
391 |
-
<a href="<?php echo $this->getPageUrl(
|
392 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
393 |
-
<?php echo esc_html( '
|
394 |
-
</a>
|
395 |
-
</div>
|
396 |
-
<div>
|
397 |
-
<a href="
|
398 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
399 |
-
<?php echo esc_html( '
|
400 |
-
</a>
|
401 |
-
</div>
|
402 |
-
<div>
|
403 |
-
<a href="<?php
|
404 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
405 |
-
<?php echo esc_html( '
|
406 |
-
</a>
|
407 |
-
</div>
|
408 |
-
<div>
|
409 |
-
<a href="<?php echo esc_url( 'https://
|
410 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
411 |
-
<?php echo esc_html( '
|
412 |
-
</a>
|
413 |
-
</div>
|
414 |
-
<div>
|
415 |
-
<a href="<?php echo esc_url( 'https://
|
416 |
-
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
417 |
-
<?php echo esc_html( '
|
418 |
-
</a>
|
419 |
-
</div>
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
//
|
511 |
-
|
512 |
-
//
|
513 |
-
//
|
514 |
-
//
|
515 |
-
//
|
516 |
-
//
|
517 |
-
//
|
518 |
-
// <
|
519 |
-
//
|
520 |
-
//
|
521 |
-
//
|
522 |
-
// <
|
523 |
-
// </
|
524 |
-
// <div class="
|
525 |
-
//
|
526 |
-
//
|
527 |
-
// <
|
528 |
-
//
|
529 |
-
//
|
530 |
-
//
|
531 |
-
//
|
532 |
-
//
|
533 |
-
// <
|
534 |
-
//
|
535 |
-
//
|
536 |
-
//
|
537 |
-
// <
|
538 |
-
// </
|
539 |
-
// <div class="
|
540 |
-
//
|
541 |
-
//
|
542 |
-
//
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
</div>';
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
$
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
printf(
|
618 |
-
'<
|
619 |
-
|
620 |
-
);
|
621 |
-
print '
|
622 |
-
|
623 |
-
printf(
|
624 |
-
'<
|
625 |
-
|
626 |
-
);
|
627 |
-
print '<
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
print '</
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
);
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
if( $
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
}
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
if ( ! class_exists( 'PostmanViewController' ) ) {
|
6 |
+
class PostmanViewController {
|
7 |
+
private $logger;
|
8 |
+
private $rootPluginFilenameAndPath;
|
9 |
+
private $options;
|
10 |
+
private $authorizationToken;
|
11 |
+
private $oauthScribe;
|
12 |
+
private $importableConfiguration;
|
13 |
+
private $adminController;
|
14 |
+
const POSTMAN_MENU_SLUG = 'postman';
|
15 |
+
|
16 |
+
// style sheets and scripts
|
17 |
+
const POSTMAN_STYLE = 'postman_style';
|
18 |
+
const JQUERY_SCRIPT = 'jquery';
|
19 |
+
const POSTMAN_SCRIPT = 'postman_script';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Constructor
|
23 |
+
*
|
24 |
+
* @param PostmanOptions $options
|
25 |
+
* @param PostmanOAuthToken $authorizationToken
|
26 |
+
* @param PostmanConfigTextHelper $oauthScribe
|
27 |
+
*/
|
28 |
+
function __construct( $rootPluginFilenameAndPath, PostmanOptions $options, PostmanOAuthToken $authorizationToken, PostmanConfigTextHelper $oauthScribe, PostmanAdminController $adminController ) {
|
29 |
+
$this->options = $options;
|
30 |
+
$this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath;
|
31 |
+
$this->authorizationToken = $authorizationToken;
|
32 |
+
$this->oauthScribe = $oauthScribe;
|
33 |
+
$this->adminController = $adminController;
|
34 |
+
$this->logger = new PostmanLogger( get_class( $this ) );
|
35 |
+
$hostname = PostmanOptions::getInstance()->getHostname();
|
36 |
+
$transportType = PostmanOptions::getInstance()->getTransportType();
|
37 |
+
$auth_type = PostmanOptions::getInstance()->getAuthenticationType();
|
38 |
+
|
39 |
+
PostmanUtils::registerAdminMenu( $this, 'generateDefaultContent' );
|
40 |
+
PostmanUtils::registerAdminMenu( $this, 'addPurgeDataSubmenu' );
|
41 |
+
|
42 |
+
// initialize the scripts, stylesheets and form fields
|
43 |
+
add_action( 'admin_init', array( $this, 'registerStylesAndScripts' ), 0 );
|
44 |
+
add_action( 'wp_ajax_delete_lock_file', array( $this, 'delete_lock_file' ) );
|
45 |
+
add_action( 'wp_ajax_dismiss_version_notify', array( $this, 'dismiss_version_notify' ) );
|
46 |
+
add_action( 'wp_ajax_dismiss_donation_notify', array( $this, 'dismiss_donation_notify' ) );
|
47 |
+
add_action( 'wp_ajax_ps-discard-less-secure-notification', array( $this, 'discard_less_secure_notification' ) );
|
48 |
+
|
49 |
+
$show_less_secure_notification = get_option( 'ps_hide_less_secure' );
|
50 |
+
|
51 |
+
if( !$show_less_secure_notification && $transportType == 'smtp' && $hostname == 'smtp.gmail.com' && ( $auth_type == 'plain' || $auth_type == 'login' ) ) {
|
52 |
+
add_action( 'admin_notices', array( $this, 'google_less_secure_notice' ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
//add_action( 'admin_init', array( $this, 'do_activation_redirect' ) );
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
function dismiss_version_notify() {
|
61 |
+
check_admin_referer( 'postsmtp', 'security' );
|
62 |
+
|
63 |
+
$result = update_option('postman_release_version', true );
|
64 |
+
}
|
65 |
+
|
66 |
+
function dismiss_donation_notify() {
|
67 |
+
check_admin_referer( 'postsmtp', 'security' );
|
68 |
+
|
69 |
+
$result = update_option('postman_dismiss_donation', true );
|
70 |
+
}
|
71 |
+
|
72 |
+
function delete_lock_file() {
|
73 |
+
check_admin_referer( 'postman', 'security' );
|
74 |
+
|
75 |
+
if ( ! PostmanUtils::lockFileExists() ) {
|
76 |
+
echo esc_html__('No lock file found.', 'post-smtp' );
|
77 |
+
die();
|
78 |
+
}
|
79 |
+
|
80 |
+
echo PostmanUtils::deleteLockFile() == true ? esc_html__('Success, try to send test email.', 'post-smtp' ) : esc_html__('Failed, try again.', 'post-smtp' );
|
81 |
+
die();
|
82 |
+
}
|
83 |
+
|
84 |
+
function do_activation_redirect() {
|
85 |
+
|
86 |
+
// Bail if no activation redirect
|
87 |
+
if ( ! get_transient( '_post_activation_redirect' ) ) {
|
88 |
+
return;
|
89 |
+
}
|
90 |
+
|
91 |
+
// Delete the redirect transient
|
92 |
+
delete_transient( '_post_activation_redirect' );
|
93 |
+
|
94 |
+
// Bail if activating from network, or bulk
|
95 |
+
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
|
96 |
+
return;
|
97 |
+
}
|
98 |
+
|
99 |
+
// Bail if the current user cannot see the about page
|
100 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
101 |
+
return;
|
102 |
+
}
|
103 |
+
|
104 |
+
// Redirect to bbPress about page
|
105 |
+
wp_safe_redirect( add_query_arg( array( 'page' => 'post-about' ), admin_url( 'index.php' ) ) );
|
106 |
+
}
|
107 |
+
|
108 |
+
public static function getPageUrl( $slug ) {
|
109 |
+
return PostmanUtils::getPageUrl( $slug );
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Add options page
|
114 |
+
*
|
115 |
+
* @since 2.1 Added `add_submenu_page`
|
116 |
+
*/
|
117 |
+
public function generateDefaultContent() {
|
118 |
+
// This page will be under "Settings"
|
119 |
+
$pageTitle = sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) );
|
120 |
+
$pluginName = __( 'Post SMTP', 'post-smtp' );
|
121 |
+
$uniqueId = self::POSTMAN_MENU_SLUG;
|
122 |
+
$pageOptions = array(
|
123 |
+
$this,
|
124 |
+
'outputDefaultContent',
|
125 |
+
);
|
126 |
+
$mainPostmanSettingsPage = add_menu_page( $pageTitle, $pluginName, Postman::MANAGE_POSTMAN_CAPABILITY_NAME, $uniqueId, $pageOptions, 'dashicons-email' );
|
127 |
+
|
128 |
+
//To change the text of top level menu
|
129 |
+
add_submenu_page( $uniqueId, $pageTitle, 'Dashboard', Postman::MANAGE_POSTMAN_CAPABILITY_NAME, $uniqueId, $pageOptions );
|
130 |
+
|
131 |
+
// When the plugin options page is loaded, also load the stylesheet
|
132 |
+
add_action( 'admin_print_styles-' . $mainPostmanSettingsPage, array(
|
133 |
+
$this,
|
134 |
+
'enqueueHomeScreenStylesheet',
|
135 |
+
) );
|
136 |
+
}
|
137 |
+
function enqueueHomeScreenStylesheet() {
|
138 |
+
wp_enqueue_style( PostmanViewController::POSTMAN_STYLE );
|
139 |
+
wp_enqueue_script( PostmanViewController::POSTMAN_SCRIPT );
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Register the Email Test screen
|
144 |
+
*/
|
145 |
+
public function addPurgeDataSubmenu() {
|
146 |
+
$page = add_submenu_page( null, sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ), __( 'Post SMTP', 'post-smtp' ), Postman::MANAGE_POSTMAN_CAPABILITY_NAME, PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG, array(
|
147 |
+
$this,
|
148 |
+
'outputPurgeDataContent',
|
149 |
+
) );
|
150 |
+
// When the plugin options page is loaded, also load the stylesheet
|
151 |
+
add_action( 'admin_print_styles-' . $page, array(
|
152 |
+
$this,
|
153 |
+
'enqueueHomeScreenStylesheet',
|
154 |
+
) );
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Register and add settings
|
159 |
+
*/
|
160 |
+
public function registerStylesAndScripts() {
|
161 |
+
if ( $this->logger->isTrace() ) {
|
162 |
+
$this->logger->trace( 'registerStylesAndScripts()' );
|
163 |
+
}
|
164 |
+
// register the stylesheet and javascript external resources
|
165 |
+
$pluginData = apply_filters( 'postman_get_plugin_metadata', null );
|
166 |
+
wp_register_style( PostmanViewController::POSTMAN_STYLE, plugins_url( 'style/postman.css', $this->rootPluginFilenameAndPath ), null, $pluginData ['version'] );
|
167 |
+
wp_register_style( 'jquery_ui_style', plugins_url( 'style/jquery-steps/jquery-ui.css', $this->rootPluginFilenameAndPath ), PostmanViewController::POSTMAN_STYLE, '1.1.0' );
|
168 |
+
wp_register_style( 'jquery_steps_style', plugins_url( 'style/jquery-steps/jquery.steps.css', $this->rootPluginFilenameAndPath ), PostmanViewController::POSTMAN_STYLE, '1.1.0' );
|
169 |
+
|
170 |
+
wp_register_script( PostmanViewController::POSTMAN_SCRIPT, plugins_url( 'script/postman.js', $this->rootPluginFilenameAndPath ), array(
|
171 |
+
PostmanViewController::JQUERY_SCRIPT,
|
172 |
+
'jquery-ui-core',
|
173 |
+
'jquery-ui-datepicker',
|
174 |
+
), $pluginData ['version'] );
|
175 |
+
wp_register_script( 'sprintf', plugins_url( 'script/sprintf/sprintf.min.js', $this->rootPluginFilenameAndPath ), null, '1.0.2' );
|
176 |
+
wp_register_script( 'jquery_steps_script', plugins_url( 'script/jquery-steps/jquery.steps.min.js', $this->rootPluginFilenameAndPath ), array(
|
177 |
+
PostmanViewController::JQUERY_SCRIPT
|
178 |
+
), '1.1.0' );
|
179 |
+
wp_register_script( 'jquery_validation', plugins_url( 'script/jquery-validate/jquery.validate.min.js', $this->rootPluginFilenameAndPath ), array(
|
180 |
+
PostmanViewController::JQUERY_SCRIPT
|
181 |
+
), '1.13.1' );
|
182 |
+
|
183 |
+
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_ajax_msg', array(
|
184 |
+
'bad_response' => __( 'An unexpected error occurred', 'post-smtp' ),
|
185 |
+
'corrupt_response' => __( 'Unexpected PHP messages corrupted the Ajax response', 'post-smtp' )
|
186 |
+
) );
|
187 |
+
|
188 |
+
wp_localize_script( PostmanViewController::POSTMAN_SCRIPT, 'postman_ajax', array(
|
189 |
+
'lessSecureNotice' => wp_create_nonce( 'less-secure-security' )
|
190 |
+
) );
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Options page callback
|
195 |
+
*/
|
196 |
+
public function outputDefaultContent() {
|
197 |
+
|
198 |
+
// Set class property
|
199 |
+
print '<div class="wrap">';
|
200 |
+
print '<div class="ps-main-container-wrap">';
|
201 |
+
|
202 |
+
$version = PostmanState::getInstance()->getVersion();
|
203 |
+
|
204 |
+
printf(
|
205 |
+
'<div class="ps-main-header post-smtp-welcome-panel"><h2>%s</h2></div>',
|
206 |
+
esc_html__( 'Post SMTP Setup', 'post-smtp' )
|
207 |
+
);
|
208 |
+
|
209 |
+
//Top Notification message
|
210 |
+
if( !PostmanPreRequisitesCheck::isReady() ) {
|
211 |
+
|
212 |
+
printf(
|
213 |
+
'<div class="ps-config-bar"><span>%s</span><span style="color: red" class="dashicons dashicons-dismiss"></span></div>',
|
214 |
+
esc_html__( 'Postman is unable to run. Email delivery is being handled by WordPress (or another plugin).', 'post-smtp' )
|
215 |
+
);
|
216 |
+
|
217 |
+
}
|
218 |
+
else {
|
219 |
+
|
220 |
+
$ready_messsage = PostmanTransportRegistry::getInstance()->getReadyMessage();
|
221 |
+
$statusMessage = $ready_messsage['message'];
|
222 |
+
|
223 |
+
if ( PostmanTransportRegistry::getInstance()->getActiveTransport()->isConfiguredAndReady() ) {
|
224 |
+
|
225 |
+
if ( $this->options->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) {
|
226 |
+
printf(
|
227 |
+
'<div class="ps-config-bar">
|
228 |
+
<span>%s</span><span style="color: orange;" class="dashicons dashicons-yes-alt"></span>
|
229 |
+
</div>',
|
230 |
+
wp_kses_post( $statusMessage )
|
231 |
+
);
|
232 |
+
} else {
|
233 |
+
printf(
|
234 |
+
'<div class="ps-config-bar">
|
235 |
+
<span>%s</span><span style="color: green" class="dashicons dashicons-yes-alt"></span>
|
236 |
+
<div class="ps-right">
|
237 |
+
What\'s Next? Get Started by Sending a Test Email! <a href="%s" class="ps-btn-orange"> Send a Test Email</a>
|
238 |
+
</div>
|
239 |
+
<div class="clear"></div>
|
240 |
+
</div>',
|
241 |
+
wp_kses_post( $statusMessage ),
|
242 |
+
esc_url( $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ) )
|
243 |
+
);
|
244 |
+
}
|
245 |
+
} else {
|
246 |
+
printf(
|
247 |
+
'<div class="ps-config-bar">
|
248 |
+
<span >%s</span>
|
249 |
+
<span style="color: red" class="dashicons dashicons-dismiss"></span>
|
250 |
+
<div class="ps-right">
|
251 |
+
%s <a href="%s" class="ps-btn-orange">%s</a>
|
252 |
+
</div>
|
253 |
+
</div>',
|
254 |
+
wp_kses_post( $statusMessage ),
|
255 |
+
esc_html__( 'Get Started by Setup Wizard!', 'post-smtp' ),
|
256 |
+
esc_attr( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ) ),
|
257 |
+
esc_html__( 'Start the Wizard', 'post-smtp' )
|
258 |
+
);
|
259 |
+
}
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
//Main Content
|
264 |
+
?>
|
265 |
+
<div class="ps-flex ps-home-main">
|
266 |
+
<div class="ps-setting-box">
|
267 |
+
<div>
|
268 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/configuration.png' ) ?>" />
|
269 |
+
<h3 class="ps-ib ps-vm"><?php esc_html_e( 'Configuration', 'post-smtp' ); ?></h3>
|
270 |
+
</div>
|
271 |
+
<div class="ps-wizard">
|
272 |
+
<a href="<?php esc_attr_e( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ) ) ?>" class="ps-btn-orange"><?php esc_html_e( 'Start the Wizard', 'post-smtp' ); ?></a>
|
273 |
+
<h4><?php esc_html_e( 'OR', 'post-smtp' ); ?></h4>
|
274 |
+
<div>
|
275 |
+
<a href="<?php echo esc_url( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ) ) ?>">
|
276 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
277 |
+
<?php esc_html_e( 'Show All Settings', 'post-smtp' ) ?>
|
278 |
+
</a>
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
</div>
|
282 |
+
<div class="ps-setting-box">
|
283 |
+
<img src="<?php echo esc_attr( POST_SMTP_ASSETS . 'images/icons/action.png' ) ?>" />
|
284 |
+
<h3 class="ps-ib ps-vm"><?php esc_html_e( 'Actions', 'post-smtp' ); ?></h3>
|
285 |
+
<div>
|
286 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
287 |
+
<?php
|
288 |
+
// Grant permission with Google
|
289 |
+
ob_start();
|
290 |
+
PostmanTransportRegistry::getInstance()->getSelectedTransport()->printActionMenuItem();
|
291 |
+
$oauth_link = ob_get_clean();
|
292 |
+
$oauth_link = apply_filters( 'post_smtp_oauth_actions', $oauth_link );
|
293 |
+
echo wp_kses_post( $oauth_link );
|
294 |
+
?>
|
295 |
+
</div>
|
296 |
+
<div>
|
297 |
+
<?php
|
298 |
+
if ( PostmanWpMailBinder::getInstance()->isBound() ) {
|
299 |
+
|
300 |
+
echo '
|
301 |
+
<div>
|
302 |
+
<a href="'.esc_url( $this->getPageUrl( PostmanSendTestEmailController::EMAIL_TEST_SLUG ) ).'">
|
303 |
+
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
304 |
+
'.esc_html__( 'Send a Test Email', 'post-smtp' ).
|
305 |
+
'</a>
|
306 |
+
</div>';
|
307 |
+
|
308 |
+
} else {
|
309 |
+
|
310 |
+
echo '
|
311 |
+
<div>
|
312 |
+
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
313 |
+
'.esc_html__( 'Send a Test Email', 'post-smtp' ) .'
|
314 |
+
</div>
|
315 |
+
';
|
316 |
+
|
317 |
+
}
|
318 |
+
?>
|
319 |
+
</div>
|
320 |
+
<div>
|
321 |
+
<?php
|
322 |
+
if ( ! $this->options->isNew() ) {
|
323 |
+
|
324 |
+
$purgeLinkPattern = '
|
325 |
+
<a href="%1$s">
|
326 |
+
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
327 |
+
%2$s
|
328 |
+
</a>';
|
329 |
+
|
330 |
+
}
|
331 |
+
else {
|
332 |
+
|
333 |
+
$purgeLinkPattern = '
|
334 |
+
<img src="'.esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ).'" width="15" />
|
335 |
+
%2$s
|
336 |
+
';
|
337 |
+
|
338 |
+
}
|
339 |
+
|
340 |
+
$importTitle = __( 'Import', 'post-smtp' );
|
341 |
+
$exportTile = __( 'Export', 'post-smtp' );
|
342 |
+
$resetTitle = __( 'Reset Plugin', 'post-smtp' );
|
343 |
+
$importExportReset = sprintf( '%s/%s/%s', $importTitle, $exportTile, $resetTitle );
|
344 |
+
|
345 |
+
printf(
|
346 |
+
wp_kses_post( $purgeLinkPattern ),
|
347 |
+
esc_url( $this->getPageUrl( PostmanAdminController::MANAGE_OPTIONS_PAGE_SLUG ) ),
|
348 |
+
sprintf( '%s', esc_html( $importExportReset ) )
|
349 |
+
);
|
350 |
+
|
351 |
+
do_action( 'post_smtp_extension_reset_link' );
|
352 |
+
?>
|
353 |
+
</div>
|
354 |
+
</div>
|
355 |
+
<div class="ps-setting-box">
|
356 |
+
<div>
|
357 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/extentions.png' ) ?>" />
|
358 |
+
<h3 class="ps-ib ps-vm"><?php esc_html_e( 'Extensions', 'post-smtp' ); ?></h3>
|
359 |
+
</div>
|
360 |
+
<div>
|
361 |
+
<a href="<?php echo esc_url( 'https://postmansmtp.com/extensions/office-365-for-post-smtp-extension/' ); ?>" target="_blank">
|
362 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
363 |
+
<?php echo esc_html( 'Office 365' ); ?>
|
364 |
+
</a>
|
365 |
+
</div>
|
366 |
+
<div>
|
367 |
+
<a href="<?php echo esc_url( 'https://postmansmtp.com/extensions/post-smtp-extension-for-amazon-ses/' ); ?>" target="_blank">
|
368 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
369 |
+
<?php echo esc_html( 'Amazon SES' ); ?>
|
370 |
+
</a>
|
371 |
+
</div>
|
372 |
+
<div>
|
373 |
+
<a href="<?php echo esc_url( 'https://postmansmtp.com/extensions/the-better-email/' ); ?>" target="_blank">
|
374 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
375 |
+
<?php echo esc_html( 'Better Email Logger' ); ?>
|
376 |
+
</a>
|
377 |
+
</div>
|
378 |
+
</div>
|
379 |
+
<div class="ps-setting-box">
|
380 |
+
<div>
|
381 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/troubleshooting.png' ) ?>" />
|
382 |
+
<h3 class="ps-ib ps-vm"><?php esc_html_e( 'Troubleshooting', 'post-smtp' ); ?></h3>
|
383 |
+
</div>
|
384 |
+
<div>
|
385 |
+
<a href="<?php echo esc_url( 'https://postmansmtp.com/help-configure-post-smtp/' ); ?>" target="_blank" >
|
386 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
387 |
+
<?php echo esc_html( 'Need help setup everything? (paid)' ); ?>
|
388 |
+
</a>
|
389 |
+
</div>
|
390 |
+
<div>
|
391 |
+
<a href="<?php echo $this->getPageUrl( PostmanConnectivityTestController::PORT_TEST_SLUG ); ?>">
|
392 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
393 |
+
<?php echo esc_html( 'Connectivity Test' ); ?>
|
394 |
+
</a>
|
395 |
+
</div>
|
396 |
+
<div>
|
397 |
+
<a href="<?php echo $this->getPageUrl( PostmanDiagnosticTestController::DIAGNOSTICS_SLUG ); ?>">
|
398 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
399 |
+
<?php echo esc_html( 'Diagnostic Test' ); ?>
|
400 |
+
</a>
|
401 |
+
</div>
|
402 |
+
<div>
|
403 |
+
<a href="#" class="release-lock-file" data-security="<?php esc_attr_e( wp_create_nonce( "postman" ) ); ?>" >
|
404 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
405 |
+
<?php echo esc_html( 'Release Lock File Error' ); ?>
|
406 |
+
</a>
|
407 |
+
</div>
|
408 |
+
<div>
|
409 |
+
<a href="<?php echo esc_url( 'https://wordpress.org/support/plugin/post-smtp/' ); ?>" target="_blank">
|
410 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
411 |
+
<?php echo esc_html( 'Online Support' ); ?>
|
412 |
+
</a>
|
413 |
+
</div>
|
414 |
+
<div>
|
415 |
+
<a href="<?php echo esc_url( 'https://www.facebook.com/groups/post.smtp' ); ?>" target="_blank">
|
416 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
417 |
+
<?php echo esc_html( 'Facebook Group' ); ?>
|
418 |
+
</a>
|
419 |
+
</div>
|
420 |
+
<div>
|
421 |
+
<a href="<?php echo esc_url( 'https://postmansmtp.com/category/guides/' ); ?>" target="_blank">
|
422 |
+
<img src="<?php echo esc_url( POST_SMTP_ASSETS . 'images/icons/finger.png' ) ?>" width="15" />
|
423 |
+
<?php echo esc_html( 'Guides' ); ?>
|
424 |
+
</a>
|
425 |
+
</div>
|
426 |
+
</div>
|
427 |
+
<div class="clear"></div>
|
428 |
+
</div>
|
429 |
+
<div class="ps-home-middle">
|
430 |
+
<?php
|
431 |
+
|
432 |
+
if ( PostmanPreRequisitesCheck::isReady() ) {
|
433 |
+
|
434 |
+
$this->printDeliveryDetails();
|
435 |
+
/* translators: where %d is the number of emails delivered */
|
436 |
+
print '<p><span>';
|
437 |
+
printf(
|
438 |
+
wp_kses_post( _n(
|
439 |
+
'Postman has delivered <span style="color:green">%d</span> email.',
|
440 |
+
'Postman has delivered <span style="color:green">%d</span> emails.',
|
441 |
+
esc_attr( PostmanState::getInstance()->getSuccessfulDeliveries() ) , 'post-smtp'
|
442 |
+
) ),
|
443 |
+
esc_attr( PostmanState::getInstance()->getSuccessfulDeliveries() )
|
444 |
+
);
|
445 |
+
if ( $this->options->isMailLoggingEnabled() ) {
|
446 |
+
print ' ';
|
447 |
+
printf(
|
448 |
+
wp_kses_post( __(
|
449 |
+
'The last %1$d email attempts are recorded <a href="%2$s">in the log</a>.', 'post-smtp'
|
450 |
+
) ),
|
451 |
+
esc_attr( PostmanOptions::getInstance()->getMailLoggingMaxEntries() ),
|
452 |
+
esc_attr( PostmanUtils::getEmailLogPageUrl() )
|
453 |
+
);
|
454 |
+
}
|
455 |
+
print '</span></p>';
|
456 |
+
|
457 |
+
}
|
458 |
+
|
459 |
+
if ( $this->options->isNew() ) {
|
460 |
+
printf(
|
461 |
+
'<h3 style="padding-top:10px">%s</h3>',
|
462 |
+
esc_html( 'Thank-you for choosing Postman!', 'post-smtp' )
|
463 |
+
);
|
464 |
+
/* translators: where %s is the URL of the Setup Wizard */
|
465 |
+
printf(
|
466 |
+
'<p><span>%s</span></p>',
|
467 |
+
sprintf(
|
468 |
+
wp_kses_post( 'Let\'s get started! All users are strongly encouraged to <a href="%s">run the Setup Wizard</a>.', 'post-smtp' ),
|
469 |
+
esc_url( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_WIZARD_SLUG ) )
|
470 |
+
)
|
471 |
+
);
|
472 |
+
printf(
|
473 |
+
'<p><span>%s</span></p>',
|
474 |
+
sprintf(
|
475 |
+
wp_kses_post( 'Alternately, <a href="%s">manually configure</a> your own settings and/or modify advanced options.', 'post-smtp' ),
|
476 |
+
esc_attr( $this->getPageUrl( PostmanConfigurationController::CONFIGURATION_SLUG ) )
|
477 |
+
)
|
478 |
+
);
|
479 |
+
} else {
|
480 |
+
if ( PostmanState::getInstance()->isTimeToReviewPostman() && ! PostmanOptions::getInstance()->isNew() ) {
|
481 |
+
print '</br><hr width="70%"></br>';
|
482 |
+
/* translators: where %s is the URL to the WordPress.org review and ratings page */
|
483 |
+
printf(
|
484 |
+
'<p>%s <a href="%s">%s</a>%s</p>',
|
485 |
+
esc_html__( 'Please consider', 'post-smtp' ),
|
486 |
+
esc_url( 'https://wordpress.org/support/plugin/post-smtp/reviews/?filter=5' ),
|
487 |
+
esc_html__( 'leaving a review', 'post-smtp' ),
|
488 |
+
esc_html( 'to help spread the word! :D', 'post-smtp' )
|
489 |
+
);
|
490 |
+
}
|
491 |
+
|
492 |
+
printf(
|
493 |
+
esc_html__( '%1$s Postman needs translators! Please take a moment to %2$s translate a few sentences on-line %3$s', 'post-smtp' ),
|
494 |
+
'<p><span>',
|
495 |
+
'<a href="https://translate.wordpress.org/projects/wp-plugins/post-smtp/stable">',
|
496 |
+
'</a> :-)</span></p>'
|
497 |
+
);
|
498 |
+
}
|
499 |
+
printf(
|
500 |
+
'<p><span><b style="
|
501 |
+
background-color:#2172b3; color: #fff;">%1$s</b>%2$s</span> <a target="_blank" href="%3$s">%4$s</a></p>',
|
502 |
+
esc_html__( 'New for v1.9.8!', 'post-smtp' ),
|
503 |
+
esc_html__( ' Fallback - setup a second delivery method when the first one is failing', 'post-smtp' ),
|
504 |
+
esc_url( 'https://postmansmtp.com/post-smtp-1-9-7-the-smtp-fallback/' ),
|
505 |
+
esc_html__( 'Check the detailes here', 'post-smtp')
|
506 |
+
);
|
507 |
+
|
508 |
+
print '</div>';
|
509 |
+
|
510 |
+
//Temporary disabled
|
511 |
+
|
512 |
+
// <div class="ps-home-bottom">
|
513 |
+
// <div class="ps-config-bar">
|
514 |
+
// <h1>Download Our Featured Plugins For Free</h1>
|
515 |
+
// </div>
|
516 |
+
// <div class="ps-flex">
|
517 |
+
// <div class="ps-email-templates">
|
518 |
+
// <h4>Create Fully Responsive Email Templates in Just a Few Minutes With Email Templates</h2>
|
519 |
+
// <ul>
|
520 |
+
// <li>A free WordPress email template plugin.</li>
|
521 |
+
// <li>Quickest way to design elegant responsive emails.</li>
|
522 |
+
// <li>Features fully compatible with Postnman SMTP.</li>
|
523 |
+
// </ul>
|
524 |
+
// <div class="ps-left">
|
525 |
+
// <a href="https://wordpress.org/plugins/email-templates/>" class="ps-btn-light-blue" target="_blank">Free Download</a>
|
526 |
+
// </div>
|
527 |
+
// <div class="ps-right">
|
528 |
+
// <img src="echo esc_url( POST_SMTP_ASSETS . 'images/logos/email-templates.jpg' )" />
|
529 |
+
// </div>
|
530 |
+
// <div class="clear"></div>
|
531 |
+
// </div>
|
532 |
+
// <div class="ps-login-designer">
|
533 |
+
// <h4>Upgrade Your Custom Login Styling Experience With Login Designer</h2>
|
534 |
+
// <ul>
|
535 |
+
// <li>A free Login customizer plugin for WordPress.</li>
|
536 |
+
// <li>Easiest way to customize your website's login page.</li>
|
537 |
+
// <li>Installation is free, fun quick, and easy.</li>
|
538 |
+
// </ul>
|
539 |
+
// <div class="ps-left">
|
540 |
+
// <a href="https://wordpress.org/plugins/login-designer/>" class="ps-btn-blue" target="_blank">Free Download</a>
|
541 |
+
// </div>
|
542 |
+
// <div class="ps-right">
|
543 |
+
// <img src="<?php esc_url( POST_SMTP_ASSETS . 'images/logos/login-designer.jpg' )" />
|
544 |
+
// </div>
|
545 |
+
// <div class="clear"></div>
|
546 |
+
// </div>
|
547 |
+
// </div>
|
548 |
+
// </div>
|
549 |
+
|
550 |
+
print "</div>";
|
551 |
+
print "</div>";
|
552 |
+
|
553 |
+
}
|
554 |
+
|
555 |
+
/**
|
556 |
+
*/
|
557 |
+
private function printDeliveryDetails() {
|
558 |
+
$currentTransport = PostmanTransportRegistry::getInstance()->getActiveTransport();
|
559 |
+
$deliveryDetails = $currentTransport->getDeliveryDetails( $this->options );
|
560 |
+
printf(
|
561 |
+
'<p><span>%s</span></p>',
|
562 |
+
wp_kses_post( $deliveryDetails )
|
563 |
+
);
|
564 |
+
}
|
565 |
+
|
566 |
+
/**
|
567 |
+
*
|
568 |
+
* @param mixed $title
|
569 |
+
* @param string $slug
|
570 |
+
*/
|
571 |
+
public static function outputChildPageHeader( $title, $slug = '' ) {
|
572 |
+
|
573 |
+
$content = '';
|
574 |
+
$content .= sprintf( '<h2>%s</h2>', sprintf( __( '%s Setup', 'post-smtp' ), __( 'Post SMTP', 'post-smtp' ) ) );
|
575 |
+
$content .= "
|
576 |
+
<div id='postman-main-menu' class='post-smtp-welcome-panel {$slug}'>
|
577 |
+
<div class='post-smtp-welcome-panel-content'>
|
578 |
+
<div class='welcome-panel-column-container'>
|
579 |
+
<div class='welcome-panel-last'>
|
580 |
+
<div class='ps-left'>
|
581 |
+
<h1>{$title}<h1/>
|
582 |
+
</div>";
|
583 |
+
$content .= sprintf( '<div class="ps-right"><div class="back-to-menu-link"><a href="%s" class="ps-btn-orange" >%s</a></div></div>', PostmanUtils::getSettingsPageUrl(), _x( 'Back To Main Menu', 'Return to main menu link', 'post-smtp' ) );
|
584 |
+
$content .= '
|
585 |
+
<div class="clear"></div>
|
586 |
+
</div>
|
587 |
+
</div>
|
588 |
+
</div>
|
589 |
+
</div>';
|
590 |
+
|
591 |
+
echo wp_kses_post( $content );
|
592 |
+
|
593 |
+
}
|
594 |
+
|
595 |
+
/**
|
596 |
+
*/
|
597 |
+
public function outputPurgeDataContent() {
|
598 |
+
$importTitle = __( 'Import', 'post-smtp' );
|
599 |
+
$exportTile = __( 'Export', 'post-smtp' );
|
600 |
+
$resetTitle = __( 'Reset Plugin', 'post-smtp' );
|
601 |
+
$options = $this->options;
|
602 |
+
print '<div class="wrap">';
|
603 |
+
PostmanViewController::outputChildPageHeader( sprintf( '%s/%s/%s', $importTitle, $exportTile, $resetTitle ) );
|
604 |
+
print '<section id="export_settings" class="ps-left">';
|
605 |
+
printf( '<h3><span>%s<span></h3>', esc_html( $exportTile ) );
|
606 |
+
printf( '<p><span>%s</span></p>', esc_html__( 'Copy this data into another instance of Postman to duplicate the configuration.', 'post-smtp' ) );
|
607 |
+
$data = '';
|
608 |
+
if ( ! PostmanPreRequisitesCheck::checkZlibEncode() ) {
|
609 |
+
$extraDeleteButtonAttributes = sprintf( 'disabled="true"' );
|
610 |
+
$data = '';
|
611 |
+
} else {
|
612 |
+
$extraDeleteButtonAttributes = '';
|
613 |
+
if ( ! $options->isNew() ) {
|
614 |
+
$data = $options->export();
|
615 |
+
}
|
616 |
+
}
|
617 |
+
printf(
|
618 |
+
'<textarea cols="80" rows="10" class="ps-textarea" readonly="true" name="settings" %s>%s</textarea>',
|
619 |
+
esc_attr( $extraDeleteButtonAttributes ), esc_textarea( $data )
|
620 |
+
);
|
621 |
+
print '</section>';
|
622 |
+
print '<section id="import_settings" class="ps-right">';
|
623 |
+
printf(
|
624 |
+
'<h3><span>%s<span></h3>',
|
625 |
+
esc_html( $importTitle )
|
626 |
+
);
|
627 |
+
print '<form method="POST" action="' . esc_attr( get_admin_url() ) . 'admin-post.php">';
|
628 |
+
wp_nonce_field( PostmanAdminController::IMPORT_SETTINGS_SLUG );
|
629 |
+
printf(
|
630 |
+
'<input type="hidden" name="action" value="%s" />',
|
631 |
+
esc_attr( PostmanAdminController::IMPORT_SETTINGS_SLUG )
|
632 |
+
);
|
633 |
+
print '<p>';
|
634 |
+
printf(
|
635 |
+
'<span>%s</span>',
|
636 |
+
esc_html__( 'Paste data from another instance of Postman here to duplicate the configuration.', 'post-smtp' )
|
637 |
+
);
|
638 |
+
if ( PostmanTransportRegistry::getInstance()->getSelectedTransport()->isOAuthUsed( PostmanOptions::getInstance()->getAuthenticationType() ) ) {
|
639 |
+
$warning = __( 'Warning', 'post-smtp' );
|
640 |
+
$errorMessage = __( 'Using the same OAuth 2.0 Client ID and Client Secret from this site at the same time as another site will cause failures.', 'post-smtp' );
|
641 |
+
printf( ' <span><b>%s</b>: %s</span>', esc_html( $warning ), esc_html( $errorMessage ) );
|
642 |
+
}
|
643 |
+
print '</p>';
|
644 |
+
printf(
|
645 |
+
'<textarea cols="80" rows="10" class="ps-textarea" name="settings" %s></textarea>',
|
646 |
+
esc_textarea( $extraDeleteButtonAttributes )
|
647 |
+
);
|
648 |
+
submit_button( __( 'Import', 'post-smtp' ), 'ps-btn-orange', 'import', true, $extraDeleteButtonAttributes );
|
649 |
+
print '</form>';
|
650 |
+
print '</section>';
|
651 |
+
print '<div class="clear"></div>';
|
652 |
+
print '<section id="delete_settings">';
|
653 |
+
printf( '<h3><span>%s<span></h3>', esc_html( $resetTitle ) );
|
654 |
+
print '<form class="post-smtp-reset-options" method="POST" action="' . esc_attr( get_admin_url() ) . 'admin-post.php">';
|
655 |
+
wp_nonce_field( PostmanAdminController::PURGE_DATA_SLUG );
|
656 |
+
printf(
|
657 |
+
'<input type="hidden" name="action" value="%s" />',
|
658 |
+
esc_attr( PostmanAdminController::PURGE_DATA_SLUG )
|
659 |
+
);
|
660 |
+
printf(
|
661 |
+
'<p><span>%s</span></p><p><span>%s</span></p>',
|
662 |
+
esc_html__( 'This will purge all of Postman\'s settings, including account credentials and the email log.', 'post-smtp' ),
|
663 |
+
esc_html__( 'Are you sure?', 'post-smtp' )
|
664 |
+
);
|
665 |
+
|
666 |
+
submit_button( $resetTitle, 'delete ps-btn-red', 'submit', true );
|
667 |
+
print '</form>';
|
668 |
+
print '</section>';
|
669 |
+
print '</div>';
|
670 |
+
}
|
671 |
+
|
672 |
+
public function google_less_secure_notice() {
|
673 |
+
|
674 |
+
?>
|
675 |
+
<div class="notice notice-error is-dismissible ps-less-secure-notice">
|
676 |
+
<?php
|
677 |
+
printf(
|
678 |
+
'<p>%1$s <br />%2$s <a href="%3$s" target="_blank">%4$s</a><br /><a href="" id="discard-less-secure-notification">%5$s</a></p>',
|
679 |
+
esc_html__( '"To help keep your account secure, starting May 30, 2022, Google will no longer support the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password."', 'post-smtp' ),
|
680 |
+
esc_html__( 'You can switch to Auth 2.0 option to continue without any downtime.', 'post-smtp' ),
|
681 |
+
esc_url( 'https://postmansmtp.com/gmail-is-disabling-less-secure-apps' ),
|
682 |
+
esc_html__( 'Click here for more info', 'post-smtp' ),
|
683 |
+
esc_html__( 'I understand and would like to discard this notice', 'post-smtp' )
|
684 |
+
);
|
685 |
+
?>
|
686 |
+
</div>
|
687 |
+
<?php
|
688 |
+
|
689 |
+
}
|
690 |
+
|
691 |
+
/**
|
692 |
+
* Discards less secure notification
|
693 |
+
*
|
694 |
+
* @since 2.1.2
|
695 |
+
* @version 1.0
|
696 |
+
*/
|
697 |
+
public function discard_less_secure_notification() {
|
698 |
+
|
699 |
+
if( !wp_verify_nonce( $_POST['_wp_nonce'], 'less-secure-security' ) ) {
|
700 |
+
die( 'Not Secure.' );
|
701 |
+
}
|
702 |
+
|
703 |
+
$result = update_option( 'ps_hide_less_secure', 1 );
|
704 |
+
|
705 |
+
if( $result ) {
|
706 |
+
wp_send_json_success(
|
707 |
+
array( 'message' => 'Success' ),
|
708 |
+
200
|
709 |
+
);
|
710 |
+
}
|
711 |
+
|
712 |
+
wp_send_json_error(
|
713 |
+
array( 'message' => 'Something went wrong' ),
|
714 |
+
500
|
715 |
+
);
|
716 |
+
|
717 |
+
}
|
718 |
+
}
|
719 |
}
|
postman-smtp.php
CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
6 |
* Plugin Name: Post SMTP
|
7 |
* Plugin URI: https://wordpress.org/plugins/post-smtp/
|
8 |
* 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!
|
9 |
-
* Version: 2.1.
|
10 |
* Author: Post SMTP
|
11 |
* Text Domain: post-smtp
|
12 |
* Author URI: https://postmansmtp.com
|
@@ -74,7 +74,7 @@ if ( ! function_exists( 'ps_fs' ) ) {
|
|
74 |
define( 'POST_SMTP_BASE', __FILE__ );
|
75 |
define( 'POST_SMTP_PATH', __DIR__ );
|
76 |
define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
|
77 |
-
define( 'POST_SMTP_VER', '2.1.
|
78 |
define( 'POST_SMTP_ASSETS', plugin_dir_url( __FILE__ ) . 'assets/' );
|
79 |
|
80 |
$postman_smtp_exist = in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) );
|
6 |
* Plugin Name: Post SMTP
|
7 |
* Plugin URI: https://wordpress.org/plugins/post-smtp/
|
8 |
* 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!
|
9 |
+
* Version: 2.1.3
|
10 |
* Author: Post SMTP
|
11 |
* Text Domain: post-smtp
|
12 |
* Author URI: https://postmansmtp.com
|
74 |
define( 'POST_SMTP_BASE', __FILE__ );
|
75 |
define( 'POST_SMTP_PATH', __DIR__ );
|
76 |
define( 'POST_SMTP_URL', plugins_url('', POST_SMTP_BASE ) );
|
77 |
+
define( 'POST_SMTP_VER', '2.1.3' );
|
78 |
define( 'POST_SMTP_ASSETS', plugin_dir_url( __FILE__ ) . 'assets/' );
|
79 |
|
80 |
$postman_smtp_exist = in_array( 'postman-smtp/postman-smtp.php', (array) get_option( 'active_plugins', array() ) );
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
=== Post SMTP Mailer
|
2 |
Plugin URI: https://wpexperts.io/
|
3 |
Contributors: wpexpertsio
|
4 |
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 6.0
|
7 |
-
Stable tag: 2.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -14,18 +14,18 @@ Send, log, and get notified when your emails are failing. Plus a unique option f
|
|
14 |
|
15 |
= WordPress Mail SMTP Plugin =
|
16 |
|
17 |
-
Post SMTP is a next-generation WP Mail SMTP plugin
|
18 |
|
19 |
The **Connectivity Test** and intelligent **Setup Wizard** scan your SMTP server to detect firewall blocks and eliminate configuration mistakes. The built-in **Email Log** is an invaluable resource for [diagnosing problems](https://wordpress.org/support/topic/ugly-e-mails-no-html-and-no-special-characters?replies=15) with emails. Even hosts that block the standard SMTP ports, like GoDaddy or Bluehost, can't stop your email as **Post SMTP can deliver via HTTPS** if it can't use SMTP.
|
20 |
|
21 |
-
Post SMTP is *not* another WP Mail SMTP clone like WP Bank or Easy SMTP. It replaces the default WordPress SMTP library, PHPMailer, with the heavy-duty Zend_Mail. Never
|
22 |
|
23 |
= The Only SMTP plugin with chrome Notifications =
|
24 |
Get notified if your emails are failing inside your Chrome browser. [Download here](https://chrome.google.com/webstore/detail/post-smtp-notifications/npklmbkpbknkmbohdbpikeidiaekjoch?hl=en-US)
|
25 |
|
26 |
https://www.youtube.com/watch?v=mXDEEE9jnfw
|
27 |
|
28 |
-
=
|
29 |
* Easy-to-use, powerful Setup Wizard for perfect configuration
|
30 |
* Commercial-grade Connectivity Tester to diagnose server issues
|
31 |
* Log and resend all emails; see the exact cause of failed emails
|
@@ -34,27 +34,25 @@ https://www.youtube.com/watch?v=mXDEEE9jnfw
|
|
34 |
* [SASL](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer) Support: Plain/Login/CRAM-MD5/[XOAUTH2](https://en.wikipedia.org/wiki/OAuth#OAuth_2.0) authentication
|
35 |
* Security Support: [SMTPS](https://en.wikipedia.org/wiki/SMTPS) and [STARTTLS](https://en.wikipedia.org/wiki/STARTTLS) ([SSL/TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security))
|
36 |
* Copy configuration to other instances of Post
|
|
|
|
|
|
|
37 |
|
38 |
= Looking for Post SMTP Pro Extensions? =
|
39 |
Post SMTP's pro extensions are everything you need to enhance your WordPress email deliverability experience. Check our extensions for Amazon SES, Better Email Logger and Office365.
|
40 |
[Post SMTP Pro Extensions](https://postmansmtp.com/extensions/)
|
41 |
|
42 |
-
=
|
43 |
[Office365 Pro extension](https://postmansmtp.com/extensions/office-365-extension-for-post-smtp/) allows you to connect PostSMTP with your Outlook and Microsoft 365 accounts to improve email deliverability.
|
44 |
|
45 |
-
=
|
46 |
-
[
|
47 |
|
48 |
-
=
|
49 |
-
[
|
50 |
|
51 |
-
=
|
52 |
-
|
53 |
-
* Fire-and-forget delivery continues even if your password changes
|
54 |
-
* Gmail: By combining OAuth2 and the Gmail API, Post can deliver where other plugins can not
|
55 |
-
|
56 |
-
= The Most Fast And Easy =
|
57 |
-
See how fast and easy to setup Post SMTP with Google/Gsuite or any SMTP service including:
|
58 |
|
59 |
= API (HTTPS) Email Support =
|
60 |
* **Gmail API for sending Gmail and Google Apps email** (requires a [Google](https://accounts.google.com/signup) account)
|
@@ -73,20 +71,17 @@ SendGrid has a free SMTP plan that you can use to send up to 100 emails per day.
|
|
73 |
* **Sendinblue API for sending any email** (requires a [Sendinblue](https://www.sendinblue.com/) account and PHP 5.3)
|
74 |
SendinBlue is an effective and great email software for Small to Medium businesses. You can build customer relationships with an all-in-one digital marketing toolbox. Their free plan allows you to send up to 300 emails per day.
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
= Compatibile With.. =
|
79 |
* [Woocommerce](https://wordpress.org/plugins/woocommerce/)
|
80 |
* [WPForms](https://wordpress.org/plugins/wpforms-lite/)
|
|
|
|
|
81 |
* [Elementor Forms](https://elementor.com/features/form-widget/)
|
82 |
-
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
|
83 |
* [Gravity Forms](http://www.gravityforms.com)
|
84 |
-
* [
|
85 |
* [Visual Forms Builder](https://wordpress.org/plugins/visual-form-builder/)
|
86 |
-
* [
|
87 |
-
* [PlanSo Forms](https://wordpress.org/plugins/planso-forms/)
|
88 |
-
* [Quform](https://www.quform.com/)
|
89 |
-
* [MyMail Newsletter](http://revaxarts-themes.com/?t=mymail) by revaxarts
|
90 |
* [SendPress Newsletters](https://wordpress.org/plugins/sendpress/)
|
91 |
* [WP HTML Mail](https://wordpress.org/plugins/wp-html-mail/)
|
92 |
* [Email Templates](https://wordpress.org/plugins/email-templates/)
|
@@ -94,27 +89,17 @@ SendinBlue is an effective and great email software for Small to Medium business
|
|
94 |
* .. and every other plugin that uses the WordPress API [wp_mail](https://codex.wordpress.org/Function_Reference/wp_mail) to send mail!
|
95 |
|
96 |
= Requirements =
|
97 |
-
* WordPress
|
98 |
* Memory: 750KiB per process at idle
|
99 |
* Reliable mail delivery with custom email domains requires an SPF record
|
100 |
* Reliable SMTP delivery requires credentials with an email service provider
|
101 |
-
* OAuth 2.0 features require a Gmail, Hotmail or Yahoo mail OAuth 2.0 credentials
|
102 |
-
|
103 |
-
= Looking for Google Analytics plugin? =
|
104 |
-
If you used Google Analytics Dashboard For WP and you really hate the latest updates, I have forked the original plugin here:
|
105 |
-
[https://wordpress.org/plugins/metrics-query/](https://wordpress.org/plugins/metrics-query/)
|
106 |
-
|
107 |
-
= CREDITS =
|
108 |
-
|
109 |
-
Post SMTP (aka Postman SMTP) plugin was originally created by Jason Hendriks.
|
110 |
|
111 |
== Installation ==
|
112 |
|
113 |
> To send email reliably, you must use the SMTP server assigned to that email. If Post is unable to connect to the right SMTP server, you may have to ask your host to open the ports, or create a new email account managed by your host, or switch hosts!
|
114 |
-
>
|
115 |
> The Connectivity Test utility will tell you which ports are open and the actions available to you.
|
116 |
|
117 |
-
= Easy install and setup! (Recommended for all users) =
|
118 |
1. Install and activate the plugin through the 'Plugins' menu in WordPress.
|
119 |
1. In the WordPress 'Settings' menu select 'Post SMTP'.
|
120 |
1. Choose 'Start the Wizard' and follow the instructions.
|
@@ -154,10 +139,6 @@ Post SMTP (aka Postman SMTP) plugin was originally created by Jason Hendriks.
|
|
154 |
|
155 |
== Frequently Asked Questions ==
|
156 |
|
157 |
-
= Where is Postman SMTP? =
|
158 |
-
From 2015-11-08 more or less I can say that Jason the original author stoped maintain the plugin.
|
159 |
-
He may still answered some support tickets, but nothing more.
|
160 |
-
|
161 |
= What is OAuth 2.0? =
|
162 |
|
163 |
A modern replacement for traditional password-based authentication. Post supports the OAuth 2.0 implementations of all three major e-mail providers: Gmail, Hotmail and Yahoo Mail.
|
@@ -235,7 +216,7 @@ You've [forgotten to choose an email address in the consent screen](https://word
|
|
235 |
|
236 |
== SMTP Error Messages ==
|
237 |
|
238 |
-
= Communication Error [334]
|
239 |
|
240 |
* This is almost always caused by being logged in to Google/Microsoft/Yahoo with a different user than the one Post is configured to send mail with. Logout and try again with the correct user
|
241 |
* Login to [Webmail](http://www.gmail.com) and see if there is an "Unusual Activity" warning waiting for your attention
|
@@ -293,6 +274,10 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
|
|
293 |
|
294 |
== Changelog ==
|
295 |
|
|
|
|
|
|
|
|
|
296 |
= 2.1.2- 2022-06-30 =
|
297 |
* **NEW**
|
298 |
* Integrated SDK for Feedback and support.
|
@@ -302,7 +287,7 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
|
|
302 |
Removed unused code
|
303 |
|
304 |
* **FIX**
|
305 |
-
|
306 |
|
307 |
|
308 |
= 2.1.1.1 - 2022-06-15 =
|
@@ -332,7 +317,7 @@ Add notice about Google Less Secure App.
|
|
332 |
= 2.0.25 - 2022-04-06 =
|
333 |
* **Bug Fixes**
|
334 |
* WP 5.9 Compatibility Ballon UI issue.
|
335 |
-
* Uncaught Error: Class
|
336 |
* Ajax error appearing due to Google API depreciated function.
|
337 |
|
338 |
* **Improvements**
|
@@ -353,7 +338,7 @@ Add notice about Google Less Secure App.
|
|
353 |
|
354 |
= 2.0.21 - 2021-02-11
|
355 |
* Fixed: Security issue - nonce validation.
|
356 |
-
* Fixed: Class
|
357 |
* New: New wp-config.php constant to disable the email logger = `POST_SMTP_CORE_MAIL_LOG`.
|
358 |
|
359 |
= 2.0.20 - 2021-01-19
|
@@ -869,8 +854,6 @@ Syntx stupid mistake
|
|
869 |
= 0.1 - 2015-01-19 =
|
870 |
* First release. Happy Fig Newton Day! It was a grueling week-end, studying PHP and OAuth and Googling like a Boss, but it's done and it works!
|
871 |
|
872 |
-
|
873 |
-
|
874 |
== Upgrade Notice ==
|
875 |
|
876 |
= 1.7 =
|
1 |
+
=== Post SMTP Mailer - Email Log - SMTP Connector ===
|
2 |
Plugin URI: https://wpexperts.io/
|
3 |
Contributors: wpexpertsio
|
4 |
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 6.0
|
7 |
+
Stable tag: 2.1.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
14 |
|
15 |
= WordPress Mail SMTP Plugin =
|
16 |
|
17 |
+
Post SMTP is a next-generation WP Mail SMTP plugin that assists in the delivery of email generated by your WordPress site. Post SMTP is the first and only plugin to support the [latest security standards](http://googleonlinesecurity.blogspot.ca/2014/04/new-security-measures-will-affect-older.html). With OAuth 2.0, there is **no need** to [store your email passsword](http://blog.codinghorror.com/youre-probably-storing-passwords-incorrectly/) in the WordPress database where it might be found.
|
18 |
|
19 |
The **Connectivity Test** and intelligent **Setup Wizard** scan your SMTP server to detect firewall blocks and eliminate configuration mistakes. The built-in **Email Log** is an invaluable resource for [diagnosing problems](https://wordpress.org/support/topic/ugly-e-mails-no-html-and-no-special-characters?replies=15) with emails. Even hosts that block the standard SMTP ports, like GoDaddy or Bluehost, can't stop your email as **Post SMTP can deliver via HTTPS** if it can't use SMTP.
|
20 |
|
21 |
+
Post SMTP is *not* another WP Mail SMTP clone like WP Bank or Easy SMTP. It replaces the default WordPress SMTP library, PHPMailer, with the heavy-duty Zend_Mail. Never lose an email to PHP mail() again.
|
22 |
|
23 |
= The Only SMTP plugin with chrome Notifications =
|
24 |
Get notified if your emails are failing inside your Chrome browser. [Download here](https://chrome.google.com/webstore/detail/post-smtp-notifications/npklmbkpbknkmbohdbpikeidiaekjoch?hl=en-US)
|
25 |
|
26 |
https://www.youtube.com/watch?v=mXDEEE9jnfw
|
27 |
|
28 |
+
= Post SMTP Features =
|
29 |
* Easy-to-use, powerful Setup Wizard for perfect configuration
|
30 |
* Commercial-grade Connectivity Tester to diagnose server issues
|
31 |
* Log and resend all emails; see the exact cause of failed emails
|
34 |
* [SASL](https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer) Support: Plain/Login/CRAM-MD5/[XOAUTH2](https://en.wikipedia.org/wiki/OAuth#OAuth_2.0) authentication
|
35 |
* Security Support: [SMTPS](https://en.wikipedia.org/wiki/SMTPS) and [STARTTLS](https://en.wikipedia.org/wiki/STARTTLS) ([SSL/TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security))
|
36 |
* Copy configuration to other instances of Post
|
37 |
+
* Supports the proprietary OAuth 2.0 implementations of Gmail, Hotmail and Yahoo
|
38 |
+
* Fire-and-forget delivery continues even if you change your password.
|
39 |
+
* [Set up an app password](https://youtu.be/OX2g6QB6LWI) in your Google account.
|
40 |
|
41 |
= Looking for Post SMTP Pro Extensions? =
|
42 |
Post SMTP's pro extensions are everything you need to enhance your WordPress email deliverability experience. Check our extensions for Amazon SES, Better Email Logger and Office365.
|
43 |
[Post SMTP Pro Extensions](https://postmansmtp.com/extensions/)
|
44 |
|
45 |
+
= Office365 API delivery =
|
46 |
[Office365 Pro extension](https://postmansmtp.com/extensions/office-365-extension-for-post-smtp/) allows you to connect PostSMTP with your Outlook and Microsoft 365 accounts to improve email deliverability.
|
47 |
|
48 |
+
= Amazon SES API delivery? =
|
49 |
+
[Amazon SES Pro Extension](https://postmansmtp.com/extensions/post-smtp-extension-for-amazon-ses/) combines Amazon's mail service provider with PostSMTP's powerful and easy-to-use SMTP mailing features.
|
50 |
|
51 |
+
= Twilio Extention? =
|
52 |
+
[Twilio Extension](https://postmansmtp.com/extensions/twilio-extension-pro/) allows you to add your phone number so that you can receive SMS notifications and alerts when emails are not delivered to your recipients.
|
53 |
|
54 |
+
= Better Email Logger Extension? =
|
55 |
+
[Better Email Logger Pro extension](https://postmansmtp.com/extensions/the-better-email/) allows you to design email marketing campaigns and improve email deliverability for your WordPress site.
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
= API (HTTPS) Email Support =
|
58 |
* **Gmail API for sending Gmail and Google Apps email** (requires a [Google](https://accounts.google.com/signup) account)
|
71 |
* **Sendinblue API for sending any email** (requires a [Sendinblue](https://www.sendinblue.com/) account and PHP 5.3)
|
72 |
SendinBlue is an effective and great email software for Small to Medium businesses. You can build customer relationships with an all-in-one digital marketing toolbox. Their free plan allows you to send up to 300 emails per day.
|
73 |
|
74 |
+
= Compatibility & Support =
|
75 |
+
* [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
|
|
|
76 |
* [Woocommerce](https://wordpress.org/plugins/woocommerce/)
|
77 |
* [WPForms](https://wordpress.org/plugins/wpforms-lite/)
|
78 |
+
* [New User Approve](https://wordpress.org/plugins/new-user-approve/)
|
79 |
+
* [Password Protected](https://wordpress.org/plugins/password-protected/)
|
80 |
* [Elementor Forms](https://elementor.com/features/form-widget/)
|
|
|
81 |
* [Gravity Forms](http://www.gravityforms.com)
|
82 |
+
* [Login Designer](https://wordpress.org/plugins/login-designer/)
|
83 |
* [Visual Forms Builder](https://wordpress.org/plugins/visual-form-builder/)
|
84 |
+
* [MyMail Newsletter](http://revaxarts-themes.com/?t=mymail)
|
|
|
|
|
|
|
85 |
* [SendPress Newsletters](https://wordpress.org/plugins/sendpress/)
|
86 |
* [WP HTML Mail](https://wordpress.org/plugins/wp-html-mail/)
|
87 |
* [Email Templates](https://wordpress.org/plugins/email-templates/)
|
89 |
* .. and every other plugin that uses the WordPress API [wp_mail](https://codex.wordpress.org/Function_Reference/wp_mail) to send mail!
|
90 |
|
91 |
= Requirements =
|
92 |
+
* WordPress 5.6 and PHP 5.6 with SPL and iconv
|
93 |
* Memory: 750KiB per process at idle
|
94 |
* Reliable mail delivery with custom email domains requires an SPF record
|
95 |
* Reliable SMTP delivery requires credentials with an email service provider
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
== Installation ==
|
98 |
|
99 |
> To send email reliably, you must use the SMTP server assigned to that email. If Post is unable to connect to the right SMTP server, you may have to ask your host to open the ports, or create a new email account managed by your host, or switch hosts!
|
|
|
100 |
> The Connectivity Test utility will tell you which ports are open and the actions available to you.
|
101 |
|
102 |
+
= Easy to install and setup! (Recommended for all users) =
|
103 |
1. Install and activate the plugin through the 'Plugins' menu in WordPress.
|
104 |
1. In the WordPress 'Settings' menu select 'Post SMTP'.
|
105 |
1. Choose 'Start the Wizard' and follow the instructions.
|
139 |
|
140 |
== Frequently Asked Questions ==
|
141 |
|
|
|
|
|
|
|
|
|
142 |
= What is OAuth 2.0? =
|
143 |
|
144 |
A modern replacement for traditional password-based authentication. Post supports the OAuth 2.0 implementations of all three major e-mail providers: Gmail, Hotmail and Yahoo Mail.
|
216 |
|
217 |
== SMTP Error Messages ==
|
218 |
|
219 |
+
= Communication Error [334] – make sure the Envelope From Email is the same account used to create the Client ID. =
|
220 |
|
221 |
* This is almost always caused by being logged in to Google/Microsoft/Yahoo with a different user than the one Post is configured to send mail with. Logout and try again with the correct user
|
222 |
* Login to [Webmail](http://www.gmail.com) and see if there is an "Unusual Activity" warning waiting for your attention
|
274 |
|
275 |
== Changelog ==
|
276 |
|
277 |
+
= 2.1.3- 2022-07-1 =
|
278 |
+
* **FIX**
|
279 |
+
* PHP Version Compatibility.
|
280 |
+
|
281 |
= 2.1.2- 2022-06-30 =
|
282 |
* **NEW**
|
283 |
* Integrated SDK for Feedback and support.
|
287 |
Removed unused code
|
288 |
|
289 |
* **FIX**
|
290 |
+
“Less secure App†Banner appearing in non-appropriate cases
|
291 |
|
292 |
|
293 |
= 2.1.1.1 - 2022-06-15 =
|
317 |
= 2.0.25 - 2022-04-06 =
|
318 |
* **Bug Fixes**
|
319 |
* WP 5.9 Compatibility Ballon UI issue.
|
320 |
+
* Uncaught Error: Class ‘PostmanAdminController’ not found.
|
321 |
* Ajax error appearing due to Google API depreciated function.
|
322 |
|
323 |
* **Improvements**
|
338 |
|
339 |
= 2.0.21 - 2021-02-11
|
340 |
* Fixed: Security issue - nonce validation.
|
341 |
+
* Fixed: Class ‘PostmanViewController’ not found
|
342 |
* New: New wp-config.php constant to disable the email logger = `POST_SMTP_CORE_MAIL_LOG`.
|
343 |
|
344 |
= 2.0.20 - 2021-01-19
|
854 |
= 0.1 - 2015-01-19 =
|
855 |
* First release. Happy Fig Newton Day! It was a grueling week-end, studying PHP and OAuth and Googling like a Boss, but it's done and it works!
|
856 |
|
|
|
|
|
857 |
== Upgrade Notice ==
|
858 |
|
859 |
= 1.7 =
|