Update email.

This commit is contained in:
Hoang Huu
2019-09-20 17:36:01 +07:00
parent 7fe9e71ec0
commit 76dcd7ae25
6 changed files with 329 additions and 330 deletions

View File

@@ -22,8 +22,8 @@ if ( ! defined( 'ABSPATH' ) ) {
* @version 1.0
*/
class OpalEstate_Abstract_Email_Template {
public $args = array();
public $args = [];
/**
* Get the unique email notification key.
@@ -34,7 +34,7 @@ class OpalEstate_Abstract_Email_Template {
return 'opalestate-notification';
}
/**
/**
* Get the friendly name for this email notification.
*
* @return string
@@ -53,8 +53,8 @@ class OpalEstate_Abstract_Email_Template {
return esc_html__( 'Send notices to the site administrator before a job listing expires.', 'opalestate-pro' );
}
public function to_email () {
public function to_email() {
}
public function get_content_template() {
@@ -62,64 +62,63 @@ class OpalEstate_Abstract_Email_Template {
}
public function set_args ( $args ) {
public function set_args( $args ) {
return $this->args = $args;
}
public function replace_tags ( $template ) {
$args = $this->args;
$default = array(
'receiver_name' => '',
'name' => '',
'receiver_email' => '',
'property_link' => '',
'message' => '',
'site_name' => bloginfo(),
'site_link' => get_home_url(),
'current_time' => date("F j, Y, g:i a"),
'phone' => ''
);
$args = array_merge( $default, $args );
public function replace_tags( $template ) {
$args = $this->args;
$default = [
'receiver_name' => '',
'name' => '',
'receiver_email' => '',
'property_link' => '',
'message' => '',
'site_name' => get_bloginfo(),
'site_link' => get_home_url(),
'current_time' => date( "F j, Y, g:i a" ),
'phone' => '',
];
$tags = array();
$values = array() ;
$args = array_merge( $default, $args );
$tags = [];
$values = [];
foreach ( $args as $key => $value ) {
$tags[] = "{".$key."}";
$tags[] = "{" . $key . "}";
$values[] = $value;
}
}
$message = str_replace( $tags, $values, $template );
return $message;
}
public function get_subject () {
}
public function from_email() {
return opalestate_get_option( 'from_email' , get_bloginfo( 'admin_email' ) );
}
public function from_name() {
return opalestate_get_option('from_name', get_bloginfo( 'name' ) );
}
public function get_cc() {
}
public function get_body(){
$template = $this->get_content_template();
return $this->replace_tags( $template );
}
public function get_plain_text_body () {
public function get_subject() {
}
public function from_email() {
return opalestate_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
}
public function from_name() {
return opalestate_get_option( 'from_name', get_bloginfo( 'name' ) );
}
public function get_cc() {
}
public function get_body() {
$template = $this->get_content_template();
return $this->replace_tags( $template );
}
public function get_plain_text_body() {
}
}

View File

@@ -11,7 +11,7 @@
* @website http://www.wpopal.com
* @support http://www.wpopal.com/support/forum.html
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
@@ -22,33 +22,34 @@ if ( ! defined( 'ABSPATH' ) ) {
* @version 1.0
*/
class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_Template {
/**
* Send Email
*/
public function get_subject () {
$propety_title = '' ;
return sprintf( esc_html__( 'You have a message request reviewing: %s at', 'opalestate-pro' ), $propety_title );
public function get_subject() {
$propety_title = '';
return sprintf( esc_html__( 'You have a message request reviewing: %s at', 'opalestate-pro' ), $propety_title );
}
/**
* Send Email
*/
public function get_content_template() {
return opalestate_load_template_path( 'emails/request-reviewing' );
}
return opalestate_load_template_path( 'emails/request-reviewing' );
}
/**
* Send Email
*/
public function to_email () {
public function to_email() {
return $this->args ['receiver_email'];
}
/**
* Send Email
*/
public function cc_email () {
public function cc_email() {
return $this->args ['sender_email'];
}
@@ -56,15 +57,12 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
* Send Email
*/
public function get_body() {
$post = get_post( $this->args['post_id'] );
$this->args['email'] = $this->args['receiver_email'];
$this->args['property_link'] = get_permalink( $post->ID );
$this->args['property_name'] = $post->post_title;
$post = get_post( $this->args['post_id'] );
$this->args['email'] = $this->args['receiver_email'];
$this->args['property_link'] = get_permalink( $post->ID );
$this->args['property_name'] = $post->post_title;
return parent::get_body();
}
}
?>