Skip to content

Commit

Permalink
V3.3.0 (#272)
Browse files Browse the repository at this point in the history
* Fix Forminator form display error.

* Block hCaptcha settings in Forminator admin.

* Use hcap_min_suffix() in Notifications.
WPCS.

* Replace hCaptcha inserted into Forminator form.

* Use ajaxSuccess event to determine which ajax actions is done.

* Block hCaptcha settings in Forminator edit field popup.

* Block hCaptcha settings in Forminator edit field popup.

* Update readme.txt.

* Rename forminator script.

* Add hCaptcha reset for Forminator.

* Add hCaptcha reset for Forminator.

* Unify Elementor script names - admin.

* Unify Elementor script names - rename admin test.

* Unify Elementor script names - fix integration admin test.

* Unify Elementor script names - rename frontend script.

* Unify Forminator script names.

* Add hCaptcha reset for Elementor form.

* Fix deprecation error with Fluent Forms.

* Fix deprecation errors with Fluent Forms.

* Fix deprecation errors with Fluent Forms.

* Update readme.txt.

* Improve observer in Fluent Forms.

* Fix submit error in Fluent Forms.

* Improve observer in Fluent Forms.

* Do not show our hCaptcha if Fluent Conversational Form has own one.

* Move hCaptcha above the submit button in Fluent Form.

* Update readme.txt.

* Compatibility with conversational Fluent Form.

* Update readme.txt.

* Fix tests.

* Update hCaptcha placeholder.

* Block hCaptcha settings on Fluent Forms settings page.

* Fix dynamic display of settings in sample hCaptcha.

* Better scroll to the message on General page.

* Better scroll to the message on General page.

* Fix message on Integrations page on smaller screens.

* Use current site key and secret key during config check.

* Use current site key and secret key during config check.

* Improve compatibility with WP Rocket.

* Add hCaptcha reset to Quform.

* Add ability to use hCaptcha field provided by the Quform plugin.

* Avoid Quform honeypot to make invisible hCaptcha working.

* Block Quform own hCaptcha settings in admin.

* WPCS.

* Update readme.txt.

* Bump up version.

* Tested with WooCommerce 8.0.

* Implement corporate colors.

* Implement corporate colors.

* WPCS 3.0.

* WPCS 3.0.

* ESLint in jest.

* PHP 7.0 in integration tests.

* PHP 7.0 in unit tests.

* PHP 7.0 in unit tests.

* Implement corporate colors.

* ESLint in jest.

* Update readme.txt.

* Cleanup .gitignore.

* Cleanup .distignore.

* Get rid of deprecated `set-output` command in CI.

* Get rid of deprecated `set-output` command in CI.

* Fix tests on CI.

* Fix tests on CI.

* Fix tests on CI.

* Fix tests on CI.

* Fix tests on CI.

* Passster integration

* Fix tests.

* EA in Settings classes.

* EA in Main.php.

* EA in Abstracts.

* Block showing hCaptcha in Theme My Login.

* Update yarn.

* Update yarn.

* Update yarn.

* Block showing hCaptcha in Theme My Login.

* Block showing hCaptcha in Theme My Login.

* Block showing hCaptcha in Theme My Login.

* Unify login add_captcha with abstract class.

* Theme My Login Login.

* Theme My Login Register.

* Theme My Login Lost Password.

* Update readme.txt.

* Do not add captcha to GF in admin.

* Fix layout for GF nested forms.

* Fix layout for GF nested forms.

* Do not verify nested GF form.

* Fix layout for GF nested forms.

* Update readme.txt.

* Add compatibility with Wordfence Login Security and Wordfence Security.

* Add compatibility with Wordfence Login Security and Wordfence Security.

* UsersWP Login Form.

* UsersWP Register Form.

* UsersWP Login Form.

* UsersWP Login Form.

* UsersWP Login Form.

* UsersWP Register Form.

* UsersWP Register Form.

* UsersWP Register Form.

* UsersWP Register Form.

* UsersWP Forgot Password Form.

* Update readme.txt.

* UsersWP Forgot Password Form.

* Make UsersWP Form work in ajax.

* EA in php files.

* Improve support for Kadence simple form.

* Add reset hCaptcha after Kadence form submit.

* Add support for Kadence advanced form.

* Fix Kadence Advanced Form on the backend.

* Block Kadence Advanced Form hCaptcha settings.

* ESLint.

* Block Kadence Advanced Form hCaptcha settings.

* Auto-add hCaptcha to Kadence Advanced form.

* Fix error in admin-kadence-advanced.js.

* Do not replace reCaptcha in Kadence simple form.

* Fix error on Classified Listing Login form.

* Fix error on Classified Listing Login form.

* Improve login sequence.

* Fix admin page title.

* Replace deprecated ajaxStop in Divi.

* Replace deprecated ajaxStop in Back-In-Stock-Notifier.

* Replace deprecated ajaxStop in Support Candy.

* Update readme.txt.

* EA in unit tests.

* EA in integration tests.

* Bump up version.

* Update readme.txt

---------

Co-authored-by: e271828- <[email protected]>
  • Loading branch information
kagg-design and e271828- authored Sep 11, 2023
1 parent c5009b1 commit 5f4b000
Show file tree
Hide file tree
Showing 127 changed files with 3,345 additions and 1,693 deletions.
2 changes: 0 additions & 2 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
/.gitignore
/.phpcs.cache
/.yarnrc.yml
/CHANGELOG.md
/README.md
/Thumbs.db
/assets/js/*.svg
/auth.json
/babel.config.json
/composer.json
Expand Down
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
20 changes: 4 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,16 @@ jobs:
with:
path: ${{ env.wp-plugin-directory }}

- name: Install PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: json, mysqli, mbstring, zip
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get Composer cache directory
working-directory: ${{ env.wp-plugin-directory }}
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Set up Composer caching
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
- name: Setup Composer caching
uses: ramsey/composer-install@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
working-directory: ${{ env.wp-plugin-directory }}

- name: Install dependencies
working-directory: ${{ env.wp-plugin-directory }}
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/create-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Set up Composer caching
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup Composer caching
uses: ramsey/composer-install@v2

- name: Install dependencies in prod version
run: |
Expand Down
15 changes: 2 additions & 13 deletions .github/workflows/deploy-to-wp-org.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Set up Composer caching
uses: actions/cache@v3
env:
cache-name: cache-composer-dependencies
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup Composer caching
uses: ramsey/composer-install@v2

- name: Install dependencies in prod version
run: |
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ assets/css/*.min.css.map
assets/js/apps/
assets/js/**/*.min.js
assets/js/**/*.min.js.map
assets/*.svg
/coverage/
coverage/
node_modules/
vendor/

Expand Down
2 changes: 2 additions & 0 deletions .tests/js/__mocks__/backboneMarionette.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// Mock Backbone
// noinspection JSUnresolvedReference

const Backbone = {
Radio: {
channel() {
Expand Down
3 changes: 3 additions & 0 deletions .tests/js/__mocks__/elementorFrontend.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSUnresolvedReference

export const hooks = {
addAction: jest.fn(),
};
Expand All @@ -8,4 +10,5 @@ const elementorFrontend = {

global.elementorFrontend = elementorFrontend;

// noinspection JSUnusedGlobalSymbols
export default elementorFrontend;
4 changes: 4 additions & 0 deletions .tests/js/__mocks__/elementorModules.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSUnresolvedReference

const elementorModules = {
editor: {
utils: {
Expand All @@ -7,4 +9,6 @@ const elementorModules = {
};

global.elementorModules = elementorModules;

// noinspection JSUnusedGlobalSymbols
export default elementorModules;
3 changes: 3 additions & 0 deletions .tests/js/__mocks__/elementorPro.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSUnresolvedReference

const elementorPro = {
config: {
forms: {
Expand All @@ -14,4 +16,5 @@ const elementorPro = {

global.elementorPro = elementorPro;

// noinspection JSUnusedGlobalSymbols
export default elementorPro;
6 changes: 5 additions & 1 deletion .tests/js/assets-js-files/hcaptcha-divi.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ describe( 'hCaptcha ajaxStop binding', () => {
} );

test( 'hCaptchaBindEvents is called when ajaxStop event is triggered', () => {
$( document ).trigger( 'ajaxStop' );
const xhr = {};
const settings = {};

settings.data = '?some_data&et_pb_contactform_submit_0=some_value';
$( document ).trigger( 'ajaxSuccess', [ xhr, settings ] );
expect( hCaptchaBindEvents ).toHaveBeenCalledTimes( 1 );
} );
} );
6 changes: 5 additions & 1 deletion .tests/js/assets-js-files/hcaptcha-support-candy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ describe( 'hCaptcha ajaxStop binding', () => {
} );

test( 'hCaptchaBindEvents is called when ajaxStop event is triggered', () => {
$( document ).trigger( 'ajaxStop' );
const xhr = {};
const settings = {};

settings.data = '?some_data&action=wpsc_get_ticket_form';
$( document ).trigger( 'ajaxSuccess', [ xhr, settings ] );
expect( hCaptchaBindEvents ).toHaveBeenCalledTimes( 1 );
} );
} );
2 changes: 2 additions & 0 deletions .tests/js/setupTests.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// noinspection JSUnresolvedReference

global.fetch = require( 'jest-fetch-mock' );

global.ajaxurl = 'http://ajax-url';
47 changes: 30 additions & 17 deletions .tests/php/integration/AMainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ public function test_init() {
* Test init() and init_hooks().
*
* @param boolean $logged_in User is logged in.
* @param boolean $hcaptcha_off_when_logged_in Option 'hcaptcha_off_when_logged_in' is set.
* @param string $hcaptcha_off_when_logged_in Option 'hcaptcha_off_when_logged_in' is set.
* @param boolean|string $whitelisted Whether IP is whitelisted.
* @param boolean $hcaptcha_active Plugin should be active.
*
* @dataProvider dp_test_init
* @noinspection PhpUnitTestsInspection
* @throws ReflectionException ReflectionException.
*/
public function test_init_and_init_hooks( $logged_in, $hcaptcha_off_when_logged_in, $whitelisted, $hcaptcha_active ) {
public function test_init_and_init_hooks( bool $logged_in, string $hcaptcha_off_when_logged_in, $whitelisted, bool $hcaptcha_active ) {
global $current_user;

$hcaptcha_wordpress_plugin = hcaptcha();
Expand All @@ -141,8 +141,7 @@ public function test_init_and_init_hooks( $logged_in, $hcaptcha_off_when_logged_
'hcap_whitelist_ip',
static function () use ( $whitelisted ) {
return $whitelisted;
},
10
}
);

// Plugin was loaded by codeception.
Expand Down Expand Up @@ -268,7 +267,7 @@ static function () use ( $whitelisted ) {
*
* @return array[]
*/
public function dp_test_init() {
public function dp_test_init(): array {
return [
'not logged in, not set, not whitelisted' => [ false, 'off', false, true ],
'not logged in, set, not whitelisted' => [ false, 'on', false, true ],
Expand All @@ -284,7 +283,7 @@ public function dp_test_init() {
/**
* Test init() and init_hooks() on Elementor Pro edit page.
*
* @param boolean $elementor_pro_status Option 'elementor_pro_status' is set.
* @param string $elementor_pro_status Option 'elementor_pro_status' is set.
* @param array $server $_SERVER variable.
* @param array $get $_GET variable.
* @param array $post $_POST variable.
Expand All @@ -295,16 +294,19 @@ public function dp_test_init() {
* @throws ReflectionException ReflectionException.
*/
public function test_init_and_init_hooks_on_elementor_pro_edit_page(
$elementor_pro_status, $server, $get, $post, $hcaptcha_active
string $elementor_pro_status,
array $server,
array $get,
array $post,
bool $hcaptcha_active
) {
global $current_user;

add_filter(
'hcap_whitelist_ip',
static function () {
return true;
},
10
}
);

unset( $current_user );
Expand Down Expand Up @@ -389,7 +391,7 @@ static function () {
*
* @return array
*/
public function dp_test_init_and_init_hooks_on_elementor_pro_edit_page() {
public function dp_test_init_and_init_hooks_on_elementor_pro_edit_page(): array {
return [
'elementor option off' => [
'off',
Expand Down Expand Up @@ -494,7 +496,8 @@ public function test_print_inline_styles() {
$div_logo_url = HCAPTCHA_URL . '/assets/images/hcaptcha-div-logo.svg';
$div_logo_url_white = HCAPTCHA_URL . '/assets/images/hcaptcha-div-logo-white.svg';

$expected = ' <style>
$expected = ' <!--suppress CssUnresolvedCustomProperty, CssUnusedSymbol -->
<style>
#wpdiscuz-subscribe-form .h-captcha {
margin-left: auto;
}
Expand Down Expand Up @@ -527,8 +530,8 @@ public function test_print_inline_styles() {
line-height: 0;
margin-bottom: 0;
}
.gform_previous_button + .h-captcha {
margin-top: 2rem;
.passster-form .h-captcha {
margin-bottom: 5px;
}
#wpforo #wpforo-wrap.wpft-topic div .h-captcha,
#wpforo #wpforo-wrap.wpft-forum div .h-captcha {
Expand Down Expand Up @@ -662,7 +665,7 @@ public function test_login_head() {
* @throws ReflectionException ReflectionException.
* @noinspection BadExpressionStatementJS
*/
public function test_print_footer_scripts( $compat, $language, $custom_themes, $expected_script_src ) {
public function test_print_footer_scripts( $compat, $language, $custom_themes, string $expected_script_src ) {
$hcaptcha_wordpress_plugin = hcaptcha();

$hcaptcha_wordpress_plugin->form_shown = true;
Expand Down Expand Up @@ -812,7 +815,7 @@ function delayedLoad() {
*
* @return array
*/
public function dp_test_print_footer_scripts() {
public function dp_test_print_footer_scripts(): array {
return [
'no options' => [
false,
Expand Down Expand Up @@ -877,7 +880,7 @@ public function test_print_footer_scripts_when_form_NOT_shown() {
* @dataProvider dp_test_load_modules
* @throws ReflectionException ReflectionException.
*/
public function test_load_modules( $module ) {
public function test_load_modules( array $module ) {
list( $option_name, $option_value ) = $module[0];

update_option(
Expand Down Expand Up @@ -981,7 +984,7 @@ static function () use ( $template ) {
*
* @return array
*/
public function dp_test_load_modules() {
public function dp_test_load_modules(): array {
$modules = [
'Comment Form' => [
[ 'wp_status', 'comment' ],
Expand Down Expand Up @@ -1213,6 +1216,16 @@ public function dp_test_load_modules() {
'supportcandy/supportcandy.php',
\HCaptcha\SupportCandy\Form::class,
],
'Theme My Login Login' => [
[ 'theme_my_login_status', 'login' ],
'theme-my-login/theme-my-login.php',
\HCaptcha\ThemeMyLogin\Login::class,
],
'Theme My Login Register' => [
[ 'theme_my_login_status', 'register' ],
'theme-my-login/theme-my-login.php',
\HCaptcha\ThemeMyLogin\Register::class,
],
'Ultimate Member Login' => [
[ 'ultimate_member_status', 'login' ],
'ultimate-member/ultimate-member.php',
Expand Down
8 changes: 4 additions & 4 deletions .tests/php/integration/AutoVerify/AutoVerifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public function test_verify_form_in_rest_case_3_and_4() {
*
* @return string
*/
private function get_test_request_uri() {
private function get_test_request_uri(): string {
return '/hcaptcha-arbitrary-form/?some_argument=22';
}

Expand All @@ -395,7 +395,7 @@ private function get_test_request_uri() {
*
* @return string
*/
private function get_test_nonce() {
private function get_test_nonce(): string {
return '5e9f1e63ed';
}

Expand All @@ -404,7 +404,7 @@ private function get_test_nonce() {
*
* @return string
*/
private function get_test_content() {
private function get_test_content(): string {
$request_uri = $this->get_test_request_uri();
$nonce = $this->get_test_nonce();

Expand Down Expand Up @@ -441,7 +441,7 @@ class="wp-block-search__input" name="s" value="" placeholder=""
*
* @return string[][][]
*/
private function get_test_registered_forms() {
private function get_test_registered_forms(): array {
$request_uri = $this->get_test_request_uri();
$request_uri = wp_parse_url( $request_uri, PHP_URL_PATH );

Expand Down
Loading

0 comments on commit 5f4b000

Please sign in to comment.