PluginProbe
WooCommerce / 11.1.0-beta.2
WooCommerce v11.1.0-beta.2
11.1.0 11.1.0-rc.2 11.1.0-rc.1 11.1.0-beta.2 11.1.0-beta.1 11.0.1 11.0.0 11.0.0-rc.3 11.0.0-rc.2 11.0.0-rc.1 11.0.0-beta.2 11.0.0-beta.1 10.9.4 10.9.3 10.9.2 10.9.1 10.9.0 10.9.0-rc.1 10.9.0-beta.2 10.9.0-beta.1 10.8.1 10.8.0 10.8.0-rc.1 10.8.0-beta.2 10.8.0-beta.1 All 648 releases
woocommerce / includes / abstracts / abstract-wc-integration.php
abstract-wc-integration.php
86 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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