| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Settings. |
| 4 |
* |
| 5 |
* This is the template that edit form settings |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
?> |
| 15 |
<!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 16 |
|
| 17 |
<div class="wrap wdk-wrap"> |
| 18 |
<h1 class="wp-heading-inline"><?php echo __('Settings', 'wpdirectorykit'); ?></h1> |
| 19 |
<br /> |
| 20 |
<div class="wdk-body"> |
| 21 |
<form method="post" action="" novalidate="novalidate"> |
| 22 |
<?php wp_nonce_field( 'wdk-settings-edit', '_wpnonce'); ?> |
| 23 |
<?php |
| 24 |
$form->messages('class="alert alert-danger"', __('Successfully saved', 'wpdirectorykit')); |
| 25 |
?> |
| 26 |
<?php if(!get_option('wdk_results_page')):?> |
| 27 |
<p class="alert alert-info"><?php echo __('Missing results page', 'wpdirectorykit'); ?></p> |
| 28 |
<?php endif;?> |
| 29 |
|
| 30 |
<div class="wdk-tabs-navs"> |
| 31 |
<label for="wdk_tab_general"<?php if(!wmvc_show_data('wdk_tabs',$_POST, false) || wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_general'):?> class="active" <?php endif;?>><?php echo esc_html__('General','wpdirectorykit');?></label> |
| 32 |
<label for="wdk_tab_apis" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_apis'):?> class="active" <?php endif;?>><?php echo esc_html__('Api-s','wpdirectorykit');?></label> |
| 33 |
<label for="wdk_tab_templates" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_templates'):?> class="active" <?php endif;?>><?php echo esc_html__('Layout','wpdirectorykit');?></label> |
| 34 |
<label for="wdk_tab_fields" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_fields'):?> class="active" <?php endif;?>><?php echo esc_html__('Fields','wpdirectorykit' );?></label> |
| 35 |
<label for="wdk_tab_tools" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_tools'):?> class="active" <?php endif;?>><?php echo esc_html__('Tools','wpdirectorykit' );?></label> |
| 36 |
<?php if(get_option('wdk_experimental_features')):?> |
| 37 |
<label for="wdk_tab_experimental" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_experimental'):?> class="active" <?php endif;?>><?php echo esc_html__('Experimental','wpdirectorykit' );?></label> |
| 38 |
<?php endif;?> |
| 39 |
<label for="wdk_tab_mails" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_mails'):?> class="active" <?php endif;?>><?php echo esc_html__('Emails','wpdirectorykit' );?></label> |
| 40 |
</div> |
| 41 |
<div class="postbox" style="display: block;"> |
| 42 |
<div class="inside"> |
| 43 |
<div class="wdk-tabs-panel"> |
| 44 |
<input type="radio" class="wdk-tab-input" name="wdk_tabs" id="wdk_tab_general" checked value="wdk_tab_general"> |
| 45 |
<div class="wdk-tab"> |
| 46 |
<?php echo wdk_generate_fields($fields_list_tabs['general'], $db_data); ?> |
| 47 |
</div> |
| 48 |
|
| 49 |
<input type="radio" class="wdk-tab-input" name="wdk_tabs" id="wdk_tab_apis" value="wdk_tab_apis" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_apis'):?> checked="checked" <?php endif;?>> |
| 50 |
<div class="wdk-tab"> |
| 51 |
<?php echo wdk_generate_fields($fields_list_tabs['apis'], $db_data); ?> |
| 52 |
</div> |
| 53 |
|
| 54 |
<input type="radio" class="wdk-tab-input" name="wdk_tabs" id="wdk_tab_templates" value="wdk_tab_templates" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_templates'):?> checked="checked" <?php endif;?>> |
| 55 |
<div class="wdk-tab"> |
| 56 |
<?php echo wdk_generate_fields($fields_list_tabs['templates'], $db_data); ?> |
| 57 |
</div> |
| 58 |
|
| 59 |
<input type="radio" class="wdk-tab-input" name="wdk_tabs" id="wdk_tab_fields" value="wdk_tab_fields" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_fields'):?> checked="checked" <?php endif;?>> |
| 60 |
<div class="wdk-tab"> |
| 61 |
<?php echo wdk_generate_fields($fields_list_tabs['fields'], $db_data); ?> |
| 62 |
</div> |
| 63 |
|
| 64 |
<?php if(get_option('wdk_experimental_features')):?> |
| 65 |
<input type="radio" class="wdk-tab-input" name="wdk_tabs" id="wdk_tab_experimental" value="wdk_tab_experimental" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_experimental'):?> checked="checked" <?php endif;?>> |
| 66 |
<div class="wdk-tab"> |
| 67 |
<?php echo wdk_generate_fields($fields_list_tabs['experimental'], $db_data); ?> |
| 68 |
</div> |
| 69 |
<?php endif;?> |
| 70 |
|
| 71 |
<input type="radio" class="wdk-tab-input" name="wdk_tabs" id="wdk_tab_tools" value="wdk_tab_tools" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_tools'):?> checked="checked" <?php endif;?>> |
| 72 |
<div class="wdk-tab"> |
| 73 |
<?php $this->view('wdk_settings/tabs/tab_tools', $data); ?> |
| 74 |
</div> |
| 75 |
|
| 76 |
<input type="radio" class="wdk-tab-input" name="wdk_tabs" id="wdk_tab_mails" value="wdk_tab_mails" <?php if(wmvc_show_data('wdk_tabs',$_POST) == 'wdk_tab_mails'):?> checked="checked" <?php endif;?>> |
| 77 |
<div class="wdk-tab"> |
| 78 |
<?php $this->view('wdk_settings/tabs/tab_emails', $data); ?> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
</div> |
| 82 |
</div> |
| 83 |
<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo __('Save Changes', 'wpdirectorykit'); ?>"> |
| 84 |
</form> |
| 85 |
</div> |
| 86 |
<br/> |
| 87 |
<div class="alert alert-info" role="alert"><a href="//wpdirectorykit.com/documentation/#change_currency" target="_blank"><?php echo __('How to change currency?','wpdirectorykit'); ?></a></div> |
| 88 |
</div> |
| 89 |
|
| 90 |
<script> |
| 91 |
jQuery(document).ready(function($) { |
| 92 |
$('#reset_data_field_button').on('click', function(e){ |
| 93 |
var self = $(this); |
| 94 |
|
| 95 |
var res = prompt("<?php echo __('Are you sure? All Listings, fields, categories, locations will be completely removed, check url and type remove if you are sure', 'wpdirectorykit')?>", ""); |
| 96 |
|
| 97 |
if(res == "<?php echo __('remove', 'wpdirectorykit')?>") { |
| 98 |
return true; |
| 99 |
} else { |
| 100 |
e.preventDefault(); |
| 101 |
e.stopPropagation(); |
| 102 |
$(this).parent().find('.wdk-ajax-indicator').addClass('hidden'); |
| 103 |
return false; |
| 104 |
} |
| 105 |
}) |
| 106 |
$('#generate_listings_images_path').on('click', function(e){ |
| 107 |
e.preventDefault(); |
| 108 |
e.stopPropagation(); |
| 109 |
var self = $(this); |
| 110 |
|
| 111 |
if(self.attr('disabled')) { |
| 112 |
return false; |
| 113 |
} |
| 114 |
|
| 115 |
self.addClass('wdk_btn_load_indicator out'); |
| 116 |
|
| 117 |
self.attr('disabled','disabled'); |
| 118 |
var ajax_param = { |
| 119 |
"page": 'wdk_backendajax', |
| 120 |
"function": 'generated_listings_images_path', |
| 121 |
"action": 'wdk_public_action', |
| 122 |
"_wpnonce": '<?php echo esc_js(wp_create_nonce( 'wdk-generated_listings_images_path'));?>', |
| 123 |
}; |
| 124 |
$.post("<?php echo admin_url( 'admin-ajax.php' );?>", ajax_param, |
| 125 |
function(data){ |
| 126 |
|
| 127 |
if(data.popup_text_success) |
| 128 |
wdk_log_notify(data.popup_text_success); |
| 129 |
|
| 130 |
if(data.popup_text_error) |
| 131 |
wdk_log_notify(data.popup_text_error, 'error'); |
| 132 |
|
| 133 |
if(data.success) { |
| 134 |
self.removeClass('wdk_btn_load_indicator out'); |
| 135 |
self.addClass('wdk_btn_load_success out'); |
| 136 |
} else { |
| 137 |
self.removeClass('wdk_btn_load_indicator out'); |
| 138 |
self.addClass('wdk_btn_load_error out'); |
| 139 |
} |
| 140 |
}).always(function(data) { |
| 141 |
|
| 142 |
}); |
| 143 |
return false; |
| 144 |
}) |
| 145 |
|
| 146 |
$('#optimization_listingfields_table').on('click', function(e){ |
| 147 |
e.preventDefault(); |
| 148 |
e.stopPropagation(); |
| 149 |
var self = $(this); |
| 150 |
|
| 151 |
if(self.attr('disabled')) { |
| 152 |
return false; |
| 153 |
} |
| 154 |
|
| 155 |
self.addClass('wdk_btn_load_indicator out'); |
| 156 |
|
| 157 |
self.attr('disabled','disabled'); |
| 158 |
var ajax_param = { |
| 159 |
"page": 'wdk_backendajax', |
| 160 |
"function": 'optimization_listingfields_table', |
| 161 |
"action": 'wdk_public_action', |
| 162 |
"_wpnonce": '<?php echo esc_js(wp_create_nonce( 'wdk-optimization_listingfields_table'));?>', |
| 163 |
}; |
| 164 |
$.post("<?php echo admin_url( 'admin-ajax.php' );?>", ajax_param, |
| 165 |
function(data){ |
| 166 |
|
| 167 |
if(data.popup_text_success) |
| 168 |
wdk_log_notify(data.popup_text_success); |
| 169 |
|
| 170 |
if(data.popup_text_error) |
| 171 |
wdk_log_notify(data.popup_text_error, 'error'); |
| 172 |
|
| 173 |
if(data.success) { |
| 174 |
self.removeClass('wdk_btn_load_indicator out'); |
| 175 |
self.addClass('wdk_btn_load_success out'); |
| 176 |
} else { |
| 177 |
self.removeClass('wdk_btn_load_indicator out'); |
| 178 |
self.addClass('wdk_btn_load_error out'); |
| 179 |
} |
| 180 |
}).always(function(data) { |
| 181 |
|
| 182 |
}); |
| 183 |
return false; |
| 184 |
}) |
| 185 |
|
| 186 |
$('.ajax_query').on('click', function(e){ |
| 187 |
e.preventDefault(); |
| 188 |
e.stopPropagation(); |
| 189 |
var self = $(this); |
| 190 |
|
| 191 |
if(self.attr('disabled')) { |
| 192 |
return false; |
| 193 |
} |
| 194 |
|
| 195 |
self.addClass('wdk_btn_load_indicator out'); |
| 196 |
|
| 197 |
self.attr('disabled','disabled'); |
| 198 |
var ajax_param = { |
| 199 |
"page": 'wdk_backendajax', |
| 200 |
"function": self.data('function'), |
| 201 |
"action": 'wdk_public_action', |
| 202 |
"_wpnonce": '<?php echo esc_js(wp_create_nonce( 'wdk-backendajax'));?>', |
| 203 |
}; |
| 204 |
$.post("<?php echo admin_url( 'admin-ajax.php' );?>", ajax_param, |
| 205 |
function(data){ |
| 206 |
|
| 207 |
if(data.popup_text_success) |
| 208 |
wdk_log_notify(data.popup_text_success); |
| 209 |
|
| 210 |
if(data.popup_text_error) |
| 211 |
wdk_log_notify(data.popup_text_error, 'error'); |
| 212 |
|
| 213 |
if(data.success) { |
| 214 |
self.removeClass('wdk_btn_load_indicator out'); |
| 215 |
self.addClass('wdk_btn_load_success out'); |
| 216 |
} else { |
| 217 |
self.removeClass('wdk_btn_load_indicator out'); |
| 218 |
self.addClass('wdk_btn_load_error out'); |
| 219 |
} |
| 220 |
}).always(function(data) { |
| 221 |
|
| 222 |
}); |
| 223 |
return false; |
| 224 |
}) |
| 225 |
}) |
| 226 |
</script> |
| 227 |
|
| 228 |
<?php $this->view('general/footer', $data); ?> |