PluginProbe
Property Hive / 2.4.0
Property Hive v2.4.0
2.4.0 2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 All 262 releases
← All changes | includes/admin/views/html-admin-matching-applicants.php +207 -68 1.4.60 → 2.4.0 View file →
@@ -1,7 +1,13 @@
1 +<?php
2 +if ( ! defined( 'ABSPATH' ) ) {
3 + exit;
4 +}
5 +?>
6 +
1 7 <div class="wrap propertyhive">
2 8
3 - <h1>Matching Applicants For <?php echo $property->get_formatted_full_address(); ?> (<?php echo count($applicants); ?>)</h1>
9 + <h1>Matching Applicants For <?php echo esc_html($property->get_formatted_full_address()); ?> (<?php echo count($applicants); ?>)</h1>
4 10
5 11 <form method="post" id="mainform" action="" enctype="multipart/form-data">
6 12
7 13 <div id="poststuff">
@@ -8,11 +14,31 @@
8 14
9 15 <?php
10 16 if ( !empty($applicants) )
11 17 {
12 - // var_dump($applicants);
18 + // 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.
19 + $select_all_actions = array(
20 + 'email' => __( 'Email', 'propertyhive' ),
21 + 'not_interested' => __( 'Not Suitable', 'propertyhive' )
22 + );
23 +
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 + $select_all_actions = apply_filters( 'propertyhive_matching_select_all_actions', $select_all_actions );
26 + ?>
27 + <div class="select-actions" style="padding-bottom:15px">
28 + <span style="display:inline-block; vertical-align:middle;"><?php echo esc_html(__( 'Select', 'propertyhive' )); ?>:</span> <?php
29 + // 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.
30 + foreach ( $select_all_actions as $key => $value )
31 + {
32 + echo '<a href="javascript:;" class="button" id="select_all_' . esc_attr(sanitize_title($key)) . '" style="display:inline-block; vertical-align:middle;">All - ' . esc_html($value) . '</a> ';
33 + }
34 + ?>
35 + <a href="javascript:;" class="button" id="select_none" style="display:inline-block; vertical-align:middle;">None</a>
36 + </div>
37 + <?php
13 38 echo '<table width="100%">';
14 39
40 + // 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.
15 41 $columns = array(
16 42 'name' => 'Name',
17 43 'contact_details' => 'Contact Details',
18 44 'requirements' => 'Requirements'
@@ -17,15 +43,17 @@
17 43 'contact_details' => 'Contact Details',
18 44 'requirements' => 'Requirements'
19 45 );
20 46
47 + // 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.
21 48 $columns = apply_filters( 'propertyhive_matching_applicants_row_headings', $columns );
22 49
23 50 echo '<thead>
24 51 <tr>';
52 + // 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 53 foreach ( $columns as $key => $column )
26 54 {
27 - echo '<th style="text-align:left">' . $column . '</th>';
55 + echo '<th style="text-align:left">' . esc_html($column) . '</th>';
28 56 }
29 57 echo '
30 58 <th style="text-align:left">Actions</th>
31 59 </tr>
@@ -32,135 +60,226 @@
32 60 </thead>
33 61 <tbody>
34 62 ';
35 63
64 + // 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.
36 65 $percentage_lower = get_option( 'propertyhive_applicant_match_price_range_percentage_lower', '' );
66 + // 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.
37 67 $percentage_higher = get_option( 'propertyhive_applicant_match_price_range_percentage_higher', '' );
38 68
69 + // 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.
39 70 foreach ( $applicants as $applicant )
40 71 {
72 + // 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.
41 73 $previously_sent = array();
74 +
75 + // 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.
76 + $currency = '&pound;';
77 + if ( isset($applicant['applicant_profile']['currency']) && !empty($applicant['applicant_profile']['currency']) )
78 + {
79 + // 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.
80 + $PH_Countries = new PH_Countries();
81 + // 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.
82 + $selected_currency = $PH_Countries->get_currency($applicant['applicant_profile']['currency']);
83 + if ( $selected_currency !== false )
84 + {
85 + // 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.
86 + $currency = $selected_currency['currency_symbol'];
87 + }
88 + }
42 89
90 + // 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.
43 91 $applicant_profile_match_history = get_post_meta( $applicant['contact_id'], '_applicant_profile_' . $applicant['applicant_profile']['applicant_profile_id'] . '_match_history', TRUE );
44 92 if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) )
45 93 {
94 + // 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.
46 95 $previously_sent = $applicant_profile_match_history[$property->id];
47 96 }
48 97
98 + // 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.
49 99 $email_address = get_post_meta( $applicant['contact_id'], '_email_address', TRUE );
100 + // 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.
50 101 $forbidden_contact_methods = get_post_meta( $applicant['contact_id'], '_forbidden_contact_methods', TRUE );
102 + // 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.
51 103 $do_not_email = false;
52 104 if ( is_array($forbidden_contact_methods) && in_array('email', $forbidden_contact_methods) )
53 105 {
106 + // 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.
54 107 $do_not_email = true;
55 108 }
56 109
110 + // 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.
57 111 $requirements = array();
58 - if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' )
112 + if (
113 + isset($applicant['applicant_profile']['department']) &&
114 + ( $applicant['applicant_profile']['department'] == 'residential-sales' || ph_get_custom_department_based_on($applicant['applicant_profile']['department']) == 'residential-sales'
115 + )
116 + )
59 117 {
60 - $requirements[] = array(
61 - 'label' => __( 'Maximum Price', 'propertyhive' ),
62 - 'value' => '&pound;' . number_format($applicant['applicant_profile']['max_price']),
63 - );
64 - }
65 - if ( $percentage_lower != '' && $percentage_higher != '' )
66 - {
67 - $match_price_range_lower = '';
68 - if ( !isset($applicant['applicant_profile']['match_price_range_lower_actual']) || ( isset($applicant['applicant_profile']['match_price_range_lower_actual']) && $applicant['applicant_profile']['match_price_range_lower_actual'] == '' ) )
118 + if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' )
69 119 {
70 - if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' )
120 + // 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.
121 + $requirements[] = array(
122 + 'label' => __( 'Maximum Price', 'propertyhive' ),
123 + 'value' => $currency . esc_html( ph_display_price_field($applicant['applicant_profile']['max_price']) ),
124 + );
125 + }
126 + if ( $percentage_lower != '' && $percentage_higher != '' )
127 + {
128 + // 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.
129 + $match_price_range_lower = '';
130 + if (
131 + !isset($applicant['applicant_profile']['match_price_range_lower_actual']) ||
132 + ( isset($applicant['applicant_profile']['match_price_range_lower_actual']) && $applicant['applicant_profile']['match_price_range_lower_actual'] == '' )
133 + )
71 134 {
72 - $match_price_range_lower = $applicant['applicant_profile']['max_price_actual'] - ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_lower / 100 ) );
135 + if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' )
136 + {
137 + // 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.
138 + $match_price_range_lower = (float) $applicant['applicant_profile']['max_price'] - ( (float) $applicant['applicant_profile']['max_price'] * ( (float) $percentage_lower / 100 ) );
139 + }
73 140 }
74 - }
75 - else
76 - {
77 - $match_price_range_lower = $applicant['applicant_profile']['match_price_range_lower_actual'];
78 - }
141 + else
142 + {
143 + // 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.
144 + $match_price_range_lower = $applicant['applicant_profile']['match_price_range_lower'];
145 + }
79 146
80 - $match_price_range_higher = '';
81 - if ( !isset($applicant['applicant_profile']['match_price_range_higher_actual']) || ( isset($applicant['applicant_profile']['match_price_range_higher_actual']) && $applicant['applicant_profile']['match_price_range_higher_actual'] == '' ) )
82 - {
83 - if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' )
147 + // 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.
148 + $match_price_range_higher = '';
149 + if (
150 + !isset($applicant['applicant_profile']['match_price_range_higher_actual']) ||
151 + ( isset($applicant['applicant_profile']['match_price_range_higher_actual']) && $applicant['applicant_profile']['match_price_range_higher_actual'] == '' )
152 + )
84 153 {
85 - $match_price_range_higher = $applicant['applicant_profile']['max_price_actual'] + ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_higher / 100 ) );
154 + if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' )
155 + {
156 + // 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.
157 + $match_price_range_higher = (float) $applicant['applicant_profile']['max_price'] + ( (float) $applicant['applicant_profile']['max_price'] * ( (float) $percentage_higher / 100 ) );
158 + }
86 159 }
160 + else
161 + {
162 + // 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.
163 + $match_price_range_higher = $applicant['applicant_profile']['match_price_range_higher'];
164 + }
165 +
166 + if (
167 + $match_price_range_lower != '' && $match_price_range_higher != ''
168 + )
169 + {
170 + // 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.
171 + $requirements[] = array(
172 + 'label' => __( 'Maximum Price Range', 'propertyhive' ),
173 + 'value' => $currency . esc_html( ph_display_price_field($match_price_range_lower) ) . ' to ' . $currency . esc_html( ph_display_price_field($match_price_range_higher) ),
174 + );
175 + }
87 176 }
88 - else
89 - {
90 - $match_price_range_higher = $applicant['applicant_profile']['match_price_range_higher_actual'];
91 - }
177 + }
92 178
93 - if (
94 - $match_price_range_lower != '' && $match_price_range_higher != ''
95 - )
179 + if (
180 + isset($applicant['applicant_profile']['department']) &&
181 + ( $applicant['applicant_profile']['department'] == 'residential-lettings' || ph_get_custom_department_based_on($applicant['applicant_profile']['department']) == 'residential-lettings'
182 + )
183 + )
184 + {
185 + if ( isset($applicant['applicant_profile']['max_rent']) && $applicant['applicant_profile']['max_rent'] != '' )
96 186 {
187 + // 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.
97 188 $requirements[] = array(
98 - 'label' => __( 'Maximum Price Range', 'propertyhive' ),
99 - 'value' => '&pound;' . number_format($match_price_range_lower) . ' to &pound;' . number_format($match_price_range_higher),
189 + 'label' => __( 'Maximum Rent', 'propertyhive' ),
190 + 'value' => $currency . esc_html( ph_display_price_field($applicant['applicant_profile']['max_rent']) ) . ' ' . esc_html( $applicant['applicant_profile']['rent_frequency'] )
100 191 );
101 192 }
102 193 }
194 +
103 195 if ( isset($applicant['applicant_profile']['min_beds']) && $applicant['applicant_profile']['min_beds'] != '' )
104 196 {
197 + // 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.
105 198 $requirements[] = array(
106 199 'label' => __( 'Minimum Beds', 'propertyhive' ),
107 - 'value' => $applicant['applicant_profile']['min_beds'],
200 + 'value' => esc_html( $applicant['applicant_profile']['min_beds'] ),
108 201 );
109 202 }
203 +
110 204 if ( isset($applicant['applicant_profile']['property_types']) && is_array($applicant['applicant_profile']['property_types']) && !empty($applicant['applicant_profile']['property_types']) )
111 205 {
112 206 //$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price'];
113 207 }
114 - if ( isset($applicant['applicant_profile']['locations']) && is_array($applicant['applicant_profile']['locations']) && !empty($applicant['applicant_profile']['locations']) )
208 +
209 + if ( get_option('propertyhive_applicant_locations_type') == 'text' && isset($applicant['applicant_profile']['location_text']) && $applicant['applicant_profile']['location_text'] != '')
115 210 {
116 - //$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price'];
211 + // 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.
212 + $location_value = $applicant['applicant_profile']['location_text'];
213 +
214 + if ( isset($applicant['applicant_profile']['location_radius']) && $applicant['applicant_profile']['location_radius'] != '' )
215 + {
216 + // 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.
217 + $location_value .= ' (Within '. $applicant['applicant_profile']['location_radius'] .' Miles)';
218 + }
219 +
220 + // 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.
221 + $requirements[] = array(
222 + 'label' => __( 'Location', 'propertyhive' ),
223 + 'value' => esc_html( $location_value ),
224 + );
117 225 }
118 226
227 + // 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.
119 228 $requirements = apply_filters( 'propertyhive_applicant_requirements_display', $requirements, $applicant['contact_id'], $applicant['applicant_profile'] );
120 229
121 230 if ( isset($applicant['applicant_profile']['notes']) && $applicant['applicant_profile']['notes'] != '' )
122 231 {
232 + // 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.
123 233 $requirements[] = array(
124 234 'label' => __( 'Notes', 'propertyhive' ),
125 - 'value' => nl2br( strip_tags($applicant['applicant_profile']['notes']) ),
235 + 'value' => nl2br( esc_html( wp_strip_all_tags($applicant['applicant_profile']['notes']) ) ),
126 236 );
127 237 }
128 238
239 + // 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.
129 240 $requirements_output = '';
130 241 if ( empty($requirements) )
131 242 {
243 + // 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.
132 244 $requirements_output = '-';
133 245 }
134 246 else
135 247 {
248 + // 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.
136 249 foreach ( $requirements as $requirement )
137 250 {
138 - $requirements_output .= $requirement['label'] . ': ' . $requirement['value'] . '<br>';
251 + // 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.
252 + $requirements_output .= esc_html( $requirement['label'] ) . ': ' . $requirement['value'] . '<br>';
139 253 }
140 254 }
141 255
256 + // 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.
142 257 $columns = array(
143 - 'name' => '<strong><a href="' . get_edit_post_link($applicant['contact_id']) . '" target="_blank">' . get_the_title($applicant['contact_id']) . '</a>' . ( ( isset($applicant['applicant_profile']['grading']) && $applicant['applicant_profile']['grading'] == 'hot' ) ? '<br><span style="color:#C00;">('. __( 'Hot Applicant', 'propertyhive' ) . ')</span>' : '' ) . '</strong>',
144 - 'contact_details' => 'T: ' . get_post_meta( $applicant['contact_id'], '_telephone_number', TRUE ) . '<br>E: ' . $email_address,
258 + 'name' => '<strong><a href="' . esc_url(get_edit_post_link($applicant['contact_id'])) . '" target="_blank">' . esc_html(get_the_title($applicant['contact_id'])) . '</a>' . ( ( isset($applicant['applicant_profile']['grading']) && $applicant['applicant_profile']['grading'] == 'hot' ) ? '<br><span style="color:#C00;">('. esc_html(__( 'Hot Applicant', 'propertyhive' )) . ')</span>' : '' ) . '</strong>',
259 + 'contact_details' => 'T: ' . esc_html(get_post_meta( $applicant['contact_id'], '_telephone_number', TRUE )) . '<br>E: ' . esc_html($email_address),
145 260 'requirements' => $requirements_output,
146 261 );
147 262
263 + // 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.
148 264 $columns = apply_filters( 'propertyhive_matching_applicants_row_data', $columns, $applicant, $property->id );
149 265
150 - echo '<tr id="matching_contact_' . $applicant['contact_id'] . '_applicant_profile_' . $applicant['applicant_profile']['applicant_profile_id'] . '">';
266 + echo '<tr id="matching_contact_' . (int)$applicant['contact_id'] . '_applicant_profile_' . (int)$applicant['applicant_profile']['applicant_profile_id'] . '">';
267 + // 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.
151 268 foreach ( $columns as $key => $column )
152 269 {
270 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Built-in row text and requirement labels/values are escaped above; preserve trusted currency, requirement and propertyhive_matching_applicants_row_data HTML filters.
153 271 echo '<td style="border-bottom:1px solid #CCC; padding:5px 0;">' . $column . '</td>';
154 272 }
155 273 echo '<td style="border-bottom:1px solid #CCC; padding:5px 0;">';
156 274
157 - echo '<label><input type="checkbox" name="email_contact_applicant_profile_id[]" value="' . $applicant['contact_id'] . '|' . $applicant['applicant_profile']['applicant_profile_id'] . '" ';
275 + echo '<label><input type="checkbox" name="email_contact_applicant_profile_id[]" value="' . (int)$applicant['contact_id'] . '|' . (int)$applicant['applicant_profile']['applicant_profile_id'] . '" ';
158 276
277 + // 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.
159 278 $post_tip = '';
160 279 if ( strpos($email_address, '@') === FALSE )
161 280 {
162 - echo ' disabled title="Invalid email address: ' . $email_address . '"';
281 + echo ' disabled title="Invalid email address: ' . esc_attr($email_address) . '"';
163 282 //$post_tip = 'Invalid email address: ' . $email_address;
164 283 }
165 284 elseif ( $do_not_email )
166 285 {
@@ -170,9 +289,10 @@
170 289 else
171 290 {
172 291 if ( !empty($previously_sent) )
173 292 {
174 - $post_tip = 'Sent previously via ' . $previously_sent[count($previously_sent) - 1]['method'] . ' on ' . date("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date']));
293 + // 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.
294 + $post_tip = 'Sent previously via ' . $previously_sent[count($previously_sent) - 1]['method'] . ' on ' . gmdate("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date']));
175 295
176 296 if (
177 297 $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] ||
178 298 $price_change_date > $previously_sent[count($previously_sent) - 1]['date']
@@ -179,13 +299,15 @@
179 299 )
180 300 {
181 301 if ( $price_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
182 302 {
183 - $post_tip .= ', however a price change occurred on ' . date("jS F Y", strtotime($price_change_date));
303 + // 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.
304 + $post_tip .= ', however a price change occurred on ' . gmdate("jS F Y", strtotime($price_change_date));
184 305 }
185 306 elseif ( $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
186 307 {
187 - $post_tip .= ', however a change to the on market status occurred on ' . date("jS F Y", strtotime($on_market_change_date));
308 + // 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.
309 + $post_tip .= ', however a change to the on market status occurred on ' . gmdate("jS F Y", strtotime($on_market_change_date));
188 310 }
189 311 echo ' checked';
190 312 }
191 313 }
@@ -194,15 +316,15 @@
194 316 echo ' checked';
195 317 }
196 318 }
197 319
198 - echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . $post_tip : '' ) . '</span></label>
320 + echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . esc_html($post_tip) : '' ) . '</span></label>
199 321
200 322 <br>';
201 323
202 324 do_action( 'propertyhive_property_match_send_methods', $applicant['contact_id'], $applicant['applicant_profile']['applicant_profile_id'], $property->id );
203 325
204 - echo '<label><input type="checkbox" name="not_interested_contact_applicant_profile_id[]" value="' . $applicant['contact_id'] . '|' . $applicant['applicant_profile']['applicant_profile_id'] . '"> Property Not Suitable</label>';
326 + echo '<label><input type="checkbox" name="not_interested_contact_applicant_profile_id[]" value="' . (int)$applicant['contact_id'] . '|' . (int)$applicant['applicant_profile']['applicant_profile_id'] . '"> Property Not Suitable</label>';
205 327
206 328 echo '</td>';
207 329 echo '</tr>';
208 330 }
@@ -213,17 +335,17 @@
213 335 ';
214 336 }
215 337 else
216 338 {
217 - echo __( 'No matching applicants found', 'propertyhive' );
339 + echo esc_html__( 'No matching applicants found', 'propertyhive' );
218 340 }
219 341 ?>
220 342
221 343 <p class="submit">
222 344
223 - <input name="save" class="button-primary" type="submit" value="<?php echo __( 'Continue', 'propertyhive' ); ?>" />
345 + <input name="save" class="button-primary" type="submit" value="<?php echo esc_html(__( 'Continue', 'propertyhive' )); ?>" />
224 346
225 - <a href="<?php echo get_edit_post_link((int)$_GET['property_id']); ?>" class="button"><?php _e( 'Cancel', 'propertyhive' ); ?></a>
347 + <a href="<?php echo esc_url(get_edit_post_link( (int) $property_id )); ?>" class="button"><?php echo esc_html(__( 'Cancel', 'propertyhive' )); ?></a>
226 348
227 349 <input type="hidden" name="step" value="one" />
228 350 <?php wp_nonce_field( 'propertyhive-matching-applicants' ); ?>
229 351
@@ -229,9 +351,9 @@
229 351
230 352 </p>
231 353
232 354 <p>
233 - <?php echo __( "If you've opted to email any of the applicants you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' ); ?>
355 + <?php echo esc_html(__( "If you've opted to email any of the applicants you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' )); ?>
234 356 </p>
235 357
236 358 </div>
237 359
@@ -240,27 +362,44 @@
240 362 </div>
241 363
242 364 <script>
243 365
244 - jQuery('body').on('change', 'input[name=\'not_interested_contact_applicant_profile_id[]\']', function()
366 + jQuery(document).ready(function()
245 367 {
246 - var applicant_contact_profile_id = jQuery(this).val();
247 - var applicant_contact_profile_id_split = applicant_contact_profile_id.split('|');
368 + jQuery('body').on('change', 'input[name=\'not_interested_contact_applicant_profile_id[]\']', function()
369 + {
370 + var applicant_contact_profile_id = jQuery(this).val();
371 + var applicant_contact_profile_id_split = applicant_contact_profile_id.split('|');
248 372
249 - jQuery('input[name=\'email_contact_applicant_profile_id[]\'][value=\'' + applicant_contact_profile_id + '\']').attr('checked', false);
373 + jQuery('input[name=\'email_contact_applicant_profile_id[]\'][value=\'' + applicant_contact_profile_id + '\']').attr('checked', false);
250 374
251 - opacity = 0.4;
252 - if ( !jQuery(this).is(':checked') )
375 + opacity = 0.4;
376 + if ( !jQuery(this).is(':checked') )
377 + {
378 + opacity = 1;
379 + }
380 + jQuery('#matching_contact_' + applicant_contact_profile_id_split[0] + '_applicant_profile_' + applicant_contact_profile_id_split[1]).animate({
381 + opacity: opacity
382 + },
383 + {
384 + duration: 250
385 + });
386 +
387 + return false;
388 + });
389 +
390 + jQuery('.select-actions a').click(function(e)
253 391 {
254 - opacity = 1;
255 - }
256 - jQuery('#matching_contact_' + applicant_contact_profile_id_split[0] + '_applicant_profile_' + applicant_contact_profile_id_split[1]).animate({
257 - opacity: opacity
258 - },
259 - {
260 - duration: 250
392 + e.preventDefault();
393 +
394 + var id = jQuery(this).attr('id').replace("select_all_", "");
395 +
396 + jQuery('input[name$=\'_contact_applicant_profile_id[]\']').prop('checked', false);
397 +
398 + if ( id != 'select_none' )
399 + {
400 + jQuery('input[name=\'' + id + '_contact_applicant_profile_id[]\']').prop('checked', 'checked');
401 + }
261 402 });
262 -
263 - return false;
264 403 });
265 404
266 405 </script>