/app/model/communication/class-ms-model-communication-finished.php

  1. <?php 
  2. /** 
  3. * Communication model - membership finished. 
  4. * 
  5. * Persisted by parent class MS_Model_CustomPostType. 
  6. * 
  7. * @since 1.0.0 
  8. * @package Membership2 
  9. * @subpackage Model 
  10. */ 
  11. class MS_Model_Communication_Finished extends MS_Model_Communication { 
  12.  
  13. /** 
  14. * Communication type. 
  15. * 
  16. * @since 1.0.0 
  17. * @var string The communication type. 
  18. */ 
  19. protected $type = self::COMM_TYPE_FINISHED; 
  20.  
  21. /** 
  22. * Get communication description. 
  23. * 
  24. * @since 1.0.0 
  25. * @return string The description. 
  26. */ 
  27. public function get_description() { 
  28. return __( 
  29. 'Sent as soon as the membership is deactivated.', 'membership2' 
  30. ); 
  31.  
  32. /** 
  33. * Communication default communication. 
  34. * 
  35. * @since 1.0.0 
  36. */ 
  37. public function reset_to_default() { 
  38. parent::reset_to_default(); 
  39.  
  40. $this->subject = sprintf( 
  41. __( 'Your %s membership has ended', 'membership2' ),  
  42. self::COMM_VAR_MS_NAME 
  43. ); 
  44. $this->message = self::get_default_message(); 
  45. $this->enabled = false; 
  46.  
  47. do_action( 
  48. 'ms_model_communication_reset_to_default_after',  
  49. $this->type,  
  50. $this 
  51. ); 
  52.  
  53. /** 
  54. * Get default email message. 
  55. * 
  56. * @since 1.0.0 
  57. * @return string The email message. 
  58. */ 
  59. public static function get_default_message() { 
  60. $subject = sprintf( 
  61. __( 'Hi %1$s, ', 'membership2' ),  
  62. self::COMM_VAR_USERNAME 
  63. ); 
  64. $body_notice = sprintf( 
  65. __( 'Your %1$s membership at %2$s has ended on %3$s.', 'membership2' ),  
  66. self::COMM_VAR_MS_NAME,  
  67. self::COMM_VAR_BLOG_NAME,  
  68. self::COMM_VAR_MS_EXPIRY_DATE 
  69. ); 
  70. $body_renew = sprintf( 
  71. __( 'You can renew your membership here: %1$s', 'membership2' ),  
  72. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  73. ); 
  74.  
  75. $html = sprintf( 
  76. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s',  
  77. $subject,  
  78. $body_notice,  
  79. $body_renew 
  80. ); 
  81.  
  82. return apply_filters( 
  83. 'ms_model_communication_finished_get_default_message',  
  84. $html 
  85. ); 
.