MS_Model_Communication_Invoice

Communication model - invoice.

Defined (1)

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

/app/model/communication/class-ms-model-communication-invoice.php  
  1. class MS_Model_Communication_Invoice extends MS_Model_Communication { 
  2.  
  3. /** 
  4. * Communication type. 
  5. * @since 1.0.0 
  6. * @var string The communication type. 
  7. */ 
  8. protected $type = self::COMM_TYPE_INVOICE; 
  9.  
  10. /** 
  11. * Get communication description. 
  12. * @since 1.0.0 
  13. * @return string The description. 
  14. */ 
  15. public function get_description() { 
  16. return __( 'Sent each time a payment has been made.', 'membership2' ); 
  17.  
  18. /** 
  19. * Communication default communication. 
  20. * @since 1.0.0 
  21. */ 
  22. public function reset_to_default() { 
  23. parent::reset_to_default(); 
  24.  
  25. $this->subject = sprintf( 
  26. __( 'Your %s membership receipt', 'membership2' ),  
  27. self::COMM_VAR_MS_NAME 
  28. ); 
  29. $this->message = self::get_default_message(); 
  30. $this->enabled = false; 
  31.  
  32. do_action( 
  33. 'ms_model_communication_reset_to_default_after',  
  34. $this->type,  
  35. $this 
  36. ); 
  37.  
  38. /** 
  39. * Get default email message. 
  40. * @since 1.0.0 
  41. * @return string The email message. 
  42. */ 
  43. public static function get_default_message() { 
  44. $subject = sprintf( 
  45. __( 'Hi %1$s, ', 'membership2' ),  
  46. self::COMM_VAR_USERNAME 
  47. ); 
  48. $body_notice = sprintf( 
  49. __( 'We\'ve received your payment for your %1$s membership at %2$s. Thanks!', 'membership2' ),  
  50. self::COMM_VAR_MS_NAME,  
  51. self::COMM_VAR_BLOG_NAME 
  52. ); 
  53. $body_invoice = __( 'Here are your latest payment details:', 'membership2' ); 
  54.  
  55. $html = sprintf( 
  56. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s<br /><br />%4$s',  
  57. $subject,  
  58. $body_notice,  
  59. $body_invoice,  
  60. self::COMM_VAR_MS_INVOICE 
  61. ); 
  62.  
  63. return apply_filters( 
  64. 'ms_model_communication_registration_get_default_message',  
  65. $html 
  66. );