diff --git a/assets/smtp-config.js b/assets/smtp-config.js index 5eadee4..82bd6b2 100644 --- a/assets/smtp-config.js +++ b/assets/smtp-config.js @@ -14,7 +14,7 @@ const { __ } = wp.i18n; function wpss_loadin() { if ( null !== document.getElementById( 'wpss-conf' ) ) { wpss_load_quicksettings( wpss_qc_settings ); - document.getElementById( 'wpss-quickset' ).onchange = function( stuff ) { + document.getElementById( 'wpss-quickset' ).onchange = function ( stuff ) { wpss_input_selection( wpss_qc_settings, stuff.target.value ); }; } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 67fac10..122b490 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -23,7 +23,7 @@ wp-simple-smtp.php - + */* @@ -37,5 +37,10 @@ tests/log/class-logservice-test.php + + + + tests/* + \ No newline at end of file diff --git a/src/class-options.php b/src/class-options.php index 2c4c8fb..de95734 100644 --- a/src/class-options.php +++ b/src/class-options.php @@ -62,25 +62,21 @@ public function get( $name, $blank_obj_on_empty = true, $ms_only = false ) { 'value' => $this->maybe_decrypt( $options, $name ), 'source' => 'CONFIG', ]; - } else { - if ( $blank_obj_on_empty ) { + } elseif ( $blank_obj_on_empty ) { return (object) [ 'value' => '', 'source' => 'CONFIG', ]; - } else { - return null; - } + } else { + return null; } - } else { - if ( $blank_obj_on_empty ) { + } elseif ( $blank_obj_on_empty ) { return (object) [ 'value' => '', 'source' => 'MULTISITE', ]; - } else { - return null; - } + } else { + return null; } } } diff --git a/src/log/class-logservice.php b/src/log/class-logservice.php index 512ee76..345391b 100644 --- a/src/log/class-logservice.php +++ b/src/log/class-logservice.php @@ -287,5 +287,4 @@ private function wp_to_obj( $post ) { return $log; } - } diff --git a/src/mail/class-mail.php b/src/mail/class-mail.php index 37449a5..380fc68 100644 --- a/src/mail/class-mail.php +++ b/src/mail/class-mail.php @@ -43,7 +43,7 @@ public function __construct() { if ( ! empty( $from->value ) ) { add_filter( 'wp_mail_from', - function( $email ) use ( $from ) { + function ( $email ) use ( $from ) { return $from->value; } ); @@ -53,7 +53,7 @@ function( $email ) use ( $from ) { if ( ! empty( $from_name->value ) ) { add_filter( 'wp_mail_from_name', - function( $email ) use ( $from_name ) { + function ( $email ) use ( $from_name ) { return $from_name->value; } ); diff --git a/src/settings/class-multisite.php b/src/settings/class-multisite.php index e10074b..2cc6bb2 100644 --- a/src/settings/class-multisite.php +++ b/src/settings/class-multisite.php @@ -82,7 +82,7 @@ function () { $this->generate_checkbox_area( 'adt', __( 'Options', 'simple-smtp' ), - function() { + function () { $this->generate_checkbox( 'disable', __( 'Disable email services', 'simple-smtp' ), __( 'When marked, all multisite email services will be disabled.', 'simple-smtp' ) ); $this->generate_checkbox( 'log', __( 'Log all sent emails to the database', 'simple-smtp' ), __( 'Works with the WordPress privacy features.', 'simple-smtp' ) ); $this->generate_checkbox( 'noverifyssl', __( 'Disable SSL Verification (advanced)', 'simple-smtp' ), __( 'Do not disable this unless you know what you\'re doing.', 'simple-smtp' ) ); diff --git a/src/settings/class-privacy.php b/src/settings/class-privacy.php index 7103f58..238502a 100644 --- a/src/settings/class-privacy.php +++ b/src/settings/class-privacy.php @@ -42,7 +42,7 @@ public function hooks() { if ( ! empty( $log_status ) && true === filter_var( $log_status->value, FILTER_VALIDATE_BOOLEAN ) ) { add_filter( 'wp_privacy_personal_data_erasers', - function( $erasers ) { + function ( $erasers ) { $erasers['wp-simple-smtp'] = array( 'eraser_friendly_name' => __( 'Remove user from SMTP log', 'simple-smtp' ), 'callback' => [ &$this, 'remove_data' ], diff --git a/src/settings/class-settings.php b/src/settings/class-settings.php index f58828c..7a683fe 100644 --- a/src/settings/class-settings.php +++ b/src/settings/class-settings.php @@ -168,7 +168,7 @@ public function generate_checkbox_area( $name, $name_pretty, $callback ) { add_settings_field( 'wpssmtp_smtp_' . $name, $name_pretty, - function() use ( &$callback ) { + function () use ( &$callback ) { ?>
diff --git a/src/settings/class-singular.php b/src/settings/class-singular.php index 89de27f..3a49ebf 100644 --- a/src/settings/class-singular.php +++ b/src/settings/class-singular.php @@ -124,7 +124,6 @@ public function options_page() { } else { $this->render_settings(); } - } /** @@ -166,7 +165,7 @@ function () { $this->generate_checkbox_area( 'adt', __( 'Options', 'simple-smtp' ), - function() { + function () { $this->generate_checkbox( 'disable', __( 'Disable email services', 'simple-smtp' ), __( 'When marked, no emails will be sent from this site.', 'simple-smtp' ) ); $this->generate_checkbox( 'log', __( 'Log all sent emails to the database', 'simple-smtp' ), __( 'Works with the WordPress privacy features.', 'simple-smtp' ) ); $this->generate_checkbox( 'noverifyssl', __( 'Disable SSL Verification (advanced)', 'simple-smtp' ), __( 'Do not disable this unless you know what you\'re doing.', 'simple-smtp' ) ); diff --git a/tests/class-bootstrap.php b/tests/class-bootstrap.php index 7f52a33..f3703a4 100644 --- a/tests/class-bootstrap.php +++ b/tests/class-bootstrap.php @@ -55,11 +55,11 @@ function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 * Mocks the WordPress get_option function. * See https://developer.wordpress.org/reference/functions/get_option/ for more information. * - * @param string $option Key name. - * @param mixed $default Default return. + * @param string $option Key name. + * @param mixed $default_return Default return. * @return mixed */ -function get_option( $option, $default = false ) { +function get_option( $option, $default_return = false ) { global $sbss_temp_store; $env_loc = __DIR__ . '/../.env'; diff --git a/tests/class-options-test.php b/tests/class-options-test.php index b81700d..8643d10 100644 --- a/tests/class-options-test.php +++ b/tests/class-options-test.php @@ -26,7 +26,7 @@ class OptionsTest extends TestCase { /** * Constructor. */ - public function setUp():void { + public function setUp(): void { if ( ! defined( 'SECURE_AUTH_KEY' ) ) { define( 'SECURE_AUTH_KEY', 's7r0237r897d89s69r83289' ); } diff --git a/tests/log/class-logservice-test.php b/tests/log/class-logservice-test.php index e66a03a..6fe0566 100644 --- a/tests/log/class-logservice-test.php +++ b/tests/log/class-logservice-test.php @@ -90,7 +90,7 @@ class LogServiceTest extends TestCase { /** * Per-test constructor. */ - public function setUp():void { + public function setUp(): void { $this->log_service = new LogService(); /** diff --git a/tests/mail/class-mail-test.php b/tests/mail/class-mail-test.php index 383882e..a631869 100644 --- a/tests/mail/class-mail-test.php +++ b/tests/mail/class-mail-test.php @@ -26,7 +26,7 @@ class MailTest extends TestCase { /** * Constructor. */ - public function setUp():void { + public function setUp(): void { $this->mail = new Mail(); } diff --git a/tests/settings/class-settings-test.php b/tests/settings/class-settings-test.php index 41424cb..fb927a6 100644 --- a/tests/settings/class-settings-test.php +++ b/tests/settings/class-settings-test.php @@ -41,7 +41,7 @@ class SettingsTest extends TestCase { /** * Constructor. */ - public function setUp():void { + public function setUp(): void { $this->settings = new Settings(); $this->multisite_settings = new SettingsMultisite(); $this->options = new Options(); diff --git a/wp-simple-smtp.php b/wp-simple-smtp.php index f9738a2..273e6b5 100644 --- a/wp-simple-smtp.php +++ b/wp-simple-smtp.php @@ -37,7 +37,7 @@ if ( ! empty( $disabled ) && true === filter_var( $disabled->value, FILTER_VALIDATE_BOOLEAN ) ) { add_action( 'plugins_loaded', - function() { + function () { global $phpmailer; $phpmailer = new MailDisable(); } @@ -64,14 +64,14 @@ function() { add_action( 'wpss_clear_resent', - function() { + function () { delete_option( 'wpss_resent' ); } ); add_action( 'wpss_clear_logs', - function() { + function () { $is_disabled = apply_filters( 'simple_smtp_disable_log_prune', false ); // 2629800 = 1 Month. if ( ! $is_disabled ) { @@ -136,7 +136,7 @@ function wpsmtp_deactivation() { */ add_action( 'init', - function() { + function () { ( new LogService() )->register_log_storage(); } );