PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
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 1.4.62 All 260 releases
← All changes | includes/admin/views/html-display-notes.php +84 -11 2.2.42.3.0 View file →
@@ -3,11 +3,18 @@
3 3 if ( ! defined( 'ABSPATH' ) ) {
4 4 exit; // Exit if accessed directly
5 5 }
6 6
7 +// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Read-only display mode; parent CRM renderer enforces access, and note mutations verify their own nonce.
8 +$propertyhive_has_pinned_filter = isset( $_POST['pinned'] );
9 +// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Read-only display filter, with a scalar integer conversion.
10 +$propertyhive_pinned_only = $propertyhive_has_pinned_filter && is_scalar( $_POST['pinned'] ) && 1 === (int) $_POST['pinned'];
11 +
12 +// 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.
7 13 $args = array(
8 14 'post_id' => (int)$post->ID,
9 15 'type' => 'propertyhive_note',
16 + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Notes use the existing serialized related_to comment metadata to include cross-record relationships.
10 17 'meta_query' => array(
11 18 array(
12 19 'key' => 'related_to',
13 20 'value' => '"' . (int)$post->ID . '"',
@@ -15,22 +22,28 @@
15 22 ),
16 23 )
17 24 );
18 25
19 -if ( isset($_POST['pinned']) && (int)$_POST['pinned'] == 1 )
26 +if ( $propertyhive_pinned_only )
20 27 {
28 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
21 29 $args['search'] = '"pinned";s:1:"1"';
22 30 }
23 31
32 +// 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 33 $notes = get_comments( $args );
25 34
35 +// 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 36 $pinned_notes = array();
37 +// 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.
27 38 $unpinned_notes = array();
28 39
29 40 if ( !empty($notes) )
30 41 {
42 + // 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.
31 43 foreach( $notes as $note )
32 44 {
45 + // 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.
33 46 $comment_content = @unserialize($note->comment_content, ['allowed_classes' => false]);
34 47
35 48 if ( $comment_content === false )
36 49 {
@@ -36,8 +49,9 @@
36 49 {
37 50 continue;
38 51 }
39 52
53 + // 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.
40 54 $note_body = 'Unknown note type';
41 55 switch ( $comment_content['note_type'] )
42 56 {
43 57 case "mailout":
@@ -43,43 +57,58 @@
43 57 case "mailout":
44 58 {
45 59 if ( isset($comment_content['method']) && $comment_content['method'] == 'email' && isset($comment_content['email_log_id']) )
46 60 {
47 - $email_log = $wpdb->get_row( "SELECT * FROM " . $wpdb->prefix . "ph_email_log WHERE email_id = '" . $comment_content['email_log_id'] . "'" );
61 + // 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.
62 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable. Prepared single-row lookup in the plugin email queue; show current delivery status changed asynchronously by the mail worker.
63 + $email_log = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}ph_email_log WHERE email_id = %d", (int) $comment_content['email_log_id'] ) );
48 64
49 65 if ( null !== $email_log )
50 66 {
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.
51 68 $next_cron_run = '';
69 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
52 70 $email_status = '';
71 + // 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.
53 72 $note_suffix = '';
54 73 switch ($email_log->status) {
55 74 case '':
75 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
56 76 $next_cron_run = $next_cron_run ?: propertyhive_human_time_difference( wp_next_scheduled( 'propertyhive_process_email_log' ) );
77 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
57 78 $email_status = __( 'queued', 'propertyhive' );
79 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
58 80 $note_suffix = '<em>(' . __( 'Due to be sent', 'propertyhive' ) . ' ' . $next_cron_run . ')</em>';
59 81 break;
60 82 case 'fail1':
61 83 case 'fail2':
84 + // 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.
62 85 $email_status = '<b>' . __( 'failed', 'propertyhive' ) . '</b>';
63 86 break;
64 87 }
88 + // 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 89 $note_body = '';
66 90 if ($section == 'property')
67 91 {
92 + // 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 93 $note_body .= 'Included in ' . $email_status . ' email mailout to ' . get_the_title($email_log->contact_id) . '. ' . $note_suffix;
69 94 }
70 95 elseif ($section == 'contact')
71 96 {
97 + // 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 98 $property_ids = @unserialize($email_log->property_ids, ['allowed_classes' => false]);
73 99 if ( $property_ids !== false )
74 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.
75 102 $note_body .= count($property_ids) . ' propert' . ( (count($property_ids) != 1) ? 'ies' : 'y' ) . ' included in ' . $email_status . ' email mailout. ' . $note_suffix;
76 103 }
77 104 }
105 + // 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.
78 106 $note_body .= ' <a href="' . wp_nonce_url( admin_url('?view_propertyhive_email=' . $comment_content['email_log_id'] . '&email_id=' . $comment_content['email_log_id'] ), 'view-email' ) . '" target="_blank">View Mailout</a>';
79 107 }
80 108 else
81 109 {
110 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
82 111 $keep_logs_days = (string)apply_filters( 'propertyhive_keep_email_logs_days', '3650' ); // 10 years
83 112
84 113 // Revert back to 3650 days if anything other than numbers has been passed
85 114 // This prevent SQL injection and errors
@@ -84,11 +113,13 @@
84 113 // Revert back to 3650 days if anything other than numbers has been passed
85 114 // This prevent SQL injection and errors
86 115 if ( !preg_match("/^\d+$/", $keep_logs_days) )
87 116 {
117 + // 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.
88 118 $keep_logs_days = '3650';
89 119 }
90 120
121 + // 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.
91 122 $note_body = 'The details of the email have since been deleted as we remove details of emails sent more then ' . $keep_logs_days . ' days ago';
92 123 }
93 124 }
94 125 break;
@@ -98,22 +129,27 @@
98 129 switch ( $comment_content['action'] )
99 130 {
100 131 case "property_price_change":
101 132 {
133 + // 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 134 $note_body = $comment_content['action'] . '<br>From: ' . $comment_content['original_value'] . '<br>To: ' . $comment_content['new_value'];
103 135 break;
104 136 }
105 137 case "property_availability_change":
106 138 {
139 + // 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.
107 140 $note_body = $comment_content['action'] . '<br>From: ' . $comment_content['original_value'] . '<br>To: ' . $comment_content['new_value'];
108 141 break;
109 142 }
110 143 case "viewing_booked":
111 144 {
145 + // 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.
112 146 $note_body = '<a href="' . get_edit_post_link($comment_content['viewing_id']) . '">Viewing</a> booked';
113 147 if ( isset($comment_content['property_id']) )
114 148 {
149 + // 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 150 $property = new PH_Property((int)$comment_content['property_id']);
151 + // 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.
116 152 $note_body .= ' on <a href="' . get_edit_post_link($comment_content['property_id']) . '">' . $property->get_formatted_full_address() . '</a>';
117 153 }
118 154 break;
119 155 }
@@ -118,12 +154,15 @@
118 154 break;
119 155 }
120 156 case "added_to_viewing":
121 157 {
158 + // 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 159 $note_body = 'Added to <a href="' . get_edit_post_link($comment_content['viewing_id']) . '">viewing</a>';
123 160 if ( isset($comment_content['property_id']) )
124 161 {
162 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
125 163 $property = new PH_Property((int)$comment_content['property_id']);
164 + // 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 165 $note_body .= ' on <a href="' . get_edit_post_link($comment_content['property_id']) . '">' . $property->get_formatted_full_address() . '</a>';
127 166 }
128 167 break;
129 168 }
@@ -128,12 +167,15 @@
128 167 break;
129 168 }
130 169 case "tenancy_booked":
131 170 {
171 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
132 172 $note_body = '<a href="' . get_edit_post_link($comment_content['tenancy_id']) . '">Tenancy</a> created';
133 173 if ( isset($comment_content['property_id']) )
134 174 {
175 + // 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.
135 176 $property = new PH_Property((int)$comment_content['property_id']);
177 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
136 178 $note_body .= ' on <a href="' . get_edit_post_link($comment_content['property_id']) . '">' . $property->get_formatted_full_address() . '</a>';
137 179 }
138 180 break;
139 181 }
@@ -138,12 +180,15 @@
138 180 break;
139 181 }
140 182 case "added_to_tenancy":
141 183 {
184 + // 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 185 $note_body = 'Added to <a href="' . get_edit_post_link($comment_content['tenancy_id']) . '">tenancy</a>';
143 186 if ( isset($comment_content['property_id']) )
144 187 {
188 + // 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 189 $property = new PH_Property((int)$comment_content['property_id']);
190 + // 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 191 $note_body .= ' on <a href="' . get_edit_post_link($comment_content['property_id']) . '">' . $property->get_formatted_full_address() . '</a>';
147 192 }
148 193 break;
149 194 }
@@ -150,12 +195,14 @@
150 195 case "removed_from_tenancy":
151 196 {
152 197 if (isset($comment_content['tenancy_id']))
153 198 {
199 + // 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.
154 200 $note_body = 'Removed from <a href="' . get_edit_post_link($comment_content['tenancy_id']) . '">tenancy</a>';
155 201 }
156 202 else
157 203 {
204 + // 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.
158 205 $note_body = '<a href="' . get_edit_post_link($comment_content['contact_id']) . '">' . get_the_title($comment_content['contact_id']) . '</a> removed from tenancy';
159 206 }
160 207 break;
161 208 }
@@ -160,8 +207,9 @@
160 207 break;
161 208 }
162 209 default:
163 210 {
211 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
164 212 $note_body = $comment_content['action'];
165 213 break;
166 214 }
167 215 }
@@ -168,14 +216,17 @@
168 216 break;
169 217 }
170 218 case "note":
171 219 {
220 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
172 221 $note_body = $comment_content['note'];
173 222
174 223 // Regular expression pattern to match {{mention-ID|NAME}} or {{mention-ID}}
224 + // 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 225 $pattern = '/\{\{mention-(\d+)(?:\|([^}]*))?\}\}/';
176 226
177 227 // Callback function to replace the mentions with HTML links
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.
178 229 $callback = function($matches)
179 230 {
180 231 $post_id = $matches[1];
181 232 $title = isset($matches[2]) ? $matches[2] : '';
@@ -204,8 +255,9 @@
204 255 }
205 256 }
206 257 };
207 258
259 + // 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 260 $note_body = preg_replace_callback($pattern, $callback, $note_body);
209 261
210 262 /*$pattern = '/\{\{mention-(\d+)(\|.*)?\}\}/';
211 263 $replacement = function($matches) {
@@ -237,8 +289,9 @@
237 289 }
238 290 };
239 291 $note_body = preg_replace_callback($pattern, $replacement, $note_body);*/
240 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.
241 294 $note_body = nl2br($note_body);
242 295
243 296 break;
244 297 }
@@ -243,21 +296,25 @@
243 296 break;
244 297 }
245 298 case "unsubscribe":
246 299 {
300 + // 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.
247 301 $note_body = 'Contact unsubscribed themselves from emails';
248 302 break;
249 303 }
250 304 case "status_change": // Believe this is only used by maintenance jobs add on
251 305 {
306 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
252 307 $note_body = 'Status changed from ' . $comment_content['previous_status'] . ' to ' . $comment_content['new_status'];
253 308 break;
254 309 }
255 310 default:
256 311 {
312 + // 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.
257 313 $note_body = apply_filters( 'propertyhive_note_body', $note_body, $note );
258 314 }
259 315 }
316 + // 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.
260 317 $note_content = array(
261 318 'id' => $note->comment_ID,
262 319 'post_id' => $note->comment_post_ID,
263 320 'type' => $comment_content['note_type'],
@@ -269,22 +326,27 @@
269 326 );
270 327
271 328 if ( $note_content['pinned'] == '1' )
272 329 {
330 + // 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.
273 331 $pinned_notes[] = $note_content;
274 332 }
275 333 else
276 334 {
335 + // 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 336 $unpinned_notes[] = $note_content;
278 337 }
279 338 }
280 339 }
281 340
341 +// 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 342 $note_output = array_merge($pinned_notes, $unpinned_notes);
283 343
284 344 if ($section != 'enquiry')
285 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.
286 347 $note_output = apply_filters( 'propertyhive_notes', $note_output, $post );
348 + // 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.
287 349 $note_output = apply_filters( 'propertyhive_' . $section . '_notes', $note_output, $post );
288 350 }
289 351 ?>
290 352 <ul class="record_notes" style="max-height:300px; overflow-y:auto">
@@ -290,23 +352,28 @@
290 352 <ul class="record_notes" style="max-height:300px; overflow-y:auto">
291 353 <?php
292 354 if ( !empty($note_output) )
293 355 {
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.
294 357 foreach ( $note_output as $key => $note )
295 358 {
296 359 // Set pinned parameter for any notes added by third party plugins
297 360 if ( !isset($note['pinned']) )
298 361 {
362 + // 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 363 $note_output[$key]['pinned'] = 0;
300 364 }
301 365 }
302 366
367 + // 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.
303 368 $datetime_format = get_option('date_format')." \a\\t ".get_option('time_format');
304 369
305 370 // order by date desc. Older PHP versions don't support array_column so just can't order for them
306 371 if ( function_exists('array_column') )
307 372 {
373 + // 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.
308 374 $pinned = array_column($note_output, 'pinned');
375 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
309 376 $timestamp = array_column($note_output, 'timestamp');
310 377
311 378 array_multisort($pinned, SORT_DESC,
312 379 $timestamp, SORT_DESC,
@@ -312,12 +379,15 @@
312 379 $timestamp, SORT_DESC,
313 380 $note_output);
314 381 }
315 382
383 + // 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.
316 384 foreach ( $note_output as $note )
317 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.
318 387 $note_classes = array( 'note' );
319 388
389 + // 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.
320 390 $note_classes[] = 'note-type-' . $note['type'];
321 391 ?>
322 392 <li rel="<?php echo absint( $note['id'] ) ; ?>" class="<?php echo esc_attr(implode( ' ', $note_classes )); ?>">
323 393 <div class="note_content<?php echo ($note['pinned'] == '1') ? ' pinned' : '' ?>">
@@ -323,17 +393,19 @@
323 393 <div class="note_content<?php echo ($note['pinned'] == '1') ? ' pinned' : '' ?>">
324 394 <?php echo wp_kses_post( $note['body'] ); ?>
325 395 </div>
326 396 <p class="meta">
327 - <abbr class="exact-date" title="<?php echo esc_attr(date("Y-m-d H:i:s", $note['timestamp'])); ?>">
397 + <abbr class="exact-date" title="<?php echo esc_attr(gmdate("Y-m-d H:i:s", $note['timestamp'])); ?>">
328 398 <?php
329 399
400 + // 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.
330 401 $time_diff = current_time( 'timestamp', 1 ) - $note['timestamp'];
331 402
332 403 if ($time_diff > 86400) {
333 - echo esc_html(date( $datetime_format, $note['timestamp'] ));
404 + echo esc_html(gmdate( $datetime_format, $note['timestamp'] ));
334 405 } else {
335 - printf( __( '%s ago', 'propertyhive' ), human_time_diff( $note['timestamp'], current_time( 'timestamp', 1 ) ) );
406 + /* translators: %s: Elapsed time. */
407 + printf( esc_html__( '%s ago', 'propertyhive' ), esc_html( human_time_diff( $note['timestamp'], current_time( 'timestamp', 1 ) ) ) );
336 408 }
337 409 ?>
338 410 </abbr>
339 411 <?php
@@ -340,15 +412,15 @@
340 412 if ( !empty($note['author']) && $note['author'] !== 'Property Hive' )
341 413 {
342 414 printf(
343 415 /* translators: %s: author name */
344 - __( 'by %s', 'propertyhive' ),
416 + esc_html__( 'by %s', 'propertyhive' ),
345 417 esc_html($note['author'])
346 418 );
347 419 }
348 420 ?>
349 421
350 - <a href="#" data-section="<?php echo esc_attr($section); ?>" class="toggle_note_pinned"><?php echo esc_html(__( ( $note['pinned'] == '0' ) ? 'Pin To Top' : 'Unpin', 'propertyhive' )); ?></a>
422 + <a href="#" data-section="<?php echo esc_attr($section); ?>" class="toggle_note_pinned"><?php echo ( $note['pinned'] == '0' ? esc_html__( 'Pin To Top', 'propertyhive' ) : esc_html__( 'Unpin', 'propertyhive' ) ); ?></a>
351 423
352 424 <?php if ( $note['type'] == 'note' ) { ?><a href="#" data-section="<?php echo esc_attr($section); ?>" class="delete_note"><?php echo esc_html(__( 'Delete', 'propertyhive' )); ?></a><?php } ?>
353 425 <?php
354 426 if ( $post->ID != $note['post_id'] )
@@ -354,13 +426,14 @@
354 426 if ( $post->ID != $note['post_id'] )
355 427 {
356 428 echo '<br>';
357 429 $post_type_object = get_post_type_object( get_post_type( $note['post_id'] ) );
430 + // 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.
358 431 $post_type_label = $post_type_object ? $post_type_object->labels->singular_name : get_post_type( $note['post_id'] );
359 432
360 433 printf(
361 434 /* translators: %s: linked post type label, for example "Property" */
362 - __( 'Note originally entered on %s', 'propertyhive' ),
435 + esc_html__( 'Note originally entered on %s', 'propertyhive' ),
363 436 '<a href="' . esc_url( get_edit_post_link( $note['post_id'] ) ) . '" style="color:inherit;">' . esc_html( $post_type_label ) . '</a>'
364 437 );
365 438 }
366 439 ?>
@@ -369,14 +442,14 @@
369 442 <?php
370 443 }
371 444 }
372 445 ?>
373 - <li id="no_notes" style="text-align:center;<?php echo (!empty($note_output)) ? 'display:none;' : ''; ?>"><?php if ( isset($_POST['pinned']) && (int)$_POST['pinned'] == 1 ) { echo esc_html(__( 'There are no pinned notes to display', 'propertyhive' )); }else{ echo esc_html(__( 'There are no notes to display', 'propertyhive' )); } ?></li>
446 + <li id="no_notes" style="text-align:center;<?php echo (!empty($note_output)) ? 'display:none;' : ''; ?>"><?php if ( $propertyhive_pinned_only ) { echo esc_html(__( 'There are no pinned notes to display', 'propertyhive' )); }else{ echo esc_html(__( 'There are no notes to display', 'propertyhive' )); } ?></li>
374 447 </ul>
375 448
376 -<?php if ( !isset($_POST['pinned']) ) { ?>
449 +<?php if ( ! $propertyhive_has_pinned_filter ) { ?>
377 450 <div class="add_note">
378 - <h4><?php _e( 'Add Note', 'propertyhive' ); ?></h4>
451 + <h4><?php esc_html_e( 'Add Note', 'propertyhive' ); ?></h4>
379 452 <p>
380 453 <textarea type="text" name="note" id="add_note" class="input-text" cols="20" rows="6" placeholder="Enter your note<?php if ( apply_filters('propertyhive_disable_notes_mention', false) === false ) { ?><br>Type <code style='background:#f9f9f9; border:1px solid #DDD; padding:0 2px; border-radius:5px; vertical-align:middle'>@</code> to tag a contact and property<?php } ?>"></textarea>
381 454 <br>
382 455 <input type="checkbox" name="pinned" id="pinned" value="1"> <?php echo esc_html(__( 'Pin Note', 'propertyhive' )); ?>