PluginProbe
Property Hive / 1.4.6
Property Hive v1.4.6
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 / settings / class-ph-settings-offices.php

class-ph-settings-offices.php in Property Hive 1.4.6, at includes/admin/settings/class-ph-settings-offices.php

675 lines 29.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * PropertyHive Office Settings
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_Settings_Offices' ) ) :
14
15 /**
16 * PH_Settings_Offices
17 */
18 class PH_Settings_Offices extends PH_Settings_Page {
19
20 /**
21 * Constructor.
22 */
23 public function __construct() {
24 $this->id = 'offices';
25 $this->label = __( 'Offices', 'propertyhive' );
26
27 add_filter( 'propertyhive_settings_tabs_array', array( $this, 'add_settings_page' ), 10 );
28 add_action( 'propertyhive_settings_' . $this->id, array( $this, 'output' ) );
29 add_action( 'propertyhive_settings_save_' . $this->id, array( $this, 'save' ) );
30 add_action( 'propertyhive_sections_' . $this->id, array( $this, 'output_sections' ) );
31 add_action( 'propertyhive_admin_field_offices', array( $this, 'offices_setting' ) );
32 }
33
34 /**
35 * Get settings array
36 *
37 * @return array
38 */
39 public function get_settings() {
40
41 return apply_filters( 'propertyhive_office_settings', array(
42
43 array( 'title' => __( 'Offices', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'offices_options' ),
44
45 array(
46 'type' => 'offices',
47 ),
48
49 array( 'type' => 'sectionend', 'id' => 'offices_options' ),
50 ));
51
52 }
53
54 /**
55 * Get add/edit office settings array
56 *
57 * @return array
58 */
59 public function get_office_settings() {
60
61 global $current_section;
62
63 $current_id = empty( $_REQUEST['id'] ) ? '' : sanitize_title( $_REQUEST['id'] );
64
65 $args = array(
66
67 array( 'title' => __( ( $current_section == 'add' ? 'Add New Office' : 'Edit Office Details' ), 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'office_options' ),
68
69 array(
70 'title' => __( 'Office Name', 'propertyhive' ),
71 'id' => 'office_name',
72 //'css' => 'width:50px;',
73 'default' => get_the_title($current_id),
74 'type' => 'text',
75 'desc_tip' => false,
76 ),
77
78 array(
79 'title' => __( 'Address Line 1', 'propertyhive' ),
80 'id' => '_office_address_1',
81 //'css' => 'width:50px;',
82 'default' => get_post_meta($current_id, '_office_address_1', TRUE),
83 'type' => 'text',
84 'desc_tip' => false,
85 ),
86
87 array(
88 'title' => __( 'Address Line 2', 'propertyhive' ),
89 'id' => '_office_address_2',
90 //'css' => 'width:50px;',
91 'default' => get_post_meta($current_id, '_office_address_2', TRUE),
92 'type' => 'text',
93 'desc_tip' => false,
94 ),
95
96 array(
97 'title' => __( 'Address Line 3', 'propertyhive' ),
98 'id' => '_office_address_3',
99 //'css' => 'width:50px;',
100 'default' => get_post_meta($current_id, '_office_address_3', TRUE),
101 'type' => 'text',
102 'desc_tip' => false,
103 ),
104
105 array(
106 'title' => __( 'Address Line 4', 'propertyhive' ),
107 'id' => '_office_address_4',
108 //'css' => 'width:50px;',
109 'default' => get_post_meta($current_id, '_office_address_4', TRUE),
110 'type' => 'text',
111 'desc_tip' => false,
112 ),
113
114 array(
115 'title' => __( 'Postcode', 'propertyhive' ),
116 'id' => '_office_address_postcode',
117 'css' => 'width:85px;',
118 'default' => get_post_meta($current_id, '_office_address_postcode', TRUE),
119 'type' => 'text',
120 'desc_tip' => false,
121 ),
122
123 array( 'type' => 'sectionend', 'id' => 'office_options' ),
124
125 array( 'title' => __( 'Contact Details', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'office_contact_options' ),
126
127 );
128
129 if ( get_option( 'propertyhive_active_departments_sales' ) == 'yes' )
130 {
131 $args[] = array(
132 'title' => __( 'Telephone Number (Residential Sales)', 'propertyhive' ),
133 'id' => '_office_telephone_number_sales',
134 //'css' => 'width:50px;',
135 'default' => get_post_meta($current_id, '_office_telephone_number_sales', TRUE),
136 'type' => 'text',
137 'desc_tip' => false,
138 );
139
140 $args[] = array(
141 'title' => __( 'Email Address (Residential Sales)', 'propertyhive' ),
142 'id' => '_office_email_address_sales',
143 //'css' => 'width:50px;',
144 'default' => get_post_meta($current_id, '_office_email_address_sales', TRUE),
145 'type' => 'text',
146 'desc_tip' => false,
147 );
148 }
149
150 if ( get_option( 'propertyhive_active_departments_lettings' ) == 'yes' )
151 {
152 $args[] = array(
153 'title' => __( 'Telephone Number (Residential Lettings)', 'propertyhive' ),
154 'id' => '_office_telephone_number_lettings',
155 //'css' => 'width:50px;',
156 'default' => get_post_meta($current_id, '_office_telephone_number_lettings', TRUE),
157 'type' => 'text',
158 'desc_tip' => false,
159 );
160
161 $args[] = array(
162 'title' => __( 'Email Address (Residential Lettings)', 'propertyhive' ),
163 'id' => '_office_email_address_lettings',
164 //'css' => 'width:50px;',
165 'default' => get_post_meta($current_id, '_office_email_address_lettings', TRUE),
166 'type' => 'text',
167 'desc_tip' => false,
168 );
169 }
170
171 if ( get_option( 'propertyhive_active_departments_commercial' ) == 'yes' )
172 {
173 $args[] = array(
174 'title' => __( 'Telephone Number (Commercial)', 'propertyhive' ),
175 'id' => '_office_telephone_number_commercial',
176 //'css' => 'width:50px;',
177 'default' => get_post_meta($current_id, '_office_telephone_number_commercial', TRUE),
178 'type' => 'text',
179 'desc_tip' => false,
180 );
181
182 $args[] = array(
183 'title' => __( 'Email Address (Commercial)', 'propertyhive' ),
184 'id' => '_office_email_address_commercial',
185 //'css' => 'width:50px;',
186 'default' => get_post_meta($current_id, '_office_email_address_commercial', TRUE),
187 'type' => 'text',
188 'desc_tip' => false,
189 );
190 }
191
192 $args[] = array( 'type' => 'sectionend', 'id' => 'office_contact_options' );
193
194 $args[] = array( 'title' => __( 'Office Location', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'office_location_options' );
195
196 $args[] = array(
197 'title' => __( 'Latitude', 'propertyhive' ),
198 'id' => '_office_latitude',
199 //'css' => 'width:50px;',
200 'default' => get_post_meta($current_id, '_office_latitude', TRUE),
201 'type' => 'text',
202 'desc_tip' => false,
203 );
204
205 $args[] = array(
206 'title' => __( 'Longitude', 'propertyhive' ),
207 'id' => '_office_longitude',
208 //'css' => 'width:50px;',
209 'default' => get_post_meta($current_id, '_office_longitude', TRUE),
210 'type' => 'text',
211 'desc_tip' => false,
212 );
213
214 $args[] = array( 'type' => 'sectionend', 'id' => 'office_location_options' );
215
216 return apply_filters( 'propertyhive_office_details_settings', $args );
217
218 }
219
220 /**
221 * Get delete office settings array
222 *
223 * @return array
224 */
225 public function get_office_delete() {
226
227 global $save_button_text, $post;
228
229 $save_button_text = __( 'Delete', 'propertyhive' );
230
231 if ( isset($_POST['confirm_removal']) && $_POST['confirm_removal'] == 1 )
232 {
233 // A term has just been deleted
234 global $hide_save_button, $show_cancel_button, $cancel_button_href;
235
236 $hide_save_button = TRUE;
237 $show_cancel_button = TRUE;
238 $cancel_button_href = admin_url( 'admin.php?page=ph-settings&tab=offices' );
239
240 $args = array();
241
242 $args[] = array( 'title' => __( 'Successfully Deleted Office', 'propertyhive' ), 'type' => 'title', 'desc' => '', 'id' => 'office_delete' );
243
244 $args[] = array(
245 'title' => __( 'Office Deleted', 'propertyhive' ),
246 'id' => '',
247 'html' => __('Office deleted successfully', 'propertyhive' ) . ' <a href="' . admin_url( 'admin.php?page=ph-settings&tab=offices' ) . '">' . __( 'Go Back', 'propertyhive' ) . '</a>',
248 'type' => 'html',
249 'desc_tip' => false,
250 );
251
252 $args[] = array( 'type' => 'sectionend', 'id' => 'office_delete' );
253 }
254 else
255 {
256 $current_id = empty( $_REQUEST['id'] ) ? '' : sanitize_title( $_REQUEST['id'] );
257
258 if ($current_id == '')
259 {
260 die("ID not passed");
261 }
262 else
263 {
264 $post_type = get_post_type( $current_id );
265
266 if ( $post_type == 'office' )
267 {
268 $args = array();
269
270 $args[] = array( 'title' => __( 'Delete Office', 'propertyhive' ) . ': ' . get_the_title( $current_id ), 'type' => 'title', 'desc' => '', 'id' => 'office_delete_options' );
271
272 // Get number of properties assigned to this term
273 $query_args = array(
274 'post_type' => 'property',
275 'nopaging' => true,
276 'post_status' => array( 'pending', 'auto-draft', 'draft', 'private', 'publish', 'future', 'trash' ),
277 'meta_query' => array(
278 array(
279 'key' => '_office_id',
280 'value' => $current_id,
281 'compare' => '='
282 )
283 )
284 );
285 $property_query = new WP_Query( $query_args );
286
287 $num_properties = $property_query->found_posts;
288
289 // Get number of applicants assigned to this term (future)
290
291 if ($num_properties > 0)
292 {
293 $alternative_offices = array();
294
295 $query_args = array(
296 'post_type' => 'office',
297 'nopaging' => true,
298 'post__not_in' => array( $current_id ),
299 'orderby' => 'title',
300 'order' => 'ASC'
301 );
302 $office_query = new WP_Query( $query_args );
303
304 if ( $office_query->have_posts() )
305 {
306 while ( $office_query->have_posts() )
307 {
308 $office_query->the_post();
309
310 $alternative_terms[$post->ID] = get_the_title();
311 }
312 }
313
314 // There are properties assigned to this term
315 $args[] = array(
316 'title' => __( 'Re-assign to', 'propertyhive' ),
317 'id' => 'reassign_to',
318 'default' => '',
319 'options' => $alternative_terms,
320 'type' => 'select',
321 'desc_tip' => false,
322 'desc' => __( 'There are properties that are assigned to the office being deleted. Which office should they be reassigned to?' , 'propertyhive' )
323 );
324 }
325
326 $args[] = array(
327 'title' => __( 'Confirm removal?', 'propertyhive' ),
328 'id' => 'confirm_removal',
329 'type' => 'checkbox',
330 'desc_tip' => false,
331 );
332
333 $args[] = array( 'type' => 'sectionend', 'id' => 'office_delete_options' );
334 }
335 else
336 {
337 die("Trying to delete a post that isn't an office.");
338 }
339 }
340 }
341
342 return apply_filters( 'propertyhive_office_delete_settings', $args );
343
344 }
345
346 /**
347 * Output the settings
348 */
349 public function output() {
350 global $current_section;
351
352 if ( $current_section == 'add' ) {
353
354 remove_action('propertyhive_admin_field_offices', array( $this, 'offices_setting' ));
355
356 $settings = $this->get_office_settings();
357
358 PH_Admin_Settings::output_fields( $settings );
359
360 /*foreach ( $shipping_methods as $method ) {
361 if ( strtolower( get_class( $method ) ) == strtolower( $current_section ) && $method->has_settings() ) {
362 $method->admin_options();
363 break;
364 }
365 }*/
366 } elseif ( $current_section == 'edit' ) {
367
368 remove_action('propertyhive_admin_field_offices', array( $this, 'offices_setting' ));
369
370 $current_id = empty( $_REQUEST['id'] ) ? '' : sanitize_title( $_REQUEST['id'] );
371
372 $settings = $this->get_office_settings();
373
374 PH_Admin_Settings::output_fields( $settings );
375
376 } elseif ( $current_section == 'delete' ) {
377
378 remove_action('propertyhive_admin_field_offices', array( $this, 'offices_setting' ));
379
380 $current_id = empty( $_REQUEST['id'] ) ? '' : sanitize_title( $_REQUEST['id'] );
381
382 $settings = $this->get_office_delete();
383
384 PH_Admin_Settings::output_fields( $settings );
385
386 } else {
387 $settings = $this->get_settings();
388
389 PH_Admin_Settings::output_fields( $settings );
390 }
391 }
392
393 /**
394 * Output list of offices
395 *
396 * @access public
397 * @return void
398 */
399 public function offices_setting() {
400 global $post;
401
402 ?>
403 <tr valign="top">
404 <th scope="row" class="titledesc">
405 &nbsp;
406 </th>
407 <td class="forminp forminp-button">
408 <a href="<?php echo admin_url( 'admin.php?page=ph-settings&tab=offices&section=add' ); ?>" class="button alignright"><?php echo __( 'Add New Office', 'propertyhive' ); ?></a>
409 </td>
410 </tr>
411 <tr valign="top">
412 <th scope="row" class="titledesc"><?php _e( 'Offices', 'propertyhive' ) ?></th>
413 <td class="forminp">
414 <table class="ph_offices widefat" cellspacing="0">
415 <thead>
416 <tr>
417 <th class="primary"><?php _e( 'Primary', 'propertyhive' ); ?></th>
418 <th class="name"><?php _e( 'Name', 'propertyhive' ); ?></th>
419 <th class="address"><?php _e( 'Address', 'propertyhive' ); ?></th>
420 <th class="contact"><?php _e( 'Contact Details', 'propertyhive' ); ?></th>
421 <th class="settings">&nbsp;</th>
422 </tr>
423 </thead>
424 <tbody>
425 <?php
426 $args = array(
427 'post_type' => 'office',
428 'nopaging' => true,
429 'orderby' => 'title',
430 'order' => 'ASC'
431 );
432 $office_query = new WP_Query($args);
433
434 if ($office_query->have_posts())
435 {
436 $num_offices = $office_query->found_posts;
437
438 while ($office_query->have_posts())
439 {
440 $office_query->the_post();
441
442 $address = '';
443 $address_part = get_post_meta($post->ID, '_office_address_1', TRUE);
444 $address .= $address_part . ', ';
445 $address_part = get_post_meta($post->ID, '_office_address_2', TRUE);
446 $address .= $address_part . ', ';
447 $address_part = get_post_meta($post->ID, '_office_address_3', TRUE);
448 $address .= $address_part . ', ';
449 $address_part = get_post_meta($post->ID, '_office_address_4', TRUE);
450 $address .= $address_part . ' ';
451 $address_part = get_post_meta($post->ID, '_office_address_postcode', TRUE);
452 $address .= $address_part;
453
454 $contact_details = '';
455 if ( get_option( 'propertyhive_active_departments_sales' ) == 'yes' )
456 {
457 $contact_details .= 'T: ' . get_post_meta($post->ID, '_office_telephone_number_sales', TRUE) . '<br>';
458 $contact_details .= 'E: ' . get_post_meta($post->ID, '_office_email_address_sales', TRUE) . '<br>';
459 }
460 if ( get_option( 'propertyhive_active_departments_lettings' ) == 'yes' )
461 {
462 $contact_details .= 'T: ' . get_post_meta($post->ID, '_office_telephone_number_lettings', TRUE) . '<br>';
463 $contact_details .= 'E: ' . get_post_meta($post->ID, '_office_email_address_lettings', TRUE) . '<br>';
464 }
465 if ( get_option( 'propertyhive_active_departments_commercial' ) == 'yes' )
466 {
467 $contact_details .= 'T: ' . get_post_meta($post->ID, '_office_telephone_number_commercial', TRUE) . '<br>';
468 $contact_details .= 'E: ' . get_post_meta($post->ID, '_office_email_address_commercial', TRUE) . '<br>';
469 }
470
471 echo '<tr>
472 <td width="1%" class="primary">
473 <input type="radio" name="primary" value="' . esc_attr( $post->ID ) . '" ' . checked( get_post_meta($post->ID, 'primary', TRUE), '1', false ) . ' />
474 </td>
475 <td class="name">
476 ' . get_the_title() . '
477 </td>
478 <td class="address">
479 ' . $address . '
480 </td>
481 <td class="contact">
482 ' . $contact_details . '
483 </td>
484 <td class="settings">
485 <a class="button" href="' . admin_url( 'admin.php?page=ph-settings&tab=offices&section=edit&id=' . $post->ID ) . '">' . __( 'Edit', 'propertyhive' ) . '</a>
486 ';
487 if ( $num_offices > 1 )
488 {
489 echo '<a class="button" href="' . admin_url( 'admin.php?page=ph-settings&tab=offices&section=delete&id=' . $post->ID ) . '">' . __( 'Delete', 'propertyhive' ) . '</a>';
490 }
491 echo '
492 </td>
493 </tr>';
494 }
495 }
496 wp_reset_postdata();
497 ?>
498 </tbody>
499 </table>
500 </td>
501 </tr>
502 <tr valign="top">
503 <th scope="row" class="titledesc">
504 &nbsp;
505 </th>
506 <td class="forminp forminp-button">
507 <a href="<?php echo admin_url( 'admin.php?page=ph-settings&tab=offices&section=add' ); ?>" class="button alignright"><?php echo __( 'Add New Office', 'propertyhive' ); ?></a>
508 </td>
509 </tr>
510 <?php
511 }
512
513 /**
514 * Save settings
515 */
516 public function save() {
517 global $current_section, $post;
518
519 if ( $current_section == 'add' ) {
520
521 // TODO: Validate (check for blank fields, and that office name doest exist already)
522
523 // Insert office
524 $office_post = array(
525 'post_title' => wp_strip_all_tags( $_POST['office_name'] ),
526 'post_content' => '',
527 'post_status' => 'publish',
528 'post_type' => 'office',
529 'comment_status' => 'closed',
530 'ping_status' => 'closed',
531 );
532
533 // Insert the post into the database
534 $office_post_id = wp_insert_post( $office_post );
535
536 // TODO: Check for errors returned from wp_insert_post()
537 // TODO: Add meta information
538
539 PH_Admin_Settings::add_message( __( 'Office added successfully', 'propertyhive' ) . ' ' . '<a href="' . admin_url( 'admin.php?page=ph-settings&tab=offices' ) . '">' . __( 'Return to offices', 'propertyhive' ) . '</a>' );
540
541 } elseif ( $current_section == 'edit' ) {
542
543 $current_id = empty( $_REQUEST['id'] ) ? '' : sanitize_title( $_REQUEST['id'] );
544
545 // TODO: Validate
546 // TODO: Make sure this ID belongs to an office
547 // TODO: Update slug?
548
549 // Update office
550 $office_post = array(
551 'ID' => $current_id,
552 'post_title' => wp_strip_all_tags( $_POST['office_name'] )
553 );
554
555 wp_update_post( $office_post );
556
557 $office_post_id = $current_id;
558
559 // TODO: Check for errors returned from wp_update_post()
560 // TODO: Update meta information
561
562 PH_Admin_Settings::add_message( __( 'Office details updated successfully', 'propertyhive' ) . ' ' . '<a href="' . admin_url( 'admin.php?page=ph-settings&tab=offices' ) . '">' . __( 'Return to offices', 'propertyhive' ) . '</a>' );
563
564 } elseif ( $current_section == 'delete' ) {
565
566 if ( isset($_POST['confirm_removal']) && $_POST['confirm_removal'] == '1' )
567 {
568 $current_id = empty( $_REQUEST['id'] ) ? '' : sanitize_title( $_REQUEST['id'] );
569
570 // Get number of properties assigned to this term
571 $query_args = array(
572 'post_type' => 'property',
573 'nopaging' => true,
574 'post_status' => array( 'pending', 'auto-draft', 'draft', 'private', 'publish', 'future', 'trash' ),
575 'meta_query' => array(
576 array(
577 'key' => '_office_id',
578 'value' => $current_id,
579 'compare' => '='
580 )
581 )
582 );
583 $property_query = new WP_Query( $query_args );
584
585 if ( $property_query->have_posts() )
586 {
587 if ( !isset($_POST['reassign_to']) || ( isset( $_POST['reassign_to'] ) && empty( $_POST['reassign_to'] ) ) )
588 {
589 die("Not assigning properties to new office. Please try again");
590 }
591 else
592 {
593 $post_type = get_post_type( $_POST['reassign_to'] );
594
595 if ( $post_type != 'office' )
596 {
597 die("New office isn't of type office. It's of type: " . $post_type);
598 }
599 }
600
601 while ( $property_query->have_posts() )
602 {
603 $property_query->the_post();
604
605 update_post_meta( $post->ID, '_office_id', $_POST['reassign_to'] );
606
607 // TODO: Check for WP_ERROR
608 }
609 }
610
611 wp_delete_post( $current_id );
612
613 // TODO: Check for WP_ERROR
614 }
615
616 }
617
618 if ( $current_section != 'delete' )
619 {
620 if ( $current_section != 'add' && $current_section != 'edit' )
621 {
622 // Set all offices as not primary
623 // Prevents multiple offices being set as primary
624 $args = array(
625 'post_type' => 'office',
626 'nopaging' => true,
627 'orderby' => 'title',
628 'order' => 'ASC'
629 );
630 $office_query = new WP_Query($args);
631
632 if ($office_query->have_posts())
633 {
634 while ($office_query->have_posts())
635 {
636 $office_query->the_post();
637
638 // Set selected office as primary
639 update_post_meta($post->ID, 'primary', '0');
640 }
641 }
642
643 wp_reset_postdata();
644
645 // Set selected office as primary
646 update_post_meta(wp_strip_all_tags( $_POST['primary'] ), 'primary', '1');
647 }
648 else
649 {
650 update_post_meta($office_post_id, '_office_address_1', wp_strip_all_tags( $_POST['_office_address_1'] ));
651 update_post_meta($office_post_id, '_office_address_2', wp_strip_all_tags( $_POST['_office_address_2'] ));
652 update_post_meta($office_post_id, '_office_address_3', wp_strip_all_tags( $_POST['_office_address_3'] ));
653 update_post_meta($office_post_id, '_office_address_4', wp_strip_all_tags( $_POST['_office_address_4'] ));
654 update_post_meta($office_post_id, '_office_address_postcode', wp_strip_all_tags( $_POST['_office_address_postcode'] ));
655
656 update_post_meta($office_post_id, '_office_telephone_number_sales', (isset($_POST['_office_telephone_number_sales'])) ? wp_strip_all_tags( $_POST['_office_telephone_number_sales'] ) : '');
657 update_post_meta($office_post_id, '_office_email_address_sales', (isset($_POST['_office_email_address_sales'])) ? wp_strip_all_tags( $_POST['_office_email_address_sales'] ) : '');
658 update_post_meta($office_post_id, '_office_telephone_number_lettings', (isset($_POST['_office_telephone_number_lettings'])) ? wp_strip_all_tags( $_POST['_office_telephone_number_lettings'] ) : '');
659 update_post_meta($office_post_id, '_office_email_address_lettings', (isset($_POST['_office_email_address_lettings'])) ? wp_strip_all_tags( $_POST['_office_email_address_lettings'] ) : '');
660 update_post_meta($office_post_id, '_office_telephone_number_commercial', (isset($_POST['_office_telephone_number_commercial'])) ? wp_strip_all_tags( $_POST['_office_telephone_number_commercial'] ) : '');
661 update_post_meta($office_post_id, '_office_email_address_commercial', (isset($_POST['_office_email_address_commercial'])) ? wp_strip_all_tags( $_POST['_office_email_address_commercial'] ) : '');
662
663 update_post_meta($office_post_id, '_office_latitude', wp_strip_all_tags( $_POST['_office_latitude'] ));
664 update_post_meta($office_post_id, '_office_longitude', wp_strip_all_tags( $_POST['_office_longitude'] ));
665
666 do_action( 'propertyhive_save_office', $office_post_id );
667 }
668 }
669 }
670
671 }
672
673 endif;
674
675 return new PH_Settings_Offices();