| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly. |
| 5 |
} |
| 6 |
|
| 7 |
require_once WPDIRECTORYKIT_PATH . 'extensions/wdk-dependfields.php'; |
| 8 |
new \Wdk\Extensions\WdkDependfields(); |
| 9 |
|
| 10 |
|
| 11 |
if(file_exists(WPDIRECTORYKIT_PATH . 'extensions/wdk-cached-users.php')) { |
| 12 |
require_once WPDIRECTORYKIT_PATH . 'extensions/wdk-cached-users.php'; |
| 13 |
new \Wdk\Extensions\WdkCachedUsers(); |
| 14 |
} |
| 15 |
|
| 16 |
/* remove wdk data on remove user */ |
| 17 |
add_action('delete_user', function($user_id ){ |
| 18 |
if(!empty($user_id)) { |
| 19 |
global $Winter_MVC_WDK; |
| 20 |
$Winter_MVC_WDK->model('user_m'); |
| 21 |
$Winter_MVC_WDK->user_m->remove_user_data(intval($user_id)); |
| 22 |
} |
| 23 |
}); |
| 24 |
|
| 25 |
/* home, results page, dash/login, menu for hamburger */ |
| 26 |
add_action('wp_footer', function(){ |
| 27 |
if(wdk_get_option('wdk_mobile_bottom_navbar_enable')) { |
| 28 |
wp_enqueue_style( 'dashicons' ); |
| 29 |
?> |
| 30 |
<div class="wdk_mobile_footer_menu"> |
| 31 |
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr__('Home','nexproperty' ); ?>"><span class="dashicons dashicons-admin-home"></span></a> |
| 32 |
<?php if(wdk_get_option('wdk_results_page')):?> |
| 33 |
<a href="<?php echo esc_url(get_permalink(wdk_get_option('wdk_results_page'))); ?>" title="<?php echo esc_attr__('Search','nexproperty' ); ?>"><span class="dashicons dashicons-search"></span></a> |
| 34 |
<?php endif;?> |
| 35 |
<?php if (!is_user_logged_in()): ?> |
| 36 |
<a href="<?php echo (get_option('wdk_membership_login_page')) ? esc_url(get_permalink(wdk_get_option('wdk_membership_login_page'))) : esc_url(wp_login_url());?>" class="sign_in sign-btn"><i class="fas fa-user" aria-hidden="true"></i></a> |
| 37 |
<?php else:?> |
| 38 |
<?php |
| 39 |
$dash_url = get_admin_url() . "admin.php?page=wdk"; |
| 40 |
if(function_exists('wdk_dash_url') && get_option('wdk_membership_dash_page') && wdk_dash_url()){ |
| 41 |
$dash_url = wdk_dash_url(); |
| 42 |
} |
| 43 |
?> |
| 44 |
<a href="<?php echo esc_url($dash_url);?>" class="sign_in dash-btn" title="<?php echo esc_attr__('Dash','nexproperty' ); ?>" class="wdk-element-button logout"> |
| 45 |
<i aria-hidden="true" class="fas fa-tachometer-alt"></i> |
| 46 |
</a> |
| 47 |
<a href="<?php echo esc_url(wp_logout_url( get_permalink() )); ?>" class="sign_in sign-btn" title="<?php echo esc_attr__('Log Out','nexproperty' ); ?>"><i class="fas fa-user-times" aria-hidden="true"></i></a> |
| 48 |
<?php endif;?> |
| 49 |
|
| 50 |
|
| 51 |
<?php if(!wdk_get_option('wdk_mobile_bottom_show_menu_disable')):?> |
| 52 |
<div class="wdk-footer-menu"> |
| 53 |
<?php |
| 54 |
$menus = wp_get_nav_menus(); |
| 55 |
|
| 56 |
$available_menus = []; |
| 57 |
foreach ($menus as $menu) { |
| 58 |
$available_menus[$menu->slug] = $menu->name; |
| 59 |
} |
| 60 |
|
| 61 |
?> |
| 62 |
|
| 63 |
<input id="wdk_mobile_footer_menu_gumb" type="checkbox" class="wdk_mobile_footer_menu_gumb"> |
| 64 |
|
| 65 |
<?php if(!empty($available_menus)):?> |
| 66 |
<label for="wdk_mobile_footer_menu_gumb" class="wdk_mobile_footer_menu_gumb-open"> |
| 67 |
<span class="dashicons dashicons-menu"></span> |
| 68 |
</label> |
| 69 |
<?php endif;?> |
| 70 |
|
| 71 |
<div class="menu__box"> |
| 72 |
<?php echo wp_nav_menu( array( |
| 73 |
'menu' => array_keys($available_menus)[0], |
| 74 |
'menu_class' => 'wl-nav-menu wl-nav-menu', |
| 75 |
'menu_id' => 'menu-' . array_keys($available_menus)[0] . '-wdk-bottom-menu', |
| 76 |
'fallback_cb' => '__return_empty_string', |
| 77 |
));?> |
| 78 |
</div> |
| 79 |
</div> |
| 80 |
<?php endif;?> |
| 81 |
</div> |
| 82 |
<?php |
| 83 |
} |
| 84 |
}); |
| 85 |
|
| 86 |
add_filter( 'intermediate_image_sizes_advanced', function( $sizes ){ |
| 87 |
if(get_option('wdk_install_images_sizes_disable') == 1) { |
| 88 |
return array(); |
| 89 |
} |
| 90 |
return $sizes; |
| 91 |
} ); |
| 92 |
|
| 93 |
/* update edit log */ |
| 94 |
add_action('wdk-membership/listing/saved', function($post_id = NULL, $old_listing_date = NULL){ |
| 95 |
global $Winter_MVC_WDK; |
| 96 |
$Winter_MVC_WDK->model('editlog_m'); |
| 97 |
$Winter_MVC_WDK->editlog_m->insert(array( |
| 98 |
'user_id' => get_current_user_id(), |
| 99 |
'post_id' => $post_id, |
| 100 |
'date' => date('Y-m-d H:i:s'), |
| 101 |
'ip' => $_SERVER['REMOTE_ADDR'] |
| 102 |
)); |
| 103 |
}); |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
?> |