| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
$current_user = wp_get_current_user(); |
| 7 |
$propertyhive_email_recipients = array(); |
| 8 |
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Read-only email composition view; the matching controller verifies propertyhive-matching-applicants before including it, and send authorization remains in the controller. |
| 9 |
$propertyhive_recipient_input = isset( $_POST['email_contact_applicant_profile_id'] ) && is_array( $_POST['email_contact_applicant_profile_id'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_POST['email_contact_applicant_profile_id'] ) ) : array(); |
| 10 |
foreach ( $propertyhive_recipient_input as $propertyhive_recipient ) { |
| 11 |
if ( is_string( $propertyhive_recipient ) && preg_match( '/^\d+\|\d+$/', $propertyhive_recipient ) ) { |
| 12 |
$propertyhive_email_recipients[] = $propertyhive_recipient; |
| 13 |
} |
| 14 |
} |
| 15 |
?> |
| 16 |
<h1>Emailing <?php echo esc_html($property->get_formatted_full_address()); ?> To <?php echo count( $propertyhive_email_recipients ); ?> Suitable Applicant<?php echo count( $propertyhive_email_recipients ) != 1 ? 's' : ''; ?></h1> |
| 17 |
|
| 18 |
<table class="form-table"> |
| 19 |
|
| 20 |
<tr valign="top"> |
| 21 |
<th scope="row" class="titledesc"><?php echo esc_html(__( 'To', 'propertyhive' )); ?></th> |
| 22 |
<td class="forminp"> |
| 23 |
<?php |
| 24 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 25 |
foreach ( $propertyhive_email_recipients as $contact_applicant_profile_id ) |
| 26 |
{ |
| 27 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 28 |
$explode_contact_applicant_profile_id = explode("|", $contact_applicant_profile_id); |
| 29 |
|
| 30 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 31 |
$contact_id = $explode_contact_applicant_profile_id[0]; |
| 32 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. |
| 33 |
$applicant_profile_id = $explode_contact_applicant_profile_id[1]; |
| 34 |
|
| 35 |
echo esc_html( get_the_title( $contact_id ) ) . ' (' . esc_html( get_post_meta( $contact_id, '_email_address', TRUE ) ) . ')<br>'; |
| 36 |
} |
| 37 |
?> |
| 38 |
<div style="margin-top:5px;"><a href="" class="show-cc">Show Cc</a> | <a href="" class="show-bcc">Show Bcc</a></div> |
| 39 |
</td> |
| 40 |
</tr> |
| 41 |
|
| 42 |
<tr valign="top" style="display:none" id="cc_email_address_row"> |
| 43 |
<th scope="row" class="titledesc"><?php echo esc_html(__( 'Cc', 'propertyhive' )); ?></th> |
| 44 |
<td class="forminp"> |
| 45 |
<input type="text" name="cc_email_address" value="" style="width:100%;"> |
| 46 |
</td> |
| 47 |
</tr> |
| 48 |
|
| 49 |
<tr valign="top" style="display:none" id="bcc_email_address_row"> |
| 50 |
<th scope="row" class="titledesc"><?php echo esc_html(__( 'Bcc', 'propertyhive' )); ?></th> |
| 51 |
<td class="forminp"> |
| 52 |
<input type="text" name="bcc_email_address" value="" style="width:100%;"> |
| 53 |
</td> |
| 54 |
</tr> |
| 55 |
|
| 56 |
<tr valign="top"> |
| 57 |
<th scope="row" class="titledesc"><?php echo esc_html(__( 'From Name', 'propertyhive' )); ?></th> |
| 58 |
<td class="forminp"> |
| 59 |
<input type="text" name="from_name" value="<?php echo esc_attr(get_bloginfo('name')); ?>" style="width:100%;"> |
| 60 |
</td> |
| 61 |
</tr> |
| 62 |
|
| 63 |
<tr valign="top"> |
| 64 |
<th scope="row" class="titledesc"><?php echo esc_html(__( 'From Email Address', 'propertyhive' )); ?></th> |
| 65 |
<td class="forminp"> |
| 66 |
<input type="text" name="from_email_address" value="<?php echo esc_attr(trim($from_email_address)); ?>" style="width:100%;"> |
| 67 |
</td> |
| 68 |
</tr> |
| 69 |
|
| 70 |
<tr valign="top"> |
| 71 |
<th scope="row" class="titledesc"><?php echo esc_html(__( 'Subject', 'propertyhive' )); ?></th> |
| 72 |
<td class="forminp"> |
| 73 |
<input type="text" name="subject" value="<?php echo esc_attr($subject); ?>" style="width:100%;"> |
| 74 |
</td> |
| 75 |
</tr> |
| 76 |
|
| 77 |
<tr valign="top"> |
| 78 |
<th scope="row" class="titledesc"><?php echo esc_html(__( 'Email Body', 'propertyhive' )); ?></th> |
| 79 |
<td class="forminp"> |
| 80 |
<textarea name="body" style="width:100%; height:300px;"><?php echo esc_textarea( $body ); ?></textarea> |
| 81 |
</td> |
| 82 |
</tr> |
| 83 |
|
| 84 |
</table> |
| 85 |
|
| 86 |
<script> |
| 87 |
|
| 88 |
jQuery(document).ready(function() |
| 89 |
{ |
| 90 |
jQuery('a.show-cc').click(function(e) |
| 91 |
{ |
| 92 |
e.preventDefault(); |
| 93 |
|
| 94 |
jQuery('#cc_email_address_row').fadeIn('fast'); |
| 95 |
jQuery('#cc_email_address_row input').focus(); |
| 96 |
}); |
| 97 |
|
| 98 |
jQuery('a.show-bcc').click(function(e) |
| 99 |
{ |
| 100 |
e.preventDefault(); |
| 101 |
|
| 102 |
jQuery('#bcc_email_address_row').fadeIn('fast'); |
| 103 |
jQuery('#bcc_email_address_row input').focus(); |
| 104 |
}); |
| 105 |
}); |
| 106 |
|
| 107 |
</script> |