diff --git a/cf7-antispam.php b/cf7-antispam.php index 5ee1f46..e31c56c 100644 --- a/cf7-antispam.php +++ b/cf7-antispam.php @@ -15,7 +15,6 @@ use CF7_AntiSpam\Core\CF7_AntiSpam; use CF7_AntiSpam\Core\CF7_AntiSpam_Activator; use CF7_AntiSpam\Core\CF7_AntiSpam_Deactivator; -use CF7_AntiSpam\Core\WPCF7_Service; use CF7_AntiSpam\Core\CF7_AntiSpam_Uninstaller; if ( ! defined( 'WPINC' ) ) { diff --git a/composer.json b/composer.json index eef7429..e2b03cf 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,9 @@ "phpunit/phpunit": "^9.6.13", "wp-phpunit/wp-phpunit": "^5.9.5", "yoast/phpunit-polyfills": "^1.1", - "dealerdirect/phpcodesniffer-composer-installer": "^0.7" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7", + "ext-dom": "*", + "ext-libxml": "*" }, "require": { "geoip2/geoip2": "~2.0", diff --git a/core/CF7_AntiSpam_Frontend.php b/core/CF7_AntiSpam_Frontend.php index 654d438..ce94be8 100644 --- a/core/CF7_AntiSpam_Frontend.php +++ b/core/CF7_AntiSpam_Frontend.php @@ -71,8 +71,8 @@ public function __construct( $plugin_name, $version ) { public function cf7a_honeypot_add( $form_elements ) { /* A list of default names for the honeypot fields. */ $options = get_option( 'cf7a_options', array() ); - $input_names = get_honeypot_input_names( $options['honeypot_input_names'] ); - $input_class = sanitize_html_class( $this->options['cf7a_customizations_class'] ); + $input_names = !empty( $options['honeypot_input_names'] ) ? get_honeypot_input_names( $options['honeypot_input_names'] ) : array(); + $input_class = !empty( $this->options['cf7a_customizations_class'] ) ? sanitize_html_class( $this->options['cf7a_customizations_class'] ) : 'cf7a'; /** * Controls the maximum number of honeypots. * @@ -91,7 +91,8 @@ public function cf7a_honeypot_add( $form_elements ) { /* add honeypot fields */ foreach ( $inputs as $i => $input ) { if ( stripos( $input, 'type="text"' ) !== false ) { - $honeypot_names = $input_names[ $i ]; + // TODO: add set of default values + $honeypot_names = isset( $input_names[ $i ] ) ? $input_names[ $i ] : 'hey_' . $i; $honeypot_input = sprintf( '', esc_attr( $honeypot_names ), diff --git a/package.json b/package.json index bb2902b..150047b 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "preplugin-zip": "wp-env run composer \"composer install --no-dev\"", "plugin-zip": "wp-scripts plugin-zip", "postplugin-zip": "wp-env run composer \"composer install\"", - "lint:css": "wp-scripts lint-style ./admin/src/**/*.scss --fix", - "lint:js": "wp-scripts lint-js ./includes/src ./admin/src", + "lint:css": "wp-scripts lint-style ./src/**/*.scss --fix", + "lint:js": "wp-scripts lint-js ./src/**/*.js", "packages-update": "wp-scripts packages-update", "wp-env:start": "wp-env start", "wp-env:stop": "wp-env stop", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 09f8bf6..85321ed 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@