summaryrefslogtreecommitdiff
path: root/Postman/Extensions/Admin
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2019-11-25 09:25:43 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2019-11-25 09:25:43 +0000
commitb5fd728e37aa2a9c7a5f37e8dead0a95117d541b (patch)
treea7158edc5e4e576e0377f078dabc87c699315c62 /Postman/Extensions/Admin
parentc61784411988d36d9bbd93cd3a97e773990af342 (diff)
downloadPost-SMTP-b5fd728e37aa2a9c7a5f37e8dead0a95117d541b.zip
phpmailer delivery improvments
bug fixes add option to disable notifications fix Invalid “Reply-To” e-mail address
Diffstat (limited to 'Postman/Extensions/Admin')
-rw-r--r--Postman/Extensions/Admin/PostmanAdmin.php31
-rw-r--r--Postman/Extensions/Admin/PostmanAdminView.php86
2 files changed, 117 insertions, 0 deletions
diff --git a/Postman/Extensions/Admin/PostmanAdmin.php b/Postman/Extensions/Admin/PostmanAdmin.php
new file mode 100644
index 0000000..3b61a0a
--- /dev/null
+++ b/Postman/Extensions/Admin/PostmanAdmin.php
@@ -0,0 +1,31 @@
+<?php
+if ( ! defined( 'ABSPATH' ) ) exit;
+
+class PostmanAdmin {
+
+ public function __construct()
+ {
+ $PostmanLicenseManager = PostmanLicenseManager::get_instance();
+ $extensions = $PostmanLicenseManager->get_extensions();
+
+ if ( count( $extensions ) > 0 ) {
+ add_action('admin_menu', [ $this, 'add_menu' ], 20 );
+ }
+
+ }
+
+ public function add_menu() {
+ add_submenu_page(
+ PostmanViewController::POSTMAN_MENU_SLUG,
+ __('Extensions', 'post-smtp'),
+ __('Extensions', 'post-smtp'),
+ 'manage_options',
+ 'post-smtp-extensions',
+ [ $this, 'render_menu' ]
+ );
+ }
+
+ public function render_menu() {
+ include_once 'PostmanAdminView.php';
+ }
+}
diff --git a/Postman/Extensions/Admin/PostmanAdminView.php b/Postman/Extensions/Admin/PostmanAdminView.php
new file mode 100644
index 0000000..c9f0509
--- /dev/null
+++ b/Postman/Extensions/Admin/PostmanAdminView.php
@@ -0,0 +1,86 @@
+<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
+
+<style>
+ .form-table .row {
+ display: flex;
+ }
+
+ .form-table .row .flex > *:not(:last-child) {
+ margin-right: 5px;
+ }
+
+ .form-table .label {
+ align-self: center;
+ font-weight: bold;
+ }
+
+ .form-table .flex {
+ display: flex;
+ }
+
+ .form-table .flex input {
+ border-radius: 3px;
+ height: 30px;
+ margin: 0;
+ margin-left: 5px;
+ }
+
+ .form-table .flex button {
+ box-shadow: none;
+ height: 100%;
+ }
+</style>
+
+<div class="wrap">
+ <h1>Post SMTP Installed Extensions</h1>
+ <form action="" method="post">
+ <div class="form-table">
+ <?php
+ $PostmanLicenseManager = PostmanLicenseManager::get_instance();
+ $extensions = $PostmanLicenseManager->get_extensions();
+
+ foreach ( $extensions as $slug => $extension) :
+ $short_name = $extension['license_manager']->get_slug( $extension['plugin_data']['Name'] );
+ $nonce = $short_name . '_license_key-nonce';
+
+ $license_data = get_option( $short_name . '_license_active' );
+ $license_key = get_option( $short_name . '_license_key' );
+
+ $license_valid = is_object( $license_data ) && $license_data->license === 'valid';
+ $license_field_class = $license_valid ? 'readonly' : '';
+ $license_field_value = $license_valid ? base64_encode($license_key) : '';
+
+ wp_nonce_field( $nonce, $nonce );
+ ?>
+
+ <div class="row">
+ <div class="label">
+ <?php echo esc_html( $extension['plugin_data']['Name'] ); ?>
+ </div>
+
+ <div class="flex">
+ <div class="input">
+ <input <?php echo $license_field_class; ?>
+ type="password"
+ name="post_smtp_extension[<?php echo $short_name . '_license_key'; ?>]"
+ class="regular-text"
+ value="<?php echo $license_field_value; ?>"
+ placeholder="Serial Key">
+ </div>
+
+ <div class="buttons">
+ <?php if ( ! $license_valid ) :?>
+ <button type="submit" name="post_smtp_extension[<?php echo $short_name; ?>_activate]" class="button button-primary">Activate</button>
+ <?php endif; ?>
+
+ <button type="submit" name="post_smtp_extension[<?php echo $short_name; ?>_deactivate]" class="button button-secondary">Deactivate</button>
+ </div>
+ </div>
+
+ </div>
+
+ <?php endforeach; ?>
+
+ </div>
+ </form>
+</div>