← All changes
|
includes/admin/views/html-admin-matching-properties-email.php
+63
-93
1.4.6
→
2.4.0
View file →
| @@ -1,116 +1,86 @@ | ||
| 1 | 1 | <?php |
| 2 | -$current_user = wp_get_current_user(); | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 5 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Read-only email composition count; the matching controller verifies propertyhive-matching-properties before including this view. | |
| 6 | +$propertyhive_email_property_ids = isset( $_POST['email_property_id'] ) && is_array( $_POST['email_property_id'] ) ? array_filter( array_map( 'sanitize_text_field', wp_unslash( $_POST['email_property_id'] ) ), 'ctype_digit' ) : array(); | |
| 3 | 7 | ?> |
| 4 | -<div class="wrap propertyhive"> | |
| 5 | 8 | |
| 6 | - <h1>Emailing <?php echo count($_POST['email_property_id']); ?> Suitable Properties To <?php echo get_the_title($contact_id); ?></h1> | |
| 9 | +<h1>Emailing <?php echo count( $propertyhive_email_property_ids ); ?> Suitable Properties To <?php echo esc_html(get_the_title($contact_id)); ?></h1> | |
| 7 | 10 | |
| 8 | - <div id="poststuff"> | |
| 11 | +<table class="form-table"> | |
| 9 | 12 | |
| 10 | - <?php /*<div style="float:left; width:50%;">*/ ?> | |
| 13 | + <tr valign="top"> | |
| 14 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'To', 'propertyhive' )); ?></th> | |
| 15 | + <td class="forminp"> | |
| 16 | + <input type="text" name="to_email_address" value="<?php echo esc_attr( get_post_meta( $contact_id, '_email_address', TRUE ) ); ?>" style="width:100%; margin-bottom:5px;"> | |
| 17 | + <a href="" class="show-cc">Show Cc</a> | <a href="" class="show-bcc">Show Bcc</a> | |
| 18 | + </td> | |
| 19 | + </tr> | |
| 11 | 20 | |
| 12 | - <form method="post" id="mainform" action="" enctype="multipart/form-data"> | |
| 21 | + <tr valign="top" style="display:none" id="cc_email_address_row"> | |
| 22 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'Cc', 'propertyhive' )); ?></th> | |
| 23 | + <td class="forminp"> | |
| 24 | + <input type="text" name="cc_email_address" value="" style="width:100%;"> | |
| 25 | + </td> | |
| 26 | + </tr> | |
| 13 | 27 | |
| 14 | - <table class="form-table"> | |
| 28 | + <tr valign="top" style="display:none" id="bcc_email_address_row"> | |
| 29 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'Bcc', 'propertyhive' )); ?></th> | |
| 30 | + <td class="forminp"> | |
| 31 | + <input type="text" name="bcc_email_address" value="" style="width:100%;"> | |
| 32 | + </td> | |
| 33 | + </tr> | |
| 15 | 34 | |
| 16 | - <tr valign="top"> | |
| 17 | - <th scope="row" class="titledesc"><?php echo __( 'To', 'propertyhive' ); ?></th> | |
| 18 | - <td class="forminp"> | |
| 19 | - <input type="text" name="to_email_address" value="<?php echo get_post_meta( $contact_id, '_email_address', TRUE ); ?>" style="width:100%;"> | |
| 20 | - </td> | |
| 21 | - </tr> | |
| 35 | + <tr valign="top"> | |
| 36 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'From Name', 'propertyhive' )); ?></th> | |
| 37 | + <td class="forminp"> | |
| 38 | + <input type="text" name="from_name" value="<?php echo esc_attr(get_bloginfo('name')); ?>" style="width:100%;"> | |
| 39 | + </td> | |
| 40 | + </tr> | |
| 22 | 41 | |
| 23 | - <tr valign="top"> | |
| 24 | - <th scope="row" class="titledesc"><?php echo __( 'From Name', 'propertyhive' ); ?></th> | |
| 25 | - <td class="forminp"> | |
| 26 | - <input type="text" name="from_name" value="<?php | |
| 42 | + <tr valign="top"> | |
| 43 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'From Email Address', 'propertyhive' )); ?></th> | |
| 44 | + <td class="forminp"> | |
| 45 | + <input type="text" name="from_email_address" value="<?php echo esc_attr(trim($from_email_address)); ?>" style="width:100%;"> | |
| 46 | + </td> | |
| 47 | + </tr> | |
| 27 | 48 | |
| 28 | - echo get_bloginfo('name'); | |
| 49 | + <tr valign="top"> | |
| 50 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'Subject', 'propertyhive' )); ?></th> | |
| 51 | + <td class="forminp"> | |
| 52 | + <input type="text" name="subject" value="<?php echo esc_attr($subject); ?>" style="width:100%;"> | |
| 53 | + </td> | |
| 54 | + </tr> | |
| 29 | 55 | |
| 30 | - ?>" style="width:100%;"> | |
| 31 | - </td> | |
| 32 | - </tr> | |
| 56 | + <tr valign="top"> | |
| 57 | + <th scope="row" class="titledesc"><?php echo esc_html(__( 'Email Body', 'propertyhive' )); ?></th> | |
| 58 | + <td class="forminp"> | |
| 59 | + <textarea name="body" style="width:100%; height:300px;"><?php echo esc_textarea( $body ); ?></textarea> | |
| 60 | + </td> | |
| 61 | + </tr> | |
| 33 | 62 | |
| 34 | - <tr valign="top"> | |
| 35 | - <th scope="row" class="titledesc"><?php echo __( 'From Email Address', 'propertyhive' ); ?></th> | |
| 36 | - <td class="forminp"> | |
| 37 | - <input type="text" name="from_email_address" value="<?php | |
| 63 | +</table> | |
| 38 | 64 | |
| 39 | - if ( trim($current_user->user_email) != '' ) | |
| 40 | - { | |
| 41 | - echo $current_user->user_email; | |
| 42 | - } | |
| 43 | - | |
| 44 | - ?>" style="width:100%;"> | |
| 45 | - </td> | |
| 46 | - </tr> | |
| 47 | - | |
| 48 | - <tr valign="top"> | |
| 49 | - <th scope="row" class="titledesc"><?php echo __( 'Subject', 'propertyhive' ); ?></th> | |
| 50 | - <td class="forminp"> | |
| 51 | - <input type="text" name="subject" value="<?php echo $subject; ?>" style="width:100%;"> | |
| 52 | - </td> | |
| 53 | - </tr> | |
| 54 | - | |
| 55 | - <tr valign="top"> | |
| 56 | - <th scope="row" class="titledesc"><?php echo __( 'Email Body', 'propertyhive' ); ?></th> | |
| 57 | - <td class="forminp"> | |
| 58 | - <textarea name="body" style="width:100%; height:300px;"><?php echo $body; ?></textarea> | |
| 59 | - </td> | |
| 60 | - </tr> | |
| 61 | - | |
| 62 | - </table> | |
| 63 | - | |
| 64 | - <p class="submit"> | |
| 65 | - | |
| 66 | - <input name="save" class="button-primary" type="submit" value="<?php echo __( 'Send Email', 'propertyhive' ); ?>" /> | |
| 67 | - <input name="preview" id="preview_email" class="button" type="button" value="<?php echo __( 'Preview Email', 'propertyhive' ); ?>" /> | |
| 68 | - | |
| 69 | - <input type="hidden" name="step" value="two" /> | |
| 70 | - <input type="hidden" name="email_property_id" value="<?php echo implode(",", $_POST['email_property_id']); ?>" /> | |
| 71 | - <?php wp_nonce_field( 'propertyhive-matching-properties' ); ?> | |
| 72 | - | |
| 73 | - </p> | |
| 74 | - | |
| 75 | - <p> | |
| 76 | - <?php echo __( 'When sending out lots of emails we recommend using <a href="https://en-gb.wordpress.org/plugins/tags/smtp" target="_blank">a plugin</a> to send them out using SMTP. Your web developer or hosting company should be able to advise on this.', 'propertyhive' ); | |
| 77 | - ?> | |
| 78 | - </p> | |
| 79 | - | |
| 80 | - </form> | |
| 81 | - | |
| 82 | - <?php /*</div> | |
| 83 | - | |
| 84 | - <div style="float:right; width:50%;"> | |
| 85 | - | |
| 86 | - <iframe name="previewFrame" src="" height="500" width="100%" style="border:1px solid #CCC;" frameborder="0" scrolling="auto">Your browser does not support iFrames</iframe> | |
| 87 | - | |
| 88 | - </div>*/ ?> | |
| 89 | - | |
| 90 | - </div> | |
| 91 | - | |
| 92 | -</div> | |
| 93 | - | |
| 94 | 65 | <script> |
| 95 | 66 | |
| 96 | - jQuery(document).ready(function() | |
| 67 | +jQuery(document).ready(function() | |
| 68 | +{ | |
| 69 | + jQuery('a.show-cc').click(function(e) | |
| 97 | 70 | { |
| 98 | - jQuery('#preview_email').click(function(e) | |
| 99 | - { | |
| 100 | - e.preventDefault(); | |
| 71 | + e.preventDefault(); | |
| 101 | 72 | |
| 102 | - showPreview(); | |
| 103 | - }); | |
| 73 | + jQuery('#cc_email_address_row').fadeIn('fast'); | |
| 74 | + jQuery('#cc_email_address_row input').focus(); | |
| 104 | 75 | }); |
| 105 | 76 | |
| 106 | - function showPreview() | |
| 77 | + jQuery('a.show-bcc').click(function(e) | |
| 107 | 78 | { |
| 108 | - jQuery('#mainform').attr('target', '_blank'); | |
| 109 | - jQuery('#mainform').attr('action', '<?php echo admin_url( '?preview_propertyhive_email=true&contact_id=' . $_GET['contact_id'] . '&applicant_profile=' . $_GET['applicant_profile'] ); ?>'); | |
| 79 | + e.preventDefault(); | |
| 110 | 80 | |
| 111 | - jQuery('#mainform').submit(); | |
| 112 | - jQuery('#mainform').attr('target', '_self'); | |
| 113 | - jQuery('#mainform').attr('action', ''); | |
| 114 | - } | |
| 81 | + jQuery('#bcc_email_address_row').fadeIn('fast'); | |
| 82 | + jQuery('#bcc_email_address_row input').focus(); | |
| 83 | + }); | |
| 84 | +}); | |
| 115 | 85 | |
| 116 | 86 | </script> |