← All changes
|
includes/admin/views/html-admin-matching-applicants-email.php
+66
-23
1.4.48
→
2.4.0
View file →
| @@ -1,64 +1,107 @@ | ||
| 1 | 1 | <?php |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 5 | + | |
| 2 | 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 | +} | |
| 3 | 15 | ?> |
| 4 | -<h1>Emailing <?php echo $property->get_formatted_full_address(); ?> To <?php echo count($_POST['email_contact_applicant_profile_id']); ?> Suitable Applicant<?php echo count($_POST['email_contact_applicant_profile_id']) != 1 ? 's' : ''; ?></h1> | |
| 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> | |
| 5 | 17 | |
| 6 | 18 | <table class="form-table"> |
| 7 | 19 | |
| 8 | 20 | <tr valign="top"> |
| 9 | - <th scope="row" class="titledesc"><?php echo __( 'To', 'propertyhive' ); ?></th> | |
| 21 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'To', 'propertyhive' )); ?></th> | |
| 10 | 22 | <td class="forminp"> |
| 11 | 23 | <?php |
| 12 | - foreach ( $_POST['email_contact_applicant_profile_id'] as $contact_applicant_profile_id ) | |
| 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 ) | |
| 13 | 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. | |
| 14 | 28 | $explode_contact_applicant_profile_id = explode("|", $contact_applicant_profile_id); |
| 15 | 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. | |
| 16 | 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. | |
| 17 | 33 | $applicant_profile_id = $explode_contact_applicant_profile_id[1]; |
| 18 | 34 | |
| 19 | - echo get_the_title($contact_id) . ' (' . get_post_meta( $contact_id, '_email_address', TRUE ) . ')<br>'; | |
| 35 | + echo esc_html( get_the_title( $contact_id ) ) . ' (' . esc_html( get_post_meta( $contact_id, '_email_address', TRUE ) ) . ')<br>'; | |
| 20 | 36 | } |
| 21 | 37 | ?> |
| 38 | + <div style="margin-top:5px;"><a href="" class="show-cc">Show Cc</a> | <a href="" class="show-bcc">Show Bcc</a></div> | |
| 22 | 39 | </td> |
| 23 | 40 | </tr> |
| 24 | 41 | |
| 25 | - <tr valign="top"> | |
| 26 | - <th scope="row" class="titledesc"><?php echo __( 'From Name', 'propertyhive' ); ?></th> | |
| 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> | |
| 27 | 44 | <td class="forminp"> |
| 28 | - <input type="text" name="from_name" value="<?php | |
| 45 | + <input type="text" name="cc_email_address" value="" style="width:100%;"> | |
| 46 | + </td> | |
| 47 | + </tr> | |
| 29 | 48 | |
| 30 | - echo get_bloginfo('name'); | |
| 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> | |
| 31 | 55 | |
| 32 | - ?>" style="width:100%;"> | |
| 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%;"> | |
| 33 | 60 | </td> |
| 34 | 61 | </tr> |
| 35 | 62 | |
| 36 | 63 | <tr valign="top"> |
| 37 | - <th scope="row" class="titledesc"><?php echo __( 'From Email Address', 'propertyhive' ); ?></th> | |
| 64 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'From Email Address', 'propertyhive' )); ?></th> | |
| 38 | 65 | <td class="forminp"> |
| 39 | - <input type="text" name="from_email_address" value="<?php | |
| 40 | - | |
| 41 | - if ( trim($current_user->user_email) != '' ) | |
| 42 | - { | |
| 43 | - echo $current_user->user_email; | |
| 44 | - } | |
| 45 | - | |
| 46 | - ?>" style="width:100%;"> | |
| 66 | + <input type="text" name="from_email_address" value="<?php echo esc_attr(trim($from_email_address)); ?>" style="width:100%;"> | |
| 47 | 67 | </td> |
| 48 | 68 | </tr> |
| 49 | 69 | |
| 50 | 70 | <tr valign="top"> |
| 51 | - <th scope="row" class="titledesc"><?php echo __( 'Subject', 'propertyhive' ); ?></th> | |
| 71 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'Subject', 'propertyhive' )); ?></th> | |
| 52 | 72 | <td class="forminp"> |
| 53 | - <input type="text" name="subject" value="<?php echo $subject; ?>" style="width:100%;"> | |
| 73 | + <input type="text" name="subject" value="<?php echo esc_attr($subject); ?>" style="width:100%;"> | |
| 54 | 74 | </td> |
| 55 | 75 | </tr> |
| 56 | 76 | |
| 57 | 77 | <tr valign="top"> |
| 58 | - <th scope="row" class="titledesc"><?php echo __( 'Email Body', 'propertyhive' ); ?></th> | |
| 78 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'Email Body', 'propertyhive' )); ?></th> | |
| 59 | 79 | <td class="forminp"> |
| 60 | - <textarea name="body" style="width:100%; height:300px;"><?php echo $body; ?></textarea> | |
| 80 | + <textarea name="body" style="width:100%; height:300px;"><?php echo esc_textarea( $body ); ?></textarea> | |
| 61 | 81 | </td> |
| 62 | 82 | </tr> |
| 63 | 83 | |
| 64 | -</table> | |
| 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> | |