Origin commit
This commit is contained in:
110
inc/email/class-opalesate-approve.php
Executable file
110
inc/email/class-opalesate-approve.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?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_Approve extends OpalEstate_Abstract_Email_Template {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function get_subject () {
|
||||
$propety_title = '' ;
|
||||
return sprintf( esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' ), $propety_title );
|
||||
}
|
||||
|
||||
/**
|
||||
* get collection of key and value base on tags which using to replace custom tags
|
||||
*/
|
||||
public function set_pros( $property_id ){
|
||||
|
||||
$property = get_post( $property_id );
|
||||
$user = get_userdata( $property->post_author );
|
||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||
$email = $email ? $email : $user->data->user_email;
|
||||
|
||||
$this->args = array(
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'current_time' => date("F j, Y, g:i a"),
|
||||
);
|
||||
|
||||
return $this->args ;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function get_content_template() {
|
||||
return opalestate_load_template_path( 'emails/request-reviewing' );
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function get_default_template() {
|
||||
|
||||
return trim(preg_replace('/\t+/', '', "Hi {user_name},<br>
|
||||
<br>
|
||||
Thank you so much for submitting to {site_name}.
|
||||
<br>
|
||||
We have completed the auditing process for your property '{property_name}' and are pleased to inform you that your submission has been accepted.
|
||||
<br>
|
||||
<br>
|
||||
Thanks again for your contribution
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<em>This message was sent by {site_link} on {current_time}.</em>"));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function to_email () {
|
||||
return $this->args ['receiver_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function cc_email () {
|
||||
return $this->args ['sender_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function get_body() {
|
||||
|
||||
$post = get_post( $this->args['post_id'] );
|
||||
|
||||
$this->args['email'] = $this->args['receiver_email'];
|
||||
$this->args['property_link'] = $post->post_title;
|
||||
|
||||
return parent::get_body();
|
||||
}
|
||||
}
|
||||
?>
|
||||
125
inc/email/class-opalestate-abs-email-template.php
Executable file
125
inc/email/class-opalestate-abs-email-template.php
Executable file
@@ -0,0 +1,125 @@
|
||||
<?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 {
|
||||
|
||||
public $args = array();
|
||||
|
||||
/**
|
||||
* Get the unique email notification key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_key() {
|
||||
return 'opalestate-notification';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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' );
|
||||
}
|
||||
|
||||
public function to_email () {
|
||||
|
||||
}
|
||||
|
||||
public function get_content_template() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
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 );
|
||||
|
||||
$tags = array();
|
||||
$values = array() ;
|
||||
|
||||
foreach ( $args as $key => $value ) {
|
||||
$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 () {
|
||||
|
||||
}
|
||||
}
|
||||
74
inc/email/class-opalestate-email-notifycation.php
Executable file
74
inc/email/class-opalestate-email-notifycation.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?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':
|
||||
$subject = html_entity_decode( esc_html__('You got a message enquiry', 'opalestate-pro') );
|
||||
break;
|
||||
|
||||
default:
|
||||
$subject = html_entity_decode( esc_html__('You got a message contact', 'opalestate-pro') );
|
||||
break;
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function get_content_template() {
|
||||
|
||||
switch ( $this->type ) {
|
||||
case 'enquiry':
|
||||
return opalestate_load_template_path( 'emails/enquiry' );
|
||||
break;
|
||||
|
||||
default:
|
||||
return opalestate_load_template_path( 'emails/contact' );
|
||||
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();
|
||||
}
|
||||
}
|
||||
?>
|
||||
110
inc/email/class-opalestate-new-submitted.php
Executable file
110
inc/email/class-opalestate-new-submitted.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?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_New_Submitted extends OpalEstate_Abstract_Email_Template {
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function get_subject () {
|
||||
$propety_title = '' ;
|
||||
$d = esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' );
|
||||
$s = opalestate_get_option( 'newproperty_email_subject' , $d );
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
* get collection of key and value base on tags which using to replace custom tags
|
||||
*/
|
||||
public function set_pros( $property_id, $user_id ){
|
||||
|
||||
$property = get_post( $property_id );
|
||||
$user = get_userdata( $property->post_author );
|
||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||
$email = $email ? $email : $user->data->user_email;
|
||||
|
||||
$this->args = array(
|
||||
'receiver_email' => $email,
|
||||
'user_mail' => $email,
|
||||
'user_name' => $user->display_name,
|
||||
'submitted_date' => $property->post_date,
|
||||
'property_name' => $property->post_title,
|
||||
'property_link' => get_permalink( $property_id ),
|
||||
'current_time' => date("F j, Y, g:i a"),
|
||||
);
|
||||
|
||||
return $this->args ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function get_content_template() {
|
||||
|
||||
$body = opalestate_get_option( 'newproperty_email_body', self::newproperty_email_body() );
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public static function get_default_template() {
|
||||
|
||||
return trim(preg_replace('/\t+/', '','
|
||||
Hi {user_name},
|
||||
<br>
|
||||
Thanks you so much for submitting {property_name} at {site_name}:<br>
|
||||
Give us a few moments to make sure that we are got space for you. You will receive another email from us soon.
|
||||
If this request was made outside of our normal working hours, we may not be able to confirm it until we are open again.
|
||||
<br>
|
||||
You may review your property at any time by logging in to your client area.
|
||||
<br>
|
||||
<em>This message was sent by {site_link} on {current_time}.</em>'
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function to_email () {
|
||||
return $this->args ['receiver_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function cc_email () {
|
||||
return $this->args ['sender_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function get_body() {
|
||||
|
||||
return parent::get_body();
|
||||
}
|
||||
}
|
||||
?>
|
||||
70
inc/email/class-opalestate-request-viewing.php
Executable file
70
inc/email/class-opalestate-request-viewing.php
Executable file
@@ -0,0 +1,70 @@
|
||||
<?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_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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function get_content_template() {
|
||||
return opalestate_load_template_path( 'emails/request-reviewing' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function to_email () {
|
||||
return $this->args ['receiver_email'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Email
|
||||
*/
|
||||
public function cc_email () {
|
||||
return $this->args ['sender_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;
|
||||
|
||||
|
||||
return parent::get_body();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user