PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 4.9.0
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v4.9.0
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / src / Providers / Sendlayer / Options.php
wp-mail-smtp / src / Providers / Sendlayer Last commit date
Mailer.php 6 days ago Options.php 6 days ago QuickConnect.php 6 days ago QuickConnectUsage.php 6 days ago
Options.php
227 lines
1 <?php
2
3 namespace WPMailSMTP\Providers\Sendlayer;
4
5 use WPMailSMTP\Admin\ConnectionSettings;
6 use WPMailSMTP\ConnectionInterface;
7 use WPMailSMTP\Helpers\UI;
8 use WPMailSMTP\Providers\OptionsAbstract;
9
10 /**
11 * Class Options.
12 *
13 * @since 3.4.0
14 */
15 class Options extends OptionsAbstract {
16
17 /**
18 * Mailer slug.
19 *
20 * @since 3.4.0
21 *
22 * @var string
23 */
24 const SLUG = 'sendlayer';
25
26 /**
27 * Options constructor.
28 *
29 * @since 3.4.0
30 *
31 * @param ConnectionInterface $connection The Connection object.
32 */
33 public function __construct( $connection = null ) {
34
35 if ( is_null( $connection ) ) {
36 $connection = wp_mail_smtp()->get_connections_manager()->get_primary_connection();
37 }
38
39 $description = sprintf(
40 wp_kses(
41 /* translators: %1$s - URL to sendlayer.com; %2$s - URL to SendLayer documentation on wpmailsmtp.com. */
42 __( '<strong><a href="%1$s" target="_blank" rel="noopener noreferrer">SendLayer</a> is our #1 recommended mailer.</strong> It offers affordable pricing and is easy to set up, which makes it an excellent option for WordPress sites. With SendLayer, your domain will be authenticated so all your outgoing emails reach your customers\' inboxes. Our detailed <a href="%2$s" target="_blank" rel="noopener noreferrer">documentation</a> will walk you through the entire process, start to finish. <span class="wp-mail-smtp-text-blue wp-mail-smtp-text-italic">When you sign up for a free trial, you can send your first emails at no charge.</span>', 'wp-mail-smtp' ), // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings
43 [
44 'strong' => [],
45 'a' => [
46 'href' => [],
47 'rel' => [],
48 'target' => [],
49 ],
50 'span' => [
51 'class' => [],
52 ],
53 ]
54 ),
55 // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound, WordPress.Security.NonceVerification.Recommended
56 esc_url( wp_mail_smtp()->get_utm_url( 'https://sendlayer.com/wp-mail-smtp/', [ 'source' => 'wpmailsmtpplugin', 'medium' => 'WordPress', 'content' => isset( $_GET['page'] ) && $_GET['page'] === 'wp-mail-smtp-setup-wizard' ? 'Setup Wizard - Mailer Description' : 'Plugin Settings - Mailer Description' ] ) ),
57 // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
58 esc_url( wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/docs/how-to-set-up-the-sendlayer-mailer-in-wp-mail-smtp/', 'SendLayer Documentation' ) )
59 );
60
61 parent::__construct(
62 [
63 'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/sendlayer.svg',
64 'slug' => self::SLUG,
65 'title' => esc_html__( 'SendLayer', 'wp-mail-smtp' ),
66 'description' => $description,
67 'recommended' => true,
68 'supports' => [
69 'from_email' => true,
70 'from_name' => true,
71 'return_path' => false,
72 'from_email_force' => true,
73 'from_name_force' => true,
74 ],
75 ],
76 $connection
77 );
78 }
79
80 /**
81 * Output the mailer provider options.
82 *
83 * @since 3.4.0
84 */
85 public function display_options() {
86
87 // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
88 $get_api_key_url = wp_mail_smtp()->get_utm_url( 'https://app.sendlayer.com/settings/api/', ['source' => 'wpmailsmtpplugin', 'medium' => 'WordPress', 'content' => 'Plugin Settings - Get API Key'] );
89 $is_const = $this->connection_options->is_const_defined( $this->get_slug(), 'api_key' );
90 $has_api_key = $is_const || ! empty( $this->connection_options->get( 'sendlayer', 'api_key' ) );
91 $is_quick_connect = (bool) $this->connection_options->get( 'sendlayer', 'quick_connect' );
92 $is_shared_domain = $is_quick_connect && (bool) $this->connection_options->get( 'sendlayer', 'is_shared_domain' );
93 $sender_domain = $is_shared_domain ? $this->connection_options->get( 'sendlayer', 'sender_domain' ) : '';
94
95 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
96 $is_new_additional = ! $this->connection->is_primary() && isset( $_GET['mode'] ) && $_GET['mode'] === 'new';
97 ?>
98 <!-- Quick Connect -->
99 <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-connect" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-sendlayer-connect wp-mail-smtp-clear"
100 <?php if ( $has_api_key ) : ?>
101 style="display: none;"
102 <?php endif; ?>>
103 <?php if ( $is_new_additional ) : ?>
104 <div class="notice-inline notice-info" style="margin-bottom: 20px;">
105 <p><?php esc_html_e( 'Please save this additional connection first to use Quick Connect or enter an API Key manually.', 'wp-mail-smtp' ); ?></p>
106 </div>
107 <?php endif; ?>
108 <button type="button" id="wp-mail-smtp-sendlayer-connect-btn" class="wp-mail-smtp-btn wp-mail-smtp-btn-md wp-mail-smtp-btn-orange wp-mail-smtp-sendlayer-connect-btn"
109 <?php disabled( $is_new_additional ); ?>>
110 <?php esc_html_e( 'Quick Connect', 'wp-mail-smtp' ); ?>
111 <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.5898 0C13.8086 0 14 0.191406 14 0.410156L13.9727 4.86719C13.9727 5.08594 13.8086 5.25 13.5898 5.25H12.6875V5.27734C12.4688 5.27734 12.2773 5.08594 12.2773 4.86719L12.3594 2.84375L12.3047 2.78906L4.67578 10.418C4.62109 10.4727 4.53906 10.5273 4.45703 10.5273C4.34766 10.5273 4.26562 10.4727 4.21094 10.418L3.58203 9.78906C3.52734 9.73438 3.47266 9.65234 3.47266 9.54297C3.47266 9.46094 3.52734 9.37891 3.58203 9.32422L11.2109 1.69531L11.1562 1.64062L9.13281 1.72266C8.91406 1.72266 8.75 1.53125 8.75 1.3125V0.410156C8.75 0.191406 8.91406 0.0273438 9.13281 0.0273438L13.5898 0ZM11.8125 7.875C12.0312 7.875 12.25 8.09375 12.25 8.3125V12.6875C12.25 13.4258 11.6484 14 10.9375 14H1.3125C0.574219 14 0 13.4258 0 12.6875V3.0625C0 2.35156 0.574219 1.75 1.3125 1.75H5.6875C5.90625 1.75 6.125 1.96875 6.125 2.1875V2.625C6.125 2.87109 5.90625 3.0625 5.6875 3.0625H1.47656C1.36719 3.0625 1.3125 3.14453 1.3125 3.22656V12.5234C1.3125 12.6328 1.36719 12.6875 1.47656 12.6875H10.7734C10.8555 12.6875 10.9375 12.6328 10.9375 12.5234V8.3125C10.9375 8.09375 11.1289 7.875 11.375 7.875H11.8125Z" fill="white"/></svg>
112 </button>
113 <p class="desc">
114 <span class="wp-mail-smtp-sendlayer-connect-badge">
115 <svg width="9" height="11" viewBox="0 0 9 11" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6.67969 0.175781C6.91406 0.351562 6.99219 0.644531 6.89453 0.917969L5.35156 4.74609H8.18359C8.45703 4.74609 8.69141 4.90234 8.76953 5.15625C8.86719 5.41016 8.78906 5.68359 8.59375 5.85938L2.96875 10.5469C2.73438 10.7227 2.42188 10.7422 2.1875 10.5664C1.95312 10.3906 1.875 10.0977 1.97266 9.82422L3.51562 5.99609H0.683594C0.429688 5.99609 0.195312 5.83984 0.0976562 5.58594C0 5.33203 0.078125 5.05859 0.292969 4.88281L5.91797 0.195312C6.13281 0.0195312 6.44531 0 6.67969 0.175781Z" fill="#6F6F84"/></svg>
116 <?php esc_html_e( 'Takes about 2 mins', 'wp-mail-smtp' ); ?>
117 </span>
118 </p>
119 </div>
120
121 <?php if ( ! $has_api_key && ! $is_new_additional ) : ?>
122 <!-- Manual API Key toggle -->
123 <div class="wp-mail-smtp-setting-row wp-mail-smtp-clear">
124 <a href="#" id="wp-mail-smtp-sendlayer-show-api-key" class="wp-mail-smtp-text-italic">
125 <?php esc_html_e( 'Connect manually with API Key', 'wp-mail-smtp' ); ?>
126 </a>
127 </div>
128 <?php endif; ?>
129
130 <?php if ( $is_shared_domain && ! empty( $sender_domain ) ) : ?>
131 <!-- Domain (shown for quick connect shared domain accounts) -->
132 <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-domain" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-setting-row-sendlayer-domain wp-mail-smtp-clear">
133 <div class="wp-mail-smtp-setting-label">
134 <label><?php esc_html_e( 'Domain', 'wp-mail-smtp' ); ?></label>
135 </div>
136 <div class="wp-mail-smtp-setting-field">
137 <p class="wp-mail-smtp-sendlayer-domain-value">
138 <?php echo esc_html( $sender_domain ); ?>
139 <a href="#" id="wp-mail-smtp-sendlayer-change-domain" class="wp-mail-smtp-sendlayer-change-domain">
140 <?php esc_html_e( 'Change', 'wp-mail-smtp' ); ?>
141 </a>
142 </p>
143 <p class="desc">
144 <?php esc_html_e( 'This is a shared domain created for you via SendLayer Connect.', 'wp-mail-smtp' ); ?>
145 </p>
146 <p class="desc">
147 <?php
148 printf(
149 wp_kses(
150 /* translators: %1$s - URL to SendLayer app domains page; %2$s - URL to documentation about custom domains. */
151 __( 'You will need to register your own domain first on the <a href="%1$s" target="_blank" rel="noopener noreferrer">SendLayer dashboard</a> to change it here. Check our <a href="%2$s" target="_blank" rel="noopener noreferrer">documentation</a> on how to add a custom domain.', 'wp-mail-smtp' ),
152 [
153 'a' => [
154 'href' => [],
155 'rel' => [],
156 'target' => [],
157 ],
158 ]
159 ),
160 // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
161 esc_url( wp_mail_smtp()->get_utm_url( 'https://app.sendlayer.com/', [ 'source' => 'wpmailsmtpplugin', 'medium' => 'WordPress', 'content' => 'Plugin Settings - Domain Link' ] ) ),
162 // phpcs:ignore WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound
163 esc_url( wp_mail_smtp()->get_utm_url( 'https://sendlayer.com/docs/authorizing-your-domain/', [ 'source' => 'wpmailsmtpplugin', 'medium' => 'WordPress', 'content' => 'Plugin Settings - Custom Domain Documentation' ] ) )
164 );
165 ?>
166 </p>
167 </div>
168 </div>
169 <?php endif; ?>
170
171 <!-- API Key -->
172 <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
173 class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear"
174 <?php if ( ! $has_api_key && ! $is_new_additional ) : ?>
175 style="display: none;"
176 <?php endif; ?>>
177 <div class="wp-mail-smtp-setting-label">
178 <label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"><?php esc_html_e( 'API Key', 'wp-mail-smtp' ); ?></label>
179 </div>
180 <div class="wp-mail-smtp-setting-field">
181 <?php if ( $is_const ) : ?>
182 <input type="text" disabled value="****************************************"
183 id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
184 />
185 <?php $this->display_const_set_message( 'WPMS_SENDLAYER_API_KEY' ); ?>
186 <?php else : ?>
187 <?php
188 $slug = $this->get_slug();
189 $value = $this->connection_options->get( $slug, 'api_key' );
190
191 $field_args = [
192 'name' => "wp-mail-smtp[{$slug}][api_key]",
193 'id' => "wp-mail-smtp-setting-{$slug}-api_key",
194 'value' => $value,
195 'clear_text' => esc_html__( 'Remove API Key', 'wp-mail-smtp' ),
196 ];
197
198 if ( $is_quick_connect ) {
199 $field_args['clear_text'] = esc_html__( 'Disconnect', 'wp-mail-smtp' );
200 $field_args['clear_url'] = wp_nonce_url( ( new ConnectionSettings( $this->connection ) )->get_admin_page_url(), 'sendlayer_quick_connect_disconnect', 'sendlayer_quick_connect_disconnect_nonce' );
201 }
202
203 UI::hidden_password_field( $field_args );
204 ?>
205 <?php endif; ?>
206 <p class="desc">
207 <?php
208 printf(
209 /* translators: %s - API key link. */
210 esc_html__( 'Follow this link to get an API Key from SendLayer: %s.', 'wp-mail-smtp' ),
211 '<a href="' . esc_url( $get_api_key_url ) . '" target="_blank" rel="noopener noreferrer">' .
212 esc_html__( 'Get API Key', 'wp-mail-smtp' ) .
213 '</a>'
214 );
215 ?>
216 </p>
217 </div>
218 </div>
219
220 <input type="hidden" id="wp-mail-smtp-sendlayer-quick-connect-return-url"
221 value="<?php echo esc_url( ( new ConnectionSettings( $this->connection ) )->get_admin_page_url() ); ?>" />
222 <input type="hidden" id="wp-mail-smtp-sendlayer-quick-connect-connection-id"
223 value="<?php echo esc_attr( $this->connection->get_id() ); ?>" />
224 <?php
225 }
226 }
227