Fix email templates.
This commit is contained in:
parent
18c41ca780
commit
b724789907
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class to define/implement base methods for all controller classes
|
* Abstract class to define/implement base methods for all controller classes
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
|
||||||
* @package Opal_Job
|
* @package Opal_Job
|
||||||
* @subpackage Opal_Job/controllers
|
* @subpackage Opal_Job/controllers
|
||||||
*/
|
*/
|
||||||
@ -11,11 +11,10 @@ abstract class Opalestate_Base_API {
|
|||||||
/**
|
/**
|
||||||
* The unique identifier of this plugin.
|
* The unique identifier of this plugin.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
|
||||||
* @access protected
|
* @access protected
|
||||||
* @var string $plugin_base_name The string used to uniquely identify this plugin.
|
* @var string $plugin_base_name The string used to uniquely identify this plugin.
|
||||||
*/
|
*/
|
||||||
public $base ;
|
public $base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post type.
|
* Post type.
|
||||||
@ -27,7 +26,6 @@ abstract class Opalestate_Base_API {
|
|||||||
/**
|
/**
|
||||||
* The unique identifier of this plugin.
|
* The unique identifier of this plugin.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
|
||||||
* @access protected
|
* @access protected
|
||||||
* @var string $plugin_base_name The string used to uniquely identify this plugin.
|
* @var string $plugin_base_name The string used to uniquely identify this plugin.
|
||||||
*/
|
*/
|
||||||
@ -37,30 +35,24 @@ abstract class Opalestate_Base_API {
|
|||||||
* Definition
|
* Definition
|
||||||
*
|
*
|
||||||
* Register all Taxonomy related to Job post type as location, category, Specialism, Types
|
* Register all Taxonomy related to Job post type as location, category, Specialism, Types
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function __construct () {
|
public function __construct() {
|
||||||
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
|
add_action( 'rest_api_init', [ $this, 'register_routes' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Definition
|
* Definition
|
||||||
*
|
*
|
||||||
* Register all Taxonomy related to Job post type as location, category, Specialism, Types
|
* Register all Taxonomy related to Job post type as location, category, Specialism, Types
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public function register_routes() {
|
public function register_routes() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_response ( $code, $output ) {
|
public function get_response( $code, $output ) {
|
||||||
|
|
||||||
$response = array();
|
$response = [];
|
||||||
|
|
||||||
$response['status'] = $code;
|
$response['status'] = $code;
|
||||||
$response = array_merge( $response, $output );
|
$response = array_merge( $response, $output );
|
||||||
@ -68,9 +60,10 @@ abstract class Opalestate_Base_API {
|
|||||||
return new WP_REST_Response( $response );
|
return new WP_REST_Response( $response );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function output ( $code ) {
|
public function output( $code ) {
|
||||||
|
|
||||||
$this->data['status'] = $code;
|
$this->data['status'] = $code;
|
||||||
|
|
||||||
return new WP_REST_Response( $this->data );
|
return new WP_REST_Response( $this->data );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +76,7 @@ abstract class Opalestate_Base_API {
|
|||||||
public function validate_request( WP_REST_Request $request ) {
|
public function validate_request( WP_REST_Request $request ) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
$response = array();
|
$response = [];
|
||||||
|
|
||||||
// Make sure we have both user and api key
|
// Make sure we have both user and api key
|
||||||
$api_admin = Opalestate_API_Admin::get_instance();
|
$api_admin = Opalestate_API_Admin::get_instance();
|
||||||
@ -117,9 +110,8 @@ abstract class Opalestate_Base_API {
|
|||||||
* Get page number
|
* Get page number
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @since 1.1
|
|
||||||
* @global $wp_query
|
|
||||||
* @return int $wp_query->query_vars['page'] if page number returned (default: 1)
|
* @return int $wp_query->query_vars['page'] if page number returned (default: 1)
|
||||||
|
* @global $wp_query
|
||||||
*/
|
*/
|
||||||
public function get_paged() {
|
public function get_paged() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
@ -132,9 +124,8 @@ abstract class Opalestate_Base_API {
|
|||||||
* Number of results to display per page
|
* Number of results to display per page
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @since 1.1
|
|
||||||
* @global $wp_query
|
|
||||||
* @return int $per_page Results to display per page (default: 10)
|
* @return int $per_page Results to display per page (default: 10)
|
||||||
|
* @global $wp_query
|
||||||
*/
|
*/
|
||||||
public function per_page() {
|
public function per_page() {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
@ -152,7 +143,7 @@ abstract class Opalestate_Base_API {
|
|||||||
*/
|
*/
|
||||||
protected function get_object( $id ) {
|
protected function get_object( $id ) {
|
||||||
// translators: %s: Class method name.
|
// translators: %s: Class method name.
|
||||||
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'opalestate-pro' ), __METHOD__ ), array( 'status' => 405 ) );
|
return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'opalestate-pro' ), __METHOD__ ), [ 'status' => 405 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,10 +152,9 @@ abstract class Opalestate_Base_API {
|
|||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @return WP_Error with message key rest_forbidden
|
* @return WP_Error with message key rest_forbidden
|
||||||
* @since 1.1
|
|
||||||
*/
|
*/
|
||||||
private function missing_auth() {
|
private function missing_auth() {
|
||||||
return new WP_Error( 'rest_forbidden', esc_html__( 'You must specify both a token and API key!' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'rest_forbidden', esc_html__( 'You must specify both a token and API key!' ), [ 'status' => rest_authorization_required_code() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,7 +165,7 @@ abstract class Opalestate_Base_API {
|
|||||||
* @return WP_Error with message key rest_forbidden
|
* @return WP_Error with message key rest_forbidden
|
||||||
*/
|
*/
|
||||||
private function invalid_auth() {
|
private function invalid_auth() {
|
||||||
return new WP_Error( 'rest_forbidden', esc_html__( 'Your request could not be authenticated!', 'opaljob' ), array( 'status' => 403 ) );
|
return new WP_Error( 'rest_forbidden', esc_html__( 'Your request could not be authenticated!', 'opaljob' ), [ 'status' => 403 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,11 +173,10 @@ abstract class Opalestate_Base_API {
|
|||||||
* validated
|
* validated
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @since 1.1
|
|
||||||
* @return WP_Error with message key rest_forbidden
|
* @return WP_Error with message key rest_forbidden
|
||||||
*/
|
*/
|
||||||
private function invalid_key() {
|
private function invalid_key() {
|
||||||
return new WP_Error( 'rest_forbidden', esc_html__( 'Invalid API key!' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'rest_forbidden', esc_html__( 'Invalid API key!' ), [ 'status' => rest_authorization_required_code() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -197,13 +186,69 @@ abstract class Opalestate_Base_API {
|
|||||||
* @return WP_Error|boolean
|
* @return WP_Error|boolean
|
||||||
*/
|
*/
|
||||||
public function get_items_permissions_check( $request ) {
|
public function get_items_permissions_check( $request ) {
|
||||||
|
$is_valid = $this->is_valid_api_key( $request );
|
||||||
|
if ( is_wp_error( $is_valid ) ) {
|
||||||
|
return $is_valid;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! opalestate_rest_check_post_permissions( $this->post_type, 'read' ) ) {
|
if ( ! opalestate_rest_check_post_permissions( $this->post_type, 'read' ) ) {
|
||||||
return new WP_Error( 'opalestate_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'opalestate-pro' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'opalestate_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'opalestate-pro' ), [ 'status' => rest_authorization_required_code() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a given request has access.
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request Full details about the request.
|
||||||
|
* @return WP_Error|boolean
|
||||||
|
*/
|
||||||
|
public function is_valid_api_key( $request ) {
|
||||||
|
// if ( ! $this->is_request_to_rest_api() ) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ( isset( $request['consumer_key'] ) && $request['consumer_secret'] ) {
|
||||||
|
$user = opalestate_get_user_data_by_consumer_key( $request['consumer_key'] );
|
||||||
|
|
||||||
|
if ( $user ) {
|
||||||
|
if ( $request['consumer_secret'] === $user->consumer_secret ) {
|
||||||
|
$route = $request->get_route();
|
||||||
|
$endpoint = explode( '/', $route );
|
||||||
|
$endpoint = end( $endpoint );
|
||||||
|
if ( in_array( $endpoint, [ 'properties' ] ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WP_Error( 'opalestate_rest_cannot_access', __( 'Sorry, you cannot list resources.', 'opalestate-pro' ), [ 'status' => rest_authorization_required_code() ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if is request to our REST API.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function is_request_to_rest_api() {
|
||||||
|
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rest_prefix = trailingslashit( rest_get_url_prefix() );
|
||||||
|
$request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
|
||||||
|
|
||||||
|
// Check if the request is to the Opalestate API endpoints.
|
||||||
|
$opalestate = ( false !== strpos( $request_uri, $rest_prefix . 'estate-api/' ) );
|
||||||
|
|
||||||
|
// Allow third party plugins use our authentication methods.
|
||||||
|
$third_party = ( false !== strpos( $request_uri, $rest_prefix . 'estate-api-' ) );
|
||||||
|
|
||||||
|
return apply_filters( 'opalestate_rest_is_request_to_rest_api', $opalestate || $third_party );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a given request has access to read an item.
|
* Check if a given request has access to read an item.
|
||||||
*
|
*
|
||||||
@ -214,7 +259,7 @@ abstract class Opalestate_Base_API {
|
|||||||
$object = $this->get_object( (int) $request['id'] );
|
$object = $this->get_object( (int) $request['id'] );
|
||||||
|
|
||||||
if ( $object && 0 !== $object->get_id() && ! opalestate_rest_check_post_permissions( $this->post_type, 'read', $object->get_id() ) ) {
|
if ( $object && 0 !== $object->get_id() && ! opalestate_rest_check_post_permissions( $this->post_type, 'read', $object->get_id() ) ) {
|
||||||
return new WP_Error( 'opalestate_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'opalestate-pro' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'opalestate_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'opalestate-pro' ), [ 'status' => rest_authorization_required_code() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -228,7 +273,7 @@ abstract class Opalestate_Base_API {
|
|||||||
*/
|
*/
|
||||||
public function create_item_permissions_check( $request ) {
|
public function create_item_permissions_check( $request ) {
|
||||||
if ( ! opalestate_rest_check_post_permissions( $this->post_type, 'create' ) ) {
|
if ( ! opalestate_rest_check_post_permissions( $this->post_type, 'create' ) ) {
|
||||||
return new WP_Error( 'opalestate_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'opalestate-pro' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'opalestate_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'opalestate-pro' ), [ 'status' => rest_authorization_required_code() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -244,7 +289,7 @@ abstract class Opalestate_Base_API {
|
|||||||
$object = $this->get_object( (int) $request['id'] );
|
$object = $this->get_object( (int) $request['id'] );
|
||||||
|
|
||||||
if ( $object && 0 !== $object->get_id() && ! opalestate_rest_check_post_permissions( $this->post_type, 'edit', $object->get_id() ) ) {
|
if ( $object && 0 !== $object->get_id() && ! opalestate_rest_check_post_permissions( $this->post_type, 'edit', $object->get_id() ) ) {
|
||||||
return new WP_Error( 'opalestate_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'opalestate-pro' ), array( 'status' => rest_authorization_required_code() ) );
|
return new WP_Error( 'opalestate_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'opalestate-pro' ), [ 'status' => rest_authorization_required_code() ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -37,10 +37,10 @@ class Opalestate_REST_Authentication {
|
|||||||
* Initialize authentication actions.
|
* Initialize authentication actions.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
add_filter( 'determine_current_user', [ $this, 'authenticate' ], 15 );
|
// add_filter( 'determine_current_user', [ $this, 'authenticate' ], 15 );
|
||||||
add_filter( 'rest_authentication_errors', [ $this, 'check_authentication_error' ], 15 );
|
// add_filter( 'rest_authentication_errors', [ $this, 'check_authentication_error' ], 15 );
|
||||||
add_filter( 'rest_post_dispatch', [ $this, 'send_unauthorized_headers' ], 50 );
|
// add_filter( 'rest_post_dispatch', [ $this, 'send_unauthorized_headers' ], 50 );
|
||||||
add_filter( 'rest_pre_dispatch', [ $this, 'check_user_permissions' ], 10, 3 );
|
// add_filter( 'rest_pre_dispatch', [ $this, 'check_user_permissions' ], 10, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,6 +27,30 @@ function opalestate_rest_check_post_permissions( $post_type, $context = 'read',
|
|||||||
return apply_filters( 'opalestate_rest_check_permissions', $permission, $context, $object_id, $post_type );
|
return apply_filters( 'opalestate_rest_check_permissions', $permission, $context, $object_id, $post_type );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the user data for the given consumer_key.
|
||||||
|
*
|
||||||
|
* @param string $consumer_key Consumer key.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function opalestate_get_user_data_by_consumer_key( $consumer_key ) {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$consumer_key = opalestate_api_hash( sanitize_text_field( $consumer_key ) );
|
||||||
|
$user = $wpdb->get_row(
|
||||||
|
$wpdb->prepare(
|
||||||
|
"
|
||||||
|
SELECT key_id, user_id, permissions, consumer_key, consumer_secret, nonces
|
||||||
|
FROM {$wpdb->prefix}opalestate_api_keys
|
||||||
|
WHERE consumer_key = %s
|
||||||
|
",
|
||||||
|
$consumer_key
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The opalestate_property post object, generate the data for the API output
|
* The opalestate_property post object, generate the data for the API output
|
||||||
*
|
*
|
||||||
|
@ -23,16 +23,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
class Opalestate_Emails {
|
class Opalestate_Emails {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init action to automatic send email when user edit or submit a new submission and init setting form in plugin setting of admin
|
* init action to automatic send email when user edit or submit a new submission and init setting form in plugin setting of admin
|
||||||
*/
|
*/
|
||||||
public static function init() {
|
public static function init() {
|
||||||
|
|
||||||
self::load();
|
self::load();
|
||||||
|
|
||||||
add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'new_submission_email' ], 10, 2 );
|
add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'new_submission_email' ], 10, 2 );
|
||||||
|
add_action( 'opalestate_processed_new_submission', [ __CLASS__, 'admin_new_submission_email' ], 15, 2 );
|
||||||
//add_action( 'opalestate_processed_edit_submission' , array( __CLASS__ , 'new_submission_email'), 10, 2 );
|
//add_action( 'opalestate_processed_edit_submission' , array( __CLASS__ , 'new_submission_email'), 10, 2 );
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
add_filter( 'opalestate_settings_tabs', [ __CLASS__, 'setting_email_tab' ], 1 );
|
add_filter( 'opalestate_settings_tabs', [ __CLASS__, 'setting_email_tab' ], 1 );
|
||||||
@ -51,18 +49,19 @@ class Opalestate_Emails {
|
|||||||
*/
|
*/
|
||||||
add_action( 'opalestate_send_email_notifycation', [ __CLASS__, 'send_notifycation' ] );
|
add_action( 'opalestate_send_email_notifycation', [ __CLASS__, 'send_notifycation' ] );
|
||||||
add_action( 'opalestate_send_email_submitted', [ __CLASS__, 'new_submission_email' ] );
|
add_action( 'opalestate_send_email_submitted', [ __CLASS__, 'new_submission_email' ] );
|
||||||
|
add_action( 'opalestate_send_email_submitted', [ __CLASS__, 'admin_new_submission_email' ] );
|
||||||
add_action( 'opalestate_send_email_request_reviewing', [ __CLASS__, 'send_email_request_reviewing' ] );
|
add_action( 'opalestate_send_email_request_reviewing', [ __CLASS__, 'send_email_request_reviewing' ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Load.
|
||||||
*/
|
*/
|
||||||
public static function load() {
|
public static function load() {
|
||||||
|
|
||||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-abs-email-template.php';
|
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-abs-email-template.php';
|
||||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-email-notifycation.php';
|
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-email-notifycation.php';
|
||||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-request-viewing.php';
|
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-request-viewing.php';
|
||||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-new-submitted.php';
|
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-new-submitted.php';
|
||||||
|
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-admin-new-submitted.php';
|
||||||
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-approve.php';
|
require_once OPALESTATE_PLUGIN_DIR . 'inc/email/class-opalestate-approve.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,9 +90,15 @@ class Opalestate_Emails {
|
|||||||
$mail = new OpalEstate_Send_Email_New_Submitted();
|
$mail = new OpalEstate_Send_Email_New_Submitted();
|
||||||
$mail->set_pros( $post_id, $user_id );
|
$mail->set_pros( $post_id, $user_id );
|
||||||
$return = self::send_mail_now( $mail );
|
$return = self::send_mail_now( $mail );
|
||||||
|
}
|
||||||
|
|
||||||
// echo json_encode( $return );
|
/**
|
||||||
// die();
|
* send email if agent submit a new property
|
||||||
|
*/
|
||||||
|
public static function admin_new_submission_email( $user_id, $post_id ) {
|
||||||
|
$mail = new OpalEstate_Send_Email_Admin_New_Submitted();
|
||||||
|
$mail->set_pros( $post_id, $user_id );
|
||||||
|
$return = self::send_mail_now( $mail );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +195,7 @@ class Opalestate_Emails {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="opalestate-template-tags-box">
|
<div class="opalestate-template-tags-box">
|
||||||
<strong>{property_link}</strong> Property of the user who made the property
|
<strong>{property_link}</strong> Link of the property
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="opalestate-template-tags-box">
|
<div class="opalestate-template-tags-box">
|
||||||
@ -202,13 +207,58 @@ class Opalestate_Emails {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="opalestate-template-tags-box">
|
<div class="opalestate-template-tags-box">
|
||||||
<strong>{property_link}</strong> * Link of the property
|
<strong>{message}</strong> * Message content of who sent via form
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{site_link}</strong> A link to this website
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{current_time}</strong> Current date and time
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> ';
|
||||||
|
|
||||||
|
$review_list_tags = '<div>
|
||||||
|
<p class="tags-description">Use the following tags to automatically add property information to the emails. Tags labeled with an asterisk (*) can be used in the email subject as well.</p>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{receive_name}</strong> Name of the agent who made the property
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{property_link}</strong> Link of the property
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{name}</strong> Name of the user who contact via email form
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{email}</strong> Email of the user who contact via email form
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{schedule_time}</strong> Schedule time
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{schedule_date}</strong> Schedule date
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="opalestate-template-tags-box">
|
<div class="opalestate-template-tags-box">
|
||||||
<strong>{message}</strong> * Message content of who sent via form
|
<strong>{message}</strong> * Message content of who sent via form
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{site_link}</strong> A link to this website
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{current_time}</strong> Current date and time
|
||||||
|
</div>
|
||||||
|
|
||||||
</div> ';
|
</div> ';
|
||||||
|
|
||||||
$list_tags = '<div>
|
$list_tags = '<div>
|
||||||
@ -219,7 +269,11 @@ class Opalestate_Emails {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="opalestate-template-tags-box">
|
<div class="opalestate-template-tags-box">
|
||||||
<strong>{property_link}</strong> Email of the user who made the property
|
<strong>{property_link}</strong> Link of the property
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="opalestate-template-tags-box">
|
||||||
|
<strong>{property_edit_link}</strong> Link for editing of the property (admin)
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="opalestate-template-tags-box">
|
<div class="opalestate-template-tags-box">
|
||||||
@ -287,23 +341,18 @@ class Opalestate_Emails {
|
|||||||
|
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Notification For New Property Submission', 'opalestate-pro' ),
|
'name' => esc_html__( 'Notification For New Property Submission (Customer)', 'opalestate-pro' ),
|
||||||
'desc' => '<hr>',
|
'desc' => '<hr>',
|
||||||
'id' => 'opalestate_title_email_settings_3',
|
'id' => 'opalestate_title_email_settings_3',
|
||||||
'type' => 'title',
|
'type' => 'title',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
[
|
[
|
||||||
'id' => 'newproperty_email_subject',
|
'id' => 'newproperty_email_subject',
|
||||||
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'desc' => esc_html__( 'The email subject for admin notifications.', 'opalestate-pro' ),
|
'desc' => esc_html__( 'The email subject for admin notifications.', 'opalestate-pro' ),
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'placeholder' => 'Your package is expired',
|
|
||||||
'rows' => 3,
|
'rows' => 3,
|
||||||
],
|
],
|
||||||
'default' => esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' ),
|
'default' => esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' ),
|
||||||
@ -317,6 +366,33 @@ class Opalestate_Emails {
|
|||||||
'default' => OpalEstate_Send_Email_New_Submitted::get_default_template(),
|
'default' => OpalEstate_Send_Email_New_Submitted::get_default_template(),
|
||||||
],
|
],
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
|
[
|
||||||
|
'name' => esc_html__( 'Notification For New Property Submission (Admin)', 'opalestate-pro' ),
|
||||||
|
'desc' => '<hr>',
|
||||||
|
'id' => 'opalestate_title_email_settings_admin',
|
||||||
|
'type' => 'title',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'admin_newproperty_email_subject',
|
||||||
|
'name' => esc_html__( 'Email Subject', 'opalestate-pro' ),
|
||||||
|
'type' => 'text',
|
||||||
|
'desc' => esc_html__( 'The email subject for admin notifications.', 'opalestate-pro' ),
|
||||||
|
'attributes' => [
|
||||||
|
'rows' => 3,
|
||||||
|
],
|
||||||
|
'default' => esc_html__( 'You received a new submission: {property_name} from {user_mail}', 'opalestate-pro' ),
|
||||||
|
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 'admin_newproperty_email_body',
|
||||||
|
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
||||||
|
'type' => 'wysiwyg',
|
||||||
|
'desc' => esc_html__( 'Enter the email an admin should receive when an initial payment request is made.', 'opalestate-pro' ),
|
||||||
|
'default' => OpalEstate_Send_Email_Admin_New_Submitted::get_default_template(),
|
||||||
|
],
|
||||||
|
//------------------------------------------
|
||||||
|
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Approve property for publish', 'opalestate-pro' ),
|
'name' => esc_html__( 'Approve property for publish', 'opalestate-pro' ),
|
||||||
'desc' => '<hr>',
|
'desc' => '<hr>',
|
||||||
@ -380,7 +456,7 @@ class Opalestate_Emails {
|
|||||||
'id' => 'enquiry_email_body',
|
'id' => 'enquiry_email_body',
|
||||||
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
||||||
'type' => 'wysiwyg',
|
'type' => 'wysiwyg',
|
||||||
'default' => OpalEstate_Send_Email_Notification::get_default_template( 'enquiry' )
|
'default' => OpalEstate_Send_Email_Notification::get_default_template( 'enquiry' ),
|
||||||
],
|
],
|
||||||
/// email contact template ////
|
/// email contact template ////
|
||||||
[
|
[
|
||||||
@ -406,12 +482,12 @@ class Opalestate_Emails {
|
|||||||
'id' => 'contact_email_body',
|
'id' => 'contact_email_body',
|
||||||
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
||||||
'type' => 'wysiwyg',
|
'type' => 'wysiwyg',
|
||||||
'default' => OpalEstate_Send_Email_Notification::get_default_template()
|
'default' => OpalEstate_Send_Email_Notification::get_default_template(),
|
||||||
],
|
],
|
||||||
/// Email Request Review ///
|
/// Email Request Review ///
|
||||||
[
|
[
|
||||||
'name' => esc_html__( 'Email Request Review Templates (Template Tags)', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Request Review Templates (Template Tags)', 'opalestate-pro' ),
|
||||||
'desc' => $contact_list_tags . '<br><hr>',
|
'desc' => $review_list_tags . '<br><hr>',
|
||||||
'id' => 'opalestate_title_email_settings_7',
|
'id' => 'opalestate_title_email_settings_7',
|
||||||
'type' => 'title',
|
'type' => 'title',
|
||||||
],
|
],
|
||||||
@ -425,14 +501,14 @@ class Opalestate_Emails {
|
|||||||
get_bloginfo( 'name' ),
|
get_bloginfo( 'name' ),
|
||||||
'rows' => 3,
|
'rows' => 3,
|
||||||
],
|
],
|
||||||
'default' =>esc_html__( 'You have a message request reviewing at: %s', 'opalestate-pro' ),
|
'default' => esc_html__( 'You have a message request reviewing', 'opalestate-pro' ),
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'id' => 'request_review_email_body',
|
'id' => 'request_review_email_body',
|
||||||
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
'name' => esc_html__( 'Email Body', 'opalestate-pro' ),
|
||||||
'type' => 'wysiwyg',
|
'type' => 'wysiwyg',
|
||||||
'default' => OpalEstate_Send_Email_Request_Reviewing::get_default_template()
|
'default' => OpalEstate_Send_Email_Request_Reviewing::get_default_template(),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
@ -73,6 +73,7 @@ class OpalEstate_Abstract_Email_Template {
|
|||||||
'name' => '',
|
'name' => '',
|
||||||
'receiver_email' => '',
|
'receiver_email' => '',
|
||||||
'property_link' => '',
|
'property_link' => '',
|
||||||
|
'property_edit_link' => '',
|
||||||
'message' => '',
|
'message' => '',
|
||||||
'site_name' => get_bloginfo(),
|
'site_name' => get_bloginfo(),
|
||||||
'site_link' => get_home_url(),
|
'site_link' => get_home_url(),
|
||||||
|
@ -21,11 +21,10 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
|||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function get_subject() {
|
public function get_subject() {
|
||||||
$propety_title = '';
|
$d = esc_html__( 'You received a new submission: {property_name} from {user_mail}', 'opalestate-pro' );
|
||||||
$d = esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' );
|
|
||||||
$s = opalestate_get_option( 'admin_newproperty_email_subject', $d );
|
$s = opalestate_get_option( 'admin_newproperty_email_subject', $d );
|
||||||
|
|
||||||
return $s;
|
return $this->replace_tags( $s );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,13 +43,13 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
|||||||
'submitted_date' => $property->post_date,
|
'submitted_date' => $property->post_date,
|
||||||
'property_name' => $property->post_title,
|
'property_name' => $property->post_title,
|
||||||
'property_link' => get_permalink( $property_id ),
|
'property_link' => get_permalink( $property_id ),
|
||||||
|
'property_edit_link' => get_edit_post_link( $property_id ),
|
||||||
'current_time' => date( "F j, Y, g:i a" ),
|
'current_time' => date( "F j, Y, g:i a" ),
|
||||||
];
|
];
|
||||||
|
|
||||||
return $this->args;
|
return $this->args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
@ -65,7 +64,7 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
|||||||
*/
|
*/
|
||||||
public static function get_default_template() {
|
public static function get_default_template() {
|
||||||
return trim( preg_replace( '/\t+/', '', '
|
return trim( preg_replace( '/\t+/', '', '
|
||||||
You’ve received a submission from %s: {user_name},
|
You’ve received a submission from: {user_name},
|
||||||
<br>
|
<br>
|
||||||
You can review it by follow this link: {property_edit_link}
|
You can review it by follow this link: {property_edit_link}
|
||||||
<em>This message was sent by {site_link} on {current_time}.</em>'
|
<em>This message was sent by {site_link} on {current_time}.</em>'
|
||||||
@ -76,7 +75,7 @@ class OpalEstate_Send_Email_Admin_New_Submitted extends OpalEstate_Abstract_Emai
|
|||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function to_email() {
|
public function to_email() {
|
||||||
return $this->args ['receiver_email'];
|
return $this->from_email();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,38 +24,35 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Get subject.
|
||||||
*/
|
*/
|
||||||
public function get_subject () {
|
public function get_subject() {
|
||||||
$propety_title = '' ;
|
$subject = esc_html__( 'The Property Listing Approved: {property_name}', 'opalestate-pro' );
|
||||||
|
$subject = opalestate_options( 'approve_email_body', $subject );
|
||||||
|
|
||||||
$subject = sprintf( esc_html__( 'The Property Listing Approved: {property_name}', 'opalestate-pro' ), $propety_title );
|
return $this->replace_tags( $subject );
|
||||||
$subject = opalestate_options( 'approve_email_body' , $subject );
|
|
||||||
|
|
||||||
return $subject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get collection of key and value base on tags which using to replace custom tags
|
* Get collection of key and value base on tags which using to replace custom tags
|
||||||
*/
|
*/
|
||||||
public function set_pros( $property_id ){
|
public function set_pros( $property_id ) {
|
||||||
|
|
||||||
$property = get_post( $property_id );
|
$property = get_post( $property_id );
|
||||||
$user = get_userdata( $property->post_author );
|
$user = get_userdata( $property->post_author );
|
||||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||||
$email = $email ? $email : $user->data->user_email;
|
$email = $email ? $email : $user->data->user_email;
|
||||||
|
|
||||||
$this->args = array(
|
$this->args = [
|
||||||
'receiver_email' => $email,
|
'receiver_email' => $email,
|
||||||
'user_mail' => $email,
|
'user_mail' => $email,
|
||||||
'user_name' => $user->display_name,
|
'user_name' => $user->display_name,
|
||||||
'submitted_date' => $property->post_date,
|
'submitted_date' => $property->post_date,
|
||||||
'property_name' => $property->post_title,
|
'property_name' => $property->post_title,
|
||||||
'property_link' => get_permalink( $property_id ),
|
'property_link' => get_permalink( $property_id ),
|
||||||
'current_time' => date("F j, Y, g:i a"),
|
'current_time' => date( "F j, Y, g:i a" ),
|
||||||
);
|
];
|
||||||
|
|
||||||
return $this->args ;
|
return $this->args;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +60,8 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
|||||||
*/
|
*/
|
||||||
public function get_content_template() {
|
public function get_content_template() {
|
||||||
|
|
||||||
$content = opalestate_options( 'approve_email_body' , self::get_default_template() );
|
$content = opalestate_options( 'approve_email_body', self::get_default_template() );
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
|||||||
*/
|
*/
|
||||||
public static function get_default_template() {
|
public static function get_default_template() {
|
||||||
|
|
||||||
return trim(preg_replace('/\t+/', '', "Hi {user_name},<br>
|
return trim( preg_replace( '/\t+/', '', "Hi {user_name},<br>
|
||||||
<br>
|
<br>
|
||||||
Thank you so much for submitting to {site_name}.
|
Thank you so much for submitting to {site_name}.
|
||||||
<br>
|
<br>
|
||||||
@ -83,20 +81,20 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
|||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<em>This message was sent by {site_link} on {current_time}.</em>"));
|
<em>This message was sent by {site_link} on {current_time}.</em>" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function to_email () {
|
public function to_email() {
|
||||||
return $this->args ['receiver_email'];
|
return $this->args ['receiver_email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function cc_email () {
|
public function cc_email() {
|
||||||
return $this->args ['sender_email'];
|
return $this->args ['sender_email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,4 +111,5 @@ class OpalEstate_Send_Email_Approve extends OpalEstate_Abstract_Email_Template {
|
|||||||
return parent::get_body();
|
return parent::get_body();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -18,8 +18,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @class OpalEstate_Send_Email_Notification
|
* @class OpalEstate_Send_Email_Notification
|
||||||
*
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
*/
|
||||||
class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Template {
|
class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Template {
|
||||||
|
|
||||||
@ -28,18 +26,18 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
|
|||||||
/**
|
/**
|
||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function get_subject () {
|
public function get_subject() {
|
||||||
switch ( $this->type ) {
|
switch ( $this->type ) {
|
||||||
case 'enquiry':
|
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 );
|
$subject = opalestate_options( 'enquiry_email_subject', $subject );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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 );
|
$subject = opalestate_options( 'contact_email_subject', $subject );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -49,7 +47,7 @@ class OpalEstate_Send_Email_Notification extends OpalEstate_Abstract_Email_Templ
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send Email
|
* Send Email.
|
||||||
*/
|
*/
|
||||||
public function get_content_template() {
|
public function get_content_template() {
|
||||||
switch ( $this->type ) {
|
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' ) );
|
return opalestate_options( 'enquiry_email_body', self::get_default_template( 'enquiry' ) );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return opalestate_options( 'contact_email_body', self::get_default_template( ) );
|
return opalestate_options( 'contact_email_body', self::get_default_template() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function to_email () {
|
public function to_email() {
|
||||||
return $this->args ['receiver_email'];
|
return $this->args ['receiver_email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cc_email () {
|
public function cc_email() {
|
||||||
return $this->args ['sender_email'];
|
return $this->args ['sender_email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_body() {
|
public function get_body() {
|
||||||
$this->args['email'] = $this->args['receiver_email'];
|
$this->args['email'] = $this->args['sender_email'];
|
||||||
|
|
||||||
return parent::get_body();
|
return parent::get_body();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***/
|
/**
|
||||||
public static function get_default_template ( $type='contact' ) {
|
* Get default template.
|
||||||
|
*
|
||||||
if( $type == 'enquiry' ) {
|
* @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/enquiry' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return opalestate_load_template_path( 'emails/contact' );
|
return opalestate_load_template_path( 'emails/contact' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
@ -19,41 +19,39 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
/**
|
/**
|
||||||
* @class OpalEstate_Send_Email_Notification
|
* @class OpalEstate_Send_Email_Notification
|
||||||
*
|
*
|
||||||
* @version 1.0
|
|
||||||
*/
|
*/
|
||||||
class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Template {
|
class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Template {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function get_subject () {
|
public function get_subject() {
|
||||||
$propety_title = '' ;
|
|
||||||
$d = esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' );
|
$d = esc_html__( 'New Property Listing Submitted: {property_name}', 'opalestate-pro' );
|
||||||
$s = opalestate_get_option( 'newproperty_email_subject' , $d );
|
$s = opalestate_get_option( 'newproperty_email_subject', $d );
|
||||||
return $s;
|
|
||||||
|
return $this->replace_tags( $s );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get collection of key and value base on tags which using to replace custom tags
|
* get collection of key and value base on tags which using to replace custom tags
|
||||||
*/
|
*/
|
||||||
public function set_pros( $property_id, $user_id ){
|
public function set_pros( $property_id, $user_id ) {
|
||||||
|
|
||||||
$property = get_post( $property_id );
|
$property = get_post( $property_id );
|
||||||
$user = get_userdata( $property->post_author );
|
$user = get_userdata( $property->post_author );
|
||||||
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
$email = get_user_meta( $property->post_author, OPALESTATE_USER_PROFILE_PREFIX . 'email', true );
|
||||||
$email = $email ? $email : $user->data->user_email;
|
$email = $email ? $email : $user->data->user_email;
|
||||||
|
|
||||||
$this->args = array(
|
$this->args = [
|
||||||
'receiver_email' => $email,
|
'receiver_email' => $email,
|
||||||
'user_mail' => $email,
|
'user_mail' => $email,
|
||||||
'user_name' => $user->display_name,
|
'user_name' => $user->display_name,
|
||||||
'submitted_date' => $property->post_date,
|
'submitted_date' => $property->post_date,
|
||||||
'property_name' => $property->post_title,
|
'property_name' => $property->post_title,
|
||||||
'property_link' => get_permalink( $property_id ),
|
'property_link' => get_permalink( $property_id ),
|
||||||
'current_time' => date("F j, Y, g:i a"),
|
'current_time' => date( "F j, Y, g:i a" ),
|
||||||
);
|
];
|
||||||
|
|
||||||
return $this->args ;
|
return $this->args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +61,7 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
|
|||||||
public function get_content_template() {
|
public function get_content_template() {
|
||||||
|
|
||||||
$body = opalestate_get_option( 'newproperty_email_body', self::get_default_template() );
|
$body = opalestate_get_option( 'newproperty_email_body', self::get_default_template() );
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
|
|||||||
*/
|
*/
|
||||||
public static function get_default_template() {
|
public static function get_default_template() {
|
||||||
|
|
||||||
return trim(preg_replace('/\t+/', '','
|
return trim( preg_replace( '/\t+/', '', '
|
||||||
Hi {user_name},
|
Hi {user_name},
|
||||||
<br>
|
<br>
|
||||||
Thanks you so much for submitting {property_name} at {site_name}:<br>
|
Thanks you so much for submitting {property_name} at {site_name}:<br>
|
||||||
@ -87,14 +86,14 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
|
|||||||
/**
|
/**
|
||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function to_email () {
|
public function to_email() {
|
||||||
return $this->args ['receiver_email'];
|
return $this->args ['receiver_email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function cc_email () {
|
public function cc_email() {
|
||||||
return $this->args ['sender_email'];
|
return $this->args ['sender_email'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,4 +104,3 @@ class OpalEstate_Send_Email_New_Submitted extends OpalEstate_Abstract_Email_Temp
|
|||||||
return parent::get_body();
|
return parent::get_body();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
@ -27,9 +27,7 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
|||||||
* Send Email
|
* Send Email
|
||||||
*/
|
*/
|
||||||
public function get_subject() {
|
public function get_subject() {
|
||||||
$propety_title = '';
|
$content = esc_html__( 'You have a message request reviewing', 'opalestate-pro' );
|
||||||
|
|
||||||
$content = sprintf( esc_html__( 'You have a message request reviewing: %s at', 'opalestate-pro' ), $propety_title );
|
|
||||||
$content = opalestate_options( 'request_review_email_subject', $content );
|
$content = opalestate_options( 'request_review_email_subject', $content );
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
@ -40,6 +38,7 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
|||||||
*/
|
*/
|
||||||
public function get_content_template() {
|
public function get_content_template() {
|
||||||
$content = opalestate_options( 'request_review_email_body', self::get_default_template() );
|
$content = opalestate_options( 'request_review_email_body', self::get_default_template() );
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
|||||||
public function get_body() {
|
public function get_body() {
|
||||||
$post = get_post( $this->args['post_id'] );
|
$post = get_post( $this->args['post_id'] );
|
||||||
|
|
||||||
$this->args['email'] = $this->args['receiver_email'];
|
// $this->args['email'] = $this->args['receiver_email'];
|
||||||
$this->args['property_link'] = get_permalink( $post->ID );
|
$this->args['property_link'] = get_permalink( $post->ID );
|
||||||
$this->args['property_name'] = $post->post_title;
|
$this->args['property_name'] = $post->post_title;
|
||||||
|
|
||||||
@ -73,5 +72,4 @@ class OpalEstate_Send_Email_Request_Reviewing extends OpalEstate_Abstract_Email_
|
|||||||
public static function get_default_template() {
|
public static function get_default_template() {
|
||||||
return opalestate_load_template_path( 'emails/request-reviewing' );
|
return opalestate_load_template_path( 'emails/request-reviewing' );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,6 @@ class OpalEstate_User_Message {
|
|||||||
* Set values when user logined in system
|
* Set values when user logined in system
|
||||||
*/
|
*/
|
||||||
public function send_equiry( $post, $member ) {
|
public function send_equiry( $post, $member ) {
|
||||||
|
|
||||||
$default = [
|
$default = [
|
||||||
'send_equiry_name' => '',
|
'send_equiry_name' => '',
|
||||||
'action' => '',
|
'action' => '',
|
||||||
@ -109,9 +108,8 @@ class OpalEstate_User_Message {
|
|||||||
'message' => '',
|
'message' => '',
|
||||||
'message_action' => '',
|
'message_action' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$post = array_merge( $default, $post );
|
$post = array_merge( $default, $post );
|
||||||
|
|
||||||
|
|
||||||
$post['property_link'] = (int) $post['post_id'] ? get_permalink( $post['post_id'] ) : get_home_url();
|
$post['property_link'] = (int) $post['post_id'] ? get_permalink( $post['post_id'] ) : get_home_url();
|
||||||
$post['receive_name'] = isset( $member['name'] ) ? $member['name'] : '';
|
$post['receive_name'] = isset( $member['name'] ) ? $member['name'] : '';
|
||||||
$subject = html_entity_decode( esc_html__( 'You got a message', 'opalestate-pro' ) );
|
$subject = html_entity_decode( esc_html__( 'You got a message', 'opalestate-pro' ) );
|
||||||
@ -119,11 +117,12 @@ class OpalEstate_User_Message {
|
|||||||
|
|
||||||
$output = [
|
$output = [
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
'name' => isset( $member['name'] ) ? $member['name'] : '',
|
'name' => isset( $post['name'] ) ? $post['name'] : '',
|
||||||
'receiver_email' => $member['receiver_email'],
|
'receiver_email' => $member['receiver_email'],
|
||||||
'receiver_id' => $member['receiver_id'],
|
'receiver_id' => $member['receiver_id'],
|
||||||
'sender_id' => get_current_user_id(),
|
'sender_id' => get_current_user_id(),
|
||||||
'sender_email' => $post['email'],
|
'sender_email' => $post['email'],
|
||||||
|
'email' => $post['email'],
|
||||||
'phone' => $post['phone'],
|
'phone' => $post['phone'],
|
||||||
'message' => $post['message'],
|
'message' => $post['message'],
|
||||||
'post_id' => $post['post_id'],
|
'post_id' => $post['post_id'],
|
||||||
@ -203,7 +202,6 @@ class OpalEstate_User_Message {
|
|||||||
* Set values when user logined in system
|
* Set values when user logined in system
|
||||||
*/
|
*/
|
||||||
public function get_member_email_data( $post_id ) {
|
public function get_member_email_data( $post_id ) {
|
||||||
|
|
||||||
return opalestate_get_member_email_data( $post_id );
|
return opalestate_get_member_email_data( $post_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +249,6 @@ class OpalEstate_User_Message {
|
|||||||
|
|
||||||
echo json_encode( $return );
|
echo json_encode( $return );
|
||||||
die();
|
die();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -284,7 +281,7 @@ class OpalEstate_User_Message {
|
|||||||
$this->insert( $content );
|
$this->insert( $content );
|
||||||
}
|
}
|
||||||
|
|
||||||
// send email for user to inbox email.
|
// Send email for user to inbox email.
|
||||||
do_action( 'opalestate_send_email_notifycation', $content );
|
do_action( 'opalestate_send_email_notifycation', $content );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +296,6 @@ class OpalEstate_User_Message {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function insert( $data ) {
|
public function insert( $data ) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$args = [
|
$args = [
|
||||||
@ -326,7 +322,6 @@ class OpalEstate_User_Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function insert_reply( $data ) {
|
public function insert_reply( $data ) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$args = [
|
$args = [
|
||||||
@ -667,11 +662,12 @@ class OpalEstate_User_Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function get_request_review_form_fields( $msg = '' ) {
|
public function get_request_review_form_fields( $msg = '' ) {
|
||||||
|
global $wp_query;
|
||||||
|
|
||||||
$prefix = '';
|
$prefix = '';
|
||||||
$id = '';
|
$id = '';
|
||||||
$sender_id = '';
|
$sender_id = '';
|
||||||
$post_id = get_the_ID();
|
$post_id = $wp_query->post->ID;
|
||||||
$email = '';
|
$email = '';
|
||||||
$current_user = wp_get_current_user();
|
$current_user = wp_get_current_user();
|
||||||
$name = '';
|
$name = '';
|
||||||
@ -684,25 +680,22 @@ class OpalEstate_User_Message {
|
|||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
[
|
[
|
||||||
'id' => "type",
|
'id' => 'type',
|
||||||
'name' => esc_html__( 'Type', 'opalestate-pro' ),
|
'name' => esc_html__( 'Type', 'opalestate-pro' ),
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
'default' => 'send_request_review',
|
'default' => 'send_request_review',
|
||||||
'description' => "",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => "post_id",
|
'id' => 'post_id',
|
||||||
'name' => esc_html__( 'Property ID', 'opalestate-pro' ),
|
'name' => esc_html__( 'Property ID', 'opalestate-pro' ),
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
'default' => $post_id,
|
'default' => $post_id,
|
||||||
'description' => "",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => "sender_id",
|
'id' => 'sender_id',
|
||||||
'name' => esc_html__( 'Sender ID', 'opalestate-pro' ),
|
'name' => esc_html__( 'Sender ID', 'opalestate-pro' ),
|
||||||
'type' => 'hidden',
|
'type' => 'hidden',
|
||||||
'default' => $sender_id,
|
'default' => $sender_id,
|
||||||
'description' => "",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => "{$prefix}date",
|
'id' => "{$prefix}date",
|
||||||
@ -710,32 +703,26 @@ class OpalEstate_User_Message {
|
|||||||
'type' => 'date',
|
'type' => 'date',
|
||||||
'before_row' => '',
|
'before_row' => '',
|
||||||
'required' => 'required',
|
'required' => 'required',
|
||||||
'description' => "",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => "{$prefix}time",
|
'id' => "{$prefix}time",
|
||||||
'name' => esc_html__( 'Time', 'opalestate-pro' ),
|
'name' => esc_html__( 'Time', 'opalestate-pro' ),
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'options' => opalestate_get_time_lapses(),
|
'options' => opalestate_get_time_lapses(),
|
||||||
'description' => "",
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => "{$prefix}phone",
|
'id' => "{$prefix}phone",
|
||||||
'name' => esc_html__( 'Phone', 'opalestate-pro' ),
|
'name' => esc_html__( 'Phone', 'opalestate-pro' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'description' => "",
|
|
||||||
'required' => 'required',
|
'required' => 'required',
|
||||||
],
|
],
|
||||||
|
|
||||||
[
|
[
|
||||||
'id' => "{$prefix}message",
|
'id' => "{$prefix}message",
|
||||||
'name' => esc_html__( 'Message', 'opalestate-pro' ),
|
'name' => esc_html__( 'Message', 'opalestate-pro' ),
|
||||||
'type' => 'textarea',
|
'type' => 'textarea',
|
||||||
'description' => "",
|
|
||||||
'default' => $msg,
|
'default' => $msg,
|
||||||
'required' => 'required',
|
'required' => 'required',
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
|
@ -74,10 +74,10 @@ class OpalEstate_User_Request_Viewing {
|
|||||||
if ( wp_verify_nonce( $_POST['message_action'], 'property-request-view' ) ) {
|
if ( wp_verify_nonce( $_POST['message_action'], 'property-request-view' ) ) {
|
||||||
$post = $_POST;
|
$post = $_POST;
|
||||||
$member = $this->get_member_email_data( absint( $post['post_id'] ) );
|
$member = $this->get_member_email_data( absint( $post['post_id'] ) );
|
||||||
|
$user = get_userdata( $this->user_id );
|
||||||
$output = [
|
$output = [
|
||||||
'subject' => isset( $subject ) && $subject ? esc_html( $subject ) : '',
|
'subject' => isset( $subject ) && $subject ? esc_html( $subject ) : '',
|
||||||
'name' => esc_html( $member['receiver_name'] ),
|
'name' => $user->display_name ? esc_html( $user->display_name ) : esc_html( $user->user_nicename ),
|
||||||
'receiver_email' => sanitize_email( $member['receiver_email'] ),
|
'receiver_email' => sanitize_email( $member['receiver_email'] ),
|
||||||
'receiver_id' => sanitize_text_field( $member['receiver_id'] ),
|
'receiver_id' => sanitize_text_field( $member['receiver_id'] ),
|
||||||
'sender_id' => get_current_user_id(),
|
'sender_id' => get_current_user_id(),
|
||||||
@ -87,6 +87,7 @@ class OpalEstate_User_Request_Viewing {
|
|||||||
'schedule_time' => sanitize_text_field( $post['time'] ),
|
'schedule_time' => sanitize_text_field( $post['time'] ),
|
||||||
'schedule_date' => sanitize_text_field( $post['date'] ),
|
'schedule_date' => sanitize_text_field( $post['date'] ),
|
||||||
'post_id' => absint( $post['post_id'] ),
|
'post_id' => absint( $post['post_id'] ),
|
||||||
|
'email' => $user->user_email,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->insert( $output );
|
$this->insert( $output );
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: Opal Estate Pro
|
* Plugin Name: Opal Estate Pro
|
||||||
* Plugin URI: http://www.wpopal.com/product/opal-estate-wordpress-plugin/
|
* Plugin URI: http://www.wpopal.com/product/opal-estate-wordpress-plugin/
|
||||||
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
|
* Description: Opal Real Estate Plugin is an ideal solution and brilliant choice for you to set up a professional estate website.
|
||||||
* Version: 1.1.4
|
* Version: 1.1.5
|
||||||
* Author: WPOPAL
|
* Author: WPOPAL
|
||||||
* Author URI: http://www.wpopal.com
|
* Author URI: http://www.wpopal.com
|
||||||
* Requires at least: 4.6
|
* Requires at least: 4.6
|
||||||
@ -151,7 +151,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
|||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone() {
|
||||||
// Cloning instances of the class is forbidden
|
// Cloning instances of the class is forbidden
|
||||||
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.1.4' );
|
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'opalestate-pro' ), '1.1.5' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +160,7 @@ if ( ! class_exists( 'OpalEstate' ) ) {
|
|||||||
public function setup_constants() {
|
public function setup_constants() {
|
||||||
// Plugin version
|
// Plugin version
|
||||||
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
|
if ( ! defined( 'OPALESTATE_VERSION' ) ) {
|
||||||
define( 'OPALESTATE_VERSION', '1.1.4' );
|
define( 'OPALESTATE_VERSION', '1.1.5' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Plugin Folder Path
|
// Plugin Folder Path
|
||||||
|
@ -153,6 +153,9 @@ This section describes how to install the plugin and get it working.
|
|||||||
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
|
* System tickets support 24/7 available : [free support](https://wpopal.ticksy.com/ "Visit the Plugin support Page")
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 1.1.5 - 2019-10-21 =
|
||||||
|
* Fixes - Email templates.
|
||||||
|
|
||||||
= 1.1.4 - 2019-10-17 =
|
= 1.1.4 - 2019-10-17 =
|
||||||
* Fixes - Properties collection pagination.
|
* Fixes - Properties collection pagination.
|
||||||
* Fixes - Agents collection pagination.
|
* Fixes - Agents collection pagination.
|
||||||
|
@ -13,6 +13,7 @@ if ( opalestate_get_option( 'enable_single_author_box' , 'on') != 'on' ) {
|
|||||||
$type = $property->get_author_type();
|
$type = $property->get_author_type();
|
||||||
$data = get_userdata( $post->post_author );
|
$data = get_userdata( $post->post_author );
|
||||||
$layout = '';
|
$layout = '';
|
||||||
|
|
||||||
switch ( $type ) {
|
switch ( $type ) {
|
||||||
case 'hide':
|
case 'hide':
|
||||||
return;
|
return;
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
?>
|
?>
|
||||||
<p class="agent-box-job"><?php echo esc_html( $job ); ?></p>
|
<p class="agent-box-job"><?php echo esc_html( $job ); ?></p>
|
||||||
|
|
||||||
<?php $email = get_user_meta( $user_id, $prefix . 'email', true ); ?>
|
<?php $email = get_userdata( $user_id )->user_email; ?>
|
||||||
<?php if ( ! empty( $email ) ) : ?>
|
<?php if ( ! empty( $email ) ) : ?>
|
||||||
<div class="agent-box-email">
|
<div class="agent-box-email">
|
||||||
<i class="fa fa-envelope"></i>
|
<i class="fa fa-envelope"></i>
|
||||||
|
Loading…
Reference in New Issue
Block a user