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