PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | application/views/wdk/index.php +571 -232 1.3.6 → 1.5.9 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 /**
3 4 * The template for Listings Management.
4 5 *
5 6 * This is the template that form edit
@@ -5,104 +6,412 @@
5 6 * This is the template that form edit
6 7 *
7 8 */
8 9
9 -if ( ! defined( 'ABSPATH' ) ) {
10 - exit; // Exit if accessed directly.
10 +if (! defined('ABSPATH')) {
11 + exit; // Exit if accessed directly.
11 12 }
12 13 ?>
13 14
14 15 <!-- This file should primarily consist of HTML with a little bit of PHP. -->
15 16 <div class="wrap wdk-wrap">
16 - <h1 class="wp-heading-inline"><?php echo __('Listings Management', 'wpdirectorykit'); ?> <a href="<?php echo get_admin_url() . "admin.php?page=wdk_listing"; ?>" class="button button-primary" title="<?php echo esc_attr__('Add Listing','wpdirectorykit');?>" id="add_listing_button"><?php echo __('Add Listing', 'wpdirectorykit'); ?></a></h1>
17 + <h1 class="wp-heading-inline"><?php echo esc_html__('Listings Management', 'wpdirectorykit'); ?> <a href="<?php echo esc_url(get_admin_url()) . "admin.php?page=wdk_listing"; ?>" class="button button-primary" title="<?php echo esc_attr__('Add Listing', 'wpdirectorykit'); ?>" id="add_listing_button"><?php echo esc_html__('Add Listing', 'wpdirectorykit'); ?></a></h1>
17 18 <?php
18 - if(!get_option('wdk_listing_page') || get_post_status(get_option('wdk_listing_page')) !='publish'
19 - || !get_option('wdk_results_page') || get_post_status(get_option('wdk_results_page')) !='publish'
20 - ):?>
21 - <div class="notice notice-success">
19 + if (
20 + !get_option('wdk_listing_page') || get_post_status(get_option('wdk_listing_page')) != 'publish'
21 + || !get_option('wdk_results_page') || get_post_status(get_option('wdk_results_page')) != 'publish'
22 + ): ?>
23 + <div class="notice notice-success">
22 24 <p>
23 - <?php echo __('Listing Preview page or Listings Result page missing','wpdirectorykit'); ?>
25 + <?php echo esc_html__('Listing Preview page or Listings Result page missing', 'wpdirectorykit'); ?>
24 26 <a href="<?php echo esc_url(get_admin_url()) . "admin.php?page=wdk_settings&function=import_demo"; ?>" class="button button-primary" id="reset_data_field_button">
25 - <?php echo __('Import Demo Data','wpdirectorykit'); ?>
27 + <?php echo esc_html__('Import Demo Data', 'wpdirectorykit'); ?>
26 28 </a>
27 29 </p>
28 30 </div>
29 - <?php endif;?>
31 + <?php endif; ?>
30 32
33 + <?php if (!function_exists('run_wdk_membership')): ?>
34 + <div class="notice notice-warning">
35 + <p>
36 + <?php echo esc_html__('Do you want that your visitors add own listings and earn money by selling subscription packages?', 'wpdirectorykit'); ?>
37 + <a href="https://wpdirectorykit.com/plugins/wp-directory-membership.html" target="_blank">
38 + <?php echo esc_html__('Purchase our premium Membership feature and support our work!', 'wpdirectorykit'); ?>
39 + </a>
40 + </p>
41 + </div>
42 + <?php endif; ?>
43 +
31 44 <?php
32 - if(class_exists('Wdk\DashWidgets\Widgets\WDK_Dashboard_Widget_Stats_Listings')) {
33 - $widget = new Wdk\DashWidgets\Widgets\WDK_Dashboard_Widget_Stats_Listings();
34 - $widget -> widget();
45 + if (class_exists('Wdk\DashWidgets\Widgets\WDK_Dashboard_Widget_Stats_Listings')) {
46 + $widget = new Wdk\DashWidgets\Widgets\WDK_Dashboard_Widget_Stats_Listings();
47 + $widget->widget();
48 + }
49 + ?>
50 +
51 + <?php if (did_action('elementor/loaded') && get_option('wdk_results_page')): ?>
52 + <?php
53 + global $Winter_MVC_WDK;
54 + $Winter_MVC_WDK->load_helper('Get_element_settings');
55 + $flag = false;
56 +
57 + $get_settings_el_results = new WdkGetElementSettings(get_option('wdk_results_page'), NULL, 'wdk-listings-results', FALSE);
58 + $results_elements = $get_settings_el_results->get_widgets();
59 + foreach ($results_elements as $key => $results_element) {
60 + if (
61 + isset($results_element['settings']['conf_pagination_enable']) && $results_element['settings']['conf_pagination_enable'] == 'yes'
62 + && (empty($results_element['settings']['conf_results_type']) || $results_element['settings']['conf_results_type'] != 'conf_results_type')
63 + ) {
64 + $flag = true;
65 + }
35 66 }
36 - ?>
67 + ?>
37 68
69 + <?php if (!$flag): ?>
70 + <div class="notice notice-success">
71 + <p>
72 + <?php echo esc_html__('Result page missing or Results widget for all results not exists on page', 'wpdirectorykit'); ?>
73 + <a href="#" class="button button-primary ajax_query_rest_pages" data-function="reinstall_page" data-arg="wdk_results_page">
74 + <?php echo esc_html__('RESET RESULTS PAGE', 'wpdirectorykit'); ?>
75 + </a>
76 + </p>
77 + </div>
78 +
79 + <?php wp_enqueue_style('jquery-confirm'); ?>
80 + <?php wp_enqueue_script('jquery-confirm'); ?>
81 +
82 + <script>
83 + jQuery(document).ready(function($) {
84 +
85 +
86 + $('.ajax_query_rest_pages').on('click', function(e) {
87 + e.preventDefault();
88 + e.stopPropagation();
89 + var self = $(this);
90 +
91 + if (self.attr('disabled')) {
92 + return false;
93 + }
94 +
95 +
96 + $.confirm({
97 + boxWidth: '400px',
98 + useBootstrap: false,
99 + title: '',
100 + content: '<?php echo esc_js(esc_html__('Are you sure? current layout will be replaced with default plugin version', 'wpdirectorykit')); ?>',
101 + buttons: {
102 + cancel: function() {
103 + return true;
104 + },
105 + confirm: {
106 + text: '<?php echo esc_js(esc_html__('Confirm', 'wpdirectorykit')); ?>',
107 + btnClass: 'btn-blue',
108 + keys: ['enter', 'shift'],
109 + action: function() {
110 + var ajax_param = {
111 + "page": 'wdk_backendajax',
112 + "function": self.data('function'),
113 + "action": 'wdk_public_action',
114 + "_wpnonce": '<?php echo esc_js(wp_create_nonce('wdk-backendajax')); ?>',
115 + "arg": self.data('arg') ?? '',
116 + };
117 +
118 + self.addClass('wdk_btn_load_indicator out');
119 + self.attr('disabled', 'disabled');
120 + $.post("<?php echo esc_url(admin_url('admin-ajax.php')); ?>", ajax_param,
121 + function(data) {
122 +
123 + if (data.popup_text_success)
124 + wdk_log_notify(data.popup_text_success);
125 +
126 + if (data.popup_text_error)
127 + wdk_log_notify(data.popup_text_error, 'error');
128 +
129 + if (data.success) {
130 + self.removeClass('wdk_btn_load_indicator out');
131 + self.addClass('wdk_btn_load_success out');
132 +
133 + if (data.page_id && data.page_title) {
134 + self.closest('.wdk-field-container').find('select option').removeAttr('selected').parent().append('<option selected="selected" value="' + data.page_id + '">' + data.page_title + ' #' + data.page_id + '</option>');
135 + }
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 +
144 + return true;
145 + }
146 + },
147 + }
148 + })
149 + })
150 + })
151 + </script>
152 + <?php endif; ?>
153 + <?php endif; ?>
154 +
38 155 <form method="GET" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate" class="filters-form">
39 156 <div class="tablenav top">
40 157 <div class="alignleft actions">
41 158 <input type="hidden" name="page" value="wdk" />
42 159
160 + <label class="screen-reader-text" for="search"><?php echo esc_html__('Filter by keyword', 'wpdirectorykit'); ?></label>
161 + <input type="text" name="search" id="search" class="postform left" value="<?php echo esc_attr(wmvc_show_data('search', $db_data, '')); ?>" placeholder="<?php echo esc_html__('Filter by keyword', 'wpdirectorykit'); ?>" />
43 162
44 - <?php if(get_option('wdk_is_location_enabled', FALSE)): ?>
45 - <label class="screen-reader-text" for="location_id"><?php echo __('Filter by location', 'wpdirectorykit'); ?></label>
46 - <?php echo wmvc_select_option('location_id', $locations, wmvc_show_data('location_id', $db_data, ''), NULL, __('Location', 'wpdirectorykit')); ?>
47 - <?php endif;?>
48 163
49 - <?php if(get_option('wdk_is_category_enabled', FALSE)): ?>
50 - <label class="screen-reader-text" for="category_id"><?php echo __('Filter by category', 'wpdirectorykit'); ?></label>
51 - <?php echo wmvc_select_option('category_id', $categories, wmvc_show_data('category_id', $db_data, ''), NULL, __('Category', 'wpdirectorykit')); ?>
52 - <?php endif;?>
164 + <?php if (get_option('wdk_is_location_enabled', FALSE)): ?>
165 + <label class="screen-reader-text" for="location_id"><?php echo esc_html__('Filter by location', 'wpdirectorykit'); ?></label>
166 + <?php echo wp_kses(
167 + wmvc_select_option(
168 + 'location_id',
169 + $locations,
170 + wmvc_show_data('location_id', $db_data, ''),
171 + NULL,
172 + __('Location', 'wpdirectorykit')
173 + ),
174 + array(
175 + 'select' => array(
176 + 'name' => true,
177 + 'id' => true,
178 + 'class' => true,
179 + 'autocomplete' => true,
180 + 'tabindex' => true,
181 + ),
182 + 'option' => array(
183 + 'value' => true,
184 + 'selected' => true,
185 + 'disabled' => true,
186 + 'label' => true,
187 + ),
188 + )
189 + ); ?>
190 +
191 + <?php endif; ?>
53 192
193 + <?php if (get_option('wdk_is_category_enabled', FALSE)): ?>
194 + <label class="screen-reader-text" for="category_id"><?php echo esc_html__('Filter by category', 'wpdirectorykit'); ?></label>
195 + <?php echo wp_kses(
196 + wmvc_select_option(
197 + 'category_id',
198 + $categories,
199 + wmvc_show_data('category_id', $db_data, ''),
200 + NULL,
201 + __('Category', 'wpdirectorykit')
202 + ),
203 + array(
204 + 'select' => array(
205 + 'name' => true,
206 + 'id' => true,
207 + 'class' => true,
208 + 'autocomplete' => true,
209 + 'tabindex' => true,
210 + ),
211 + 'option' => array(
212 + 'value' => true,
213 + 'selected' => true,
214 + 'disabled' => true,
215 + 'label' => true,
216 + ),
217 + )
218 + ); ?>
219 +
220 + <?php endif; ?>
221 +
54 222 <label class="screen-reader-text" for="user_id_editor"><?php echo esc_html__('Filter by user', 'wpdirectorykit'); ?></label>
55 - <?php echo wmvc_select_option('user_id_editor', $users, wmvc_show_data('user_id_editor', $db_data, ''), NULL, __('User', 'wpdirectorykit')); ?>
223 + <?php echo wp_kses(
224 + wmvc_select_option('user_id_editor', $users, wmvc_show_data('user_id_editor', $db_data, ''), NULL, __('User', 'wpdirectorykit')),
225 + array(
226 + 'select' => array(
227 + 'name' => true,
228 + 'id' => true,
229 + 'class' => true,
230 + 'autocomplete' => true,
231 + 'tabindex' => true,
232 + ),
233 + 'option' => array(
234 + 'value' => true,
235 + 'selected' => true,
236 + 'disabled' => true,
237 + 'label' => true,
238 + ),
239 + )
240 + ); ?>
241 +
56 242
57 - <label class="screen-reader-text" for="search"><?php echo __('Filter by keyword', 'wpdirectorykit'); ?></label>
58 - <input type="text" name="search" id="search" class="postform left" value="<?php echo esc_attr(wmvc_show_data('search', $db_data, '')); ?>" placeholder="<?php echo __('Filter by keyword', 'wpdirectorykit'); ?>" />
243 + <label class="screen-reader-text" for="order_by"><?php echo esc_html__('Order By', 'wpdirectorykit'); ?></label>
244 + <?php echo wp_kses(
245 + wmvc_select_option('order_by', $order_by, wmvc_show_data('order_by', $db_data, ''), NULL, __('Order by', 'wpdirectorykit')),
246 + array(
247 + 'select' => array(
248 + 'name' => true,
249 + 'id' => true,
250 + 'class' => true,
251 + 'autocomplete' => true,
252 + 'tabindex' => true,
253 + ),
254 + 'option' => array(
255 + 'value' => true,
256 + 'selected' => true,
257 + 'disabled' => true,
258 + 'label' => true,
259 + ),
260 + )
261 + ); ?>
262 +
59 263
60 - <label class="screen-reader-text" for="order_by"><?php echo __('Order By', 'wpdirectorykit'); ?></label>
61 - <?php echo wmvc_select_option('order_by', $order_by, wmvc_show_data('order_by', $db_data, ''), NULL, __('Order by', 'wpdirectorykit')); ?>
62 264
63 -
64 265 <?php
65 - $custom_field_init = false;
66 - foreach ($_GET as $key => $value) {
67 - if(stripos($key, 'c_field_') !== FALSE && stripos($key, '_field',8) !== FALSE) {
68 - $field_id = substr($key, 8, (stripos($key, '_',8) - 8) );
266 + $custom_field_init = false;
267 + foreach ($_GET as $key => $value) {
268 + if (stripos($key, 'c_field_') !== FALSE && stripos($key, '_field', 8) !== FALSE) {
269 + $field_id = substr($key, 8, (stripos($key, '_', 8) - 8));
270 + ?>
271 + <span class="custom_parameter" data-key="<?php echo esc_attr($field_id); ?>">
272 + <?php
273 + echo wp_kses(
274 + wmvc_select_option(
275 + 'c_field_' . $field_id . '_field',
276 + $fields_list,
277 + wmvc_show_data('c_field_' . $field_id . '_field', $_GET, ''),
278 + 'class="cus_p_field"',
279 + __('Field', 'wpdirectorykit')
280 + ),
281 + array(
282 + 'select' => array(
283 + 'name' => true,
284 + 'id' => true,
285 + 'class' => true,
286 + 'autocomplete' => true,
287 + 'tabindex' => true,
288 + ),
289 + 'option' => array(
290 + 'value' => true,
291 + 'selected' => true,
292 + 'disabled' => true,
293 + 'label' => true,
294 + ),
295 + )
296 + );
297 + echo wp_kses(
298 + wmvc_select_option(
299 + 'c_field_' . $field_id . '_like',
300 + array('==' => '=', '>' => '>', '<' => '<'),
301 + wmvc_show_data('c_field_' . $field_id . '_like', $_GET, ''),
302 + 'class="cus_p_like"'
303 + ),
304 + array(
305 + 'select' => array(
306 + 'name' => true,
307 + 'id' => true,
308 + 'class' => true,
309 + 'autocomplete' => true,
310 + 'tabindex' => true,
311 + ),
312 + 'option' => array(
313 + 'value' => true,
314 + 'selected' => true,
315 + 'disabled' => true,
316 + 'label' => true,
317 + ),
318 + )
319 + );
69 320 ?>
70 - <span class="custom_parameter" data-key="<?php echo esc_attr($field_id);?>">
71 - <?php echo wmvc_select_option('c_field_'.$field_id.'_field', $fields_list, wmvc_show_data('c_field_'.$field_id.'_field', $_GET, ''), 'class="cus_p_field"', __('Field', 'wpdirectorykit')); ?>
72 - <?php echo wmvc_select_option('c_field_'.$field_id.'_like', array('=='=>'=','>'=>'>','<'=>'<'), wmvc_show_data('c_field_'.$field_id.'_like', $_GET, ''), 'class="cus_p_like"'); ?>
73 - <input type="text" name="c_field_<?php echo esc_attr($field_id);?>_value" value="<?php echo esc_html(wmvc_show_data('c_field_'.$field_id.'_value', $_GET, '')); ?>" class="cus_p_value" placeholder="<?php echo __('Value', 'wpdirectorykit'); ?>" />
74 - </span>
75 - <?php
76 - $custom_field_init = true;
77 - }
78 - };
321 +
322 + <input type="text" name="c_field_<?php echo esc_attr($field_id); ?>_value" value="<?php echo esc_attr(wmvc_show_data('c_field_' . $field_id . '_value', $_GET, '')); ?>" class="cus_p_value" placeholder="<?php echo esc_html__('Value', 'wpdirectorykit'); ?>" />
323 + </span>
324 + <?php
325 + $custom_field_init = true;
326 + }
327 + };
79 328 ?>
80 - <?php if(!$custom_field_init):?>
329 + <?php if (!$custom_field_init): ?>
81 330 <span class="custom_parameter">
82 - <?php echo wmvc_select_option('c_field_1_field', $fields_list, wmvc_show_data('c_field_1_field', $db_data, ''), 'class="cus_p_field"', __('Field', 'wpdirectorykit')); ?>
83 - <?php echo wmvc_select_option('c_field_1_like', array('=='=>'=','>'=>'>','<'=>'<'), wmvc_show_data('c_field_1_like', $db_data, ''), 'class="cus_p_like"'); ?>
84 - <input type="text" name="c_field_1_value" value="<?php echo esc_html(wmvc_show_data('c_field_1_value', $db_data, '')); ?>" class="cus_p_value" placeholder="<?php echo __('Value', 'wpdirectorykit'); ?>" />
331 + <?php
332 + echo wp_kses(
333 + wmvc_select_option(
334 + 'c_field_1_field',
335 + $fields_list,
336 + wmvc_show_data('c_field_1_field', $db_data, ''),
337 + 'class="cus_p_field"',
338 + __('Field', 'wpdirectorykit')
339 + ),
340 + array(
341 + 'select' => array(
342 + 'name' => true,
343 + 'id' => true,
344 + 'class' => true,
345 + 'autocomplete' => true,
346 + 'tabindex' => true,
347 + ),
348 + 'option' => array(
349 + 'value' => true,
350 + 'selected' => true,
351 + 'disabled' => true,
352 + 'label' => true,
353 + ),
354 + )
355 + );
356 + echo wp_kses(
357 + wmvc_select_option(
358 + 'c_field_1_like',
359 + array('==' => '=', '>' => '>', '<' => '<'),
360 + wmvc_show_data('c_field_1_like', $db_data, ''),
361 + 'class="cus_p_like"'
362 + ),
363 + array(
364 + 'select' => array(
365 + 'name' => true,
366 + 'id' => true,
367 + 'class' => true,
368 + 'autocomplete' => true,
369 + 'tabindex' => true,
370 + ),
371 + 'option' => array(
372 + 'value' => true,
373 + 'selected' => true,
374 + 'disabled' => true,
375 + 'label' => true,
376 + ),
377 + )
378 + );
379 + ?>
380 +
381 + <input type="text" name="c_field_1_value" value="<?php echo esc_attr(wmvc_show_data('c_field_1_value', $db_data, '')); ?>" class="cus_p_value" placeholder="<?php echo esc_html__('Value', 'wpdirectorykit'); ?>" />
85 382 </span>
86 - <?php endif;?>
383 + <?php endif; ?>
87 384
88 385 <a href="" class="btn_parameter remove"><span class="dashicons dashicons-minus"></span></a>
89 386 <a href="" class="btn_parameter add"><span class="dashicons dashicons-plus-alt2"></span></a>
90 387
91 - <input type="submit" name="filter_action" id="post-query-submit" class="button" value="<?php echo __('Filter', 'wpdirectorykit'); ?>">
92 -
93 - <input type="hidden" name="is_featured" value="<?php echo esc_attr(wmvc_show_data('is_featured', $db_data, ''));?>">
94 - <input type="hidden" name="is_activated" value="<?php echo esc_attr(wmvc_show_data('is_activated', $db_data, ''));?>">
388 + <input type="submit" name="filter_action" id="post-query-submit" class="button" value="<?php echo esc_html__('Filter', 'wpdirectorykit'); ?>">
389 +
390 + <input type="hidden" name="is_featured" value="<?php echo esc_attr(wmvc_show_data('is_featured', $db_data, '')); ?>">
391 + <input type="hidden" name="is_activated" value="<?php echo esc_attr(wmvc_show_data('is_activated', $db_data, '')); ?>">
95 392 </div>
96 - <?php echo wmvc_xss_clean($pagination_output); ?>
393 + <?php echo wp_kses($pagination_output, array(
394 + 'div' => array('class' => true, 'id' => true, 'style' => true),
395 + 'span' => array('class' => true, 'id' => true, 'style' => true),
396 + 'a' => array('href' => true, 'class' => true, 'id' => true, 'style' => true, 'title' => true, 'rel' => true),
397 + 'ul' => array('class' => true, 'id' => true, 'style' => true),
398 + 'li' => array('class' => true, 'id' => true, 'style' => true),
399 + 'b' => array(),
400 + 'strong' => array(),
401 + 'em' => array(),
402 + 'i' => array(),
403 + 'br' => array(),
404 + )); ?>
405 +
97 406 <br class="clear">
98 407 </div>
99 408 </form>
100 409
101 - <?php
102 - if (function_exists('PLL')){
103 - $pll_langs = pll_the_languages( array( 'raw' => 1 ) );
104 - }
410 + <?php
411 + if (function_exists('PLL')) {
412 + $pll_langs = pll_the_languages(array('raw' => 1));
413 + }
105 414 ?>
106 415
107 416 <form method="GET" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate">
108 417 <table class="wp-list-table widefat fixed striped table-view-list pages">
@@ -107,29 +416,58 @@
107 416 <form method="GET" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate">
108 417 <table class="wp-list-table widefat fixed striped table-view-list pages">
109 418 <thead>
110 419 <tr>
111 - <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo __('Select All', 'wpdirectorykit'); ?></label><input id="cb-select-all-1" type="checkbox"></td>
112 - <th style="width:50px;"><?php echo __('#ID', 'wpdirectorykit'); ?></th>
113 - <th><?php echo __('Title', 'wpdirectorykit'); ?></th>
114 - <?php if(get_option('wdk_is_category_enabled', FALSE)): ?>
115 - <th><?php echo __('Category', 'wpdirectorykit'); ?></th>
420 + <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php echo esc_html__('Select All', 'wpdirectorykit'); ?></label><input id="cb-select-all-1" type="checkbox"></td>
421 + <th style="width:50px;"><?php echo esc_html__('#ID', 'wpdirectorykit'); ?></th>
422 + <th><?php echo esc_html__('Title', 'wpdirectorykit'); ?></th>
423 + <?php if (get_option('wdk_is_category_enabled', FALSE)): ?>
424 + <th><?php echo esc_html__('Category', 'wpdirectorykit'); ?></th>
116 425 <?php endif; ?>
117 - <th style="text-align: center;"><?php echo __('Image', 'wpdirectorykit'); ?></th>
118 - <th><?php echo __('Post Date', 'wpdirectorykit'); ?></th>
426 + <th style="text-align: center;"><?php echo esc_html__('Image', 'wpdirectorykit'); ?></th>
427 + <th><?php echo esc_html__('Post Date', 'wpdirectorykit'); ?></th>
119 428 <?php if (function_exists('PLL')): ?>
120 - <?php $pll_langs = pll_the_languages( array( 'raw' => 1 ) );
121 - foreach($pll_langs as $pll_lang): ?>
122 - <th class="manage-column column-language_<?php echo esc_attr($pll_lang['slug']); ?>"><img src="<?php echo esc_html($pll_lang['flag']); ?>" /></th>
123 - <?php endforeach; ?>
429 + <?php $pll_langs = pll_the_languages(array('raw' => 1));
430 + foreach ($pll_langs as $pll_lang): ?>
431 + <th class="manage-column column-language_<?php echo esc_attr($pll_lang['slug']); ?>"><img src="<?php echo esc_attr($pll_lang['flag']); ?>" /></th>
432 + <?php endforeach; ?>
124 433 <?php endif; ?>
125 - <th class="actions_column"><?php echo __('Actions', 'wpdirectorykit'); ?></th>
434 + <th class="static"><?php echo esc_html__('Views', 'wpdirectorykit'); ?></th>
435 + <th class="static"><?php echo esc_html__('Showed in results', 'wpdirectorykit'); ?></th>
436 + <th class="actions_column"><?php echo esc_html__('Actions', 'wpdirectorykit'); ?></th>
126 437 </tr>
127 438 </thead>
128 439 <tbody>
129 440 <?php if (count($listings) == 0) : ?>
130 441 <tr class="no-items">
131 - <td class="colspanchange" colspan="7"><?php echo __('No Listings found.', 'wpdirectorykit'); ?></td>
442 + <td class="colspanchange" colspan="9">
443 + <div class="wdk-empty-state">
444 + <img
445 + src="<?php echo esc_url(WPDIRECTORYKIT_URL . 'admin/img/no-listings.svg'); ?>"
446 + class="wdk-empty-state__image"
447 + alt=""
448 + width="220"
449 + height="178"
450 + />
451 +
452 + <h3 class="wdk-empty-state__title">
453 + <?php echo esc_html__('No Listings Yet', 'wpdirectorykit'); ?>
454 + </h3>
455 +
456 + <p class="wdk-empty-state__description">
457 + <?php echo esc_html__(
458 + 'You haven’t created any listings yet. Start by creating your first listing to see it here.',
459 + 'wpdirectorykit'
460 + ); ?>
461 + </p>
462 +
463 + <a class="button-primary"
464 + href="<?php echo esc_url(get_admin_url()) . "admin.php?page=wdk_listing"; ?>">
465 + <span aria-hidden="true">+</span>
466 + <?php echo esc_html__('Create Listing', 'wpdirectorykit'); ?>
467 + </a>
468 + </div>
469 + </td>
132 470 </tr>
133 471 <?php endif; ?>
134 472 <?php foreach ($listings as $listing) : ?>
135 473 <tr>
@@ -136,165 +474,156 @@
136 474 <th scope="row" class="check-column">
137 475 <input id="cb-select-<?php echo esc_attr(wmvc_show_data('ID', $listing, '-')); ?>" type="checkbox" name="post[]" value="<?php echo esc_attr(wmvc_show_data('ID', $listing, '-')); ?>">
138 476 <div class="locked-indicator">
139 477 <span class="locked-indicator-icon" aria-hidden="true"></span>
140 - <span class="screen-reader-text"><?php echo __('Is Locked', 'wpdirectorykit'); ?></span>
478 + <span class="screen-reader-text"><?php echo esc_html__('Is Locked', 'wpdirectorykit'); ?></span>
141 479 </div>
142 480 </th>
143 481 <td>
144 - <?php echo wmvc_show_data('ID', $listing, '-'); ?>
482 + <?php echo esc_html(wmvc_show_data('ID', $listing, '-')); ?>
145 483 </td>
146 484 <td class="title column-title has-row-actions column-primary page-title" data-colname="Title">
147 485 <strong>
148 - <a class="row-title" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . wmvc_show_data('ID', $listing, '-')); ?>"><?php echo wmvc_show_data('post_title', $listing, '-'); ?></a>
149 - <?php if(!wmvc_show_data('is_activated', $listing, 0)): ?>
150 - <span class="label label-danger"><?php echo __('Not activated', 'wpdirectorykit'); ?></span>
486 + <a class="row-title" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . wmvc_show_data('ID', $listing, '-')); ?>"><?php echo esc_html(wmvc_show_data('post_title', $listing, '-')); ?></a>
487 + <?php if (!wmvc_show_data('is_activated', $listing, 0)): ?>
488 + <span class="label label-danger"><?php echo esc_html__('Not activated', 'wpdirectorykit'); ?></span>
151 489 <?php endif; ?>
152 - <?php if(!wmvc_show_data('is_approved', $listing, 0) && function_exists('run_wdk_membership')): ?>
153 - <span class="label label-danger"><?php echo esc_html__('Not approved', 'wpdirectorykit'); ?></span>
490 + <?php if (!wmvc_show_data('is_approved', $listing, 0) && function_exists('run_wdk_membership')): ?>
491 + <span class="label label-danger"><?php echo esc_html__('Not approved', 'wpdirectorykit'); ?></span>
154 492 <?php endif; ?>
155 493
156 - <?php if(wdk_get_option('wdk_is_featured_enabled', FALSE)): ?>
157 - <?php if(wmvc_show_data('is_featured', $listing, 0)): ?>
158 - <span class="label label-info"><?php echo esc_html__('featured', 'wpdirectorykit'); ?></span>
159 - <?php endif; ?>
494 + <?php if (wdk_get_option('wdk_is_featured_enabled', FALSE)): ?>
495 + <?php if (wmvc_show_data('is_featured', $listing, 0)): ?>
496 + <span class="label label-info"><?php echo esc_html__('featured', 'wpdirectorykit'); ?></span>
160 497 <?php endif; ?>
498 + <?php endif; ?>
161 499
162 500 </strong>
163 501 <div class="row-actions">
164 - <span class="edit"><a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . wmvc_show_data('ID', $listing, '-')); ?>"><?php echo __('Edit', 'wpdirectorykit'); ?></a> | </span>
165 - <span class="trash "><a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk&function=delete&paged=".esc_attr($paged)."&id=" . wmvc_show_data('ID', $listing, '-')); ?>&_wpnonce=<?php echo wp_create_nonce( 'wdk-listing-delete_'.wmvc_show_data('ID', $listing, '-'));?>" class="submitdelete question_sure"><?php echo __('Delete', 'wpdirectorykit'); ?></a> | </span>
166 - <span class="view"><a href="<?php echo get_permalink($listing); ?>" target="blank"><?php echo __('View', 'wpdirectorykit'); ?></a></span>
502 + <span class="edit"><a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . wmvc_show_data('ID', $listing, '-')); ?>"><?php echo esc_html__('Edit', 'wpdirectorykit'); ?></a> | </span>
503 + <span class="trash "><a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk&function=delete&paged=" . esc_attr($paged) . "&id=" . wmvc_show_data('ID', $listing, '-')); ?>&_wpnonce=<?php echo esc_attr(wp_create_nonce('wdk-listing-delete_' . wmvc_show_data('ID', $listing, '-'))); ?>" class="submitdelete question_sure"><?php echo esc_html__('Delete', 'wpdirectorykit'); ?></a> | </span>
504 + <span class="view"><a href="<?php echo esc_url(get_permalink($listing)); ?>" target="blank"><?php echo esc_html__('View', 'wpdirectorykit'); ?></a></span>
167 505 </div>
168 506
169 507
170 - <?php if(get_option('wdk_sub_listings_enable')): ?>
171 - <?php if(!empty(wmvc_show_data('listing_related_ids', $listing))):?>
172 - <div class="">
173 - <a href="#" class="laoding_sublistings" data-listing_id = '<?php echo esc_attr(wmvc_show_data('ID', $listing, '-'));?>'><?php echo esc_html__('Show Related','wpdirectorykit');?></a>
174 - </div>
508 + <?php if (get_option('wdk_sub_listings_enable')): ?>
509 + <?php if (!empty(wmvc_show_data('listing_related_ids', $listing))): ?>
510 + <div class="">
511 + <a href="#" class="laoding_sublistings" data-listing_id='<?php echo esc_attr(wmvc_show_data('ID', $listing, '-')); ?>'><?php echo esc_html__('Show Related', 'wpdirectorykit'); ?></a>
512 + </div>
175 513 <?php endif; ?>
176 514 <?php endif; ?>
177 515 </td>
178 516
179 - <?php if(get_option('wdk_is_category_enabled', FALSE)): ?>
180 - <td>
181 - <?php echo wmvc_show_data($listing->category_id, $categories, '-'); ?>
182 - <?php
517 + <?php if (get_option('wdk_is_category_enabled', FALSE)): ?>
518 + <td>
519 + <?php echo esc_html(wmvc_show_data($listing->category_id, $categories, '-')); ?>
520 + <?php
183 521 $other_categories = wdk_generate_other_categories_fast($listing->categories_list);
184 522
185 - if(!empty($other_categories)):?>
523 + if (!empty($other_categories)): ?>
186 524 <br>
187 - <span style="display: inline-block;padding-top: 10px;" ><?php echo esc_html(join(', ',$other_categories));?></span>
188 - <?php endif;?>
189 - </td>
525 + <span style="display: inline-block;padding-top: 10px;"><?php echo esc_html(join(', ', $other_categories)); ?></span>
526 + <?php endif; ?>
527 + </td>
190 528 <?php endif; ?>
191 -
529 +
192 530 <td style="text-align: center;">
193 531 <a class="img-link" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . wmvc_show_data('ID', $listing, '-')); ?>">
194 - <img src="<?php echo esc_url(wdk_image_src($listing));?>" alt="thumb" style="height:70px;width:110px;object-fit:cover;text-align: center;"/>
532 + <img src="<?php echo esc_url(wdk_image_src($listing)); ?>" alt="thumb" style="height:70px;width:110px;object-fit:cover;text-align: center;" />
195 533 </a>
196 534 </td>
197 535 <td>
198 - <?php echo wdk_get_date($listing->post_date, false); ?>
536 + <?php echo esc_html(wdk_get_date($listing->post_date, false)); ?>
199 537 </td>
200 538 <?php if (function_exists('PLL')): ?>
201 539
202 - <?php foreach($pll_langs as $pll_lang): ?>
203 - <?php //var_dump($pll_lang); ?>
204 - <?php if($pll_lang['slug'] == pll_get_post_language($listing->ID, 'slug' )): ?>
205 - <td><img src="<?php echo esc_html($pll_lang['flag']); ?>" /></td>
206 - <?php elseif(empty(pll_get_post( $listing->ID, $pll_lang['slug'] ))): ?>
207 - <td><a class="pll_icon_edit translation_<?php echo esc_attr($listing->ID); ?>" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&function=copy&from_id=" . $listing->ID . "&to_lang=".$pll_lang['slug']); ?>"></a></td>
208 - <?php else: ?>
209 - <td><a class="pll_icon_edit translation_<?php echo esc_attr($listing->ID); ?>" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . pll_get_post( $listing->ID, $pll_lang['slug'] )); ?>"></a></td>
210 - <?php endif; ?>
211 - <?php endforeach; ?>
540 + <?php foreach ($pll_langs as $pll_lang): ?>
541 + <?php //var_dump($pll_lang);
542 + ?>
543 + <?php if ($pll_lang['slug'] == pll_get_post_language($listing->ID, 'slug')): ?>
544 + <td><img src="<?php echo esc_attr($pll_lang['flag']); ?>" /></td>
545 + <?php elseif (empty(pll_get_post($listing->ID, $pll_lang['slug']))): ?>
546 + <td><a class="pll_icon_edit translation_<?php echo esc_attr($listing->ID); ?>" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&function=copy&from_id=" . $listing->ID . "&to_lang=" . $pll_lang['slug']); ?>"></a></td>
547 + <?php else: ?>
548 + <td><a class="pll_icon_edit translation_<?php echo esc_attr($listing->ID); ?>" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . pll_get_post($listing->ID, $pll_lang['slug'])); ?>"></a></td>
549 + <?php endif; ?>
550 + <?php endforeach; ?>
212 551
213 552 <?php endif; ?>
553 + <td class="static">
554 + <?php echo esc_html(wmvc_show_data('counter_views', $listing, '-')); ?>
555 + </td>
556 + <td class="static">
557 + <?php echo esc_html(wmvc_show_data('counter_results_views', $listing, '-')); ?>
558 + </td>
214 559 <td class="actions_column">
215 - <a href="<?php echo get_permalink($listing); ?>" title="<?php echo esc_attr__('View','wpdirectorykit');?>" target="blank"><span class="dashicons dashicons-visibility"></span></a>
216 - <a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . wmvc_show_data('ID', $listing, '-')); ?>" title="<?php echo esc_attr__('Edit','wpdirectorykit');?>"><span class="dashicons dashicons-edit"></span></a>
217 - <a class="question_sure" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk&function=delete&paged=".esc_attr($paged)."&id=" . wmvc_show_data('ID', $listing, '-')."&_wpnonce=".wp_create_nonce( 'wdk-listing-delete_'.wmvc_show_data('ID', $listing, '-'))); ?>" title="<?php echo esc_attr__('Remove','wpdirectorykit');?>"><span class="dashicons dashicons-no"></span></a>
560 + <a href="<?php echo esc_html(get_permalink($listing)); ?>" title="<?php echo esc_attr__('View', 'wpdirectorykit'); ?>" target="blank"><span class="dashicons dashicons-visibility"></span></a>
561 + <a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . wmvc_show_data('ID', $listing, '-')); ?>" title="<?php echo esc_attr__('Edit', 'wpdirectorykit'); ?>"><span class="dashicons dashicons-edit"></span></a>
562 + <a class="question_sure" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk&function=delete&paged=" . esc_attr($paged) . "&id=" . wmvc_show_data('ID', $listing, '-') . "&_wpnonce=" . esc_attr(wp_create_nonce('wdk-listing-delete_' . wmvc_show_data('ID', $listing, '-')))); ?>" title="<?php echo esc_attr__('Remove', 'wpdirectorykit'); ?>"><span class="dashicons dashicons-no"></span></a>
218 563 </td>
219 564 </tr>
220 -
221 - <?php if(get_option('wdk_sub_listings_enable')): ?>
222 - <?php if(!empty(wmvc_show_data('listing_related_ids', $listing))):?>
223 - <?php if(false)foreach (explode(',',wmvc_show_data('listing_related_ids', $listing, '')) as $key => $child_idlisting):?>
224 - <tr class="child">
225 - <th scope="row"></th>
226 - <td scope="row"></td>
227 - <td colspan="1">
228 - <a target="_blank" href="<?php echo esc_url(admin_url('admin.php?page=wdk_listing&id='.$child_idlisting));?>"><?php echo esc_html('#'.$child_idlisting.', '.wdk_field_value('post_title', $child_idlisting));?></a>
229 - </td>
230 - <td>
231 - <?php echo wdk_field_value('category_id', $categories); ?>
232 - </td>
233 - <td style="text-align: center;">
234 - <a class="img-link" href="<?php echo get_admin_url() . "admin.php?page=wdk_listing&id=" . $child_idlisting; ?>">
235 - <img src="<?php echo esc_url(wdk_image_src(array('listing_images'=>wdk_field_value('listing_images', $child_idlisting))));?>" alt="thumb" style="height:50px;width:65px;object-fit:cover;text-align: center;"/>
236 - </a>
237 - </td>
238 - <td>
239 - <?php echo wdk_get_date(wdk_field_value('date', $child_idlisting), false); ?>
240 - </td>
241 - <td class="actions_column">
242 - <a href="<?php echo get_permalink($child_idlisting); ?>" title="<?php echo esc_attr__('View','wpdirectorykit');?>" target="blank"><span class="dashicons dashicons-visibility"></span></a>
243 - <a href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk_listing&id=" . $child_idlisting); ?>" title="<?php echo esc_attr__('Edit','wpdirectorykit');?>"><span class="dashicons dashicons-edit"></span></a>
244 - <a class="question_sure" href="<?php echo esc_url(get_admin_url() . "admin.php?page=wdk&function=delete&paged=".esc_attr($paged)."&id=" . $child_idlisting."&_wpnonce=".wp_create_nonce( 'wdk-listing-delete_'.wmvc_show_data('ID', $listing, '-'))); ?>" title="<?php echo esc_attr__('Remove','wpdirectorykit');?>"><span class="dashicons dashicons-no"></span></a>
245 - </td>
246 - </tr>
247 - <?php endforeach;?>
248 - <?php endif;?>
249 - <?php endif;?>
250 - <?php endforeach;?>
251 - </tbody>
565 + <?php endforeach; ?>
566 + </tbody>
252 567 <tfoot>
253 568 <tr>
254 - <td class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-2"><?php echo __('Select All', 'wpdirectorykit'); ?></label><input id="cb-select-all-2" type="checkbox"></td>
255 - <th style="width:50px;"><?php echo __('#ID', 'wpdirectorykit'); ?></th>
256 - <th><?php echo __('Title', 'wpdirectorykit'); ?></th>
257 - <?php if(get_option('wdk_is_category_enabled', FALSE)): ?>
258 - <th><?php echo __('Category', 'wpdirectorykit'); ?></th>
569 + <td class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-2"><?php echo esc_html__('Select All', 'wpdirectorykit'); ?></label><input id="cb-select-all-2" type="checkbox"></td>
570 + <th style="width:50px;"><?php echo esc_html__('#ID', 'wpdirectorykit'); ?></th>
571 + <th><?php echo esc_html__('Title', 'wpdirectorykit'); ?></th>
572 + <?php if (get_option('wdk_is_category_enabled', FALSE)): ?>
573 + <th><?php echo esc_html__('Category', 'wpdirectorykit'); ?></th>
259 574 <?php endif; ?>
260 - <th style="text-align: center;"><?php echo __('Image', 'wpdirectorykit'); ?></th>
261 - <th><?php echo __('Post Date', 'wpdirectorykit'); ?></th>
575 + <th style="text-align: center;"><?php echo esc_html__('Image', 'wpdirectorykit'); ?></th>
576 + <th><?php echo esc_html__('Post Date', 'wpdirectorykit'); ?></th>
262 577 <?php if (function_exists('PLL')): ?>
263 - <?php foreach($pll_langs as $pll_lang): ?>
264 - <th><img src="<?php echo esc_html($pll_lang['flag']); ?>" /></th>
265 - <?php endforeach; ?>
578 + <?php foreach ($pll_langs as $pll_lang): ?>
579 + <th><img src="<?php echo esc_attr($pll_lang['flag']); ?>" /></th>
580 + <?php endforeach; ?>
266 581 <?php endif; ?>
267 - <th class="actions_column"><?php echo __('Actions', 'wpdirectorykit'); ?></th>
582 + <th class=""></th>
583 + <th class=""></th>
584 + <th class="actions_column"><?php echo esc_html__('Actions', 'wpdirectorykit'); ?></th>
268 585 </tr>
269 586 </tfoot>
270 587 </table>
271 588 <div class="tablenav bottom">
272 589 <div class="alignleft actions bulkactions">
273 - <?php wp_nonce_field( 'wdk-listing-bulk', '_wpnonce'); ?>
274 - <label for="bulk-action-selector-bottom" class="screen-reader-text"><?php echo __('Select bulk action', 'wpdirectorykit'); ?></label>
590 + <?php wp_nonce_field('wdk-listing-bulk', '_wpnonce'); ?>
591 + <label for="bulk-action-selector-bottom" class="screen-reader-text"><?php echo esc_html__('Select bulk action', 'wpdirectorykit'); ?></label>
275 592 <select name="action" id="bulk-action-selector-bottom">
276 - <option value="-1"><?php echo __('Bulk actions', 'wpdirectorykit'); ?></option>
277 - <option value="delete" class="hide-if-no-js"><?php echo __('Delete', 'wpdirectorykit'); ?></option>
278 - <option value="deactivate" class="hide-if-no-js"><?php echo __('Deactivate', 'wpdirectorykit'); ?></option>
279 - <option value="activate" class="hide-if-no-js"><?php echo __('Activate', 'wpdirectorykit'); ?></option>
280 - <?php if(function_exists('run_wdk_membership')):?>
281 - <option value="deapprove" class="hide-if-no-js"><?php echo __('Deapprove', 'wpdirectorykit'); ?></option>
282 - <option value="approve" class="hide-if-no-js"><?php echo __('Approve', 'wpdirectorykit'); ?></option>
283 - <?php endif;?>
593 + <option value="-1"><?php echo esc_html__('Bulk actions', 'wpdirectorykit'); ?></option>
594 + <option value="delete" class="hide-if-no-js"><?php echo esc_html__('Delete', 'wpdirectorykit'); ?></option>
595 + <option value="deactivate" class="hide-if-no-js"><?php echo esc_html__('Deactivate', 'wpdirectorykit'); ?></option>
596 + <option value="activate" class="hide-if-no-js"><?php echo esc_html__('Activate', 'wpdirectorykit'); ?></option>
597 + <?php if (function_exists('run_wdk_membership')): ?>
598 + <option value="deapprove" class="hide-if-no-js"><?php echo esc_html__('Deapprove', 'wpdirectorykit'); ?></option>
599 + <option value="approve" class="hide-if-no-js"><?php echo esc_html__('Approve', 'wpdirectorykit'); ?></option>
600 + <?php endif; ?>
284 601 </select>
285 602 <input type="hidden" name="page" value="wdk" />
286 603 <input type="submit" id="table_action" class="button action" name="table_action" value="<?php echo esc_attr__('Apply', 'wpdirectorykit'); ?>">
287 604 </div>
288 605
289 - <?php echo wmvc_xss_clean($pagination_output); ?>
606 + <?php echo wp_kses($pagination_output, array(
607 + 'div' => array('class' => true, 'id' => true, 'style' => true),
608 + 'span' => array('class' => true, 'id' => true, 'style' => true),
609 + 'a' => array('href' => true, 'class' => true, 'id' => true, 'style' => true, 'title' => true, 'rel' => true),
610 + 'ul' => array('class' => true, 'id' => true, 'style' => true),
611 + 'li' => array('class' => true, 'id' => true, 'style' => true),
612 + 'b' => array(),
613 + 'strong' => array(),
614 + 'em' => array(),
615 + 'i' => array(),
616 + 'br' => array(),
617 + )); ?>
618 +
290 619 <br class="clear">
291 620 </div>
292 621 </form>
293 622 </div>
294 623 <?php
295 - wp_enqueue_style('wdk-notify');
296 - wp_enqueue_script('wdk-notify');
624 +wp_enqueue_style('wdk-notify');
625 +wp_enqueue_script('wdk-notify');
297 626 ?>
298 627 <script>
299 628 // Generate table
300 629 jQuery(document).ready(function($) {
@@ -306,20 +635,20 @@
306 635 wdk_custom_search_parameters();
307 636 });
308 637
309 638 const wdk_loading_sublistings = ($selector_btn = '.laoding_sublistings') => {
310 - var init,action,event, eventRemove;
639 + var init, action, event, eventRemove;
311 640
312 641 event = (elem) => {
313 642 var listing_id = jQuery(elem).attr('data-listing_id');
314 643 var self = jQuery(elem);
315 644
316 - if(self.attr('disabled')) {
645 + if (self.attr('disabled')) {
317 646 return false;
318 647 }
319 648
320 649 self.addClass('wdk_btn_load_indicator out');
321 - self.attr('disabled','disabled');
650 + self.attr('disabled', 'disabled');
322 651
323 652 var ajax_param = {
324 653 "page": 'wdk_backendajax',
325 654 "function": 'loading_sublistings',
@@ -324,55 +653,61 @@
324 653 "page": 'wdk_backendajax',
325 654 "function": 'loading_sublistings',
326 655 "action": 'wdk_public_action',
327 656 "listing_id": listing_id,
328 - "_wpnonce": '<?php echo esc_js(wp_create_nonce( 'wdk-backendajax'));?>',
657 + "_wpnonce": '<?php echo esc_js(wp_create_nonce('wdk-backendajax')); ?>',
329 658 };
330 -
331 - jQuery.post("<?php echo admin_url( 'admin-ajax.php' );?>", ajax_param,
332 - function(data){
333 -
334 - if(data.popup_text_success)
335 - wdk_log_notify(data.popup_text_success);
336 -
337 - if(data.popup_text_error)
338 - wdk_log_notify(data.popup_text_error, 'error');
339 -
340 - self.removeClass('wdk_btn_load_indicator out');
341 659
342 - data.results
343 - var html = '';
344 - jQuery.each(data.results, function(index, value){
345 - html += '<tr class="child">\n\
660 + jQuery.post("<?php echo esc_url(admin_url('admin-ajax.php')); ?>", ajax_param,
661 + function(data) {
662 +
663 + if (data.popup_text_success)
664 + wdk_log_notify(data.popup_text_success);
665 +
666 + if (data.popup_text_error)
667 + wdk_log_notify(data.popup_text_error, 'error');
668 +
669 + self.removeClass('wdk_btn_load_indicator out');
670 +
671 + data.results
672 + var html = '';
673 + jQuery.each(data.results, function(index, value) {
674 + html += '<tr class="child">\n\
346 675 <th scope="row"></th>\n\
347 - <td scope="row">'+value.post_id+'</td>\n\
676 + <td scope="row">' + value.post_id + '</td>\n\
348 677 <td colspan="1">\n\
349 - <a target="_blank" href="'+value.listing_edit_url+'">'+value.post_title+'</a>\n\
678 + <a target="_blank" href="' + value.listing_edit_url + '">' + value.post_title + '</a>\n\
350 679 </td>\n\
351 680 <td>\n\
352 - '+value.category+'\n\
681 + ' + value.category + '\n\
353 682 </td>\n\
354 683 <td style="text-align: center;">\n\
355 - <a class="img-link" href="'+value.listing_edit_url+'">\n\
356 - <img src="'+value.image_src+'" alt="thumb" style="height:50px;width:65px;object-fit:cover;text-align: center;"/>\n\
684 + <a class="img-link" href="' + value.listing_edit_url + '">\n\
685 + <img src="' + value.image_src + '" alt="thumb" style="height:50px;width:65px;object-fit:cover;text-align: center;"/>\n\
357 686 </a>\n\
358 687 </td>\n\
359 688 <td>\n\
360 - '+value.date+'\n\
689 + ' + value.date + '\n\
361 690 </td>\n\
691 + <td>\n\
692 + ' + value.counter_views + '\n\
693 + </td>\n\
694 + <td>\n\
695 + ' + value.counter_results_views + '\n\
696 + </td>\n\
362 697 <td class="actions_column">\n\
363 - <a href="'+value.listing_view_url+'" title="<?php echo esc_attr__('View','wpdirectorykit');?>" target="blank"><span class="dashicons dashicons-visibility"></span></a>\n\
364 - <a href="'+value.listing_edit_url+'" title="<?php echo esc_attr__('Edit','wpdirectorykit');?>"><span class="dashicons dashicons-edit"></span></a>\n\
365 - <a class="question_sure remove_event" href="'+value.listing_remove_url+'" data-listing_id ="'+value.post_id+'" title="<?php echo esc_attr__('Remove','wpdirectorykit');?>"><span class="dashicons dashicons-no"></span></a>\n\
698 + <a href="' + value.listing_view_url + '" title="<?php echo esc_attr__('View', 'wpdirectorykit'); ?>" target="blank"><span class="dashicons dashicons-visibility"></span></a>\n\
699 + <a href="' + value.listing_edit_url + '" title="<?php echo esc_attr__('Edit', 'wpdirectorykit'); ?>"><span class="dashicons dashicons-edit"></span></a>\n\
700 + <a class="question_sure remove_event" href="' + value.listing_remove_url + '" data-listing_id ="' + value.post_id + '" title="<?php echo esc_attr__('Remove', 'wpdirectorykit'); ?>"><span class="dashicons dashicons-no"></span></a>\n\
366 701 </td>\n\
367 702 </tr>'
368 - });
703 + });
369 704
370 - jQuery( html ).insertAfter( self.closest('tr') );
371 - jQuery(self).remove();
705 + jQuery(html).insertAfter(self.closest('tr'));
706 + jQuery(self).remove();
372 707
373 - }).always(function(data) {
374 - if(true) {
708 + }).always(function(data) {
709 + if (true) {
375 710 eventRemove();
376 711 } else {
377 712 jQuery('.child .question_sure').off().on('click', function() {
378 713 return confirm("<?php echo esc_js(__('Are you sure? Selected item will be completely removed!', 'wpdirectorykit')); ?>");
@@ -385,9 +720,9 @@
385 720
386 721 eventRemove = () => {
387 722 jQuery('.child .remove_event').off().on('click', function(e) {
388 723 e.preventDefault();
389 - if(!confirm("<?php echo esc_js(__('Are you sure? Selected item will be completely removed!', 'wpdirectorykit')); ?>")) {
724 + if (!confirm("<?php echo esc_js(__('Are you sure? Selected item will be completely removed!', 'wpdirectorykit')); ?>")) {
390 725 return false;
391 726 }
392 727
393 728 var self = jQuery(this);
@@ -397,35 +732,39 @@
397 732 "page": 'wdk_backendajax',
398 733 "function": 'remove_listing',
399 734 "action": 'wdk_public_action',
400 735 "listing_id": listing_id,
401 - "_wpnonce": '<?php echo esc_js(wp_create_nonce( 'wdk-backendajax'));?>',
736 + "_wpnonce": '<?php echo esc_js(wp_create_nonce('wdk-backendajax')); ?>',
402 737 };
403 738
404 739 var tr = self.closest('tr');
405 740
406 741 self.addClass('wdk_btn_load_indicator out');
407 -
408 - jQuery.post("<?php echo admin_url( 'admin-ajax.php' );?>", ajax_param,
409 - function(data){
410 -
411 - if(data.popup_text_success)
412 - wdk_log_notify(data.popup_text_success);
413 -
414 - if(data.popup_text_error)
415 - wdk_log_notify(data.popup_text_error, 'error');
416 -
417 - if(data.success) {
418 -
419 - setTimeout(function() {
420 - tr.animate({ opacity: 1/2 }, 500, function(){tr.remove();});
421 - }, 200);
422 -
423 - } else {
424 - self.removeClass('loading_removing').addClass('loading_removed_error');
425 - }
426 -
427 - }).always(function(data) {
742 +
743 + jQuery.post("<?php echo esc_url(admin_url('admin-ajax.php')); ?>", ajax_param,
744 + function(data) {
745 +
746 + if (data.popup_text_success)
747 + wdk_log_notify(data.popup_text_success);
748 +
749 + if (data.popup_text_error)
750 + wdk_log_notify(data.popup_text_error, 'error');
751 +
752 + if (data.success) {
753 +
754 + setTimeout(function() {
755 + tr.animate({
756 + opacity: 1 / 2
757 + }, 500, function() {
758 + tr.remove();
759 + });
760 + }, 200);
761 +
762 + } else {
763 + self.removeClass('loading_removing').addClass('loading_removed_error');
764 + }
765 +
766 + }).always(function(data) {
428 767 self.removeClass('wdk_btn_load_indicator out').addClass('wdk_btn_load_success out');
429 768 });
430 769 })
431 770 };
@@ -437,9 +776,9 @@
437 776 event(jQuery(this));
438 777 });
439 778 */
440 779
441 - document.querySelectorAll($selector_btn).forEach(elem => elem.addEventListener('click', (e)=>{
780 + document.querySelectorAll($selector_btn).forEach(elem => elem.addEventListener('click', (e) => {
442 781 e.preventDefault();
443 782 event(e.target);
444 783 }, false));
445 784
@@ -455,26 +794,26 @@
455 794 const wdk_custom_search_parameters = ($selector_customParameter = '.custom_parameter') => {
456 795 var selector_customParameter = jQuery($selector_customParameter).first();
457 796
458 797 var event = () => {
459 - jQuery('.btn_parameter.add').off().on('click', function(e){
798 + jQuery('.btn_parameter.add').off().on('click', function(e) {
460 799 e.preventDefault();
461 800 var cus_field = selector_customParameter.clone().insertAfter(jQuery($selector_customParameter).last());
462 801 cus_field.find('input,select').val('');
463 -
802 +
464 803 var key = 1;
465 - while (jQuery('.custom_parameter .cus_p_field[name="c_field_'+key+'_field"]').length) {
804 + while (jQuery('.custom_parameter .cus_p_field[name="c_field_' + key + '_field"]').length) {
466 805 key++;
467 806 }
468 807
469 - cus_field.find('.cus_p_field').attr('name', 'c_field_'+key+'_field');
470 - cus_field.find('.cus_p_like').attr('name', 'c_field_'+key+'_like');
471 - cus_field.find('.cus_p_value').attr('name', 'c_field_'+key+'_value');
808 + cus_field.find('.cus_p_field').attr('name', 'c_field_' + key + '_field');
809 + cus_field.find('.cus_p_like').attr('name', 'c_field_' + key + '_like');
810 + cus_field.find('.cus_p_value').attr('name', 'c_field_' + key + '_value');
472 811 });
473 812
474 - jQuery('.btn_parameter.remove').off().on('click', function(e){
813 + jQuery('.btn_parameter.remove').off().on('click', function(e) {
475 814 e.preventDefault();
476 - if(jQuery($selector_customParameter).length>1) {
815 + if (jQuery($selector_customParameter).length > 1) {
477 816 jQuery($selector_customParameter).last().remove();
478 817 } else {
479 818 jQuery($selector_customParameter).last().find('input,select').val('');
480 819 }