Add woocommerce form locations
Validate Build / validate-build (push) Failing after 27s
Validate Build / validate-build (push) Failing after 27s
This commit is contained in:
+18
-1
@@ -35,6 +35,10 @@ require_once 'vendor/autoload.php';
|
||||
|
||||
final class Captcha extends Plugin {
|
||||
|
||||
public static function is_woocommerce_active():bool {
|
||||
return is_plugin_active('woocommerce/woocommerce.php');
|
||||
}
|
||||
|
||||
protected function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
@@ -50,6 +54,8 @@ final class Captcha extends Plugin {
|
||||
'inc/location/class-post-password-form.php',
|
||||
'inc/location/class-registration-page.php',
|
||||
]);
|
||||
|
||||
add_action('plugins_loaded', [$this, 'load_woocommerce'], 9, 0);
|
||||
}
|
||||
|
||||
protected function enable():void {
|
||||
@@ -62,7 +68,7 @@ final class Captcha extends Plugin {
|
||||
remove_filter('plugin_action_links_' . self::get_basename(), [$this, 'action_links']);
|
||||
}
|
||||
|
||||
public function action_links($links) {
|
||||
public function action_links(array $links):array {
|
||||
if (current_user_can('manage_options')) {
|
||||
array_unshift($links, sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
@@ -73,6 +79,17 @@ final class Captcha extends Plugin {
|
||||
return $links;
|
||||
}
|
||||
|
||||
public function load_woocommerce():void {
|
||||
if (!self::is_woocommerce_active()) return;
|
||||
|
||||
$this->add_files([
|
||||
'inc/location/woocommerce/class-checkout.php',
|
||||
'inc/location/woocommerce/class-login.php',
|
||||
'inc/location/woocommerce/class-lost-password.php',
|
||||
'inc/location/woocommerce/class-register.php',
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Captcha::instance();
|
||||
|
||||
Reference in New Issue
Block a user