Skip to content

Commit

Permalink
Remove custom element support in EA admin.
Browse files Browse the repository at this point in the history
  • Loading branch information
kagg-design committed Oct 20, 2024
1 parent 5380d08 commit cfedcd4
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 57 deletions.
23 changes: 0 additions & 23 deletions .tests/php/integration/EssentialAddons/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use HCaptcha\EssentialAddons\Base;
use HCaptcha\Tests\Integration\HCaptchaWPTestCase;
use Mockery;
use Patchwork\Exceptions\NonNullToVoid;
use tad\FunctionMocker\FunctionMocker;

/**
* Class BaseTest
Expand All @@ -37,27 +35,6 @@ public function tearDown(): void {
parent::tearDown();
}

/**
* Test enqueue_scripts().
*
* @return void
*/
public function test_enqueue_scripts(): void {
$subject = Mockery::mock( Base::class );

$subject->makePartial();

$subject->enqueue_scripts();

self::assertFalse( wp_script_is( 'admin-essential-addons' ) );

$_GET['elementor-preview'] = '4242';

$subject->enqueue_scripts();

self::assertTrue( wp_script_is( 'admin-essential-addons' ) );
}

/**
* Test print_hcaptcha_scripts().
*
Expand Down
1 change: 0 additions & 1 deletion .tests/php/integration/EssentialAddons/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public function test_init_hooks(): void {
);
self::assertSame( 10, has_action( 'eael/login-register/before-login', [ $subject, 'verify' ] ) );

self::assertSame( 10, has_action( 'wp_enqueue_scripts', [ $subject, 'enqueue_scripts' ] ) );
self::assertSame( 10, has_action( 'hcap_print_hcaptcha_scripts', [ $subject, 'print_hcaptcha_scripts' ] ) );
}

Expand Down
1 change: 0 additions & 1 deletion .tests/php/integration/EssentialAddons/RegisterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public function test_init_hooks(): void {

self::assertSame( 10, has_action( 'wp_head', [ $subject, 'print_inline_styles' ] ) );

self::assertSame( 10, has_action( 'wp_enqueue_scripts', [ $subject, 'enqueue_scripts' ] ) );
self::assertSame( 10, has_action( 'hcap_print_hcaptcha_scripts', [ $subject, 'print_hcaptcha_scripts' ] ) );
}

Expand Down
8 changes: 0 additions & 8 deletions assets/js/admin-essential-addons.js

This file was deleted.

22 changes: 0 additions & 22 deletions src/php/EssentialAddons/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,11 @@
namespace HCaptcha\EssentialAddons;

use HCaptcha\Helpers\Pages;
use HCaptcha\Main;

/**
* Base trait.
*/
trait Base {
/**
* Enqueue admin scripts.
*
* @return void
*/
public function enqueue_scripts(): void {
if ( ! Pages::is_elementor_preview_page() ) {
return;
}

$min = hcap_min_suffix();

wp_enqueue_script(
'admin-essential-addons',
HCAPTCHA_URL . "/assets/js/admin-essential-addons$min.js",
[ Main::HANDLE ],
HCAPTCHA_VERSION,
true
);
}

/**
* Print hCaptcha script on edit page.
*
Expand Down
1 change: 0 additions & 1 deletion src/php/EssentialAddons/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ protected function init_hooks(): void {
add_action( 'eael/login-register/before-login-footer', [ $this, 'add_login_hcaptcha' ] );
add_action( 'eael/login-register/before-login', [ $this, 'verify' ], 10, 3 );

add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
add_action( 'hcap_print_hcaptcha_scripts', [ $this, 'print_hcaptcha_scripts' ] );
}

Expand Down
1 change: 0 additions & 1 deletion src/php/EssentialAddons/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ protected function init_hooks(): void {

add_action( 'wp_head', [ $this, 'print_inline_styles' ] );

add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
add_action( 'hcap_print_hcaptcha_scripts', [ $this, 'print_hcaptcha_scripts' ] );
}

Expand Down

0 comments on commit cfedcd4

Please sign in to comment.