Opal-Estate-Pro/inc/email/class-opalestate-email-notifycation.php

88 lines
1.9 KiB
PHP
Raw Normal View History

2019-09-10 06:27:33 +02:00
<?php
/**
* $Desc$
*
* @version $Id$
* @package opalestate
* @author Opal Team <info@wpopal.com >
* @copyright Copyright (C) 2019 wpopal.com. All Rights Reserved.
* @license GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
*
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* @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 () {
switch ( $this->type ) {
case 'enquiry':
2019-09-30 11:28:04 +02:00
2019-09-10 06:27:33 +02:00
$subject = html_entity_decode( esc_html__('You got a message enquiry', 'opalestate-pro') );
2019-09-30 11:28:04 +02:00
$subject = opalestate_options( 'enquiry_email_subject', $subject );
2019-09-10 06:27:33 +02:00
break;
default:
2019-09-30 11:28:04 +02:00
2019-09-10 06:27:33 +02:00
$subject = html_entity_decode( esc_html__('You got a message contact', 'opalestate-pro') );
2019-09-30 11:28:04 +02:00
$subject = opalestate_options( 'contact_email_subject', $subject );
2019-09-10 06:27:33 +02:00
break;
}
return $subject;
}
/**
* Send Email
*/
public function get_content_template() {
switch ( $this->type ) {
case 'enquiry':
2019-09-30 11:28:04 +02:00
return opalestate_options( 'enquiry_email_body', self::get_default_template( 'enquiry' ) );
2019-09-10 06:27:33 +02:00
break;
default:
2019-09-30 11:28:04 +02:00
return opalestate_options( 'contact_email_body', self::get_default_template( ) );
2019-09-10 06:27:33 +02:00
break;
}
}
public function to_email () {
return $this->args ['receiver_email'];
}
public function cc_email () {
return $this->args ['sender_email'];
}
public function get_body() {
$this->args['email'] = $this->args['receiver_email'];
return parent::get_body();
}
2019-09-30 11:28:04 +02:00
/***/
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' );
}
2019-09-10 06:27:33 +02:00
}
?>