| @@ -47,9 +47,8 @@ | ||
| 47 | 47 | * |
| 48 | 48 | * @return void |
| 49 | 49 | */ |
| 50 | 50 | public static function load_hooks() { |
| 51 | - | |
| 52 | 51 | add_filter( 'wp_mail_smtp_is_white_labeled', '__return_true' ); |
| 53 | 52 | |
| 54 | 53 | $self = new self(); |
| 55 | 54 | |
| @@ -80,10 +79,9 @@ | ||
| 80 | 79 | * @return string |
| 81 | 80 | */ |
| 82 | 81 | public function link( $link ) { |
| 83 | 82 | $new_link = 'formidableforms.com/go-wp-mail-smtp/?urllink=wpmailsmtp%2Ecom%2Flite%2Dupgrade&'; |
| 84 | - $link = str_replace( 'wpmailsmtp.com/lite-upgrade/?', $new_link, $link ); | |
| 85 | - return $link; | |
| 83 | + return str_replace( 'wpmailsmtp.com/lite-upgrade/?', $new_link, $link ); | |
| 86 | 84 | } |
| 87 | 85 | |
| 88 | 86 | /** |
| 89 | 87 | * Don't nag people to install WPForms |
| @@ -96,9 +94,9 @@ | ||
| 96 | 94 | */ |
| 97 | 95 | public static function remove_wpforms_nag( $upsell ) { |
| 98 | 96 | if ( is_array( $upsell ) ) { |
| 99 | 97 | foreach ( $upsell as $k => $plugin ) { |
| 100 | - if ( strpos( $plugin['slug'], 'wpforms' ) !== false ) { | |
| 98 | + if ( str_contains( $plugin['slug'], 'wpforms' ) ) { | |
| 101 | 99 | unset( $upsell[ $k ] ); |
| 102 | 100 | } |
| 103 | 101 | } |
| 104 | 102 | } |
| @@ -149,8 +147,9 @@ | ||
| 149 | 147 | 'width' => 90, |
| 150 | 148 | ); |
| 151 | 149 | |
| 152 | 150 | // Heading section. |
| 151 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 153 | 152 | ?> |
| 154 | 153 | <section class="top"> |
| 155 | 154 | <div class="frm-smtp-logos"> |
| 156 | 155 | <?php |
| @@ -166,11 +165,12 @@ | ||
| 166 | 165 | $this->stmp_logo(); |
| 167 | 166 | ?> |
| 168 | 167 | </div> |
| 169 | 168 | <h1><?php esc_html_e( 'Making Email Deliverability Easy for WordPress', 'formidable' ); ?></h1> |
| 170 | - <p><?php esc_html_e( 'WP Mail SMTP allows you to easily set up WordPress to use a trusted provider to reliably send emails, including form notifications.', 'formidable' ); ?></p> | |
| 169 | + <p><?php esc_html_e( 'WP Mail SMTP allows you to easily set up WordPress to use a trusted provider to reliably send emails, including form notifications.', 'formidable' ); ?></p><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 171 | 170 | </section> |
| 172 | 171 | <?php |
| 172 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Generate and output screenshot section HTML. |
| @@ -179,9 +179,8 @@ | ||
| 179 | 179 | * |
| 180 | 180 | * @return void |
| 181 | 181 | */ |
| 182 | 182 | protected function output_section_screenshot() { |
| 183 | - | |
| 184 | 183 | printf( |
| 185 | 184 | '<section class="screenshot"> |
| 186 | 185 | <div class="cont"> |
| 187 | 186 | <img src="%1$s" alt="%2$s"/> |
| @@ -194,9 +193,9 @@ | ||
| 194 | 193 | </ul> |
| 195 | 194 | </section>', |
| 196 | 195 | esc_url( FrmAppHelper::plugin_url() . '/images/smtp-screenshot-tnail.png' ), |
| 197 | 196 | esc_attr__( 'WP Mail SMTP screenshot', 'formidable' ), |
| 198 | - '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 492 492" width="14" height="14"><path d="M484 227L306 49a27 27 0 00-38 0l-16 16a27 27 0 000 38l104 105H27c-15 0-27 11-27 26v23c0 15 12 27 27 27h330L252 389a27 27 0 000 38l16 16a27 27 0 0038 0l178-178a27 27 0 000-38z" fill="#5bbfa5"/></svg> ', | |
| 197 | + '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 492 492" width="14" height="14"><path d="M484 227L306 49a27 27 0 00-38 0l-16 16a27 27 0 000 38l104 105H27c-15 0-27 11-27 26v23c0 15 12 27 27 27h330L252 389a27 27 0 000 38l16 16a27 27 0 0038 0l178-178a27 27 0 000-38z" fill="#5bbfa5"/></svg> ', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 199 | 198 | esc_html__( 'Over 1,000,000 websites use WP Mail SMTP.', 'formidable' ), |
| 200 | 199 | esc_html__( 'Send emails authenticated via trusted parties.', 'formidable' ), |
| 201 | 200 | esc_html__( 'Transactional Mailers: Pepipost, SendinBlue, Mailgun, SendGrid, Amazon SES.', 'formidable' ), |
| 202 | 201 | esc_html__( 'Web Mailers: Gmail, G Suite, Office 365, Outlook.com.', 'formidable' ) |
| @@ -210,12 +209,11 @@ | ||
| 210 | 209 | * |
| 211 | 210 | * @return void |
| 212 | 211 | */ |
| 213 | 212 | protected function output_section_step_install() { |
| 214 | - | |
| 215 | 213 | $step = $this->get_data_step_install(); |
| 216 | 214 | |
| 217 | - if ( empty( $step ) ) { | |
| 215 | + if ( ! $step ) { | |
| 218 | 216 | return; |
| 219 | 217 | } |
| 220 | 218 | |
| 221 | 219 | $icon = FrmAppHelper::icon_by_class( |
| @@ -259,12 +257,11 @@ | ||
| 259 | 257 | * |
| 260 | 258 | * @return void |
| 261 | 259 | */ |
| 262 | 260 | protected function output_section_step_setup() { |
| 263 | - | |
| 264 | 261 | $step = $this->get_data_step_setup(); |
| 265 | 262 | |
| 266 | - if ( empty( $step ) ) { | |
| 263 | + if ( ! $step ) { | |
| 267 | 264 | return; |
| 268 | 265 | } |
| 269 | 266 | |
| 270 | 267 | $icon = FrmAppHelper::icon_by_class( |
| @@ -305,9 +302,8 @@ | ||
| 305 | 302 | * |
| 306 | 303 | * @return array Step data. |
| 307 | 304 | */ |
| 308 | 305 | protected function get_data_step_install() { |
| 309 | - | |
| 310 | 306 | $lite_plugin = new FrmInstallPlugin( array( 'plugin_file' => $this->config['lite_plugin'] ) ); |
| 311 | 307 | $pro_plugin = new FrmInstallPlugin( array( 'plugin_file' => $this->config['pro_plugin'] ) ); |
| 312 | 308 | |
| 313 | 309 | $this->output_data['plugin_installed'] = $lite_plugin->is_installed(); |
| @@ -356,9 +352,8 @@ | ||
| 356 | 352 | * |
| 357 | 353 | * @return array Step data. |
| 358 | 354 | */ |
| 359 | 355 | protected function get_data_step_setup() { |
| 360 | - | |
| 361 | 356 | $step = array(); |
| 362 | 357 | |
| 363 | 358 | $step['icon'] = 'frm_step2_icon'; |
| 364 | 359 | $step['section_class'] = $this->output_data['plugin_activated'] ? '' : 'grey'; |
| @@ -383,17 +378,14 @@ | ||
| 383 | 378 | * |
| 384 | 379 | * @return bool True if some mailer is selected and configured properly. |
| 385 | 380 | */ |
| 386 | 381 | protected function is_smtp_configured() { |
| 387 | - | |
| 388 | 382 | if ( ! $this->is_smtp_activated() ) { |
| 389 | 383 | return false; |
| 390 | 384 | } |
| 391 | 385 | |
| 392 | - $phpmailer = $this->get_phpmailer(); | |
| 393 | - | |
| 394 | 386 | $mailer = WPMailSMTP\Options::init()->get( 'mail', 'mailer' ); |
| 395 | - $is_mailer_complete = wp_mail_smtp()->get_providers()->get_mailer( $mailer, $phpmailer )->is_mailer_complete(); | |
| 387 | + $is_mailer_complete = wp_mail_smtp()->get_providers()->get_mailer( $mailer, $this->get_phpmailer() )->is_mailer_complete(); | |
| 396 | 388 | |
| 397 | 389 | return 'mail' !== $mailer && $is_mailer_complete; |
| 398 | 390 | } |
| 399 | 391 | |
| @@ -417,17 +409,19 @@ | ||
| 417 | 409 | */ |
| 418 | 410 | protected function get_phpmailer() { |
| 419 | 411 | global $phpmailer; |
| 420 | 412 | |
| 421 | - if ( ! is_object( $phpmailer ) || ! is_a( $phpmailer, 'PHPMailer' ) ) { | |
| 422 | - if ( is_callable( array( wp_mail_smtp(), 'generate_mail_catcher' ) ) ) { | |
| 423 | - $phpmailer = wp_mail_smtp()->generate_mail_catcher( true ); // phpcs:ignore | |
| 424 | - } else { | |
| 425 | - require_once ABSPATH . WPINC . '/class-phpmailer.php'; | |
| 426 | - $phpmailer = new PHPMailer( true ); // phpcs:ignore | |
| 427 | - } | |
| 413 | + if ( is_object( $phpmailer ) && is_a( $phpmailer, 'PHPMailer' ) ) { | |
| 414 | + return $phpmailer; | |
| 428 | 415 | } |
| 429 | 416 | |
| 417 | + if ( is_callable( array( wp_mail_smtp(), 'generate_mail_catcher' ) ) ) { | |
| 418 | + $phpmailer = wp_mail_smtp()->generate_mail_catcher( true ); // phpcs:ignore | |
| 419 | + } else { | |
| 420 | + require_once ABSPATH . WPINC . '/class-phpmailer.php'; | |
| 421 | + $phpmailer = new PHPMailer( true ); // phpcs:ignore | |
| 422 | + } | |
| 423 | + | |
| 430 | 424 | return $phpmailer; |
| 431 | 425 | } |
| 432 | 426 | |
| 433 | 427 | /** |
| @@ -447,11 +441,13 @@ | ||
| 447 | 441 | /** |
| 448 | 442 | * @return void |
| 449 | 443 | */ |
| 450 | 444 | private function stmp_logo() { |
| 445 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 451 | 446 | ?> |
| 452 | - <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" height="90" width="90"><defs><style>.cls-11,.cls-12{fill-rule:evenodd}.cls-4{fill:none}.cls-11{fill:#86a196}.cls-12{fill:#fff}</style></defs><path class="cls-4" d="M-6.3 0h60v60h-60z"/><path d="M16.7 8.1a15.4 15.4 0 00-8 10.2 23.5 23.5 0 1030 0 15.4 15.4 0 00-9.3-10.8 3.4 3.4 0 00-2.1-2.7A4.6 4.6 0 0018.4 3a24.4 24.4 0 00-1.7 5z" fill="#395360" fill-rule="evenodd"/><path fill="#fbaa6f" d="M18 26h12v14H18z"/><path d="M25.9 33.2l-.1-.1a1.4 1.4 0 111.6-2.3 1.9 1.9 0 00-1.2.8 1.9 1.9 0 00-.3 1.6zm-4.5 0a1.8 1.8 0 00-.4-1.6 2 2 0 00-1.2-.8 1.4 1.4 0 011.6 2.3zm7.2-3.2h.5l-1 4.8-2.2 6.5h-4.3l-3.2-5.4 1.1-3.2 2.1 2.7c.6.5 2.7.5 3.8-.6a26.2 26.2 0 003.2-4.8z" fill="#dc7f3c" fill-rule="evenodd"/><path d="M9.7 29H15v-9h-4a13 13 0 017.4-10q1.2-5 2.8-6.8l.1-.1.1-.1a2.3 2.3 0 011.1-.5 2.3 2.3 0 012.2 3.8 1.6 1.6 0 01-.4.3A15 15 0 0023 8a5 5 0 013-1.5 1.4 1.4 0 01.7.2 1.3 1.3 0 01.5 1.8 1.3 1.3 0 01-.6.6 13 13 0 0110.1 11l.1.8H33v8h4.8l1.8 13.4q-6.3 4-15.8 4T8 42.4zM25 38.4q3.8-6.4 3.8-7.6c0-2.2-3.2-4-4.8-4s-4.9 1.7-4.9 4q0 1.2 3.8 7.6a1.2 1.2 0 001 .6 1 1 0 001-.6z" fill="#bdcfc8" fill-rule="evenodd"/><path class="cls-4" d="M19 31h9.6L27 47.2h-6.4l-1.6-16z"/><path d="M39.8 48.8a20 20 0 01-32 0l.8-6a2.7 2.7 0 001 .1 2.8 2.8 0 002.8-2.4v1.2a2.8 2.8 0 005.6 0v1.6a2.9 2.9 0 005.7 0 2.8 2.8 0 005.7 0v-1.6a2.8 2.8 0 105.7 0v-1.2A2.8 2.8 0 0038 43a2.9 2.9 0 001-.2l.8 6z" fill="#809eb0" fill-rule="evenodd"/><path d="M8.3 44.6l.3-1.8a2.7 2.7 0 001 .2 2.8 2.8 0 002.8-2.5v1.2a2.8 2.8 0 005.7 0v1.7a2.9 2.9 0 005.6 0 2.8 2.8 0 005.7 0v-1.7a2.8 2.8 0 105.7 0v-1.2A2.8 2.8 0 0038 43a2.9 2.9 0 001-.2l.3 2a2.9 2.9 0 01-4.1-2.2v1.2a2.8 2.8 0 11-5.7 0v1.6a2.8 2.8 0 01-5.7 0 2.9 2.9 0 01-5.7 0v-1.7a2.8 2.8 0 01-5.7 0v-1.2A2.8 2.8 0 019.6 45a2.9 2.9 0 01-1.3-.3z" fill="#738e9e" fill-rule="evenodd"/><path class="cls-11" d="M37.8 22.4c-1-2.9-3-4.7-4.7-4.5-2.2.2-2.8 3.7-2.3 8s1.7 7.5 3.9 7.3 4-3.9 3.6-8c0 1.2-.5 2.3-1.3 2.4-1.2 0-1.5-1.2-1.6-2.9s-.2-3 1-3a1.5 1.5 0 011.4.7z"/><path class="cls-12" d="M37 21.8c-.6-1.3-1.5-2-2.4-1.9-1.5.1-1.9 2.6-1.6 5.5s1.2 5.1 2.7 5c1.1-.2 2-1.5 2.2-3.4a1.2 1.2 0 01-1 .6c-1 0-1.4-1.2-1.5-2.9s-.1-3 1-3a1.6 1.6 0 01.6 0z"/><path class="cls-11" d="M9.6 22.4c1-2.9 3-4.7 4.7-4.5 2.2.2 2.8 3.7 2.3 8s-1.7 7.5-3.9 7.3-4-3.9-3.7-8c.1 1.2.5 2.3 1.4 2.4 1.1 0 1.5-1.2 1.6-2.9s.1-3-1-3a1.5 1.5 0 00-1.4.7z"/><path class="cls-12" d="M10.4 21.8c.6-1.3 1.5-2 2.4-1.9 1.5.1 1.8 2.6 1.5 5.5s-1.1 5.1-2.6 5c-1.1-.2-2-1.5-2.2-3.4a1.2 1.2 0 00.9.6c1.1 0 1.4-1.2 1.6-2.9s.1-3-1-3a1.7 1.7 0 00-.7 0z"/><path d="M19 28.6a5.3 5.3 0 010-.7c0-2.4 1.2-5.2 4.9-5.2s4.8 2.8 4.8 5.2a4.4 4.4 0 010 1c-.9-1.3-2.4-2.1-4.9-2.1-2.4 0-3.9.7-4.8 1.8z" fill="#f4f8ff" fill-rule="evenodd"/><path class="cls-11" d="M26.5 9.2L23.3 9l4-1.2a1.4 1.4 0 01-.8 1.4zm-3.5-1l-1.3 1a16.8 16.8 0 002-3.8 6.6 6.6 0 00.3-2.7A2.4 2.4 0 0125.2 5a2.4 2.4 0 01-.7 1.5A15 15 0 0023 8.1z"/></svg> | |
| 447 | + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" height="90" width="90"><defs><style>.cls-11,.cls-12{fill-rule:evenodd}.cls-4{fill:none}.cls-11{fill:#86a196}.cls-12{fill:#fff}</style></defs><path class="cls-4" d="M-6.3 0h60v60h-60z"/><path d="M16.7 8.1a15.4 15.4 0 00-8 10.2 23.5 23.5 0 1030 0 15.4 15.4 0 00-9.3-10.8 3.4 3.4 0 00-2.1-2.7A4.6 4.6 0 0018.4 3a24.4 24.4 0 00-1.7 5z" fill="#395360" fill-rule="evenodd"/><path fill="#fbaa6f" d="M18 26h12v14H18z"/><path d="M25.9 33.2l-.1-.1a1.4 1.4 0 111.6-2.3 1.9 1.9 0 00-1.2.8 1.9 1.9 0 00-.3 1.6zm-4.5 0a1.8 1.8 0 00-.4-1.6 2 2 0 00-1.2-.8 1.4 1.4 0 011.6 2.3zm7.2-3.2h.5l-1 4.8-2.2 6.5h-4.3l-3.2-5.4 1.1-3.2 2.1 2.7c.6.5 2.7.5 3.8-.6a26.2 26.2 0 003.2-4.8z" fill="#dc7f3c" fill-rule="evenodd"/><path d="M9.7 29H15v-9h-4a13 13 0 017.4-10q1.2-5 2.8-6.8l.1-.1.1-.1a2.3 2.3 0 011.1-.5 2.3 2.3 0 012.2 3.8 1.6 1.6 0 01-.4.3A15 15 0 0023 8a5 5 0 013-1.5 1.4 1.4 0 01.7.2 1.3 1.3 0 01.5 1.8 1.3 1.3 0 01-.6.6 13 13 0 0110.1 11l.1.8H33v8h4.8l1.8 13.4q-6.3 4-15.8 4T8 42.4zM25 38.4q3.8-6.4 3.8-7.6c0-2.2-3.2-4-4.8-4s-4.9 1.7-4.9 4q0 1.2 3.8 7.6a1.2 1.2 0 001 .6 1 1 0 001-.6z" fill="#bdcfc8" fill-rule="evenodd"/><path class="cls-4" d="M19 31h9.6L27 47.2h-6.4l-1.6-16z"/><path d="M39.8 48.8a20 20 0 01-32 0l.8-6a2.7 2.7 0 001 .1 2.8 2.8 0 002.8-2.4v1.2a2.8 2.8 0 005.6 0v1.6a2.9 2.9 0 005.7 0 2.8 2.8 0 005.7 0v-1.6a2.8 2.8 0 105.7 0v-1.2A2.8 2.8 0 0038 43a2.9 2.9 0 001-.2l.8 6z" fill="#809eb0" fill-rule="evenodd"/><path d="M8.3 44.6l.3-1.8a2.7 2.7 0 001 .2 2.8 2.8 0 002.8-2.5v1.2a2.8 2.8 0 005.7 0v1.7a2.9 2.9 0 005.6 0 2.8 2.8 0 005.7 0v-1.7a2.8 2.8 0 105.7 0v-1.2A2.8 2.8 0 0038 43a2.9 2.9 0 001-.2l.3 2a2.9 2.9 0 01-4.1-2.2v1.2a2.8 2.8 0 11-5.7 0v1.6a2.8 2.8 0 01-5.7 0 2.9 2.9 0 01-5.7 0v-1.7a2.8 2.8 0 01-5.7 0v-1.2A2.8 2.8 0 019.6 45a2.9 2.9 0 01-1.3-.3z" fill="#738e9e" fill-rule="evenodd"/><path class="cls-11" d="M37.8 22.4c-1-2.9-3-4.7-4.7-4.5-2.2.2-2.8 3.7-2.3 8s1.7 7.5 3.9 7.3 4-3.9 3.6-8c0 1.2-.5 2.3-1.3 2.4-1.2 0-1.5-1.2-1.6-2.9s-.2-3 1-3a1.5 1.5 0 011.4.7z"/><path class="cls-12" d="M37 21.8c-.6-1.3-1.5-2-2.4-1.9-1.5.1-1.9 2.6-1.6 5.5s1.2 5.1 2.7 5c1.1-.2 2-1.5 2.2-3.4a1.2 1.2 0 01-1 .6c-1 0-1.4-1.2-1.5-2.9s-.1-3 1-3a1.6 1.6 0 01.6 0z"/><path class="cls-11" d="M9.6 22.4c1-2.9 3-4.7 4.7-4.5 2.2.2 2.8 3.7 2.3 8s-1.7 7.5-3.9 7.3-4-3.9-3.7-8c.1 1.2.5 2.3 1.4 2.4 1.1 0 1.5-1.2 1.6-2.9s.1-3-1-3a1.5 1.5 0 00-1.4.7z"/><path class="cls-12" d="M10.4 21.8c.6-1.3 1.5-2 2.4-1.9 1.5.1 1.8 2.6 1.5 5.5s-1.1 5.1-2.6 5c-1.1-.2-2-1.5-2.2-3.4a1.2 1.2 0 00.9.6c1.1 0 1.4-1.2 1.6-2.9s.1-3-1-3a1.7 1.7 0 00-.7 0z"/><path d="M19 28.6a5.3 5.3 0 010-.7c0-2.4 1.2-5.2 4.9-5.2s4.8 2.8 4.8 5.2a4.4 4.4 0 010 1c-.9-1.3-2.4-2.1-4.9-2.1-2.4 0-3.9.7-4.8 1.8z" fill="#f4f8ff" fill-rule="evenodd"/><path class="cls-11" d="M26.5 9.2L23.3 9l4-1.2a1.4 1.4 0 01-.8 1.4zm-3.5-1l-1.3 1a16.8 16.8 0 002-3.8 6.6 6.6 0 00.3-2.7A2.4 2.4 0 0125.2 5a2.4 2.4 0 01-.7 1.5A15 15 0 0023 8.1z"/></svg><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 453 | 448 | <?php |
| 449 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 454 | 450 | } |
| 455 | 451 | |
| 456 | 452 | /** |
| 457 | 453 | * @return void |
| @@ -456,8 +452,9 @@ | ||
| 456 | 452 | /** |
| 457 | 453 | * @return void |
| 458 | 454 | */ |
| 459 | 455 | private function css() { |
| 456 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 460 | 457 | ?> |
| 461 | 458 | <style> |
| 462 | 459 | #frm-admin-smtp *, #frm-admin-smtp *::before, #frm-admin-smtpp *::after { |
| 463 | 460 | box-sizing: border-box; |
| @@ -565,6 +562,7 @@ | ||
| 565 | 562 | cursor: default; |
| 566 | 563 | } |
| 567 | 564 | </style> |
| 568 | 565 | <?php |
| 566 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 569 | 567 | } |
| 570 | 568 | } |