Fix email templates.

This commit is contained in:
Hoang Huu
2019-10-21 13:24:14 +07:00
parent 18c41ca780
commit b724789907
16 changed files with 374 additions and 240 deletions

View File

@@ -18,38 +18,36 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* @class OpalEstate_Send_Email_Notification
*
* @version 1.0
*/
class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Template {
public $type = '';
/**
* Send Email
*/
public function get_subject () {
public function get_subject() {
switch ( $this->type ) {
case 'enquiry':
$subject = html_entity_decode( esc_html__('You got a message enquiry', 'opalestate-pro') );
$subject = html_entity_decode( esc_html__( 'You got a message enquiry', 'opalestate-pro' ) );
$subject = opalestate_options( 'enquiry_email_subject', $subject );
break;
default:
$subject = html_entity_decode( esc_html__('You got a message contact', 'opalestate-pro') );
$subject = html_entity_decode( esc_html__( 'You got a message contact', 'opalestate-pro' ) );
$subject = opalestate_options( 'contact_email_subject', $subject );
break;
}
return $subject;
return $subject;
}
/**
* Send Email
* Send Email.
*/
public function get_content_template() {
switch ( $this->type ) {
@@ -57,32 +55,36 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
return opalestate_options( 'enquiry_email_body', self::get_default_template( 'enquiry' ) );
break;
default:
return opalestate_options( 'contact_email_body', self::get_default_template( ) );
return opalestate_options( 'contact_email_body', self::get_default_template() );
break;
}
}
}
public function to_email () {
public function to_email() {
return $this->args ['receiver_email'];
}
public function cc_email () {
public function cc_email() {
return $this->args ['sender_email'];
}
public function get_body() {
$this->args['email'] = $this->args['receiver_email'];
$this->args['email'] = $this->args['sender_email'];
return parent::get_body();
}
/***/
public static function get_default_template ( $type='contact' ) {
if( $type == 'enquiry' ) {
/**
* Get default template.
*
* @param string $type
* @return string
*/
public static function get_default_template( $type = 'contact' ) {
if ( $type == 'enquiry' ) {
return opalestate_load_template_path( 'emails/enquiry' );
}
return opalestate_load_template_path( 'emails/contact' );
return opalestate_load_template_path( 'emails/contact' );
}
}
?>