PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 1.5.1
Subscriptions for WooCommerce with Stripe Recurring Payments v1.5.1
2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
subscription / includes / Illuminate / Emails / SubscriptionExpired.php

SubscriptionExpired.php in Subscriptions for WooCommerce with Stripe Recurring Payments 1.5.1, at includes/Illuminate/Emails/SubscriptionExpired.php

83 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SpringDevs\Subscription\Illuminate\Emails;
4
5 use SpringDevs\Subscription\Traits\Email;
6 use WC_Email;
7
8 /**
9 * Subscription Expired Mail to Customer.
10 */
11 class SubscriptionExpired extends WC_Email {
12
13 use Email;
14
15 /**
16 *
17 * Initialize the class.
18 */
19 public function __construct() {
20 $this->customer_email = true;
21
22 $this->id = 'subscrpt_subscription_expired_email';
23 $this->title = __( 'Subscription expired', 'wp_subscription' );
24 $this->description = __( 'This email is sent to customer when a subscription expired.', 'wp_subscription' );
25
26 // email template path.
27 $this->set_template( $this->id );
28
29 // Triggers for this email.
30 add_action( 'subscrpt_subscription_expired_email_notification', array( $this, 'trigger' ) );
31
32 // Call parent constructor.
33 parent::__construct();
34 }
35
36 /**
37 * Get default subject.
38 *
39 * @return string
40 */
41 public function get_default_subject(): string {
42 return __( '#{subscription_id} subscription expired!', 'wp_subscription' );
43 }
44
45 /**
46 * Get the customer email.
47 *
48 * @return string
49 */
50 public function get_recipient(): string {
51 return get_the_author_meta( 'email', get_post_field( 'post_author', $this->subscription_id ) );
52 }
53
54 /**
55 * Trigger the mail.
56 *
57 * @param int $subscription_id Subscription id.
58 *
59 * @return void
60 */
61 public function trigger( int $subscription_id ) {
62 if ( 'no' === $this->enabled ) {
63 return;
64 }
65 $this->placeholders['{subscription_id}'] = $subscription_id;
66 $this->subscription_id = $subscription_id;
67
68 $this->set_table_data();
69
70 $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
71 }
72
73 /**
74 * Initialize form fields for settings.
75 *
76 * @return void
77 */
78 public function init_form_fields() {
79 parent::init_form_fields();
80 unset( $this->form_fields['additional_content'] );
81 }
82 }
83