WC_QuickPay_Instance

The WooCommerce QuickPay WC QuickPay Instance class.

Defined (1)

The class is defined in the following location(s).

/classes/instances/instance.php  
  1. class WC_QuickPay_Instance extends WC_QuickPay { 
  2.  
  3. public $main_settings = NULL; 
  4.  
  5. public function __construct() { 
  6. parent::__construct(); 
  7.  
  8. $this->supports = array(  
  9. 'products',  
  10. 'refunds' 
  11. ); 
  12.  
  13. public function setup() { 
  14. $this->hooks_and_filters(); 
  15.  
  16. // Keep a reference 
  17. $this->main_settings = $this->settings; 
  18.  
  19. // Load the form fields and settings 
  20. $this->init_form_fields(); 
  21. $this->init_settings();  
  22.  
  23.  
  24. /** 
  25. * init_form_fields function. 
  26. * Initiates the plugin settings form fields 
  27. * @access public 
  28. * @return array 
  29. */ 
  30. public function init_form_fields() 
  31. $this->form_fields = array(); 
  32.  
  33. /** 
  34. * admin_options function. 
  35. * Prints the admin settings form 
  36. * @access public 
  37. * @return string 
  38. */ 
  39. public function admin_options() 
  40. $main_settings_args = array( 
  41. 'page' => 'wc-settings',  
  42. 'tab' => 'checkout',  
  43. 'section' => 'wc_quickpay' 
  44. ); 
  45. echo "<h3>QuickPay - {$this->id}, v" . WCQP_VERSION . "</h3>"; 
  46. echo "<p>" . sprintf(__('Allows you to receive payments via QuickPay %s.', 'woo-quickpay'), $this->id) . "</p>"; 
  47. echo "<p>" . sprintf(__('This module has it\'s main configuration inside the \'QuickPay\' tab.', 'woo-quickpay'), 's') . "</p>"; 
  48. echo "<p>" . sprintf(__('Click <a href="%s">here</a> to access the main configuration.', 'woo-quickpay'), add_query_arg( $main_settings_args, admin_url('admin.php'))) . "</p>"; 
  49. echo "<table class=\"form-table\">"; 
  50. $this->generate_settings_html(); 
  51. echo "</table"; 
  52.  
  53. /** 
  54. * s function. 
  55. * Returns a setting if set. Introduced to prevent undefined key when introducing new settings. 
  56. * In an instance class, this method first check if a local setting is set in the current instance. If not, it will check for the same setting inside 
  57. * the core library. 
  58. * @access public 
  59. * @return string 
  60. */ 
  61. public function s( $key, $default = NULL ) 
  62. if( isset( $this->settings[$key] ) ) { 
  63. return $this->settings[$key]; 
  64.  
  65. if( isset( $this->main_settings[$key] ) ) { 
  66. return $this->main_settings[$key]; 
  67.  
  68. return ! is_null( $default ) ? $default : ''; 
  69.  
  70.  
  71. /** 
  72. * FILTER: apply_gateway_icons function. 
  73. * Sets gateway icons on frontend 
  74. * @access public 
  75. * @return void 
  76. */  
  77. public function apply_gateway_icons( $icon, $id ) { 
  78.  
  79. if($id == $this->id) { 
  80. $icons_maxheight = $this->gateway_icon_size(); 
  81. $icon .= $this->gateway_icon_create(strtolower($this->id), $icons_maxheight); 
  82.  
  83. return $icon;