PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
← All changes | back/dynamics/google/plugin.php +36 -34 10.11.1 → 11.1.0 View file →
@@ -34,68 +34,65 @@
34 34
35 35 $refreshToken = $this->config->get('google_refresh_token');
36 36 $refreshTokenExpiration = $this->config->get('google_refresh_token_expiration');
37 37 $mustAuthenticate = empty($refreshToken) || (!empty($refreshTokenExpiration) && $refreshTokenExpiration < time());
38 -
39 - $mailerHelper = new MailerHelper();
40 -
41 - ob_start();
42 38 ?>
43 - <div class="send_settings grid-x cell large-6 xlarge-5 xxlarge-4 margin-auto" id="<?php echo self::SENDING_METHOD_ID; ?>_settings">
39 + <div class="send_settings grid-x cell large-6 xlarge-5 xxlarge-4 margin-auto" id="<?php echo esc_attr(self::SENDING_METHOD_ID); ?>_settings">
44 40 <div class="acym_port_465_closed is-hidden">
45 41 <?php acym_display(acym_translation('ACYM_PORT_NEEDED'), 'error', false); ?>
46 42 </div>
47 43 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
48 44 <label for="google_username" class="cell">
49 - <?php echo acym_translation('ACYM_SMTP_USERNAME').acym_info(['textShownInTooltip' => 'ACYM_SMTP_USERNAME_DESC']); ?>
45 + <?php echo esc_html(acym_translation('ACYM_SMTP_USERNAME'));
46 + acym_info(['textShownInTooltip' => 'ACYM_SMTP_USERNAME_DESC']); ?>
50 47 </label>
51 48 <input id="google_username"
52 - class="cell"
53 - type="text"
54 - name="config[google_username]"
55 - value="<?php echo acym_escape($username); ?>">
49 + class="cell"
50 + type="text"
51 + name="config[google_username]"
52 + value="<?php echo esc_attr($username); ?>">
56 53 </div>
57 54 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
58 - <label for="google_client_id" class="cell"><?php echo acym_externalLink('ACYM_SMTP_CLIENT_ID', $setupDocumentation, false); ?></label>
55 + <label for="google_client_id" class="cell"><?php acym_externalLink('ACYM_SMTP_CLIENT_ID', $setupDocumentation, false); ?></label>
59 56 <input id="google_client_id"
60 - class="cell"
61 - type="text"
62 - name="config[google_client_id]"
63 - value="<?php echo acym_escape($this->config->get('google_client_id')); ?>">
57 + class="cell"
58 + type="text"
59 + name="config[google_client_id]"
60 + value="<?php echo esc_attr($this->config->get('google_client_id')); ?>">
64 61 </div>
65 62 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
66 - <label for="google_client_secret" class="cell"><?php echo acym_externalLink('ACYM_SMTP_CLIENT_SECRET', $setupDocumentation, false); ?></label>
63 + <label for="google_client_secret" class="cell"><?php acym_externalLink('ACYM_SMTP_CLIENT_SECRET', $setupDocumentation, false); ?></label>
67 64 <input id="google_client_secret"
68 - class="cell"
69 - type="text"
70 - name="config[google_client_secret]"
71 - value="<?php echo acym_escape($this->config->get('google_client_secret')); ?>">
65 + class="cell"
66 + type="text"
67 + name="config[google_client_secret]"
68 + value="<?php echo esc_attr($this->config->get('google_client_secret')); ?>">
72 69 </div>
73 70 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
74 - <label for="google_redirect_url" class="cell"><?php echo acym_translation('ACYM_SMTP_REDIRECT_URL'); ?></label>
71 + <label for="google_redirect_url" class="cell"><?php echo esc_html(acym_translation('ACYM_SMTP_REDIRECT_URL')); ?></label>
75 72 <input id="google_redirect_url"
76 - class="cell"
77 - type="text"
78 - name="config[google_redirect_url]"
79 - value="<?php echo acym_escape($redirectUrl); ?>">
73 + class="cell"
74 + type="text"
75 + name="config[google_redirect_url]"
76 + value="<?php echo esc_attr($redirectUrl); ?>">
80 77 </div>
81 78 <div class="cell grid-x acym_vcenter acym__sending__methods__one__settings">
82 79 <?php if ($mustAuthenticate) { ?>
83 80 <button data-before-action="configSave"
84 - data-task="loginForOAuth2Smtp"
85 - class="button acy_button_submit margin-next-1">
86 - <?php echo acym_translation('ACYM_AUTHENTICATE'); ?>
81 + data-task="loginForOAuth2Smtp"
82 + class="button acy_button_submit margin-next-1">
83 + <?php echo esc_html(acym_translation('ACYM_AUTHENTICATE')); ?>
87 84 </button>
88 - <?php echo $this->getCopySettingsButton($data, self::SENDING_METHOD_ID, 'wp_mail_smtp', false); ?>
85 + <?php $this->getCopySettingsButton($data, self::SENDING_METHOD_ID, 'wp_mail_smtp', false); ?>
89 86 <?php } else { ?>
90 87 <button data-before-action="configSave"
91 - data-task="logoutForOAuth2Smtp"
92 - class="button acy_button_submit button-secondary margin-bottom-1">
93 - <?php echo acym_translation('ACYM_REVOKE_PERMISSIONS'); ?>
88 + data-task="logoutForOAuth2Smtp"
89 + class="button acy_button_submit button-secondary margin-bottom-1">
90 + <?php echo esc_html(acym_translation('ACYM_REVOKE_PERMISSIONS')); ?>
94 91 </button>
95 92 <?php
96 93 if (!empty($refreshTokenExpiration)) {
97 - echo acym_translationSprintf('ACYM_AUTHENTICATION_WILL_EXPIRE', acym_date($refreshTokenExpiration, 'ACYM_DATE_FORMAT_LC2'));
94 + echo esc_html(acym_translationSprintf('ACYM_AUTHENTICATION_WILL_EXPIRE', acym_date($refreshTokenExpiration, 'ACYM_DATE_FORMAT_LC2')));
98 95 }
99 96 ?>
100 97 <?php } ?>
101 98 </div>
@@ -100,9 +97,8 @@
100 97 <?php } ?>
101 98 </div>
102 99 </div>
103 100 <?php
104 - $data['sendingMethodsHtmlSettings'][self::SENDING_METHOD_ID] = ob_get_clean();
105 101 }
106 102
107 103 public function onAcymGetSettingsSendingMethodFromPlugin(&$data, $plugin, $method)
108 104 {
@@ -122,8 +118,11 @@
122 118 $data['google_client_secret'] = $wpMailSmtpSetting['gmail']['client_secret'] ?? '';
123 119 }
124 120 }
125 121
122 + /**
123 + * Doc: https://developers.google.com/identity/protocols/oauth2/web-server#httprest_2
124 + */
126 125 public function onAcymOauthAuthenticate(string &$consentUrl, bool $isSmtp): void
127 126 {
128 127 if ($isSmtp) {
129 128 if ($this->config->get('mailer_method') !== self::SENDING_METHOD_ID) {
@@ -156,8 +155,11 @@
156 155 $consentUrl .= '&scope='.urlencode('https://mail.google.com/');
157 156 $consentUrl .= '&state=acymailing'.($isSmtp ? 'smtp' : 'bounce');
158 157 }
159 158
159 + /**
160 + * Doc: https://developers.google.com/identity/protocols/oauth2/web-server#httprest_3
161 + */
160 162 public function onAcymOauthCredentialsCreation(bool $isSmtp, string $code): void
161 163 {
162 164 if ($isSmtp) {
163 165 if ($this->config->get('mailer_method') !== self::SENDING_METHOD_ID) {