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 / Sendgrid / Options.php
wp-mail-smtp / src / Providers / Sendgrid Last commit date
Mailer.php 6 days ago Options.php 6 days ago
Options.php
149 lines
1 <?php
2
3 namespace WPMailSMTP\Providers\Sendgrid;
4
5 use WPMailSMTP\ConnectionInterface;
6 use WPMailSMTP\Helpers\UI;
7 use WPMailSMTP\Providers\OptionsAbstract;
8
9 /**
10 * Class Option.
11 *
12 * @since 1.0.0
13 */
14 class Options extends OptionsAbstract {
15
16 /**
17 * Options constructor.
18 *
19 * @since 1.0.0
20 * @since 2.3.0 Added supports parameter.
21 *
22 * @param ConnectionInterface $connection The Connection object.
23 */
24 public function __construct( $connection = null ) {
25
26 parent::__construct(
27 [
28 'logo_url' => wp_mail_smtp()->assets_url . '/images/providers/sendgrid.svg',
29 'slug' => 'sendgrid',
30 'title' => esc_html__( 'SendGrid', 'wp-mail-smtp' ),
31 'description' => sprintf(
32 wp_kses(
33 /* translators: %1$s - URL to sendgrid.com; %2$s - URL to Sendgrid documentation on wpmailsmtp.com */
34 __( '<a href="%1$s" target="_blank" rel="noopener noreferrer">SendGrid</a> is a popular transactional email provider that sends more than 35 billion emails every month. If you\'re just starting out, the free plan allows you to send up to 100 emails each day without entering your credit card details.<br><br>To get started, read our <a href="%2$s" target="_blank" rel="noopener noreferrer">SendGrid documentation</a>.', 'wp-mail-smtp' ),
35 [
36 'br' => [],
37 'a' => [
38 'href' => [],
39 'rel' => [],
40 'target' => [],
41 ],
42 ]
43 ),
44 'https://sendgrid.com',
45 esc_url( wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/', 'SendGrid documentation' ) )
46 ),
47 'supports' => [
48 'from_email' => true,
49 'from_name' => true,
50 'return_path' => false,
51 'from_email_force' => true,
52 'from_name_force' => true,
53 ],
54 ],
55 $connection
56 );
57 }
58
59 /**
60 * @inheritdoc
61 */
62 public function display_options() {
63 ?>
64
65 <!-- API Key -->
66 <div id="wp-mail-smtp-setting-row-<?php echo esc_attr( $this->get_slug() ); ?>-api_key" class="wp-mail-smtp-setting-row wp-mail-smtp-setting-row-text wp-mail-smtp-clear">
67 <div class="wp-mail-smtp-setting-label">
68 <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>
69 </div>
70 <div class="wp-mail-smtp-setting-field">
71 <?php if ( $this->connection_options->is_const_defined( $this->get_slug(), 'api_key' ) ) : ?>
72 <input type="text" disabled value="****************************************"
73 id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-api_key"
74 />
75 <?php $this->display_const_set_message( 'WPMS_SENDGRID_API_KEY' ); ?>
76 <?php else : ?>
77 <?php
78 $slug = $this->get_slug();
79 $value = $this->connection_options->get( $this->get_slug(), 'api_key' );
80
81 UI::hidden_password_field(
82 [
83 'name' => "wp-mail-smtp[{$slug}][api_key]",
84 'id' => "wp-mail-smtp-setting-{$slug}-api_key",
85 'value' => $value,
86 'clear_text' => esc_html__( 'Remove API Key', 'wp-mail-smtp' ),
87 ]
88 );
89 ?>
90 <?php endif; ?>
91 <p class="desc">
92 <?php
93 printf(
94 /* translators: %s - API key link. */
95 esc_html__( 'Follow this link to get an API Key from SendGrid: %s.', 'wp-mail-smtp' ),
96 '<a href="https://app.sendgrid.com/settings/api_keys" target="_blank" rel="noopener noreferrer">' .
97 esc_html__( 'Create API Key', 'wp-mail-smtp' ) .
98 '</a>'
99 );
100 ?>
101 <br/>
102 <?php
103 printf(
104 /* translators: %s - SendGrid access level. */
105 esc_html__( 'To send emails you will need only a %s access level for this API key.', 'wp-mail-smtp' ),
106 '<code>Mail Send</code>'
107 );
108 ?>
109 </p>
110 </div>
111 </div>
112
113 <!-- Sending Domain -->
114 <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-clear">
115 <div class="wp-mail-smtp-setting-label">
116 <label for="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-domain"><?php esc_html_e( 'Sending Domain', 'wp-mail-smtp' ); ?></label>
117 </div>
118 <div class="wp-mail-smtp-setting-field">
119 <input name="wp-mail-smtp[<?php echo esc_attr( $this->get_slug() ); ?>][domain]" type="text"
120 value="<?php echo esc_attr( $this->connection_options->get( $this->get_slug(), 'domain' ) ); ?>"
121 <?php echo $this->connection_options->is_const_defined( $this->get_slug(), 'domain' ) ? 'disabled' : ''; ?>
122 id="wp-mail-smtp-setting-<?php echo esc_attr( $this->get_slug() ); ?>-domain" spellcheck="false"
123 />
124 <p class="desc">
125 <?php
126 printf(
127 wp_kses(
128 /* translators: %s - URL to SendGrid documentation on wpmailsmtp.com */
129 __( 'Please input the sending domain/subdomain you configured in your SendGrid dashboard. More information can be found in our <a href="%s" target="_blank" rel="noopener noreferrer">SendGrid documentation</a>.', 'wp-mail-smtp' ),
130 [
131 'br' => [],
132 'a' => [
133 'href' => [],
134 'rel' => [],
135 'target' => [],
136 ],
137 ]
138 ),
139 esc_url( wp_mail_smtp()->get_utm_url( 'https://wpmailsmtp.com/docs/how-to-set-up-the-sendgrid-mailer-in-wp-mail-smtp/#setup', 'SendGrid documentation - setup' ) )
140 );
141 ?>
142 </p>
143 </div>
144 </div>
145
146 <?php
147 }
148 }
149