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_Abstract_Email_Template {
|
2019-09-20 12:36:01 +02:00
|
|
|
|
|
|
|
public $args = [];
|
2019-09-10 06:27:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the unique email notification key.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_key() {
|
|
|
|
return 'opalestate-notification';
|
|
|
|
}
|
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
/**
|
2019-09-10 06:27:33 +02:00
|
|
|
* Get the friendly name for this email notification.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_title() {
|
|
|
|
return esc_html__( 'Admin Notice of Expiring Job Listings', 'opalestate-pro' );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the description for this email notification.
|
|
|
|
*
|
|
|
|
* @type abstract
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function get_description() {
|
|
|
|
return esc_html__( 'Send notices to the site administrator before a job listing expires.', 'opalestate-pro' );
|
|
|
|
}
|
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function to_email() {
|
|
|
|
|
2019-09-10 06:27:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function get_content_template() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function set_args( $args ) {
|
2019-09-10 06:27:33 +02:00
|
|
|
return $this->args = $args;
|
|
|
|
}
|
2019-09-20 12:36:01 +02:00
|
|
|
|
|
|
|
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' => '',
|
|
|
|
];
|
|
|
|
|
|
|
|
$args = array_merge( $default, $args );
|
|
|
|
|
|
|
|
$tags = [];
|
|
|
|
$values = [];
|
2019-09-10 06:27:33 +02:00
|
|
|
|
|
|
|
foreach ( $args as $key => $value ) {
|
2019-09-20 12:36:01 +02:00
|
|
|
$tags[] = "{" . $key . "}";
|
2019-09-10 06:27:33 +02:00
|
|
|
$values[] = $value;
|
2019-09-20 12:36:01 +02:00
|
|
|
}
|
|
|
|
|
2019-09-10 06:27:33 +02:00
|
|
|
$message = str_replace( $tags, $values, $template );
|
2019-09-20 12:36:01 +02:00
|
|
|
|
2019-09-10 06:27:33 +02:00
|
|
|
return $message;
|
2019-09-20 12:36:01 +02:00
|
|
|
}
|
2019-09-10 06:27:33 +02:00
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function get_subject() {
|
2019-09-10 06:27:33 +02:00
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
}
|
2019-09-10 06:27:33 +02:00
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function from_email() {
|
|
|
|
return opalestate_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
|
|
|
|
}
|
2019-09-10 06:27:33 +02:00
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function from_name() {
|
|
|
|
return opalestate_get_option( 'from_name', get_bloginfo( 'name' ) );
|
|
|
|
}
|
2019-09-10 06:27:33 +02:00
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function get_cc() {
|
2019-09-10 06:27:33 +02:00
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
}
|
2019-09-10 06:27:33 +02:00
|
|
|
|
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function get_body() {
|
|
|
|
$template = $this->get_content_template();
|
2019-09-10 06:27:33 +02:00
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
return $this->replace_tags( $template );
|
2019-09-10 06:27:33 +02:00
|
|
|
}
|
|
|
|
|
2019-09-20 12:36:01 +02:00
|
|
|
public function get_plain_text_body() {
|
2019-09-10 06:27:33 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|