HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/doccure-wp/wp-content/plugins/doccure/helpers/templates/email-published.php
<?php
/**
 * Email Helper To Send Email
 * @since    1.0.0
 */
if (!class_exists('doccure_Published')) {

    class doccure_Published extends doccure_Email_helper{

        public function __construct() {
			//do stuff here
        }

		/**
		 * @Approve freelancer & Employer Profiles
		 *
		 * @since 1.0.0
		 */ 
		 
 
 
public function publish_approve_user_acount($params = '') {
	global $doccure_options;
	extract($params);

	// Validate email & username
	$email_to = isset($email_to) ? sanitize_email($email_to) : '';
	$name = isset($name) ? esc_html($name) : '';

	if (empty($email_to) || empty($name)) {
		return; // Stop execution if no valid email or username is provided.
	}

	// Get Redux options or fallback values
	$from_name = isset($doccure_options['emails_name']) ? esc_html($doccure_options['emails_name']) : get_bloginfo('name');
	$from_email = isset($doccure_options['emails_from_email']) ? sanitize_email($doccure_options['emails_from_email']) : get_bloginfo('admin_email');

	$disable_welcome_email = isset($doccure_options['welcome_email_enabled_doctors_approved']) ? $doccure_options['welcome_email_enabled_doctors_approved'] : false;
	$login_link = isset($doccure_options['header_cta_btn_link']) ? esc_url($doccure_options['header_cta_btn_link']) : wp_login_url();
	$email_logo = isset($doccure_options['email_logo']['url']) ? esc_url($doccure_options['email_logo']['url']) : '';

	// Email Subject & Content
	$email_subject = isset($doccure_options['listing_welcome_email_subject_doctors_approved']) 
		? esc_html($doccure_options['listing_welcome_email_subject_doctors_approved']) 
		: __('Welcome to {site_name}', 'doccure_core');

	$email_content_raw = isset($doccure_options['listing_welcome_email_content_doctor_approval_only']) 
		? wp_kses_post($doccure_options['listing_welcome_email_content_doctor_approval_only']) 
		: 'Your account has been successfully confirmed by the admin. You can now log in and access all available features. If you have any questions or need further assistance, please feel free to contact support';

	// If the welcome email is disabled, return
	if (!$disable_welcome_email) {
		return;
	}

	// Replace placeholders in email content
	$email_subject = str_replace('{site_name}', get_bloginfo('name'), $email_subject);
	$email_content = str_replace(
		['{user_mail}', '{user_name}', '{site_name}', '{login}'],
		[$email_to, $name, get_bloginfo('name'), $login_link],
		$email_content_raw
	);

	// Construct the email message
	$message = '<!DOCTYPE html>
	<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<style>
			body { font-family: Arial, sans-serif; color: #333; line-height: 1.6; margin: 0; padding: 0; }
			.container { max-width: 600px; margin: 20px auto; padding: 20px; background: #f9f9f9; border-radius: 5px; border: 1px solid #ddd; }
			.header { text-align: center; margin-bottom: 20px; }
			.header img { max-width: 150px; }
			.content { background: #fff; padding: 20px; border-radius: 5px; }
			.content h2 { color: #333; }
			.content p { margin-bottom: 20px; }
			.button { text-align: center; margin-top: 20px; }
			.button a { background-color: #0073e6; color: #fff; padding: 12px 20px; border-radius: 5px; text-decoration: none; font-weight: bold; }
			.footer { margin-top: 20px; text-align: center; color: #777; font-size: 12px; }
		</style>
	</head>
	<body>
		<div class="container">
			<div class="header">';
			
	if (!empty($email_logo)) {
		$message .= '<img src="' . esc_url($email_logo) . '" alt="Logo">';
	}
	
	$message .= '</div>
			<div class="content">
				' . wpautop($email_content) . '
 			</div>
			<div class="footer">
				&copy; ' . date("Y") . ' ' . get_bloginfo('name') . '. All rights reserved.
			</div>
		</div>
	</body>
	</html>';

	// Email Headers
	$headers = [
		'Content-Type: text/html; charset=UTF-8',
		'From: ' . $from_name . ' <' . $from_email . '>',
	];

	// Send the email and log if it fails
	if (!wp_mail($email_to, $email_subject, $message, $headers)) {
		error_log('Failed to send email to: ' . $email_to);
	}
}
 
		

public function publish_reject_user_acount($params = '') {
	global $doccure_options;
	extract($params);

	// Validate email & username
	$email_to = isset($email_to) ? sanitize_email($email_to) : '';
	$name = isset($name) ? esc_html($name) : '';

	if (empty($email_to) || empty($name)) {
		return; // Stop execution if no valid email or username is provided.
	}

	// Get Redux options or fallback values
	$from_name = isset($doccure_options['emails_name']) ? esc_html($doccure_options['emails_name']) : get_bloginfo('name');
	$from_email = isset($doccure_options['emails_from_email']) ? sanitize_email($doccure_options['emails_from_email']) : get_bloginfo('admin_email');

	$disable_welcome_email = isset($doccure_options['welcome_email_enabled_doctors_reject']) ? $doccure_options['welcome_email_enabled_doctors_reject'] : false;
	$login_link = isset($doccure_options['header_cta_btn_link']) ? esc_url($doccure_options['header_cta_btn_link']) : wp_login_url();
	$email_logo = isset($doccure_options['email_logo']['url']) ? esc_url($doccure_options['email_logo']['url']) : '';

	// Email Subject & Content
	$email_subject = isset($doccure_options['listing_welcome_email_subject_doctors_reject']) 
		? esc_html($doccure_options['listing_welcome_email_subject_doctors_reject']) 
		: __('Welcome to {site_name}', 'doccure_core');

	$email_content_raw = isset($doccure_options['listing_welcome_email_content_doctor_reject']) 
		? wp_kses_post($doccure_options['listing_welcome_email_content_doctor_reject']) 
		: 'We regret to inform you that your account application has been reviewed but was not approved by the admin.';

	// If the welcome email is disabled, return
	if (!$disable_welcome_email) {
		return;
	}

	// Replace placeholders in email content
	$email_subject = str_replace('{site_name}', get_bloginfo('name'), $email_subject);
	$email_content = str_replace(
		['{user_mail}', '{user_name}', '{site_name}', '{login}'],
		[$email_to, $name, get_bloginfo('name'), $login_link],
		$email_content_raw
	);

	// Construct the email message
	$message = '<!DOCTYPE html>
	<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<style>
			body { font-family: Arial, sans-serif; color: #333; line-height: 1.6; margin: 0; padding: 0; }
			.container { max-width: 600px; margin: 20px auto; padding: 20px; background: #f9f9f9; border-radius: 5px; border: 1px solid #ddd; }
			.header { text-align: center; margin-bottom: 20px; }
			.header img { max-width: 150px; }
			.content { background: #fff; padding: 20px; border-radius: 5px; }
			.content h2 { color: #333; }
			.content p { margin-bottom: 20px; }
			.button { text-align: center; margin-top: 20px; }
			.button a { background-color: #0073e6; color: #fff; padding: 12px 20px; border-radius: 5px; text-decoration: none; font-weight: bold; }
			.footer { margin-top: 20px; text-align: center; color: #777; font-size: 12px; }
		</style>
	</head>
	<body>
		<div class="container">
			<div class="header">';
			
	if (!empty($email_logo)) {
		$message .= '<img src="' . esc_url($email_logo) . '" alt="Logo">';
	}
	
	$message .= '</div>
			<div class="content">
				' . wpautop($email_content) . '
 			</div>
			<div class="footer">
				&copy; ' . date("Y") . ' ' . get_bloginfo('name') . '. All rights reserved.
			</div>
		</div>
	</body>
	</html>';

	// Email Headers
	$headers = [
		'Content-Type: text/html; charset=UTF-8',
		'From: ' . $from_name . ' <' . $from_email . '>',
	];

	// Send the email and log if it fails
	if (!wp_mail($email_to, $email_subject, $message, $headers)) {
		error_log('Failed to send email to: ' . $email_to);
	}
}


		
	 

		

public function publish_sendemail_user_acount($params = '') {
	global $doccure_options;
	extract($params);

	// Validate email & username
	$email_to = isset($email_to) ? sanitize_email($email_to) : '';
	$name = isset($name) ? esc_html($name) : '';

	if (empty($email_to) || empty($name)) {
		return; // Stop execution if no valid email or username is provided.
	}

	// Get Redux options or fallback values
	$from_name = isset($doccure_options['emails_name']) ? esc_html($doccure_options['emails_name']) : get_bloginfo('name');
	$from_email = isset($doccure_options['emails_from_email']) ? sanitize_email($doccure_options['emails_from_email']) : get_bloginfo('admin_email');

	$disable_welcome_email = isset($doccure_options['welcome_email_enabled_doctors_sendmail']) ? $doccure_options['welcome_email_enabled_doctors_sendmail'] : false;
	$login_link = isset($doccure_options['header_cta_btn_link']) ? esc_url($doccure_options['header_cta_btn_link']) : wp_login_url();
	$email_logo = isset($doccure_options['email_logo']['url']) ? esc_url($doccure_options['email_logo']['url']) : '';

	// Email Subject & Content
	$email_subject = isset($doccure_options['listing_welcome_email_subject_doctors_sendmail']) 
		? esc_html($doccure_options['listing_welcome_email_subject_doctors_sendmail']) 
		: __('Welcome to {site_name}', 'doccure_core');

	$email_content_raw = isset($doccure_options['listing_welcome_email_content_doctor_send_email']) 
		? wp_kses_post($doccure_options['listing_welcome_email_content_doctor_send_email']) 
		: 'We are pleased to inform you that your account has been successfully approved. You can now log in to your dashboard and access all available features.';

	// If the welcome email is disabled, return
	if (!$disable_welcome_email) {
		return;
	}

	// Replace placeholders in email content
	$email_subject = str_replace('{site_name}', get_bloginfo('name'), $email_subject);
	$email_content = str_replace(
		['{user_mail}', '{user_name}', '{site_name}', '{login}'],
		[$email_to, $name, get_bloginfo('name'), $login_link],
		$email_content_raw
	);

	// Construct the email message
	$message = '<!DOCTYPE html>
	<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<style>
			body { font-family: Arial, sans-serif; color: #333; line-height: 1.6; margin: 0; padding: 0; }
			.container { max-width: 600px; margin: 20px auto; padding: 20px; background: #f9f9f9; border-radius: 5px; border: 1px solid #ddd; }
			.header { text-align: center; margin-bottom: 20px; }
			.header img { max-width: 150px; }
			.content { background: #fff; padding: 20px; border-radius: 5px; }
			.content h2 { color: #333; }
			.content p { margin-bottom: 20px; }
			.button { text-align: center; margin-top: 20px; }
			.button a { background-color: #0073e6; color: #fff; padding: 12px 20px; border-radius: 5px; text-decoration: none; font-weight: bold; }
			.footer { margin-top: 20px; text-align: center; color: #777; font-size: 12px; }
		</style>
	</head>
	<body>
		<div class="container">
			<div class="header">';
			
	if (!empty($email_logo)) {
		$message .= '<img src="' . esc_url($email_logo) . '" alt="Logo">';
	}
	
	$message .= '</div>
			<div class="content">
				' . wpautop($email_content) . '
 			</div>
			<div class="footer">
				&copy; ' . date("Y") . ' ' . get_bloginfo('name') . '. All rights reserved.
			</div>
		</div>
	</body>
	</html>';

	// Email Headers
	$headers = [
		'Content-Type: text/html; charset=UTF-8',
		'From: ' . $from_name . ' <' . $from_email . '>',
	];

	// Send the email and log if it fails
	if (!wp_mail($email_to, $email_subject, $message, $headers)) {
		error_log('Failed to send email to: ' . $email_to);
	}
}


		
	}
	new doccure_Published();
}