MS_Addon_Taxamo_Model

Taxamo settings model.

Defined (1)

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

/app/addon/taxamo/class-ms-addon-taxamo-model.php  
  1. class MS_Addon_Taxamo_Model extends MS_Model_Option { 
  2.  
  3. /** 
  4. * Group name of the custom settings 
  5. * @since 1.0.0 
  6. * @type string 
  7. */ 
  8. const GROUP = 'taxamo'; 
  9.  
  10. /** 
  11. * Return current value of an addon setting 
  12. * @since 1.0.0 
  13. * @param string $key 
  14. * @return string 
  15. */ 
  16. public function get( $key ) { 
  17. switch ( $key ) { 
  18. case 'public_key': 
  19. if ( $this->get( 'is_live' ) ) { 
  20. $key = 'live_public_key'; 
  21. } else { 
  22. $key = 'test_public_key'; 
  23. break; 
  24.  
  25. case 'private_key': 
  26. if ( $this->get( 'is_live' ) ) { 
  27. $key = 'live_private_key'; 
  28. } else { 
  29. $key = 'test_private_key'; 
  30. break; 
  31.  
  32. return $this->get_custom_setting( self::GROUP, $key ); 
  33.  
  34. /** 
  35. * Change a setting of the addon 
  36. * @since 1.0.0 
  37. * @param string $key 
  38. * @param string $value 
  39. */ 
  40. public function set( $key, $value ) { 
  41. switch ( $key ) { 
  42. case 'is_live': 
  43. // This is a boolean value, not a string. 
  44. $value = lib3()->is_true( $value ); 
  45. break; 
  46.  
  47. return $this->set_custom_setting( self::GROUP, $key, $value ); 
  48.