PluginProbe
Property Hive / 1.4.62
Property Hive v1.4.62
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
propertyhive / includes / admin / class-ph-admin-post-types.php

class-ph-admin-post-types.php in Property Hive 1.4.62, at includes/admin/class-ph-admin-post-types.php

1,355 lines 49.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Post Types Admin
4 *
5 * @author PropertyHive
6 * @category Admin
7 * @package PropertyHive/Admin
8 * @version 1.0.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
13 if ( ! class_exists( 'PH_Admin_Post_Types' ) ) :
14
15 /**
16 * PH_Admin_Post_Types Class
17 */
18 class PH_Admin_Post_Types {
19
20 /**
21 * Constructor
22 */
23 public function __construct() {
24 add_action( 'admin_init', array( $this, 'include_post_type_handlers' ) );
25 add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
26 add_action( 'admin_print_scripts', array( $this, 'remove_month_filter' ) );
27 add_action( 'admin_print_scripts', array( $this, 'disable_autosave' ) );
28
29 // Filters
30 add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ) );
31 add_filter( 'request', array( $this, 'request_query' ) );
32 add_filter( 'posts_join', array( $this, 'posts_join' ) );
33 add_filter( 'posts_where', array( $this, 'posts_where' ) );
34
35 // Status transitions
36 add_action( 'delete_post', array( $this, 'delete_post' ) );
37 add_action( 'wp_trash_post', array( $this, 'trash_post' ) );
38 add_action( 'untrash_post', array( $this, 'untrash_post' ) );
39
40
41 }
42
43 /**
44 * Conditonally load classes and functions only needed when viewing a post type.
45 */
46 public function include_post_type_handlers() {
47 include( 'post-types/class-ph-admin-header-stripes.php' );
48 include( 'post-types/class-ph-admin-meta-boxes.php' );
49
50 include( 'post-types/class-ph-admin-cpt-property.php' );
51 include( 'post-types/class-ph-admin-cpt-contact.php' );
52 include( 'post-types/class-ph-admin-cpt-enquiry.php' );
53 include( 'post-types/class-ph-admin-cpt-office.php' );
54 include( 'post-types/class-ph-admin-cpt-appraisal.php' );
55 include( 'post-types/class-ph-admin-cpt-viewing.php' );
56 include( 'post-types/class-ph-admin-cpt-offer.php' );
57 include( 'post-types/class-ph-admin-cpt-sale.php' );
58 }
59
60 /**
61 * Change messages when a post type is updated.
62 *
63 * @param array $messages
64 * @return array
65 */
66 public function post_updated_messages( $messages ) {
67 global $post, $post_ID;
68
69 $messages['property'] = array(
70 0 => '', // Unused. Messages start at index 1.
71 1 => sprintf( __( 'Property updated. <a href="%s">View Property</a>', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ),
72 2 => __( 'Custom field updated.', 'propertyhive' ),
73 3 => __( 'Custom field deleted.', 'propertyhive' ),
74 4 => __( 'Property updated.', 'propertyhive' ),
75 5 => isset($_GET['revision']) ? sprintf( __( 'Property restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
76 6 => sprintf( __( 'Property published. <a href="%s">View Property</a>', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ),
77 7 => __( 'Property saved.', 'propertyhive' ),
78 8 => sprintf( __( 'Property submitted. <a target="_blank" href="%s">Preview Property</a>', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
79 9 => sprintf( __( 'Property scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Property</a>', 'propertyhive' ),
80 date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
81 10 => sprintf( __( 'Property draft updated. <a target="_blank" href="%s">Preview Property</a>', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
82 );
83
84 $messages['contact'] = array(
85 0 => '', // Unused. Messages start at index 1.
86 1 => __( 'Contact updated.', 'propertyhive' ),
87 2 => __( 'Custom field updated.', 'propertyhive' ),
88 3 => __( 'Custom field deleted.', 'propertyhive' ),
89 4 => __( 'Contact updated.', 'propertyhive' ),
90 5 => isset($_GET['revision']) ? sprintf( __( 'Contact restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
91 6 => __( 'Contact published.', 'propertyhive' ),
92 7 => __( 'Contact saved.', 'propertyhive' ),
93 8 => __( 'Contact submitted.', 'propertyhive' ),
94 9 => sprintf( __( 'Contact scheduled for: <strong>%1$s</strong>.', 'propertyhive' ), date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) )),
95 10 => __( 'Contact draft updated.', 'propertyhive' ),
96 );
97
98 $messages['office'] = array(
99 0 => '', // Unused. Messages start at index 1.
100 1 => __( 'Office updated.', 'propertyhive' ),
101 2 => __( 'Custom field updated.', 'propertyhive' ),
102 3 => __( 'Custom field deleted.', 'propertyhive' ),
103 4 => __( 'Office updated.', 'propertyhive' ),
104 5 => isset($_GET['revision']) ? sprintf( __( 'Office restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
105 6 => sprintf( __( 'Office published.', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ),
106 7 => __( 'Office saved.', 'propertyhive' ),
107 8 => sprintf( __( 'Office submitted.', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
108 9 => sprintf( __( 'Office scheduled for: <strong>%1$s</strong>.', 'propertyhive' ),
109 date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
110 10 => sprintf( __( 'Office draft updated. ', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
111 );
112
113 $messages['enquiry'] = array(
114 0 => '', // Unused. Messages start at index 1.
115 1 => sprintf( __( 'Enquiry updated.', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ),
116 2 => __( 'Custom field updated.', 'propertyhive' ),
117 3 => __( 'Custom field deleted.', 'propertyhive' ),
118 4 => __( 'Enquiry updated.', 'propertyhive' ),
119 5 => isset($_GET['revision']) ? sprintf( __( 'Enquiry restored to revision from %s', 'propertyhive' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
120 6 => sprintf( __( 'Enquiry published.', 'propertyhive' ), esc_url( get_permalink($post_ID) ) ),
121 7 => __( 'Enquiry saved.', 'propertyhive' ),
122 8 => sprintf( __( 'Enquiry submitted.', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
123 9 => sprintf( __( 'Enquiry scheduled for: <strong>%1$s</strong>.', 'propertyhive' ),
124 date_i18n( __( 'M j, Y @ G:i', 'propertyhive' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
125 10 => sprintf( __( 'Enquiry draft updated.', 'propertyhive' ), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
126 );
127
128 return $messages;
129 }
130
131 /**
132 * Remove month filter from some property hive pages
133 */
134 public function remove_month_filter() {
135 global $typenow;
136
137 if ($typenow == 'property' || $typenow == 'contact' || $typenow == 'appraisal' || $typenow == 'viewing' || $typenow == 'offer' || $typenow == 'sale')
138 {
139 add_filter('months_dropdown_results', '__return_empty_array');
140 }
141 }
142
143 /**
144 * Disable the auto-save functionality for certain CPT's.
145 *
146 * @access public
147 * @return void
148 */
149 public function disable_autosave(){
150 /*global $post;
151
152 if ( $post && get_post_type( $post->ID ) === 'enquiry' ) {
153 wp_dequeue_script( 'autosave' );
154 }*/
155 }
156
157 /**
158 * Filters for post types
159 */
160 public function restrict_manage_posts() {
161 global $typenow, $wp_query;
162
163 switch ( $typenow ) {
164 case 'property' :
165 $this->property_filters();
166 break;
167 case 'contact' :
168 $this->contact_filters();
169 break;
170 case 'enquiry' :
171 $this->enquiry_filters();
172 break;
173 case 'appraisal' :
174 $this->appraisal_filters();
175 break;
176 case 'viewing' :
177 $this->viewing_filters();
178 break;
179 case 'offer' :
180 $this->offer_filters();
181 break;
182 case 'sale' :
183 $this->sale_filters();
184 break;
185 default :
186 break;
187 }
188 }
189
190 /**
191 * Show a property filter box
192 */
193 public function property_filters() {
194 global $wp_query;
195
196 // Department filtering
197 $output = '';
198
199 $output .= $this->property_department_filter();
200 $output .= $this->property_marketing_filter();
201 $output .= $this->property_availability_filter();
202 $output .= $this->property_location_filter();
203 $output .= $this->property_office_filter();
204 $output .= $this->property_negotiator_filter();
205
206 echo apply_filters( 'propertyhive_property_filters', $output );
207 }
208
209 /**
210 * Show a property department filter box
211 */
212 public function property_department_filter() {
213 global $wp_query;
214
215 $departments = ph_get_departments();
216
217 $selected_department = isset( $_GET['_department'] ) && in_array( $_GET['_department'], array_keys($departments) ) ? $_GET['_department'] : '';
218
219 // Department filtering
220 $output = '<select name="_department" id="dropdown_property_department">';
221
222 $output .= '<option value="">' . __( 'All Departments', 'propertyhive' ) . '</option>';
223
224 foreach ( $departments as $key => $value )
225 {
226 if ( get_option( 'propertyhive_active_departments_' . str_replace("residential-", "", $key) ) == 'yes' )
227 {
228 $output .= '<option value="' . $key . '"';
229 $output .= selected( $key, $selected_department, false );
230 $output .= '>' . $value . '</option>';
231 }
232 }
233
234 $output .= '</select>';
235
236 return $output;
237 }
238
239 /**
240 * Show a property office filter box
241 */
242 public function property_office_filter() {
243 global $wp_query, $post;
244
245 // Department filtering
246 $output = '<select name="_office_id" id="dropdown_property_office_id">';
247
248 $output .= '<option value="">' . __( 'All Offices', 'propertyhive' ) . '</option>';
249
250 $args = array(
251 'post_type' => 'office',
252 'nopaging' => true,
253 'orderby' => 'title',
254 'order' => 'ASC'
255 );
256 $office_query = new WP_Query($args);
257
258 if ($office_query->have_posts())
259 {
260 while ($office_query->have_posts())
261 {
262 $office_query->the_post();
263
264 $output .= '<option value="' . $post->ID . '"';
265 if ( isset( $_GET['_office_id'] ) && ! empty( $_GET['_office_id'] ) )
266 {
267 $output .= selected( $post->ID, (int)$_GET['_office_id'], false );
268 }
269 $output .= '>' . get_the_title() . '</option>';
270 }
271 }
272
273 wp_reset_postdata();
274
275 $output .= '</select>';
276
277 return $output;
278 }
279
280 /**
281 * Show a property negotiator filter box
282 */
283 public function property_negotiator_filter() {
284 global $wp_query, $post;
285
286 $selected = '';
287 if ( isset( $_GET['_negotiator_id'] ) && ! empty( $_GET['_negotiator_id'] ) )
288 {
289 $selected = (int)$_GET['_negotiator_id'];
290 }
291
292 $args = array(
293 'name' => '_negotiator_id',
294 'id' => 'dropdown_property_negotiator_id',
295 'show_option_all' => __( 'All Negotiators', 'propertyhive' ),
296 'selected' => $selected,
297 'echo' => false,
298 'role__not_in' => array('property_hive_contact')
299 );
300 $output = wp_dropdown_users($args);
301
302 return $output;
303 }
304
305 /**
306 * Show a property location filter box
307 */
308 public function property_location_filter() {
309 global $wp_query, $post;
310
311 // Department filtering
312 $output = '<select name="_location_id" id="dropdown_property_location_id">';
313
314 $options = array( );
315 $args = array(
316 'hide_empty' => false,
317 'parent' => 0
318 );
319 $terms = get_terms( 'location', $args );
320
321 if ( !empty( $terms ) && !is_wp_error( $terms ) )
322 {
323 foreach ($terms as $term)
324 {
325 $options[$term->term_id] = $term->name;
326
327 $args = array(
328 'hide_empty' => false,
329 'parent' => $term->term_id
330 );
331 $subterms = get_terms( 'location', $args );
332
333 if ( !empty( $subterms ) && !is_wp_error( $subterms ) )
334 {
335 foreach ($subterms as $term)
336 {
337 $options[$term->term_id] = '- ' . $term->name;
338
339 $args = array(
340 'hide_empty' => false,
341 'parent' => $term->term_id
342 );
343 $subsubterms = get_terms( 'location', $args );
344
345 if ( !empty( $subsubterms ) && !is_wp_error( $subsubterms ) )
346 {
347 foreach ($subsubterms as $term)
348 {
349 $options[$term->term_id] = '- ' . $term->name;
350 }
351 }
352 }
353 }
354 }
355 }
356
357 $output .= '<option value="">' . __( 'All Locations', 'propertyhive' ) . '</option>';
358
359 if ( !empty($options) )
360 {
361 foreach ( $options as $value => $label )
362 {
363 $output .= '<option value="' . $value . '"';
364 if ( isset( $_GET['_location_id'] ) && ! empty( $_GET['_location_id'] ) )
365 {
366 $output .= selected( $value, (int)$_GET['_location_id'], false );
367 }
368 $output .= '>' . $label . '</option>';
369 }
370 }
371
372 $output .= '</select>';
373
374 return $output;
375 }
376
377 /**
378 * Show a property availability filter box
379 */
380 public function property_availability_filter() {
381 global $wp_query, $post;
382
383 // Availability filtering
384 $output = '<select name="_availability_id" id="dropdown_property_availability_id">';
385
386 $options = array( );
387 $args = array(
388 'hide_empty' => false,
389 'parent' => 0
390 );
391 $terms = get_terms( 'availability', $args );
392
393 if ( !empty( $terms ) && !is_wp_error( $terms ) )
394 {
395 foreach ($terms as $term)
396 {
397 $options[$term->term_id] = $term->name;
398 }
399 }
400
401 $output .= '<option value="">' . __( 'All Availabilities', 'propertyhive' ) . '</option>';
402
403 if ( !empty($options) )
404 {
405 foreach ( $options as $value => $label )
406 {
407 $output .= '<option value="' . $value . '"';
408 if ( isset( $_GET['_availability_id'] ) && ! empty( $_GET['_availability_id'] ) )
409 {
410 $output .= selected( $value, (int)$_GET['_availability_id'], false );
411 }
412 $output .= '>' . $label . '</option>';
413 }
414 }
415
416 $output .= '</select>';
417
418 return $output;
419 }
420
421 /**
422 * Show a property marketing filter box
423 */
424 public function property_marketing_filter() {
425 global $wp_query, $post;
426
427 // Availability filtering
428 $output = '<select name="_marketing" id="dropdown_property_marketing">';
429
430 $output .= '<option value="">' . __( 'All Marketing Statuses', 'propertyhive' ) . '</option>';
431
432 $options = array(
433 'on_market' => __( 'On Market Only', 'propertyhive' ),
434 'off_market' => __( 'Not On Market Only', 'propertyhive' ),
435 'featured' => __( 'Featured Only', 'propertyhive' ),
436 );
437
438 $args = array(
439 'hide_empty' => false,
440 'parent' => 0
441 );
442 $terms = get_terms( 'marketing_flag', $args );
443
444 if ( !empty( $terms ) && !is_wp_error( $terms ) )
445 {
446 foreach ($terms as $term)
447 {
448 $options['marketing_flag_' . $term->term_id] = __( 'Has Marketing Flag', 'propertyhive') . ' - ' . $term->name;
449 }
450 }
451
452 $options = apply_filters( 'propertyhive_property_filter_marketing_options', $options );
453
454 foreach ( $options as $key => $value )
455 {
456 $output .= '<option value="' . $key . '"';
457 if ( isset( $_GET['_marketing'] ) && ! empty( $_GET['_marketing'] ) )
458 {
459 $output .= selected( $key, sanitize_text_field($_GET['_marketing']), false );
460 }
461 $output .= '>' . $value . '</option>';
462 }
463
464 $output .= '</select>';
465
466 return $output;
467 }
468
469 /**
470 * Show a contact filter box
471 */
472 public function contact_filters() {
473 global $wp_query;
474
475 $selected_contact_type = isset( $_GET['_contact_type'] ) && in_array( $_GET['_contact_type'], array( 'owner', 'potentialowner', 'applicant', 'hotapplicant', 'thirdparty' ) ) ? $_GET['_contact_type'] : '';
476
477 // Type filtering
478 $options = array();
479
480 // Owners
481 $option = '<option value="owner"';
482 $option .= selected( 'owner', $selected_contact_type, false );
483 $option .= '>' . __( 'Owners and Landlords', 'propertyhive' ) . '</option>';
484
485 $options[] = $option;
486
487 // Potential Owners
488 $option = '<option value="potentialowner"';
489 $option .= selected( 'potentialowner', $selected_contact_type, false );
490 $option .= '>' . __( 'Potential Owners and Landlords', 'propertyhive' ) . '</option>';
491
492 $options[] = $option;
493
494 // Applicants
495 $option = '<option value="applicant"';
496 $option .= selected( 'applicant', $selected_contact_type, false );
497 $option .= '>' . __( 'Applicants', 'propertyhive' ) . '</option>';
498
499 $options[] = $option;
500
501 // Hot Applicants
502 $option = '<option value="hotapplicant"';
503 $option .= selected( 'hotapplicant', $selected_contact_type, false );
504 $option .= '>- ' . __( 'Hot Applicants', 'propertyhive' ) . '</option>';
505
506 $options[] = $option;
507
508 // Third Parties
509 $option = '<option value="thirdparty"';
510 $option .= selected( 'thirdparty', $selected_contact_type, false );
511 $option .= '>' . __( 'Third Party Contacts', 'propertyhive' ) . '</option>';
512
513 $options[] = $option;
514
515 $options = apply_filters( 'propertyhive_contact_filter_options', $options );
516
517 $output = '';
518 if (count($options) > 1)
519 {
520 $output = '<select name="_contact_type" id="dropdown_contact_type">';
521
522 $output .= '<option value="">' . __( 'Show all contact types', 'propertyhive' ) . '</option>';
523
524 $output .= implode("", $options);
525
526 $output .= '</select>';
527 }
528
529 echo $output;
530 }
531
532 /**
533 * Show an enquiry filter box
534 */
535 public function enquiry_filters() {
536 global $wp_query;
537
538 // Department filtering
539 $output = '';
540
541 $output .= $this->enquiry_status_filter();
542 $output .= $this->enquiry_source_filter();
543 $output .= $this->enquiry_office_filter();
544
545 echo apply_filters( 'propertyhive_enquiry_filters', $output );
546 }
547
548 /**
549 * Show an enquiry status filter box
550 */
551 public function enquiry_status_filter() {
552 global $wp_query;
553
554 $selected_status = isset( $_GET['_status'] ) && in_array( $_GET['_status'], array( 'open', 'closed' ) ) ? $_GET['_status'] : '';
555
556 // Status filtering
557 $output = '<select name="_status" id="dropdown_enquiry_status">';
558
559 $output .= '<option value="open"';
560 $output .= selected( 'open', $selected_status, false );
561 $output .= '>' . __( 'Open', 'propertyhive' ) . '</option>';
562
563 $output .= '<option value="closed"';
564 $output .= selected( 'closed', $selected_status, false );
565 $output .= '>' . __( 'Closed', 'propertyhive' ) . '</option>';
566
567 $output .= '</select>';
568
569 return $output;
570 }
571
572 /**
573 * Show an enquiry source filter box
574 */
575 public function enquiry_source_filter() {
576 global $wp_query;
577
578 $sources = array(
579 'office' => __( 'Office', 'propertyhive' ),
580 'website' => __( 'Website', 'propertyhive' )
581 );
582
583 $sources = apply_filters( 'propertyhive_enquiry_sources', $sources );
584
585 asort($sources);
586
587 // Status filtering
588 $output = '<select name="_source" id="dropdown_enquiry_source">';
589
590 $output .= '<option value="">' . __( 'Show all sources', 'propertyhive' ) . '</option>';
591
592 foreach ( $sources as $key => $value )
593 {
594 $output .= '<option value="' . $key . '"';
595 if ( isset( $_GET['_source'] ) && ! empty( $_GET['_source'] ) )
596 {
597 $output .= selected( $key, sanitize_text_field($_GET['_source']), false );
598 }
599 $output .= '>' . __( $value, 'propertyhive' ) . '</option>';
600 }
601
602 $output .= '</select>';
603
604 return $output;
605 }
606
607 /**
608 * Show an enquiry office filter box
609 */
610 public function enquiry_office_filter() {
611 global $wp_query, $post;
612
613 // Department filtering
614 $output = '<select name="_office_id" id="dropdown_enquiry_office_id">';
615
616 $output .= '<option value="">' . __( 'All Offices', 'propertyhive' ) . '</option>';
617
618 $args = array(
619 'post_type' => 'office',
620 'nopaging' => true,
621 'orderby' => 'title',
622 'order' => 'ASC'
623 );
624 $office_query = new WP_Query($args);
625
626 if ($office_query->have_posts())
627 {
628 while ($office_query->have_posts())
629 {
630 $office_query->the_post();
631
632 $output .= '<option value="' . $post->ID . '"';
633 if ( isset( $_GET['_office_id'] ) && ! empty( $_GET['_office_id'] ) )
634 {
635 $output .= selected( $post->ID, (int)$_GET['_office_id'], false );
636 }
637 $output .= '>' . get_the_title() . '</option>';
638 }
639 }
640
641 wp_reset_postdata();
642
643 $output .= '</select>';
644
645 return $output;
646 }
647
648 /**
649 * Show am appraisal filter box
650 */
651 public function appraisal_filters() {
652 global $wp_query;
653
654 $output = '';
655
656 $output .= $this->appraisal_status_filter();
657 $output .= $this->appraisal_attending_negotiator_filter();
658
659 echo apply_filters( 'propertyhive_appraisal_filters', $output );
660 }
661
662 /**
663 * Show an appraisal status filter box
664 */
665 public function appraisal_status_filter() {
666 global $wp_query;
667
668 $selected_status = isset( $_GET['_status'] ) && in_array( $_GET['_status'], array( 'pending', 'carried_out', 'won', 'lost', 'instructed', 'cancelled' ) ) ? $_GET['_status'] : '';
669
670 // Status filtering
671 $output = '<select name="_status" id="dropdown_appraisal_status">';
672
673 $output .= '<option value="">All Statuses</option>';
674
675 $output .= '<option value="pending"';
676 $output .= selected( 'pending', $selected_status, false );
677 $output .= '>' . __( 'Pending', 'propertyhive' ) . '</option>';
678
679 $output .= '<option value="carried_out"';
680 $output .= selected( 'carried_out', $selected_status, false );
681 $output .= '>' . __( 'Carried Out', 'propertyhive' ) . '</option>';
682
683 $output .= '<option value="won"';
684 $output .= selected( 'won', $selected_status, false );
685 $output .= '>- ' . __( 'Won', 'propertyhive' ) . '</option>';
686
687 $output .= '<option value="lost"';
688 $output .= selected( 'lost', $selected_status, false );
689 $output .= '>- ' . __( 'Lost', 'propertyhive' ) . '</option>';
690
691 $output .= '<option value="instructed"';
692 $output .= selected( 'instructed', $selected_status, false );
693 $output .= '>- ' . __( 'Instructed', 'propertyhive' ) . '</option>';
694
695 $output .= '<option value="cancelled"';
696 $output .= selected( 'cancelled', $selected_status, false );
697 $output .= '>' . __( 'Cancelled', 'propertyhive' ) . '</option>';
698
699 $output .= '</select>';
700
701 return $output;
702 }
703
704 /**
705 * Show an appraisal attending negotiator filter box
706 */
707 public function appraisal_attending_negotiator_filter() {
708 global $wp_query;
709
710 $selected_negotiator_id = isset( $_GET['_negotiator_id']) ? (int)$_GET['_negotiator_id'] : '';
711
712 // Status filtering
713 $output = '<select name="_negotiator_id" id="dropdown_appraisal_negotiator_id">';
714
715 $output .= '<option value="">Attending Negotiator</option>';
716 $output .= '<option value="">All Negotiators</option>';
717
718 $args = array(
719 'number' => 9999,
720 'orderby' => 'display_name',
721 'role__not_in' => array('property_hive_contact')
722 );
723 $user_query = new WP_User_Query( $args );
724
725 if ( ! empty( $user_query->results ) )
726 {
727 foreach ( $user_query->results as $user )
728 {
729 $output .= '<option value="' . $user->ID . '"';
730 if ( $user->ID == $selected_negotiator_id )
731 {
732 $output .= ' selected';
733 }
734 $output .= '>' . $user->display_name . '</option>';
735 }
736 }
737
738 $output .= '</select>';
739
740 return $output;
741 }
742
743 /**
744 * Show a viewing filter box
745 */
746 public function viewing_filters() {
747 global $wp_query;
748
749 // Department filtering
750 $output = '';
751
752 $output .= $this->viewing_status_filter();
753 $output .= $this->viewing_attending_negotiator_filter();
754
755 echo apply_filters( 'propertyhive_viewing_filters', $output );
756 }
757
758 /**
759 * Show a viewing status filter box
760 */
761 public function viewing_status_filter() {
762 global $wp_query;
763
764 $selected_status = isset( $_GET['_status'] ) && in_array( $_GET['_status'], array( 'pending', 'confirmed', 'unconfirmed', 'carried_out', 'feedback_passed_on', 'feedback_not_passed_on', 'cancelled' ) ) ? $_GET['_status'] : '';
765
766 // Status filtering
767 $output = '<select name="_status" id="dropdown_viewing_status">';
768
769 $output .= '<option value="">All Statuses</option>';
770
771 $output .= '<option value="pending"';
772 $output .= selected( 'pending', $selected_status, false );
773 $output .= '>' . __( 'Pending', 'propertyhive' ) . '</option>';
774
775 $output .= '<option value="confirmed"';
776 $output .= selected( 'confirmed', $selected_status, false );
777 $output .= '>- ' . __( 'Confirmed', 'propertyhive' ) . '</option>';
778
779 $output .= '<option value="unconfirmed"';
780 $output .= selected( 'unconfirmed', $selected_status, false );
781 $output .= '>- ' . __( 'Awaiting Confirmation', 'propertyhive' ) . '</option>';
782
783 $output .= '<option value="carried_out"';
784 $output .= selected( 'carried_out', $selected_status, false );
785 $output .= '>' . __( 'Carried Out', 'propertyhive' ) . '</option>';
786
787 $output .= '<option value="feedback_passed_on"';
788 $output .= selected( 'feedback_passed_on', $selected_status, false );
789 $output .= '>- ' . __( 'Feedback Passed On', 'propertyhive' ) . '</option>';
790
791 $output .= '<option value="feedback_not_passed_on"';
792 $output .= selected( 'feedback_not_passed_on', $selected_status, false );
793 $output .= '>- ' . __( 'Feedback Not Passed On', 'propertyhive' ) . '</option>';
794
795 $output .= '<option value="cancelled"';
796 $output .= selected( 'cancelled', $selected_status, false );
797 $output .= '>' . __( 'Cancelled', 'propertyhive' ) . '</option>';
798
799 $output .= '</select>';
800
801 return $output;
802 }
803
804 /**
805 * Show a viewing attending negotiator filter box
806 */
807 public function viewing_attending_negotiator_filter() {
808 global $wp_query;
809
810 $selected_negotiator_id = isset( $_GET['_negotiator_id']) ? (int)$_GET['_negotiator_id'] : '';
811
812 // Status filtering
813 $output = '<select name="_negotiator_id" id="dropdown_viewing_negotiator_id">';
814
815 $output .= '<option value="">Attending Negotiator</option>';
816 $output .= '<option value="">All Negotiators</option>';
817
818 $args = array(
819 'number' => 9999,
820 'orderby' => 'display_name',
821 'role__not_in' => array('property_hive_contact')
822 );
823 $user_query = new WP_User_Query( $args );
824
825 if ( ! empty( $user_query->results ) )
826 {
827 foreach ( $user_query->results as $user )
828 {
829 $output .= '<option value="' . $user->ID . '"';
830 if ( $user->ID == $selected_negotiator_id )
831 {
832 $output .= ' selected';
833 }
834 $output .= '>' . $user->display_name . '</option>';
835 }
836 }
837
838 $output .= '</select>';
839
840 return $output;
841 }
842
843 /**
844 * Show an offer filter box
845 */
846 public function offer_filters() {
847 global $wp_query;
848
849 $output = '';
850
851 $output .= $this->offer_status_filter();
852
853 echo apply_filters( 'propertyhive_offer_filters', $output );
854 }
855
856 /**
857 * Show an offer status filter box
858 */
859 public function offer_status_filter() {
860 global $wp_query;
861
862 $selected_status = isset( $_GET['_status'] ) && in_array( $_GET['_status'], array( 'pending', 'accepted', 'declined' ) ) ? $_GET['_status'] : '';
863
864 // Status filtering
865 $output = '<select name="_status" id="dropdown_offer_status">';
866
867 $output .= '<option value="">All Statuses</option>';
868
869 $output .= '<option value="pending"';
870 $output .= selected( 'pending', $selected_status, false );
871 $output .= '>' . __( 'Pending', 'propertyhive' ) . '</option>';
872
873 $output .= '<option value="accepted"';
874 $output .= selected( 'accepted', $selected_status, false );
875 $output .= '>' . __( 'Accepted', 'propertyhive' ) . '</option>';
876
877 $output .= '<option value="declined"';
878 $output .= selected( 'declined', $selected_status, false );
879 $output .= '>' . __( 'Declined', 'propertyhive' ) . '</option>';
880
881 $output .= '</select>';
882
883 return $output;
884 }
885
886 /**
887 * Show an sale filter box
888 */
889 public function sale_filters() {
890 global $wp_query;
891
892 $output = '';
893
894 $output .= $this->sale_status_filter();
895
896 echo apply_filters( 'propertyhive_sale_filters', $output );
897 }
898
899 /**
900 * Show an sale status filter box
901 */
902 public function sale_status_filter() {
903 global $wp_query;
904
905 $selected_status = isset( $_GET['_status'] ) && in_array( $_GET['_status'], array( 'current', 'exchanged', 'completed', 'fallen_through' ) ) ? $_GET['_status'] : '';
906
907 // Status filtering
908 $output = '<select name="_status" id="dropdown_sale_status">';
909
910 $output .= '<option value="">All Statuses</option>';
911
912 $output .= '<option value="current"';
913 $output .= selected( 'current', $selected_status, false );
914 $output .= '>' . __( 'Current', 'propertyhive' ) . '</option>';
915
916 $output .= '<option value="exchanged"';
917 $output .= selected( 'exchanged', $selected_status, false );
918 $output .= '>' . __( 'Exchanged', 'propertyhive' ) . '</option>';
919
920 $output .= '<option value="completed"';
921 $output .= selected( 'completed', $selected_status, false );
922 $output .= '>' . __( 'Completed', 'propertyhive' ) . '</option>';
923
924 $output .= '<option value="fallen_through"';
925 $output .= selected( 'fallen_through', $selected_status, false );
926 $output .= '>' . __( 'Fallen Through', 'propertyhive' ) . '</option>';
927
928 $output .= '</select>';
929
930 return $output;
931 }
932
933 /**
934 * Filters and sorting handler
935 * @param array $vars
936 * @return array
937 */
938 public function request_query( $vars ) {
939 global $typenow, $wp_query;
940
941 if ( !isset($vars['meta_query']) ) { $vars['meta_query'] = array(); }
942 if ( !isset($vars['tax_query']) ) { $vars['tax_query'] = array(); }
943
944 if ( 'property' === $typenow )
945 {
946 if ( ! empty( $_GET['_department'] ) ) {
947 $vars['meta_query'][] = array(
948 'key' => '_department',
949 'value' => sanitize_text_field( $_GET['_department'] ),
950 );
951 }
952 if ( ! empty( $_GET['_office_id'] ) ) {
953 $vars['meta_query'][] = array(
954 'key' => '_office_id',
955 'value' => (int)$_GET['_office_id'],
956 );
957 }
958 if ( ! empty( $_GET['_negotiator_id'] ) ) {
959 $vars['meta_query'][] = array(
960 'key' => '_negotiator_id',
961 'value' => (int)$_GET['_negotiator_id'],
962 );
963 }
964 if ( ! empty( $_GET['_location_id'] ) ) {
965 $vars['tax_query'][] = array(
966 'taxonomy' => 'location',
967 'terms' => ( (is_array($_GET['_location_id'])) ? (int)$_GET['_location_id'] : array( (int)$_GET['_location_id'] ) )
968 );
969 }
970 if ( ! empty( $_GET['_availability_id'] ) ) {
971 $vars['tax_query'][] = array(
972 'taxonomy' => 'availability',
973 'terms' => ( (is_array($_GET['_availability_id'])) ? (int)$_GET['_availability_id'] : array( (int)$_GET['_availability_id'] ) )
974 );
975 }
976 if ( ! empty( $_GET['_marketing'] ) && $_GET['_marketing'] == 'on_market' ) {
977 $vars['meta_query'][] = array(
978 'key' => '_on_market',
979 'value' => 'yes',
980 );
981 }
982 if ( ! empty( $_GET['_marketing'] ) && $_GET['_marketing'] == 'off_market' ) {
983 $vars['meta_query'][] = array(
984 'key' => '_on_market',
985 'value' => 'yes',
986 'compare' => '!=',
987 );
988 }
989 if ( ! empty( $_GET['_marketing'] ) && $_GET['_marketing'] == 'featured' ) {
990 $vars['meta_query'][] = array(
991 'key' => '_featured',
992 'value' => 'yes',
993 );
994 }
995 if ( ! empty( $_GET['_marketing'] ) && substr($_GET['_marketing'], 0, 15) == 'marketing_flag_' ) {
996 $marketing_flag_id = sanitize_text_field( str_replace("marketing_flag_", "", $_GET['_marketing']) );
997 $vars['tax_query'][] = array(
998 'taxonomy' => 'marketing_flag',
999 'terms' => ( (is_array($marketing_flag_id)) ? $marketing_flag_id : array( $marketing_flag_id ) )
1000 );
1001 }
1002 }
1003 elseif ( 'contact' === $typenow )
1004 {
1005 if ( ! empty( $_GET['_contact_type'] ) )
1006 {
1007 $contact_type = ph_clean($_GET['_contact_type']);
1008 if ( $contact_type == 'hotapplicant' )
1009 {
1010 $contact_type = 'applicant';
1011
1012 $vars['meta_query'][] = array(
1013 'key' => '_hot_applicant',
1014 'value' => 'yes',
1015 );
1016 }
1017 $vars['meta_query'][] = array(
1018 'key' => '_contact_types',
1019 'value' => $contact_type,
1020 'compare' => 'LIKE'
1021 );
1022 }
1023 }
1024 elseif ( 'enquiry' === $typenow )
1025 {
1026 if ( ! empty( $_GET['_status'] ) ) {
1027 $vars['meta_query'][] = array(
1028 'key' => '_status',
1029 'value' => sanitize_text_field( $_GET['_status'] ),
1030 );
1031 }
1032 if ( ! empty( $_GET['_source'] ) ) {
1033 $vars['meta_query'][] = array(
1034 'key' => '_source',
1035 'value' => sanitize_text_field( $_GET['_source'] ),
1036 );
1037 }
1038 if ( ! empty( $_GET['_office_id'] ) ) {
1039 $vars['meta_query'][] = array(
1040 'key' => '_office_id',
1041 'value' => sanitize_text_field( $_GET['_office_id'] ),
1042 );
1043 }
1044 }
1045 elseif ( 'appraisal' === $typenow )
1046 {
1047 if ( ! empty( $_GET['_status'] ) ) {
1048 switch ( sanitize_text_field( $_GET['_status'] ) )
1049 {
1050 case "confirmed":
1051 {
1052 $vars['meta_query'][] = array(
1053 'key' => '_status',
1054 'value' => 'pending',
1055 );
1056 $vars['meta_query'][] = array(
1057 'key' => '_all_confirmed',
1058 'value' => 'yes',
1059 );
1060 break;
1061 }
1062 case "unconfirmed":
1063 {
1064 $vars['meta_query'][] = array(
1065 'key' => '_status',
1066 'value' => 'pending',
1067 );
1068 $vars['meta_query'][] = array(
1069 'key' => '_all_confirmed',
1070 'value' => '',
1071 );
1072 break;
1073 }
1074 default:
1075 {
1076 $vars['meta_query'][] = array(
1077 'key' => '_status',
1078 'value' => sanitize_text_field( $_GET['_status'] ),
1079 );
1080 }
1081 }
1082 }
1083 if ( ! empty( $_GET['_negotiator_id'] ) )
1084 {
1085 $vars['meta_query'][] = array(
1086 'key' => '_negotiator_id',
1087 'value' => (int)$_GET['_negotiator_id'],
1088 );
1089 }
1090 }
1091 elseif ( 'viewing' === $typenow )
1092 {
1093 if ( ! empty( $_GET['_status'] ) ) {
1094 switch ( sanitize_text_field( $_GET['_status'] ) )
1095 {
1096 case "confirmed":
1097 {
1098 $vars['meta_query'][] = array(
1099 'key' => '_status',
1100 'value' => 'pending',
1101 );
1102 $vars['meta_query'][] = array(
1103 'key' => '_all_confirmed',
1104 'value' => 'yes',
1105 );
1106 break;
1107 }
1108 case "unconfirmed":
1109 {
1110 $vars['meta_query'][] = array(
1111 'key' => '_status',
1112 'value' => 'pending',
1113 );
1114 $vars['meta_query'][] = array(
1115 'key' => '_all_confirmed',
1116 'value' => '',
1117 );
1118 break;
1119 }
1120 case "feedback_passed_on":
1121 {
1122 $vars['meta_query'][] = array(
1123 'key' => '_status',
1124 'value' => 'carried_out',
1125 );
1126 $vars['meta_query'][] = array(
1127 'key' => '_feedback_status',
1128 'value' => array('interested', 'not_interested'),
1129 'compare' => 'IN'
1130 );
1131 $vars['meta_query'][] = array(
1132 'key' => '_feedback_passed_on',
1133 'value' => 'yes',
1134 );
1135 break;
1136 }
1137 case "feedback_not_passed_on":
1138 {
1139 $vars['meta_query'][] = array(
1140 'key' => '_status',
1141 'value' => 'carried_out',
1142 );
1143 $vars['meta_query'][] = array(
1144 'key' => '_feedback_status',
1145 'value' => array('interested', 'not_interested'),
1146 'compare' => 'IN'
1147 );
1148 $vars['meta_query'][] = array(
1149 'key' => '_feedback_passed_on',
1150 'value' => '',
1151 );
1152 break;
1153 }
1154 default:
1155 {
1156 $vars['meta_query'][] = array(
1157 'key' => '_status',
1158 'value' => sanitize_text_field( $_GET['_status'] ),
1159 );
1160 }
1161 }
1162 }
1163 if ( ! empty( $_GET['_negotiator_id'] ) )
1164 {
1165 $vars['meta_query'][] = array(
1166 'key' => '_negotiator_id',
1167 'value' => (int)$_GET['_negotiator_id'],
1168 );
1169 }
1170 }
1171 elseif ( 'offer' === $typenow )
1172 {
1173 if ( ! empty( $_GET['_status'] ) ) {
1174 $vars['meta_query'][] = array(
1175 'key' => '_status',
1176 'value' => sanitize_text_field( $_GET['_status'] ),
1177 );
1178 }
1179 }
1180 elseif ( 'sale' === $typenow )
1181 {
1182 if ( ! empty( $_GET['_status'] ) ) {
1183 $vars['meta_query'][] = array(
1184 'key' => '_status',
1185 'value' => sanitize_text_field( $_GET['_status'] ),
1186 );
1187 }
1188 }
1189
1190 $vars = apply_filters( 'propertyhive_property_filter_query', $vars, $typenow );
1191
1192 return $vars;
1193 }
1194
1195 public function posts_join( $join ) {
1196 global $typenow, $wp_query, $wpdb;
1197
1198 if ( !isset($_GET['s']) || ( isset($_GET['s']) && ph_clean($_GET['s']) == '' ) )
1199 return $join;
1200
1201 if ( 'appraisal' === $typenow )
1202 {
1203 $join .= "
1204 LEFT JOIN " . $wpdb->postmeta . " AS ph_appraisal_filter_meta_name_number ON " . $wpdb->posts . ".ID = ph_appraisal_filter_meta_name_number.post_id AND ph_appraisal_filter_meta_name_number.meta_key = '_address_name_number'
1205 LEFT JOIN " . $wpdb->postmeta . " AS ph_appraisal_filter_meta_street ON " . $wpdb->posts . ".ID = ph_appraisal_filter_meta_street.post_id AND ph_appraisal_filter_meta_street.meta_key = '_address_street'
1206 LEFT JOIN " . $wpdb->postmeta . " AS ph_appraisal_filter_meta_2 ON " . $wpdb->posts . ".ID = ph_appraisal_filter_meta_2.post_id AND ph_appraisal_filter_meta_2.meta_key = '_address_two'
1207 LEFT JOIN " . $wpdb->postmeta . " AS ph_appraisal_filter_meta_3 ON " . $wpdb->posts . ".ID = ph_appraisal_filter_meta_3.post_id AND ph_appraisal_filter_meta_3.meta_key = '_address_three'
1208 LEFT JOIN " . $wpdb->postmeta . " AS ph_appraisal_filter_meta_4 ON " . $wpdb->posts . ".ID = ph_appraisal_filter_meta_4.post_id AND ph_appraisal_filter_meta_4.meta_key = '_address_four'
1209 LEFT JOIN " . $wpdb->postmeta . " AS ph_appraisal_filter_meta_postcode ON " . $wpdb->posts . ".ID = ph_appraisal_filter_meta_postcode.post_id AND ph_appraisal_filter_meta_postcode.meta_key = '_address_postcode'
1210 ";
1211 }
1212 elseif ( 'viewing' === $typenow || 'offer' === $typenow || 'sale' === $typenow )
1213 {
1214 $join .= "
1215 LEFT JOIN " . $wpdb->postmeta . " AS ph_property_filter_meta ON " . $wpdb->posts . ".ID = ph_property_filter_meta.post_id AND ph_property_filter_meta.meta_key = '_property_id'
1216 LEFT JOIN " . $wpdb->posts . " AS ph_property_filter_posts ON ph_property_filter_posts.ID = ph_property_filter_meta.meta_value
1217 LEFT JOIN " . $wpdb->postmeta . " AS ph_property_filter_meta_name_number ON ph_property_filter_posts.ID = ph_property_filter_meta_name_number.post_id AND ph_property_filter_meta_name_number.meta_key = '_address_name_number'
1218 LEFT JOIN " . $wpdb->postmeta . " AS ph_property_filter_meta_street ON ph_property_filter_posts.ID = ph_property_filter_meta_street.post_id AND ph_property_filter_meta_street.meta_key = '_address_street'
1219 LEFT JOIN " . $wpdb->postmeta . " AS ph_property_filter_meta_2 ON ph_property_filter_posts.ID = ph_property_filter_meta_2.post_id AND ph_property_filter_meta_2.meta_key = '_address_2'
1220 LEFT JOIN " . $wpdb->postmeta . " AS ph_property_filter_meta_3 ON ph_property_filter_posts.ID = ph_property_filter_meta_3.post_id AND ph_property_filter_meta_3.meta_key = '_address_3'
1221 LEFT JOIN " . $wpdb->postmeta . " AS ph_property_filter_meta_4 ON ph_property_filter_posts.ID = ph_property_filter_meta_4.post_id AND ph_property_filter_meta_4.meta_key = '_address_4'
1222 LEFT JOIN " . $wpdb->postmeta . " AS ph_property_filter_meta_postcode ON ph_property_filter_posts.ID = ph_property_filter_meta_postcode.post_id AND ph_property_filter_meta_postcode.meta_key = '_address_postcode'
1223
1224 LEFT JOIN " . $wpdb->postmeta . " AS ph_applicant_filter_meta ON " . $wpdb->posts . ".ID = ph_applicant_filter_meta.post_id AND ph_applicant_filter_meta.meta_key = '_applicant_contact_id'
1225 LEFT JOIN " . $wpdb->posts . " AS ph_applicant_filter_posts ON ph_applicant_filter_posts.ID = ph_applicant_filter_meta.meta_value
1226 ";
1227 }
1228
1229 return $join;
1230 }
1231
1232 public function posts_where( $where ) {
1233 global $typenow, $wp_query, $wpdb;
1234
1235 if ( !isset($_GET['s']) || ( isset($_GET['s']) && ph_clean($_GET['s']) == '' ) )
1236 return $where;
1237
1238 if ( 'appraisal' === $typenow )
1239 {
1240 $where = preg_replace(
1241 "/\(\s*" . $wpdb->posts . ".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
1242 "(
1243 (" . $wpdb->posts . ".post_title LIKE $1)
1244 OR
1245 (ph_appraisal_filter_meta_name_number.meta_value LIKE $1)
1246 OR
1247 (ph_appraisal_filter_meta_street.meta_value LIKE $1)
1248 OR
1249 (ph_appraisal_filter_meta_2.meta_value LIKE $1)
1250 OR
1251 (ph_appraisal_filter_meta_3.meta_value LIKE $1)
1252 OR
1253 (ph_appraisal_filter_meta_4.meta_value LIKE $1)
1254 OR
1255 (ph_appraisal_filter_meta_postcode.meta_value LIKE $1)
1256 )",
1257 $where
1258 );
1259 }
1260 elseif ( 'viewing' === $typenow || 'offer' === $typenow || 'sale' === $typenow )
1261 {
1262 $where = preg_replace(
1263 "/\(\s*" . $wpdb->posts . ".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
1264 "(
1265 (" . $wpdb->posts . ".post_title LIKE $1)
1266 OR
1267 (ph_property_filter_posts.post_title LIKE $1)
1268 OR
1269 (ph_property_filter_meta_name_number.meta_value LIKE $1)
1270 OR
1271 (ph_property_filter_meta_street.meta_value LIKE $1)
1272 OR
1273 (ph_property_filter_meta_2.meta_value LIKE $1)
1274 OR
1275 (ph_property_filter_meta_3.meta_value LIKE $1)
1276 OR
1277 (ph_property_filter_meta_4.meta_value LIKE $1)
1278 OR
1279 (ph_property_filter_meta_postcode.meta_value LIKE $1)
1280 OR
1281 (ph_applicant_filter_posts.post_title LIKE $1)
1282 )",
1283 $where
1284 );
1285 }
1286
1287 return $where;
1288 }
1289
1290 /**
1291 * Removes variations etc belonging to a deleted post, and clears transients
1292 *
1293 * @access public
1294 * @param mixed $id ID of post being deleted
1295 * @return void
1296 */
1297 public function delete_post( $id ) {
1298 /*global $propertyhive, $wpdb;
1299
1300 if ( ! current_user_can( 'delete_posts' ) )
1301 return;
1302
1303 if ( $id > 0 ) {
1304
1305 $post_type = get_post_type( $id );
1306
1307 switch( $post_type ) {
1308 case 'property' :
1309 ph_delete_property_transients();
1310 break;
1311 case 'contact' :
1312 ph_delete_contact_transients();
1313 break;
1314 case 'enquiry' :
1315 ph_delete_enquiry_transients();
1316 break;
1317 }
1318 }*/
1319 }
1320
1321 /**
1322 * propertyhive_trash_post function.
1323 *
1324 * @access public
1325 * @param mixed $id
1326 * @return void
1327 */
1328 public function trash_post( $id ) {
1329 /*if ( $id > 0 ) {
1330
1331 $post_type = get_post_type( $id );
1332
1333
1334 }*/
1335 }
1336
1337 /**
1338 * propertyhive_untrash_post function.
1339 *
1340 * @access public
1341 * @param mixed $id
1342 * @return void
1343 */
1344 public function untrash_post( $id ) {
1345 /*if ( $id > 0 ) {
1346
1347 $post_type = get_post_type( $id );
1348
1349 }*/
1350 }
1351 }
1352
1353 endif;
1354
1355 return new PH_Admin_Post_Types();