abstract-wc-integration.php
1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Abstract Integration Class
*
* Extended by individual integrations to offer additional functionality.
*
* @class WC_Integration
* @extends WC_Settings_API
* @version 2.6.0
* @package WooCommerce/Abstracts
* @category Abstract Class
* @author WooThemes
*/
abstract class WC_Integration extends WC_Settings_API {
/**
* yes or no based on whether the integration is enabled.
* @var string
*/
public $enabled = 'yes';
/**
* Integration title.
* @var string
*/
public $method_title = '';
/**
* Integration description.
* @var string
*/
public $method_description = '';
/**
* Return the title for admin screens.
* @return string
*/
public function get_method_title() {
return apply_filters( 'woocommerce_integration_title', $this->method_title, $this );
}
/**
* Return the description for admin screens.
* @return string
*/
public function get_method_description() {
return apply_filters( 'woocommerce_integration_description', $this->method_description, $this );
}
/**
* Output the gateway settings screen.
*/
public function admin_options() {
echo '<h2>' . esc_html( $this->get_method_title() ) . '</h2>';
echo wp_kses_post( wpautop( $this->get_method_description() ) );
echo '<div><input type="hidden" name="section" value="' . esc_attr( $this->id ) . '" /></div>';
parent::admin_options();
}
/**
* Init settings for gateways.
*/
public function init_settings() {
parent::init_settings();
$this->enabled = ! empty( $this->settings['enabled'] ) && 'yes' === $this->settings['enabled'] ? 'yes' : 'no';
}
}