Skip to content

Commit 15bc4d9

Browse files
authored
V3.10.0 (#322)
* Improve translation on Settings pages. * Fix test. * Login/Signup Popup Login Form. * Login/Signup Popup Register Form. * Login/Signup Popup add hCaptcha reset. * Login/Signup Popup update readme.txt. * Add CoBlocks integration. * Add CoBlocks integration. * Fix hash error preventing first sending of the form. * Make request.php test coverage 100%. * WPCS. * Make Migrations test coverage 100%. * Identify and fix change in the Siteverify Error Codes Table. * Add Enterprise params to System Info. * Check the Enterprise params before saving. * Show console errors on General page when updating hCaptcha API script. * Show console errors on General page when updating hCaptcha API script. * WPCS. * Update readme.txt. * Security and other updates of packages. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Update actions/cache to v4. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix CI tests. * Fix integration tests on CI. * Fix integration tests on CI. * Update migrations to use 2-digit version numbers. * Fix Migrations tests. * Fix Settings layout for Chrome 122. * Fix Settings layout for Chrome 122. * Add Elementor Pro Login integration. * Fix tests. * Update readme.txt. * Fix CSP headers. * Fix Jetpack form styling. * WPCS. * Add Force hCaptcha check feature. * Add Force hCaptcha check to Jetpack. * Add Force hCaptcha check feature. * Update readme.txt. * Fix grammar and styling in readme.txt. * Add force argument to the shortcode and update readme.txt. * Fix tests. * Fix Jetpack tests. * WPCS. * ESLint. * Fix Jetpack tests. * Prevent submit when force widget was manually solved. * Prevent submit when force widget was manually solved. * Do not execute hCaptcha twice. * Fix Jest. * Tested with WooCommerce 8.6. * Tested with WooCommerce 8.6. * Fix Migrations test. * Fix Migrations test. * Add tracking info class. * WPCS. * Add registered report domain. * Change tracking event name. * Change tracking event name. * Add 3.10.0 migration. * Revert test change. * Update readme.txt according to new standards. * Add User-Agent header to TrackingInfo.php. * Fix error codes in request_verify. * Change event name to the custom one. * Fix fatal error with Formidable Forms 6.8.2. * Block Formidable hCaptcha settings. * Always add hcaptcha-widget. * Fix 40 tests after widget update. * WPCS. * WPCS. * Save hCaptcha events. * Update GH infrastructure. * Save hCaptcha events. * Save hCaptcha events. * Fix tests. * Use in CF7 the latest HCaptcha features. * Fix cf7-hcaptcha shortcode to save event form_id. * Create Events list page. * Create Events list page. * Date axis and scaling issues in Chart. * Date axis and scaling issues in Chart. * Make Chart responsive. * Tested with WordPress 6.5. * Rename EventsInfo class. * Rename EventsInfo class. * Improve language on Events page. * Create Forms page. * Create Forms page. * Create Forms page. * Block Forms page when Statistics switch is off. * Add Statistics settings section. * Add sample Foms Page image. * Add sample Events Page image. * Do not write statistics when switch is off. * Add collection switches. * Do not collect items if not selected. * Fix tests. * Shrink the tracking information. * Send tracking info on plugin update. * Fix test. * Add Enterprise to Tracking info. * Fix CSP issue. * Fix Tracking Info. * Store all class instances into repository. * Update readme.txt. * Flatten the tracking info. * Update changelog.txt. * Change custom event name. * Update readme.txt. * Update softprops/action-gh-release. * Remove Statistics settings on General page. * Delete Forms and Events pages. * Delete Events class. * Remove Statistics from the readme.txt. * Remove Statistics from the changelog.txt. * Remove Statistics settings on General page. * Fix unit tests. * Remove migration to 3.10.0. * Fix integration tests. * Bump up version. * Remove TrackingInfo from 3.10.0.
1 parent fafa0fd commit 15bc4d9

File tree

103 files changed

+4250
-1751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+4250
-1751
lines changed

.codeception.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: Checkout code
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
3333
with:
3434
path: ${{ env.wp-plugin-directory }}
3535

@@ -40,7 +40,7 @@ jobs:
4040
extensions: json, mysqli, mbstring, zip
4141

4242
- name: Install dependencies with caching
43-
uses: ramsey/composer-install@v2
43+
uses: kagg-design/composer-install@v2
4444
with:
4545
working-directory: ${{ env.wp-plugin-directory }}
4646

@@ -92,7 +92,7 @@ jobs:
9292

9393
- name: Install plugins
9494
working-directory: ${{ env.wp-directory }}
95-
run: wp plugin install bbpress buddypress ultimate-member wpforms-lite wpforo
95+
run: wp plugin install bbpress buddypress ultimate-member wpforms-lite
9696

9797
- name: Install plugins requiring 7.1
9898
if: ${{ matrix.php-version >= '7.1' }}

.github/workflows/create-zip.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111

1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
- name: Install dependencies with caching
17-
uses: ramsey/composer-install@v2
17+
uses: kagg-design/composer-install@v2
1818
with:
1919
composer-options: "--no-dev --optimize-autoloader --classmap-authoritative"
2020

.github/workflows/deploy-readme-assets-to-wp-org.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout code
12-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1313

1414
- name: WordPress.org plugin asset/readme update
1515
uses: 10up/action-wordpress-plugin-asset-update@stable

.github/workflows/deploy-to-wp-org.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313

1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1717

1818
- name: Install dependencies with caching
19-
uses: ramsey/composer-install@v2
19+
uses: kagg-design/composer-install@v2
2020
with:
2121
composer-options: "--no-dev --optimize-autoloader --classmap-authoritative"
2222

@@ -38,7 +38,7 @@ jobs:
3838
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
3939

4040
- name: Upload release asset
41-
uses: softprops/action-gh-release@v1
41+
uses: softprops/action-gh-release@v2
4242
with:
4343
files: ${{github.workspace}}/${{ env.SLUG }}.zip
4444
env:

.tests/js/hcaptcha/hcaptcha.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ describe( 'HCaptcha', () => {
6464
// Mock the rendering of the hCaptcha widget by adding a dataset attribute
6565
const iframe = document.createElement( 'iframe' );
6666
iframe.dataset.hcaptchaWidgetId = 'mock-widget-id';
67+
iframe.dataset.hcaptchaResponse = '';
6768
hcaptchaElement.appendChild( iframe );
6869
} ),
6970
execute: jest.fn(),

.tests/php/integration/AAAMainTest.php

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use ReflectionException;
4242
use stdClass;
4343
use tad\FunctionMocker\FunctionMocker;
44+
use HCaptcha\Admin\Events\Events;
4445

4546
/**
4647
* Test Main class.
@@ -408,18 +409,19 @@ public function test_prefetch_hcaptcha_dns() {
408409
* @return void
409410
*/
410411
public function test_csp_headers() {
411-
$headers = [ 'some_header' => 'some header content' ];
412+
$headers = [
413+
'some_header' => 'some header content',
414+
'Content-Security-Policy' => "default-src 'self'",
415+
];
412416
$expected = $headers;
413-
$hcap_csp = "'self' https://hcaptcha.com https://*.hcaptcha.com";
417+
$hcap_csp = "'self' 'unsafe-inline' 'unsafe-eval' https://hcaptcha.com https://*.hcaptcha.com";
414418

415-
$expected['X-Content-Security-Policy'] =
416-
"default-src 'self'; " .
419+
$expected['Content-Security-Policy'] =
417420
"script-src $hcap_csp; " .
418421
"frame-src $hcap_csp; " .
419422
"style-src $hcap_csp; " .
420423
"connect-src $hcap_csp; " .
421-
"unsafe-eval $hcap_csp; " .
422-
"unsafe-inline $hcap_csp;";
424+
"default-src 'self'";
423425

424426
$subject = new Main();
425427

@@ -1065,7 +1067,7 @@ static function () use ( &$activate ) {
10651067
$expected_loaded_classes = [];
10661068
$loaded_classes = $this->get_protected_property( $subject, 'loaded_classes' );
10671069

1068-
self::assertSame( $expected_loaded_classes, $loaded_classes );
1070+
self::assertSame( $expected_loaded_classes, array_keys( $loaded_classes ) );
10691071

10701072
// Activate hCaptcha.
10711073
$activate = true;
@@ -1094,7 +1096,7 @@ static function () use ( &$activate ) {
10941096

10951097
$loaded_classes = $this->get_protected_property( $subject, 'loaded_classes' );
10961098

1097-
self::assertSame( $expected_loaded_classes, $loaded_classes );
1099+
self::assertSame( $expected_loaded_classes, array_keys( $loaded_classes ) );
10981100

10991101
array_walk(
11001102
$component,
@@ -1327,7 +1329,12 @@ public function dp_test_load_modules(): array {
13271329
'Elementor Pro Form' => [
13281330
[ 'elementor_pro_status', 'form' ],
13291331
'elementor-pro/elementor-pro.php',
1330-
HCaptchaHandler::class,
1332+
[ HCaptchaHandler::class, \HCaptcha\ElementorPro\Login::class ],
1333+
],
1334+
'Elementor Pro Login' => [
1335+
[ 'elementor_pro_status', null ],
1336+
'elementor-pro/elementor-pro.php',
1337+
\HCaptcha\ElementorPro\Login::class,
13311338
],
13321339
'Fluent Forms' => [
13331340
[ 'fluent_status', 'form' ],
@@ -1588,9 +1595,12 @@ public function test_load_textdomain() {
15881595
$subject = new Main();
15891596
$subject->init_hooks();
15901597

1591-
$domain = 'hcaptcha-for-forms-and-more';
15921598
$locale = 'en_US';
15931599

1600+
$default_domain = 'default';
1601+
$default_mofile = WP_LANG_DIR . "/$locale.mo";
1602+
1603+
$domain = 'hcaptcha-for-forms-and-more';
15941604
$mofile =
15951605
WP_PLUGIN_DIR . '/' . dirname( plugin_basename( HCAPTCHA_FILE ) ) . '/languages/' .
15961606
$domain . '-' . $locale . '.mo';
@@ -1600,19 +1610,22 @@ public function test_load_textdomain() {
16001610
add_filter(
16011611
'override_load_textdomain',
16021612
static function ( $override, $domain, $mofile ) use ( &$override_filter_params ) {
1603-
$override_filter_params = [ $override, $domain, $mofile ];
1613+
$override_filter_params[] = [ $override, $domain, $mofile ];
16041614

16051615
return $override;
16061616
},
1607-
10,
1617+
- PHP_INT_MAX,
16081618
3
16091619
);
16101620

16111621
$subject->load_textdomain();
16121622

1613-
self::assertFalse( $override_filter_params[0] );
1614-
self::assertSame( $domain, $override_filter_params[1] );
1615-
self::assertSame( $mofile, $override_filter_params[2] );
1623+
self::assertFalse( $override_filter_params[0][0] );
1624+
self::assertSame( $default_domain, $override_filter_params[0][1] );
1625+
self::assertSame( $default_mofile, $override_filter_params[0][2] );
1626+
self::assertFalse( $override_filter_params[1][0] );
1627+
self::assertSame( $domain, $override_filter_params[1][1] );
1628+
self::assertSame( basename( $mofile ), basename( $override_filter_params[1][2] ) );
16161629
}
16171630

16181631
/**

.tests/php/integration/ACFE/FormTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,18 @@ public function dp_test_add_hcaptcha(): array {
150150
'key' => 'some-key',
151151
'name' => 'some-name',
152152
],
153-
'<div class="acf-input-wrap acfe-field-recaptcha"> <div> <div
154-
class="h-captcha"
155-
data-sitekey=""
156-
data-theme=""
157-
data-size=""
158-
data-auto="false">
159-
</div>
160-
</div><input type="hidden" id="acf-some-key" name="some-name"></div>',
153+
'<div class="acf-input-wrap acfe-field-recaptcha"> <div>' .
154+
$this->get_hcap_form(
155+
[
156+
'id' => [
157+
'source' => [
158+
'acf-extended-pro/acf-extended.php',
159+
'acf-extended/acf-extended.php',
160+
],
161+
'form_id' => 0,
162+
],
163+
]
164+
) . '</div><input type="hidden" id="acf-some-key" name="some-name"></div>',
161165
],
162166
'some field' => [
163167
[ 'type' => 'some' ],

.tests/php/integration/Avada/FormTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,18 @@ public function test_init_hooks() {
5252
* @return void
5353
*/
5454
public function test_add_hcaptcha() {
55-
$args = [];
56-
$params = [ 'id' => 5 ];
55+
$form_id = 5;
56+
$args = [
57+
'id' =>
58+
[
59+
'source' => [ 'Avada' ],
60+
'form_id' => $form_id,
61+
],
62+
];
63+
$params = [ 'id' => $form_id ];
5764
$wrong_html = 'some html';
5865
$html = '<button type="submit">';
59-
$form = $this->get_hcap_form();
66+
$form = $this->get_hcap_form( $args );
6067
$expected = $form . $html;
6168

6269
$subject = new Form();

.tests/php/integration/BBPress/NewTopicTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* Test NewTopic class.
21+
*
22+
* @group bbpress
2123
*/
2224
class NewTopicTest extends HCaptchaPluginWPTestCase {
2325

@@ -45,8 +47,16 @@ public function tearDown(): void { // phpcs:ignore PHPCompatibility.FunctionDecl
4547
* Test add_captcha().
4648
*/
4749
public function test_add_captcha() {
48-
$nonce = wp_nonce_field( 'hcaptcha_bbp_new_topic', 'hcaptcha_bbp_new_topic_nonce', true, false );
49-
$expected = $this->get_hcap_form() . $nonce;
50+
$args = [
51+
'action' => 'hcaptcha_bbp_new_topic',
52+
'name' => 'hcaptcha_bbp_new_topic_nonce',
53+
'id' => [
54+
'source' => [ 'bbpress/bbpress.php' ],
55+
'form_id' => 'new_topic',
56+
],
57+
];
58+
59+
$expected = $this->get_hcap_form( $args );
5060

5161
$subject = new NewTopic();
5262

0 commit comments

Comments
 (0)