/includes/abstracts/abstract-wc-integration.php

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