MS_Model_Communication_Credit_Card_Expire

Communication model - credit card expire.

Defined (1)

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

/app/model/communication/class-ms-model-communication-credit-card-expire.php  
  1. class MS_Model_Communication_Credit_Card_Expire 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_CREDIT_CARD_EXPIRE; 
  9.  
  10. /** 
  11. * Populates the field title/description of the Period before/after field 
  12. * in the admin settings. 
  13. * @since 1.0.0 
  14. * @param array $field A HTML definition, passed to lib3()->html->element() 
  15. */ 
  16. public function set_period_name( $field ) { 
  17. $field['title'] = __( 'Notify Period', 'membership2' ); 
  18. $field['desc'] = __( 'We want to notify the user some days in advance, so there is time to react.<br>Enter here, how many days in advance this message should be sent.', 'membership2' ); 
  19.  
  20. return $field; 
  21.  
  22. /** 
  23. * Get communication description. 
  24. * @since 1.0.0 
  25. * @return string The description. 
  26. */ 
  27. public function get_description() { 
  28. return __( 'A notice to indicate that the member\'s credit card is about to expire.', 'membership2' ); 
  29.  
  30. /** 
  31. * Communication default communication. 
  32. * @since 1.0.0 
  33. */ 
  34. public function reset_to_default() { 
  35. parent::reset_to_default(); 
  36.  
  37. $this->subject = __( 'Your credit card is about to expire', 'membership2' ); 
  38. $this->message = self::get_default_message(); 
  39. $this->enabled = false; 
  40. $this->period_enabled = true; 
  41.  
  42. do_action( 'ms_model_communication_reset_to_default_after', $this->type, $this ); 
  43.  
  44. /** 
  45. * Get default email message. 
  46. * @since 1.0.0 
  47. * @return string The email message. 
  48. */ 
  49. public static function get_default_message() { 
  50. $subject = sprintf( 
  51. __( 'Hi %1$s, ', 'membership2' ),  
  52. self::COMM_VAR_USERNAME 
  53. ); 
  54. $body_notice = __( 'This is a reminder that your credit card is about to expire.', 'membership2' ); 
  55. $body_continue = sprintf( 
  56. __( 'To continue your %1$s membership at %2$s, please update your card details before your next payment is due here: %3$s', 'membership2' ),  
  57. self::COMM_VAR_MS_NAME,  
  58. self::COMM_VAR_BLOG_NAME,  
  59. self::COMM_VAR_MS_ACCOUNT_PAGE_URL 
  60. ); 
  61.  
  62. $html = sprintf( 
  63. '<h2>%1$s</h2><br /><br />%2$s<br /><br />%3$s',  
  64. $subject,  
  65. $body_notice,  
  66. $body_continue 
  67. ); 
  68.  
  69. return apply_filters( 
  70. 'ms_model_communication_credit_card_expire_get_default_message',  
  71. $html 
  72. );