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