← All changes
|
inc/emails/admin/class-lp-email-enrolled-course-admin.php
+58
-58
4.3.9.1
→
4.4.9
View file →
| @@ -1,58 +1,58 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * LP_Email_Enrolled_Course_Admin. | |
| 4 | - * | |
| 5 | - * @author ThimPress | |
| 6 | - * @package Learnpress/Classes | |
| 7 | - * @extends LP_Email | |
| 8 | - * @version 3.0.0 | |
| 9 | - */ | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * Prevent loading this file directly | |
| 13 | - */ | |
| 14 | -defined( 'ABSPATH' ) || exit(); | |
| 15 | - | |
| 16 | -if ( ! class_exists( 'LP_Email_Enrolled_Course_Admin' ) ) { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * Class LP_Email_Enrolled_Course_Admin | |
| 20 | - */ | |
| 21 | - class LP_Email_Enrolled_Course_Admin extends LP_Email_Type_Enrolled_Course { | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * LP_Email_Enrolled_Course_Admin constructor. | |
| 25 | - */ | |
| 26 | - public function __construct() { | |
| 27 | - $this->id = 'enrolled-course-admin'; | |
| 28 | - $this->title = __( 'Admin', 'learnpress' ); | |
| 29 | - $this->description = __( 'Send an email to admin when the user has enrolled in the course.', 'learnpress' ); | |
| 30 | - $this->default_subject = __( '{{user_display_name}} has enrolled in the course', 'learnpress' ); | |
| 31 | - $this->default_heading = __( 'The user has enrolled in the course', 'learnpress' ); | |
| 32 | - | |
| 33 | - $this->recipient = LP_Settings::instance()->get( 'emails_' . $this->id . '.recipients', $this->_get_admin_email() ); | |
| 34 | - | |
| 35 | - parent::__construct(); | |
| 36 | - } | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * Trigger email. | |
| 40 | - * Receive 2 params: order_id, old_status | |
| 41 | - * | |
| 42 | - * @param array $params | |
| 43 | - * | |
| 44 | - * @throws Exception | |
| 45 | - * @since 4.1.1 | |
| 46 | - * @author tungnx | |
| 47 | - */ | |
| 48 | - public function handle( array $params ) { | |
| 49 | - if ( ! $this->check_and_set( $params ) ) { | |
| 50 | - return; | |
| 51 | - } | |
| 52 | - | |
| 53 | - $this->set_data_content(); | |
| 54 | - $this->send_email(); | |
| 55 | - } | |
| 56 | - } | |
| 57 | -} | |
| 58 | -return new LP_Email_Enrolled_Course_Admin(); | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * LP_Email_Enrolled_Course_Admin. | |
| 4 | + * | |
| 5 | + * @author ThimPress | |
| 6 | + * @package Learnpress/Classes | |
| 7 | + * @extends LP_Email | |
| 8 | + * @version 3.0.0 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Prevent loading this file directly | |
| 13 | + */ | |
| 14 | +defined( 'ABSPATH' ) || exit(); | |
| 15 | + | |
| 16 | +if ( ! class_exists( 'LP_Email_Enrolled_Course_Admin' ) ) { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * Class LP_Email_Enrolled_Course_Admin | |
| 20 | + */ | |
| 21 | + class LP_Email_Enrolled_Course_Admin extends LP_Email_Type_Enrolled_Course { | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * LP_Email_Enrolled_Course_Admin constructor. | |
| 25 | + */ | |
| 26 | + public function __construct() { | |
| 27 | + $this->id = 'enrolled-course-admin'; | |
| 28 | + $this->title = __( 'Admin', 'learnpress' ); | |
| 29 | + $this->description = __( 'Send an email to admin when the user has enrolled in the course.', 'learnpress' ); | |
| 30 | + $this->default_subject = __( '{{user_display_name}} has enrolled in the course', 'learnpress' ); | |
| 31 | + $this->default_heading = __( 'The user has enrolled in the course', 'learnpress' ); | |
| 32 | + | |
| 33 | + $this->recipient = LP_Settings::instance()->get( 'emails_' . $this->id . '.recipients', $this->_get_admin_email() ); | |
| 34 | + | |
| 35 | + parent::__construct(); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * Trigger email. | |
| 40 | + * Receive 2 params: order_id, old_status | |
| 41 | + * | |
| 42 | + * @param array $params | |
| 43 | + * | |
| 44 | + * @throws Exception | |
| 45 | + * @since 4.1.1 | |
| 46 | + * @author tungnx | |
| 47 | + */ | |
| 48 | + public function handle( array $params ) { | |
| 49 | + if ( ! $this->check_and_set( $params ) ) { | |
| 50 | + return; | |
| 51 | + } | |
| 52 | + | |
| 53 | + $this->set_data_content(); | |
| 54 | + $this->send_email(); | |
| 55 | + } | |
| 56 | + } | |
| 57 | +} | |
| 58 | +return new LP_Email_Enrolled_Course_Admin(); | |