| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin functions for the contact post type |
| 4 |
* |
| 5 |
* @author PropertyHive |
| 6 |
* @category Admin |
| 7 |
* @package PropertyHive/Admin/Post Types |
| 8 |
* @version 1.0.0 |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) { |
| 12 |
exit; // Exit if accessed directly |
| 13 |
} |
| 14 |
|
| 15 |
if ( ! class_exists( 'PH_Admin_CPT' ) ) { |
| 16 |
include( 'class-ph-admin-cpt.php' ); |
| 17 |
} |
| 18 |
|
| 19 |
if ( ! class_exists( 'PH_Admin_CPT_Contact' ) ) : |
| 20 |
|
| 21 |
/** |
| 22 |
* PH_Admin_CPT_Contact Class |
| 23 |
*/ |
| 24 |
class PH_Admin_CPT_Contact extends PH_Admin_CPT { |
| 25 |
|
| 26 |
/** |
| 27 |
* Constructor |
| 28 |
*/ |
| 29 |
public function __construct() { |
| 30 |
$this->type = 'contact'; |
| 31 |
|
| 32 |
// Post title fields |
| 33 |
add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 ); |
| 34 |
|
| 35 |
// Featured image text |
| 36 |
//add_filter( 'gettext', array( $this, 'featured_image_gettext' ) ); |
| 37 |
//add_filter( 'media_view_strings', array( $this, 'media_view_strings' ), 10, 2 ); |
| 38 |
|
| 39 |
// Visibility option |
| 40 |
//add_action( 'post_submitbox_misc_actions', array( $this, 'property_data_visibility' ) ); |
| 41 |
|
| 42 |
// Before data updates |
| 43 |
add_action( 'pre_post_update', array( $this, 'pre_post_update' ) ); |
| 44 |
add_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ) ); |
| 45 |
|
| 46 |
// Admin Columns |
| 47 |
add_filter( 'manage_edit-contact_columns', array( $this, 'edit_columns' ) ); |
| 48 |
add_action( 'manage_contact_posts_custom_column', array( $this, 'custom_columns' ), 2 ); |
| 49 |
add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ), 10, 2 ); |
| 50 |
add_filter( 'post_row_actions', array( $this, 'remove_actions' ), 10, 2 ); |
| 51 |
add_filter( 'manage_edit-contact_sortable_columns', array( $this, 'custom_columns_sort' ) ); |
| 52 |
add_filter( 'request', array( $this, 'custom_columns_orderby' ) ); |
| 53 |
|
| 54 |
// Sort link |
| 55 |
// add_filter( 'views_edit-property', array( $this, 'default_sorting_link' ) ); |
| 56 |
|
| 57 |
// Prouct filtering |
| 58 |
// add_action( 'restrict_manage_posts', array( $this, 'product_filters' ) ); |
| 59 |
// add_filter( 'parse_query', array( $this, 'property_filters_query' ) ); |
| 60 |
|
| 61 |
// Maintain hierarchy of terms |
| 62 |
// add_filter( 'wp_terms_checklist_args', array( $this, 'disable_checked_ontop' ) ); |
| 63 |
|
| 64 |
// Bulk / quick edit |
| 65 |
add_filter( 'bulk_actions-edit-contact', array( $this, 'remove_bulk_actions') ); |
| 66 |
add_filter( 'bulk_actions-edit-contact', array( $this, 'add_merge_contacts_action') ); |
| 67 |
add_filter( 'handle_bulk_actions-edit-contact', array( $this, 'merge_contacts_redirect'), 10, 3 ); |
| 68 |
/*add_action( 'bulk_edit_custom_box', array( $this, 'bulk_edit' ), 10, 2 ); |
| 69 |
add_action( 'quick_edit_custom_box', array( $this, 'quick_edit' ), 10, 2 ); |
| 70 |
add_action( 'save_post', array( $this, 'bulk_and_quick_edit_save_post' ), 10, 2 ); |
| 71 |
|
| 72 |
// Uploads |
| 73 |
add_filter( 'upload_dir', array( $this, 'upload_dir' ) ); |
| 74 |
add_action( 'media_upload_downloadable_product', array( $this, 'media_upload_downloadable_product' ) ); |
| 75 |
add_filter( 'mod_rewrite_rules', array( $this, 'ms_protect_download_rewite_rules' ) ); |
| 76 |
|
| 77 |
// Download permissions |
| 78 |
//add_action( 'propertyhive_process_product_file_download_paths', array( $this, 'process_product_file_download_paths' ), 10, 3 );*/ |
| 79 |
|
| 80 |
add_action( 'admin_notices', array( $this, 'ph_message_admin_notice') ); |
| 81 |
|
| 82 |
add_action( 'manage_posts_extra_tablenav', array( $this, 'generate_applicant_list_action') ); |
| 83 |
|
| 84 |
add_filter( 'admin_url', array( $this, 'append_contact_type_to_add_new_url' ), 10, 2 ); |
| 85 |
|
| 86 |
|
| 87 |
// Call PH_Admin_CPT constructor |
| 88 |
parent::__construct(); |
| 89 |
} |
| 90 |
|
| 91 |
public function append_contact_type_to_add_new_url( $url, $path ) |
| 92 |
{ |
| 93 |
if ( $path === 'post-new.php?post_type=contact' ) |
| 94 |
{ |
| 95 |
if ( isset($_GET['_contact_type']) ) |
| 96 |
{ |
| 97 |
$url .= '&contact_type=' . ph_clean($_GET['_contact_type']); |
| 98 |
} |
| 99 |
} |
| 100 |
return $url; |
| 101 |
} |
| 102 |
|
| 103 |
public function ph_message_admin_notice() |
| 104 |
{ |
| 105 |
$message = ''; |
| 106 |
|
| 107 |
if ( isset($_GET['ph_message']) ) |
| 108 |
{ |
| 109 |
switch ( $_GET['ph_message'] ) |
| 110 |
{ |
| 111 |
case "1": { |
| 112 |
$message = __( 'All done! The selected properties will be emailed to the applicant shortly.', 'propertyhive' ); |
| 113 |
break; |
| 114 |
} |
| 115 |
case "2": { |
| 116 |
$message = __( 'Selected properties successfully removed from applicant matches', 'propertyhive' ); |
| 117 |
break; |
| 118 |
} |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
if ( $message != '' ) |
| 123 |
{ |
| 124 |
echo "<div class=\"notice notice-success\"> |
| 125 |
<p>" . esc_html($message) . "</p> |
| 126 |
</div>"; |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* Check if we're editing or adding a contact |
| 132 |
* @return boolean |
| 133 |
*/ |
| 134 |
private function is_editing_contact() { |
| 135 |
if ( ! empty( $_GET['post_type'] ) && 'contact' == $_GET['post_type'] ) { |
| 136 |
return true; |
| 137 |
} |
| 138 |
if ( ! empty( $_GET['post'] ) && 'contact' == get_post_type( (int)$_GET['post'] ) ) { |
| 139 |
return true; |
| 140 |
} |
| 141 |
if ( ! empty( $_REQUEST['post_id'] ) && 'contact' == get_post_type( (int)$_REQUEST['post_id'] ) ) { |
| 142 |
return true; |
| 143 |
} |
| 144 |
return false; |
| 145 |
} |
| 146 |
|
| 147 |
/** |
| 148 |
* Change title boxes in admin. |
| 149 |
* @param string $text |
| 150 |
* @param object $post |
| 151 |
* @return string |
| 152 |
*/ |
| 153 |
public function enter_title_here( $text, $post ) { |
| 154 |
if ( is_admin() && $post->post_type == 'contact' ) { |
| 155 |
return __( 'Enter Contact Name(s)', 'propertyhive' ); |
| 156 |
} |
| 157 |
|
| 158 |
return $text; |
| 159 |
} |
| 160 |
|
| 161 |
/** |
| 162 |
* Some functions, like the term recount, require the visibility to be set prior. Lets save that here. |
| 163 |
* |
| 164 |
* @param int $post_id |
| 165 |
*/ |
| 166 |
public function pre_post_update( $post_id ) { |
| 167 |
|
| 168 |
} |
| 169 |
|
| 170 |
/** |
| 171 |
* Forces certain product data based on the product's type, e.g. grouped products cannot have a parent. |
| 172 |
* |
| 173 |
* @param array $data |
| 174 |
* @return array |
| 175 |
*/ |
| 176 |
public function wp_insert_post_data( $data ) { |
| 177 |
|
| 178 |
|
| 179 |
return $data; |
| 180 |
} |
| 181 |
|
| 182 |
/** |
| 183 |
* Change the columns shown in admin. |
| 184 |
*/ |
| 185 |
public function edit_columns( $existing_columns ) { |
| 186 |
|
| 187 |
if ( empty( $existing_columns ) && ! is_array( $existing_columns ) ) { |
| 188 |
$existing_columns = array(); |
| 189 |
} |
| 190 |
|
| 191 |
unset( $existing_columns['title'], $existing_columns['comments'], $existing_columns['date'] ); |
| 192 |
|
| 193 |
$columns = array(); |
| 194 |
$columns['cb'] = '<input type="checkbox" />'; |
| 195 |
$columns['name'] = __( 'Name', 'propertyhive' ); |
| 196 |
$columns['address'] = __( 'Address', 'propertyhive' ); |
| 197 |
$columns['contact_details'] = __( 'Contact Details', 'propertyhive' ); |
| 198 |
$columns['date'] = __( 'Date Created', 'propertyhive' ); |
| 199 |
|
| 200 |
return array_merge( $columns, $existing_columns ); |
| 201 |
} |
| 202 |
|
| 203 |
/** |
| 204 |
* Define our custom columns shown in admin. |
| 205 |
* @param string $column |
| 206 |
*/ |
| 207 |
public function custom_columns( $column ) { |
| 208 |
global $post, $propertyhive, $the_contact; |
| 209 |
|
| 210 |
if ( empty( $the_contact ) || $the_contact->ID != $post->ID ) |
| 211 |
{ |
| 212 |
$the_contact = new PH_Contact( $post->ID ); |
| 213 |
} |
| 214 |
|
| 215 |
switch ( $column ) { |
| 216 |
case 'name' : |
| 217 |
|
| 218 |
$edit_link = get_edit_post_link( $post->ID ); |
| 219 |
//$title = _draft_or_post_title(); |
| 220 |
$title = $the_contact->post_title; |
| 221 |
$contact_types = $the_contact->_contact_types; |
| 222 |
|
| 223 |
$post_type_object = get_post_type_object( $post->post_type ); |
| 224 |
$can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); |
| 225 |
|
| 226 |
echo '<strong><a class="row-title" href="' . esc_url( $edit_link ) .'">' . esc_html($title) . '</a>'; |
| 227 |
if ( isset( $_GET['_contact_type'] ) && strpos( ph_clean($_GET['_contact_type']), 'applicant' ) !== FALSE && is_array($contact_types) && in_array('applicant', $contact_types) && $the_contact->_hot_applicant == 'yes' ) |
| 228 |
{ |
| 229 |
echo ' <span style="color:#C00;">(' . esc_html(__( 'Hot Applicant', 'propertyhive' )) . ')</span>'; |
| 230 |
} |
| 231 |
echo '</strong>'; |
| 232 |
|
| 233 |
/*if ( $post->post_parent > 0 ) { |
| 234 |
echo ' ← <a href="'. get_edit_post_link( $post->post_parent ) .'">'. get_the_title( $post->post_parent ) .'</a>'; |
| 235 |
} |
| 236 |
|
| 237 |
// Excerpt view |
| 238 |
if ( isset( $_GET['mode'] ) && 'excerpt' == $_GET['mode'] ) { |
| 239 |
echo apply_filters( 'the_excerpt', $post->post_excerpt ); |
| 240 |
}*/ |
| 241 |
|
| 242 |
/*get_inline_data( $post );*/ |
| 243 |
|
| 244 |
/* Custom inline data for propertyhive */ |
| 245 |
/*echo ' |
| 246 |
<div class="hidden" id="propertyhive_inline_' . $post->ID . '"> |
| 247 |
<div class="menu_order">' . $post->menu_order . '</div> |
| 248 |
</div> |
| 249 |
';*/ |
| 250 |
|
| 251 |
break; |
| 252 |
case 'address' : |
| 253 |
|
| 254 |
echo esc_html($the_contact->get_formatted_full_address()); |
| 255 |
|
| 256 |
break; |
| 257 |
case 'contact_details' : |
| 258 |
|
| 259 |
echo 'T: ' . esc_html($the_contact->_telephone_number) . '<br>'; |
| 260 |
echo 'E: ' . esc_html($the_contact->_email_address); |
| 261 |
|
| 262 |
break; |
| 263 |
default : |
| 264 |
break; |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
public function set_primary_column( $default, $screen ) { |
| 269 |
|
| 270 |
if ( 'edit-contact' === $screen ) |
| 271 |
{ |
| 272 |
$default = 'name'; |
| 273 |
} |
| 274 |
|
| 275 |
return $default; |
| 276 |
} |
| 277 |
|
| 278 |
public function remove_actions($actions, $post) { |
| 279 |
|
| 280 |
if ( $post->post_type !== 'contact' ) |
| 281 |
{ |
| 282 |
return $actions; |
| 283 |
} |
| 284 |
|
| 285 |
// Remove 'Quick Edit' link |
| 286 |
if ( isset($actions['inline hide-if-no-js']) ) |
| 287 |
{ |
| 288 |
unset($actions['inline hide-if-no-js']); |
| 289 |
} |
| 290 |
|
| 291 |
if ( isset($actions['trash']) ) |
| 292 |
{ |
| 293 |
unset($actions['trash']); |
| 294 |
} |
| 295 |
|
| 296 |
return $actions; |
| 297 |
} |
| 298 |
|
| 299 |
/** |
| 300 |
* Remove bulk edit option |
| 301 |
* @param array $actions |
| 302 |
*/ |
| 303 |
public function remove_bulk_actions( $actions ) { |
| 304 |
unset( $actions['edit'] ); |
| 305 |
return $actions; |
| 306 |
} |
| 307 |
|
| 308 |
/** |
| 309 |
* Add merge contacts option |
| 310 |
* @param array $actions |
| 311 |
*/ |
| 312 |
public function add_merge_contacts_action( $actions ) { |
| 313 |
$actions['merge_contacts'] = __('Merge Selected', 'propertyhive'); |
| 314 |
return $actions; |
| 315 |
} |
| 316 |
|
| 317 |
public function merge_contacts_redirect( $redirect_url, $action, $post_ids ) { |
| 318 |
|
| 319 |
if ( $action == 'merge_contacts' && count($post_ids) > 1 ) |
| 320 |
{ |
| 321 |
$redirect_url = add_query_arg( 'merge_ids', implode( '|', $post_ids ), admin_url('admin.php?page=ph-merge-duplicate-contacts') ); |
| 322 |
} |
| 323 |
return $redirect_url; |
| 324 |
|
| 325 |
} |
| 326 |
|
| 327 |
/** |
| 328 |
* Make contact columns sortable |
| 329 |
* |
| 330 |
* https://gist.github.com/906872 |
| 331 |
* |
| 332 |
* @access public |
| 333 |
* @param mixed $columns |
| 334 |
* @return array |
| 335 |
*/ |
| 336 |
public function custom_columns_sort( $columns ) { |
| 337 |
$custom = array( |
| 338 |
'name' => 'title' |
| 339 |
); |
| 340 |
return wp_parse_args( $custom, $columns ); |
| 341 |
} |
| 342 |
|
| 343 |
/** |
| 344 |
* Product column orderby |
| 345 |
* |
| 346 |
* http://scribu.net/wordpress/custom-sortable-columns.html#comment-4732 |
| 347 |
* |
| 348 |
* @access public |
| 349 |
* @param mixed $vars |
| 350 |
* @return array |
| 351 |
*/ |
| 352 |
public function custom_columns_orderby( $vars ) { |
| 353 |
/*if ( isset( $vars['orderby'] ) ) { |
| 354 |
if ( 'price' == $vars['orderby'] ) { |
| 355 |
$vars = array_merge( $vars, array( |
| 356 |
'meta_key' => 'price', |
| 357 |
'orderby' => 'meta_value_num' |
| 358 |
) ); |
| 359 |
} |
| 360 |
}*/ |
| 361 |
|
| 362 |
return $vars; |
| 363 |
} |
| 364 |
|
| 365 |
/** |
| 366 |
* Product sorting link |
| 367 |
* |
| 368 |
* Based on Simple Page Ordering by 10up (http://wordpress.org/extend/plugins/simple-page-ordering/) |
| 369 |
* |
| 370 |
* @param array $views |
| 371 |
* @return array |
| 372 |
*/ |
| 373 |
public function default_sorting_link( $views ) { |
| 374 |
global $post_type, $wp_query; |
| 375 |
|
| 376 |
if ( ! current_user_can('edit_others_pages') ) { |
| 377 |
return $views; |
| 378 |
} |
| 379 |
|
| 380 |
$class = ( isset( $wp_query->query['orderby'] ) && $wp_query->query['orderby'] == 'menu_order title' ) ? 'current' : ''; |
| 381 |
$query_string = remove_query_arg(array( 'orderby', 'order' )); |
| 382 |
$query_string = add_query_arg( 'orderby', urlencode('menu_order title'), $query_string ); |
| 383 |
$query_string = add_query_arg( 'order', urlencode('ASC'), $query_string ); |
| 384 |
$views['byorder'] = '<a href="'. $query_string . '" class="' . esc_attr( $class ) . '">' . __( 'Sort Contacts', 'propertyhive' ) . '</a>'; |
| 385 |
|
| 386 |
return $views; |
| 387 |
} |
| 388 |
|
| 389 |
/** |
| 390 |
* Maintain term hierarchy when editing a property. |
| 391 |
* @param array $args |
| 392 |
* @return array |
| 393 |
*/ |
| 394 |
public function disable_checked_ontop( $args ) { |
| 395 |
if ( 'product_cat' == $args['taxonomy'] ) { |
| 396 |
$args['checked_ontop'] = false; |
| 397 |
} |
| 398 |
|
| 399 |
return $args; |
| 400 |
} |
| 401 |
|
| 402 |
/** |
| 403 |
* Custom bulk edit - form |
| 404 |
* |
| 405 |
* @access public |
| 406 |
* @param mixed $column_name |
| 407 |
* @param mixed $post_type |
| 408 |
*/ |
| 409 |
public function bulk_edit( $column_name, $post_type ) { |
| 410 |
if ( 'price' != $column_name || 'property' != $post_type ) { |
| 411 |
return; |
| 412 |
} |
| 413 |
|
| 414 |
include( HP()->plugin_path() . '/includes/admin/views/html-bulk-edit-product.php' ); |
| 415 |
} |
| 416 |
|
| 417 |
/** |
| 418 |
* Custom quick edit - form |
| 419 |
* |
| 420 |
* @access public |
| 421 |
* @param mixed $column_name |
| 422 |
* @param mixed $post_type |
| 423 |
*/ |
| 424 |
public function quick_edit( $column_name, $post_type ) { |
| 425 |
if ( 'price' != $column_name || 'property' != $post_type ) { |
| 426 |
return; |
| 427 |
} |
| 428 |
|
| 429 |
include( HP()->plugin_path() . '/includes/admin/views/html-quick-edit-contact.php' ); |
| 430 |
} |
| 431 |
|
| 432 |
/** |
| 433 |
* Quick and bulk edit saving |
| 434 |
* |
| 435 |
* @access public |
| 436 |
* @param int $post_id |
| 437 |
* @param WP_Post $post |
| 438 |
* @return int |
| 439 |
*/ |
| 440 |
public function bulk_and_quick_edit_save_post( $post_id, $post ) { |
| 441 |
// If this is an autosave, our form has not been submitted, so we don't want to do anything. |
| 442 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
| 443 |
return $post_id; |
| 444 |
} |
| 445 |
|
| 446 |
// Don't save revisions and autosaves |
| 447 |
if ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) { |
| 448 |
return $post_id; |
| 449 |
} |
| 450 |
|
| 451 |
// Check post type is product |
| 452 |
if ( 'contact' != $post->post_type ) { |
| 453 |
return $post_id; |
| 454 |
} |
| 455 |
|
| 456 |
// Check user permission |
| 457 |
if ( ! current_user_can( 'edit_post', $post_id ) ) { |
| 458 |
return $post_id; |
| 459 |
} |
| 460 |
|
| 461 |
// Check nonces |
| 462 |
if ( ! isset( $_REQUEST['propertyhive_quick_edit_nonce'] ) && ! isset( $_REQUEST['propertyhive_bulk_edit_nonce'] ) ) { |
| 463 |
return $post_id; |
| 464 |
} |
| 465 |
if ( isset( $_REQUEST['propertyhive_quick_edit_nonce'] ) && ! wp_verify_nonce( $_REQUEST['propertyhive_quick_edit_nonce'], 'propertyhive_quick_edit_nonce' ) ) { |
| 466 |
return $post_id; |
| 467 |
} |
| 468 |
if ( isset( $_REQUEST['propertyhive_bulk_edit_nonce'] ) && ! wp_verify_nonce( $_REQUEST['propertyhive_bulk_edit_nonce'], 'propertyhive_bulk_edit_nonce' ) ) { |
| 469 |
return $post_id; |
| 470 |
} |
| 471 |
|
| 472 |
// Get the product and save |
| 473 |
$contact = get_contact( $post ); |
| 474 |
|
| 475 |
if ( ! empty( $_REQUEST['propertyhive_quick_edit'] ) ) { |
| 476 |
$this->quick_edit_save( $post_id, $contact ); |
| 477 |
} else { |
| 478 |
$this->bulk_edit_save( $post_id, $contact ); |
| 479 |
} |
| 480 |
|
| 481 |
// Clear transient |
| 482 |
//ph_delete_contact_transients( $post_id ); |
| 483 |
|
| 484 |
return $post_id; |
| 485 |
} |
| 486 |
|
| 487 |
/** |
| 488 |
* Quick edit |
| 489 |
*/ |
| 490 |
private function quick_edit_save( $post_id, $contact ) { |
| 491 |
|
| 492 |
global $wpdb; |
| 493 |
|
| 494 |
/* |
| 495 |
// Save fields |
| 496 |
if ( isset( $_REQUEST['_availability'] ) ) { |
| 497 |
update_post_meta( $post_id, '_availability', ph_clean( $_REQUEST['_availability'] ) ); |
| 498 |
}*/ |
| 499 |
|
| 500 |
do_action( 'propertyhive_contact_quick_edit_save', $contact ); |
| 501 |
} |
| 502 |
|
| 503 |
/** |
| 504 |
* Bulk edit |
| 505 |
*/ |
| 506 |
public function bulk_edit_save( $post_id, $contact ) { |
| 507 |
|
| 508 |
/* |
| 509 |
// Save fields |
| 510 |
if ( ! empty( $_REQUEST['_availability'] ) ) { |
| 511 |
update_post_meta( $post_id, '_availability', ph_clean( $_REQUEST['_availability'] ) ); |
| 512 |
}*/ |
| 513 |
|
| 514 |
do_action( 'propertyhive_contact_bulk_edit_save', $contact ); |
| 515 |
} |
| 516 |
|
| 517 |
/** |
| 518 |
* Filter the directory for uploads. |
| 519 |
* |
| 520 |
* @param array $pathdata |
| 521 |
* @return array |
| 522 |
*/ |
| 523 |
public function upload_dir( $pathdata ) { |
| 524 |
// Change upload dir for downloadable files |
| 525 |
if ( isset( $_POST['type'] ) && 'downloadable_product' == $_POST['type'] ) { |
| 526 |
if ( empty( $pathdata['subdir'] ) ) { |
| 527 |
$pathdata['path'] = $pathdata['path'] . '/propertyhive_uploads'; |
| 528 |
$pathdata['url'] = $pathdata['url']. '/propertyhive_uploads'; |
| 529 |
$pathdata['subdir'] = '/propertyhive_uploads'; |
| 530 |
} else { |
| 531 |
$new_subdir = '/propertyhive_uploads' . $pathdata['subdir']; |
| 532 |
|
| 533 |
$pathdata['path'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['path'] ); |
| 534 |
$pathdata['url'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['url'] ); |
| 535 |
$pathdata['subdir'] = str_replace( $pathdata['subdir'], $new_subdir, $pathdata['subdir'] ); |
| 536 |
} |
| 537 |
} |
| 538 |
|
| 539 |
return $pathdata; |
| 540 |
} |
| 541 |
|
| 542 |
public function generate_applicant_list_action( $which ) |
| 543 |
{ |
| 544 |
global $typenow, $wp_query; |
| 545 |
|
| 546 |
if ( 'contact' != $typenow ) { |
| 547 |
return; |
| 548 |
} |
| 549 |
|
| 550 |
if ( $which == 'top' && isset($_GET['_contact_type']) && $_GET['_contact_type'] == 'applicant' ) |
| 551 |
{ |
| 552 |
echo '<div class="alignleft actions"><a href="' . esc_url(admin_url('admin.php?page=ph-generate-applicant-list')) . '" id="generate_applicant_list_button" class="button">' . esc_html(__( 'Generate Applicant List', 'propertyhive' )) . '</a></div>'; |
| 553 |
} |
| 554 |
} |
| 555 |
} |
| 556 |
|
| 557 |
endif; |
| 558 |
|
| 559 |
return new PH_Admin_CPT_Contact(); |
| 560 |
|