abstract-wc-address-provider.php
9 months ago
abstract-wc-data.php
4 months ago
abstract-wc-deprecated-hooks.php
6 years ago
abstract-wc-integration.php
5 years ago
abstract-wc-log-handler.php
2 years ago
abstract-wc-object-query.php
5 years ago
abstract-wc-order.php
1 month ago
abstract-wc-payment-gateway.php
1 month ago
abstract-wc-payment-token.php
5 years ago
abstract-wc-privacy.php
5 years ago
abstract-wc-product.php
1 month ago
abstract-wc-session.php
10 months ago
abstract-wc-settings-api.php
1 year ago
abstract-wc-shipping-method.php
4 months ago
abstract-wc-widget.php
5 years ago
class-wc-background-process.php
5 years ago
abstract-wc-integration.php
86 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Abstract Integration class |
| 4 | * |
| 5 | * Extension of the Settings API which in turn gets extended |
| 6 | * by individual integrations to offer additional functionality. |
| 7 | * |
| 8 | * @class WC_Settings_API |
| 9 | * @version 2.6.0 |
| 10 | * @package WooCommerce\Abstracts |
| 11 | */ |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Abstract Integration Class |
| 19 | * |
| 20 | * Extended by individual integrations to offer additional functionality. |
| 21 | * |
| 22 | * @class WC_Integration |
| 23 | * @extends WC_Settings_API |
| 24 | * @version 2.6.0 |
| 25 | * @package WooCommerce\Abstracts |
| 26 | */ |
| 27 | abstract class WC_Integration extends WC_Settings_API { |
| 28 | |
| 29 | /** |
| 30 | * Yes or no based on whether the integration is enabled. |
| 31 | * |
| 32 | * @var string |
| 33 | */ |
| 34 | public $enabled = 'yes'; |
| 35 | |
| 36 | /** |
| 37 | * Integration title. |
| 38 | * |
| 39 | * @var string |
| 40 | */ |
| 41 | public $method_title = ''; |
| 42 | |
| 43 | /** |
| 44 | * Integration description. |
| 45 | * |
| 46 | * @var string |
| 47 | */ |
| 48 | public $method_description = ''; |
| 49 | |
| 50 | /** |
| 51 | * Return the title for admin screens. |
| 52 | * |
| 53 | * @return string |
| 54 | */ |
| 55 | public function get_method_title() { |
| 56 | return apply_filters( 'woocommerce_integration_title', $this->method_title, $this ); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Return the description for admin screens. |
| 61 | * |
| 62 | * @return string |
| 63 | */ |
| 64 | public function get_method_description() { |
| 65 | return apply_filters( 'woocommerce_integration_description', $this->method_description, $this ); |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Output the gateway settings screen. |
| 70 | */ |
| 71 | public function admin_options() { |
| 72 | echo '<h2>' . esc_html( $this->get_method_title() ) . '</h2>'; |
| 73 | echo wp_kses_post( wpautop( $this->get_method_description() ) ); |
| 74 | echo '<div><input type="hidden" name="section" value="' . esc_attr( $this->id ) . '" /></div>'; |
| 75 | parent::admin_options(); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Init settings for gateways. |
| 80 | */ |
| 81 | public function init_settings() { |
| 82 | parent::init_settings(); |
| 83 | $this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no'; |
| 84 | } |
| 85 | } |
| 86 |