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-properties.php +360 -76 1.4.5 → 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 Properties For <?php echo get_the_title($contact_id); ?> (<?php echo count($properties); ?>)</h1>
9 + <h1>Matching Properties For <?php echo esc_html(get_the_title($contact_id)); ?> (<?php echo count($properties); ?>)</h1>
4 10
5 11 <form method="post" id="mainform" action="" enctype="multipart/form-data">
6 12
7 13 <div id="poststuff">
@@ -6,110 +12,305 @@
6 12
7 13 <div id="poststuff">
8 14
9 15 <?php
16 + // 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 + $percentage_lower = get_option( 'propertyhive_applicant_match_price_range_percentage_lower', '' );
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 + $percentage_higher = get_option( 'propertyhive_applicant_match_price_range_percentage_higher', '' );
20 +
21 + // 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.
22 + $currency = '&pound;';
23 + if ( isset($applicant_profile['currency']) && !empty($applicant_profile['currency']) )
24 + {
25 + // 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.
26 + $PH_Countries = new PH_Countries();
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 + $selected_currency = $PH_Countries->get_currency($applicant_profile['currency']);
29 + if ( $selected_currency !== false )
30 + {
31 + // 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.
32 + $currency = $selected_currency['currency_symbol'];
33 + }
34 + }
35 +
10 36 echo '<div style="background:#F3F3F3; border:1px solid #DDD; padding:20px;">
11 37
12 - <h3 style="padding-top:0; margin-top:0;">Applicant Requirements</h3>';
38 + <h3 style="padding-top:0; margin-top:0;">' . esc_html( __('Applicant Requirements', 'propertyhive') ) . '</h3>';
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.
41 + $requirements = array();
42 +
13 43 if (
14 - isset($applicant_profile['department']) && $applicant_profile['department'] == 'residential-sales' &&
15 - isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' && $applicant_profile['max_price_actual'] != 0
44 + isset($applicant_profile['department']) &&
45 + ( $applicant_profile['department'] == 'residential-sales' || ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-sales' ) &&
46 + isset($applicant_profile['max_price_actual']) &&
47 + $applicant_profile['max_price_actual'] != '' &&
48 + $applicant_profile['max_price_actual'] != 0
16 49 )
17 50 {
18 - echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
19 - <strong>Maximum Price:</strong><br>
20 - &pound;' . number_format($applicant_profile['max_price']) . '
21 - </div>';
51 + // 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.
52 + $requirements[] = array(
53 + 'label' => __( 'Maximum Price', 'propertyhive' ),
54 + 'value' => $currency . esc_html( ph_display_price_field($applicant_profile['max_price']) ),
55 + );
22 56 }
23 57 if (
24 - isset($applicant_profile['department']) && $applicant_profile['department'] == 'residential-lettings' &&
58 + isset($applicant_profile['department']) &&
59 + ( $applicant_profile['department'] == 'residential-sales' || ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-sales'
60 + )
61 + )
62 + {
63 + if ( $percentage_lower != '' && $percentage_higher != '' )
64 + {
65 + // 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.
66 + $match_price_range_lower = '';
67 + // 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.
68 + $match_price_range_lower_display = '';
69 + if (
70 + !isset($applicant_profile['match_price_range_lower_actual']) ||
71 + ( isset($applicant_profile['match_price_range_lower_actual']) && $applicant_profile['match_price_range_lower_actual'] == '' )
72 + )
73 + {
74 + if ( isset($applicant_profile['max_price']) && $applicant_profile['max_price'] != '' )
75 + {
76 + // 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.
77 + $match_price_range_lower = (float) $applicant_profile['max_price'] - ( (float) $applicant_profile['max_price'] * ( (float) $percentage_lower / 100 ) );
78 + }
79 + }
80 + else
81 + {
82 + // 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.
83 + $match_price_range_lower = $applicant_profile['match_price_range_lower'];
84 + }
85 +
86 + // 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.
87 + $match_price_range_higher = '';
88 + if (
89 + !isset($applicant_profile['match_price_range_higher_actual']) ||
90 + ( isset($applicant_profile['match_price_range_higher_actual']) && $applicant_profile['match_price_range_higher_actual'] == '' )
91 + )
92 + {
93 + if ( isset($applicant_profile['max_price']) && $applicant_profile['max_price'] != '' )
94 + {
95 + // 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.
96 + $match_price_range_higher = (float) $applicant_profile['max_price'] + ( (float) $applicant_profile['max_price'] * ( (float) $percentage_higher / 100 ) );
97 + }
98 + }
99 + else
100 + {
101 + // 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.
102 + $match_price_range_higher = $applicant_profile['match_price_range_higher'];
103 + }
104 +
105 + if (
106 + $match_price_range_lower != '' && $match_price_range_higher != ''
107 + )
108 + {
109 + // 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.
110 + $requirements[] = array(
111 + 'label' => __( 'Match Price Range', 'propertyhive' ),
112 + 'value' => $currency . esc_html( ph_display_price_field($match_price_range_lower) ) . ' to ' . $currency . esc_html( ph_display_price_field($match_price_range_higher) ),
113 + );
114 + }
115 + }
116 + }
117 + if (
118 + isset($applicant_profile['department']) && ( $applicant_profile['department'] == 'residential-lettings' || ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-lettings' ) &&
25 119 isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' && $applicant_profile['max_price_actual'] != 0
26 120 )
27 121 {
28 - echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
29 - <strong>Maximum Rent:</strong><br>
30 - &pound;' . number_format($applicant_profile['max_rent']) . ' ' . $applicant_profile['rent_frequency'] . '
31 - </div>';
122 + // 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 + $requirements[] = array(
124 + 'label' => __( 'Maximum Rent', 'propertyhive' ),
125 + 'value' => $currency . esc_html( ph_display_price_field($applicant_profile['max_rent']) ) . ' ' . esc_html( $applicant_profile['rent_frequency'] ),
126 + );
32 127 }
33 128 if (
34 129 isset($applicant_profile['department']) &&
35 - ( $applicant_profile['department'] == 'residential-sales' || $applicant_profile['department'] == 'residential-lettings' )
130 + (
131 + $applicant_profile['department'] == 'residential-sales' ||
132 + $applicant_profile['department'] == 'residential-lettings' ||
133 + ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-sales' ||
134 + ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-lettings'
135 + )
36 136 )
37 137 {
38 138 if ( isset($applicant_profile['min_beds']) && $applicant_profile['min_beds'] != '' && $applicant_profile['min_beds'] != 0 )
39 139 {
40 - echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
41 - <strong>Minimum Beds:</strong><br>
42 - ' . $applicant_profile['min_beds'] . '
43 - </div>';
140 + // 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.
141 + $requirements[] = array(
142 + 'label' => __( 'Minimum Beds', 'propertyhive' ),
143 + 'value' => esc_html( $applicant_profile['min_beds'] ),
144 + );
44 145 }
45 146 if ( isset($applicant_profile['property_types']) && is_array($applicant_profile['property_types']) && !empty($applicant_profile['property_types']) )
46 147 {
47 - $terms = get_terms('property_type', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['property_types']));
148 + // 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.
149 + $terms = get_terms( array_merge( wp_parse_args( array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['property_types']) ), array( 'taxonomy' => 'property_type' ) ) );
48 150 if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
49 151 {
152 + // 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 153 $sliced_terms = array_slice( $terms, 0, 2 );
51 - echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
52 - <strong>Property Types:</strong><br>
53 - ' . implode(", ", $sliced_terms) . ( (count($terms) > 2) ? '<span title="' . addslashes( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ) . '
54 - </div>';
154 +
155 + // 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.
156 + $requirements[] = array(
157 + 'label' => __( 'Property Types', 'propertyhive' ),
158 + 'value' => esc_html( implode(", ", $sliced_terms) ) . ( (count($terms) > 2) ? '<span title="' . esc_attr( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ),
159 + );
55 160 }
56 161 }
57 162 }
58 163 if (
59 164 isset($applicant_profile['department']) &&
60 - ( $applicant_profile['department'] == 'commercial' )
165 + ( $applicant_profile['department'] == 'commercial' || ph_get_custom_department_based_on($applicant_profile['department']) == 'commercial' )
61 166 )
62 167 {
63 168 if ( isset($applicant_profile['available_as']) && is_array($applicant_profile['available_as']) && !empty($applicant_profile['available_as']) )
64 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.
65 171 $available_as = array();
66 172 if ( in_array('sale', $applicant_profile['available_as']) )
67 173 {
174 + // 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.
68 175 $available_as[] = 'For Sale';
69 176 }
70 177 if ( in_array('rent', $applicant_profile['available_as']) )
71 178 {
179 + // 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.
72 180 $available_as[] = 'To Rent';
73 181 }
74 182
75 - echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
76 - <strong>Available As:</strong><br>
77 - ' . implode(", ", $available_as) .'
78 - </div>';
183 + // 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.
184 + $requirements[] = array(
185 + 'label' => __( 'Available As', 'propertyhive' ),
186 + 'value' => implode(", ", $available_as),
187 + );
79 188 }
80 189
190 + if (
191 + (isset($applicant_profile['min_floor_area_actual']) && $applicant_profile['min_floor_area_actual'] != '')
192 + ||
193 + (isset($applicant_profile['max_floor_area_actual']) && $applicant_profile['max_floor_area_actual'] != '')
194 + )
195 + {
196 + // 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.
197 + $sizes = array('min' => '', 'max' => '');
198 + // 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.
199 + $value = '';
200 + if ( isset($applicant_profile['min_floor_area_actual']) && $applicant_profile['min_floor_area_actual'] != '' )
201 + {
202 + // 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.
203 + $sizes['min'] = $applicant_profile['min_floor_area_actual'];
204 + }
205 + if ( isset($applicant_profile['max_floor_area_actual']) && $applicant_profile['max_floor_area_actual'] != '' )
206 + {
207 + // 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.
208 + $sizes['max'] = $applicant_profile['max_floor_area_actual'];
209 + }
210 + if ( $sizes['min'] != '' && $sizes['max'] != '' )
211 + {
212 + // 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.
213 + $value = number_format( (float) $sizes['min'] ) . ' - ' . number_format( (float) $sizes['max'] ) . ' Sq Ft';
214 + }
215 + if ( $sizes['min'] != '' && $sizes['max'] == '' )
216 + {
217 + // 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.
218 + $value = 'From ' . number_format( (float) $sizes['min'] ) . ' Sq Ft';
219 + }
220 + if ( $sizes['min'] == '' && $sizes['max'] != '' )
221 + {
222 + // 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.
223 + $value = 'Up To ' . number_format( (float) $sizes['max'] ) . ' Sq Ft';
224 + }
225 +
226 + if ( $value != '' )
227 + {
228 + // 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.
229 + $requirements[] = array(
230 + 'label' => __( 'Floor Area', 'propertyhive' ),
231 + 'value' => $value,
232 + );
233 + }
234 + }
235 +
81 236 if ( isset($applicant_profile['commercial_property_types']) && is_array($applicant_profile['commercial_property_types']) && !empty($applicant_profile['commercial_property_types']) )
82 237 {
83 - $terms = get_terms('commercial_property_type', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['commercial_property_types']));
238 + // 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.
239 + $terms = get_terms( array_merge( wp_parse_args( array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['commercial_property_types']) ), array( 'taxonomy' => 'commercial_property_type' ) ) );
84 240 if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
85 241 {
242 + // 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 243 $sliced_terms = array_slice( $terms, 0, 2 );
87 - echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
88 - <strong>Property Types:</strong><br>
89 - ' . implode(", ", $sliced_terms) . ( (count($terms) > 2) ? '<span title="' . addslashes( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ) . '
90 - </div>';
244 +
245 + // 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.
246 + $requirements[] = array(
247 + 'label' => __( 'Property Types', 'propertyhive' ),
248 + 'value' => esc_html( implode(", ", $sliced_terms) ) . ( (count($terms) > 2) ? '<span title="' . esc_attr( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ),
249 + );
91 250 }
92 251 }
93 252 }
94 - if ( isset($applicant_profile['locations']) && is_array($applicant_profile['locations']) && !empty($applicant_profile['locations']) )
253 + if ( get_option('propertyhive_applicant_locations_type') != 'text' )
95 254 {
96 - $terms = get_terms('location', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['locations']));
97 - if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
255 + if ( isset($applicant_profile['locations']) && is_array($applicant_profile['locations']) && !empty($applicant_profile['locations']) )
98 256 {
99 - $sliced_terms = array_slice( $terms, 0, 2 );
100 - echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
101 - <strong>Locations:</strong><br>
102 - ' . implode(", ", $sliced_terms) . ( (count($terms) > 2) ? ' <span title="' . addslashes( implode(", ", $terms) ) .'">+ ' . (count($terms) - 2) . ' more</span>' : '' ) . '
103 - </div>';
257 + // 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.
258 + $terms = get_terms( array_merge( wp_parse_args( array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['locations']) ), array( 'taxonomy' => 'location' ) ) );
259 + if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
260 + {
261 + // 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.
262 + $sliced_terms = array_slice( $terms, 0, 2 );
263 +
264 + // 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.
265 + $requirements[] = array(
266 + 'label' => __( 'Locations', 'propertyhive' ),
267 + 'value' => esc_html( implode(", ", $sliced_terms) ) . ( (count($terms) > 2) ? ' <span title="' . esc_attr( implode(", ", $terms) ) .'">+ ' . (count($terms) - 2) . ' more</span>' : '' ),
268 + );
269 + }
104 270 }
105 271 }
272 + else
273 + {
274 + if ( isset($applicant_profile['location_text']) && trim($applicant_profile['location_text']) != '' )
275 + {
276 + // 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.
277 + $location_value = trim($applicant_profile['location_text']);
106 278
279 + if ( isset($applicant_profile['location_radius']) && $applicant_profile['location_radius'] != '' )
280 + {
281 + // 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.
282 + $location_value .= ' (Within '. $applicant_profile['location_radius'] .' Miles)';
283 + }
284 +
285 + // 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.
286 + $requirements[] = array(
287 + 'label' => __( 'Location', 'propertyhive' ),
288 + 'value' => esc_html( $location_value ),
289 + );
290 + }
291 + }
292 +
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 + $requirements = apply_filters( 'propertyhive_applicant_requirements_display', $requirements, $contact_id, $applicant_profile );
295 +
296 + if ( !empty($requirements) )
297 + {
298 + // 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.
299 + foreach ( $requirements as $requirement )
300 + {
301 + echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"><strong>' . esc_html( $requirement['label'] ) . ':</strong><br>';
302 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core requirement values escape stored text/attributes above; preserve trusted HTML supplied by propertyhive_applicant_requirements_display and currency-symbol filters.
303 + echo $requirement['value'];
304 + echo '</div>';
305 + }
306 + }
307 +
107 308 if ( isset($applicant_profile['notes']) && $applicant_profile['notes'] != '' )
108 309 {
109 310 echo '<div style="display:inline-block; width:100%; vertical-align:top; margin-top:15px;">
110 311 <strong>Additional Requirement Notes:</strong><br>
111 - ' . strip_tags( $applicant_profile['notes'] ) . '
312 + ' . nl2br( esc_html( wp_strip_all_tags( $applicant_profile['notes'] ) ) ) . '
112 313 </div>';
113 314 }
114 315
115 316 echo '</div>';
@@ -117,62 +318,107 @@
117 318
118 319 <?php
119 320 if ( !empty($properties) )
120 321 {
322 + // 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.
323 + $select_all_actions = array(
324 + 'email' => __( 'Email', 'propertyhive' ),
325 + 'not_interested' => __( 'Not Suitable', 'propertyhive' )
326 + );
327 +
328 + // 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.
329 + $select_all_actions = apply_filters( 'propertyhive_matching_select_all_actions', $select_all_actions );
330 + ?>
331 + <div class="select-actions" style="padding-top:15px">
332 + <span style="display:inline-block; vertical-align:middle;"><?php echo esc_html(__( 'Select', 'propertyhive' )); ?>:</span> <?php
333 + // 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.
334 + foreach ( $select_all_actions as $key => $value )
335 + {
336 + 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> ';
337 + }
338 + ?>
339 + <a href="javascript:;" class="button" id="select_none" style="display:inline-block; vertical-align:middle;">None</a>
340 + </div>
341 +
342 + <?php
343 + // 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 344 foreach ( $properties as $property )
122 345 {
346 + // 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 347 $previously_sent = array();
124 348 if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) )
125 349 {
350 + // 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.
126 351 $previously_sent = $applicant_profile_match_history[$property->id];
127 352 }
128 353
129 - echo '<div id="matching_applicant_' . $contact_id . '_property_' . $property->id . '" style="padding:20px 0; border-bottom:1px solid #CCC;">';
354 + // 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.
355 + $on_market_change_date = $property->_on_market_change_date;
356 + // 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.
357 + $price_change_date = $property->_price_change_date;
358 +
359 + echo '<div id="matching_applicant_' . (int)$contact_id . '_property_' . (int)$property->id . '" style="padding:20px 0; border-bottom:1px solid #CCC;">';
130 360
131 - echo '<div style="float:left; width:18%;"><a href="' . get_edit_post_link( $property->id ) . '" target="_blank"><img src="' . $property->get_main_photo_src() . '" style="max-width:100%; margin:0 auto; display:block;" alt="' . addslashes($property->get_formatted_summary_address()) . '"></a></div>';
361 + echo '<div style="float:left; width:18%;">';
362 +
363 + // 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.
364 + $image_url = $property->get_main_photo_src();
365 + if ( $image_url !== FALSE )
366 + {
367 + echo '<a href="' . esc_url(get_edit_post_link( $property->id )) . '" target="_blank"><img src="' . esc_url($image_url) . '" style="max-width:100%; margin:0 auto; display:block;" alt="' . esc_attr($property->get_formatted_summary_address()) . '"></a>';
368 + }
369 +
370 + echo '</div>';
132 371
133 372 echo '<div style="float:right; width:80%;">';
134 373
135 - echo '<h3 style="margin:0; padding:0; margin-bottom:9px;"><a href="' . get_edit_post_link( $property->id ) . '" target="_blank">' . $property->get_formatted_summary_address() . '</a></h3>';
374 + echo '<h3 style="margin:0; padding:0; margin-bottom:9px;"><a href="' . esc_url(get_edit_post_link( $property->id )) . '" target="_blank">' . esc_html($property->get_formatted_summary_address()) . '</a></h3>';
136 375
137 - echo '<div style="margin-bottom:7px; font-size:15px;">
138 - <strong>' . ( ($property->_department == 'residential-lettings') ? __('Rent', 'propertyhive') : __('Price', 'propertyhive') ) . ': ' . $property->price_qualifier . ' ' . $property->get_formatted_price() . '</strong>
139 - | ';
140 - if ($property->department != 'commercial')
376 + echo '<div style="margin-bottom:7px; font-size:15px;"><strong>' . esc_html( ( $property->_department == 'residential-lettings' ) ? __( 'Rent', 'propertyhive' ) : __( 'Price', 'propertyhive' ) ) . ': ' . esc_html( $property->price_qualifier ) . ' ';
377 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Price producers escape stored text before trusted currency/commercial/property price HTML filters.
378 + echo $property->get_formatted_price();
379 + echo '</strong> | ';
380 + if ($property->department != 'commercial' || ph_get_custom_department_based_on($property->department) == 'commercial')
141 381 {
142 - echo $property->bedrooms . ' bed | ';
382 + echo esc_html( $property->bedrooms ) . ' bed | ';
143 383 }
144 384 else
145 385 {
386 + // 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.
146 387 $floor_area = $property->get_formatted_floor_area();
147 388 if ( $floor_area != '' )
148 389 {
390 + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Floor-area producer escapes base text before the trusted propertyhive_floor_area_output HTML filter.
149 391 echo $floor_area . ' | ';
150 392 }
151 393 }
394 + // 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.
152 395 $property_type = $property->get_property_type();
153 396 if ( $property_type != '' )
154 397 {
155 - echo $property_type . ' | ';
398 + echo esc_html($property_type) . ' | ';
156 399 }
157 - echo ' ' . $property->get_availability() . '
400 + echo ' ' . esc_html($property->get_availability()) . '
158 401 </div>';
159 402
160 - echo '<div style="margin-bottom:7px;">' . strip_tags(get_the_excerpt()) . '</div>';
403 + echo '<div style="margin-bottom:7px;">' . esc_html(wp_strip_all_tags(get_the_excerpt($property->id))) . '</div>';
161 404
162 405 echo '<div style="background:#F8F8F8; padding:12px 11px; line-height:1.7em; border:1px solid #DDD; font-weight:700">
163 406
164 - <label><input type="checkbox" name="email_property_id[]" value="' . $property->id . '" ';
407 + <label><input type="checkbox" name="email_property_id[]" value="' . (int)$property->id . '" ';
165 408
409 + // 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.
166 410 $post_tip = '';
167 411 if ( strpos($email_address, '@') === FALSE )
168 412 {
169 - echo ' disabled title="Invalid email address: ' . $email_address . '"';
413 + echo ' disabled title="Invalid email address: ' . esc_attr($email_address) . '"';
414 + // 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.
170 415 $post_tip = 'Invalid email address: ' . $email_address;
171 416 }
172 417 elseif ( $do_not_email )
173 418 {
174 419 echo ' disabled title="Contact via email not permitted - Set under contact details"';
420 + // 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.
175 421 $post_tip = 'Contact via email not permitted - Set under contact details';
176 422 }
177 423 else
178 424 {
@@ -177,9 +423,28 @@
177 423 else
178 424 {
179 425 if ( !empty($previously_sent) )
180 426 {
181 - $post_tip = 'Sent previously on ' . date("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date']));
427 + // 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.
428 + $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']));
429 +
430 + if (
431 + $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] ||
432 + $price_change_date > $previously_sent[count($previously_sent) - 1]['date']
433 + )
434 + {
435 + if ( $price_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
436 + {
437 + // 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.
438 + $post_tip .= ', however a price change occurred on ' . gmdate("jS F Y", strtotime($price_change_date));
439 + }
440 + elseif ( $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
441 + {
442 + // 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.
443 + $post_tip .= ', however a change to the on market status occurred on ' . gmdate("jS F Y", strtotime($on_market_change_date));
444 + }
445 + echo ' checked';
446 + }
182 447 }
183 448 else
184 449 {
185 450 echo ' checked';
@@ -185,14 +450,16 @@
185 450 echo ' checked';
186 451 }
187 452 }
188 453
189 - echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . $post_tip : '' ) . '</span></label>
454 + echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . esc_html($post_tip) : '' ) . '</span></label>
190 455
191 - <br>
456 + <br>';
192 457
193 - <label><input type="checkbox" name="not_interested_property_id[]" value="' . $property->id . '"> Property Not Suitable</label>
458 + do_action( 'propertyhive_applicant_match_send_methods', $contact_id, $applicant_profile_id, $property->id );
194 459
460 + echo '<label><input type="checkbox" name="not_interested_property_id[]" value="' . (int)$property->id . '"> Property Not Suitable</label>
461 +
195 462 </div>';
196 463
197 464 echo '</div>';
198 465
@@ -204,11 +471,11 @@
204 471 ?>
205 472
206 473 <p class="submit">
207 474
208 - <input name="save" class="button-primary" type="submit" value="<?php echo __( 'Continue', 'propertyhive' ); ?>" />
475 + <input name="save" class="button-primary" type="submit" value="<?php echo esc_html(__( 'Continue', 'propertyhive' )); ?>" />
209 476
210 - <a href="<?php echo get_edit_post_link($_GET['contact_id']); ?>" class="button"><?php _e( 'Cancel', 'propertyhive' ); ?></a>
477 + <a href="<?php echo esc_url(get_edit_post_link( (int) $contact_id )); ?>" class="button"><?php echo esc_html(__( 'Cancel', 'propertyhive' )); ?></a>
211 478
212 479 <input type="hidden" name="step" value="one" />
213 480 <?php wp_nonce_field( 'propertyhive-matching-properties' ); ?>
214 481
@@ -214,9 +481,9 @@
214 481
215 482 </p>
216 483
217 484 <p>
218 - <?php echo __( "If you've opted to email any of the properties you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' ); ?>
485 + <?php echo esc_html(__( "If you've opted to email any of the properties you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' )); ?>
219 486 </p>
220 487
221 488 </div>
222 489
@@ -225,26 +492,43 @@
225 492 </div>
226 493
227 494 <script>
228 495
229 - jQuery('body').on('change', 'input[name=\'not_interested_property_id[]\']', function()
496 + jQuery(document).ready(function()
230 497 {
231 - var property_id = jQuery(this).val();
498 + jQuery('body').on('change', 'input[name=\'not_interested_property_id[]\']', function()
499 + {
500 + var property_id = jQuery(this).val();
232 501
233 - jQuery('input[name=\'email_property_id[]\'][value=\'' + property_id + '\']').attr('checked', false);
502 + jQuery('input[name=\'email_property_id[]\'][value=\'' + property_id + '\']').attr('checked', false);
234 503
235 - opacity = 0.4;
236 - if ( !jQuery(this).is(':checked') )
504 + opacity = 0.4;
505 + if ( !jQuery(this).is(':checked') )
506 + {
507 + opacity = 1;
508 + }
509 + jQuery('#matching_applicant_<?php echo (int)$contact_id; ?>_property_' + property_id).animate({
510 + opacity: opacity
511 + },
512 + {
513 + duration: 250
514 + });
515 +
516 + return false;
517 + });
518 +
519 + jQuery('.select-actions a').click(function(e)
237 520 {
238 - opacity = 1;
239 - }
240 - jQuery('#matching_applicant_<?php echo $contact_id; ?>_property_' + property_id).animate({
241 - opacity: opacity
242 - },
243 - {
244 - duration: 250
521 + e.preventDefault();
522 +
523 + var id = jQuery(this).attr('id').replace("select_all_", "");
524 +
525 + jQuery('input[name$=\'_property_id[]\']').prop('checked', false);
526 +
527 + if ( id != 'select_none' )
528 + {
529 + jQuery('input[name=\'' + id + '_property_id[]\']').prop('checked', 'checked');
530 + }
245 531 });
246 -
247 - return false;
248 532 });
249 533
250 534 </script>