| 1 |
<?php |
| 2 |
/** |
| 3 |
* Handles interactions with Woocommerce. |
| 4 |
* |
| 5 |
* @package WP_Defender\Integrations |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WP_Defender\Integrations; |
| 9 |
|
| 10 |
if ( ! defined( 'ABSPATH' ) ) { |
| 11 |
die; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Woocommerce integration module. |
| 16 |
* |
| 17 |
* @since 2.6.1 |
| 18 |
* @since 3.3.0 Add locations. |
| 19 |
*/ |
| 20 |
class Woocommerce { |
| 21 |
|
| 22 |
public const WOO_LOGIN_FORM = 'woo_login', |
| 23 |
WOO_REGISTER_FORM = 'woo_register', |
| 24 |
WOO_LOST_PASSWORD_FORM = 'woo_lost_password', |
| 25 |
WOO_CHECKOUT_FORM = 'woo_checkout'; |
| 26 |
|
| 27 |
/** |
| 28 |
* Check if Woo is activated. |
| 29 |
* |
| 30 |
* @return bool |
| 31 |
*/ |
| 32 |
public function is_activated(): bool { |
| 33 |
return class_exists( 'woocommerce' ); |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* Retrieves an array of WooCommerce forms with their respective translations. |
| 38 |
* |
| 39 |
* @return array An associative array where the keys are the form identifiers and the values are the translated |
| 40 |
* form names. |
| 41 |
*/ |
| 42 |
public static function get_forms(): array { |
| 43 |
return array( |
| 44 |
self::WOO_LOGIN_FORM => esc_html__( 'Login', 'defender-security' ), |
| 45 |
self::WOO_REGISTER_FORM => esc_html__( 'Registration', 'defender-security' ), |
| 46 |
self::WOO_LOST_PASSWORD_FORM => esc_html__( 'Lost Password', 'defender-security' ), |
| 47 |
self::WOO_CHECKOUT_FORM => esc_html__( 'Checkout', 'defender-security' ), |
| 48 |
); |
| 49 |
} |
| 50 |
} |
| 51 |
|