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 | elementor-elements/classes/wdk-search.php +139 -30 1.3.8 → 1.5.9 View file →
@@ -29,8 +29,9 @@
29 29 \Elementor\Controls_Manager::add_tab(
30 30 'tab_conf',
31 31 esc_html__('Settings', 'wpdirectorykit')
32 32 );
33 +
33 34
34 35 \Elementor\Controls_Manager::add_tab(
35 36 'tab_layout',
36 37 esc_html__('Layout', 'wpdirectorykit')
@@ -120,11 +121,11 @@
120 121 $this->data['id_element'] = $this->get_id();
121 122 $this->data['settings'] = $this->get_settings();
122 123 $this->data['counts'] = array();
123 124
124 - wp_enqueue_script('select2');
125 + wp_enqueue_script('select2-select2');
125 126 wp_enqueue_script('wdk-select2');
126 - wp_enqueue_style('select2');
127 + wp_enqueue_style('select2-select2');
127 128 global $wdk_visible_filters_limit;
128 129 global $wdk_enable_search_fields_toggle;
129 130
130 131 global $wdk_search_fields_toggle_reset;
@@ -195,9 +196,9 @@
195 196 }
196 197 }
197 198
198 199
199 - echo $this->view('wdk-search', $this->data);
200 + $this->view('wdk-search', $this->data, true);
200 201 }
201 202
202 203
203 204 private function generate_controls_conf() {
@@ -234,9 +235,22 @@
234 235 'default' => '',
235 236 ]
236 237 );
237 238
239 +
238 240 $this->add_control(
241 + 'ai_search_enable',
242 + [
243 + 'label' => __( 'AI Search Enable', 'wpdirectorykit' ),
244 + 'type' => Controls_Manager::SWITCHER,
245 + 'label_on' => __( 'Show', 'wpdirectorykit' ),
246 + 'label_off' => __( 'Hide', 'wpdirectorykit' ),
247 + 'return_value' => 'yes',
248 + 'default' => '',
249 + ]
250 + );
251 +
252 + $this->add_control(
239 253 'section_config_more',
240 254 [
241 255 'label' => __( 'Field more hide', 'wpdirectorykit' ),
242 256 'type' => Controls_Manager::SWITCHER,
@@ -248,8 +262,20 @@
248 262 '{{WRAPPER}} .wdk-field-group-additional' => 'display: {{VALUE}};',
249 263 ],
250 264 ]
251 265 );
266 +
267 + $this->add_control(
268 + 'section_more_before_buttons',
269 + [
270 + 'label' => __( 'Show Additional Fields Before Search Buttons', 'wpdirectorykit' ),
271 + 'type' => Controls_Manager::SWITCHER,
272 + 'label_on' => __( 'Yes', 'wpdirectorykit' ),
273 + 'label_off' => __( 'None', 'wpdirectorykit' ),
274 + 'return_value' => 'yes',
275 + 'default' => '',
276 + ]
277 + );
252 278
253 279 $this->add_control(
254 280 'section_config_more_limit',
255 281 [
@@ -306,9 +332,9 @@
306 332
307 333 $this->add_control(
308 334 'field_button_icon',
309 335 [
310 - 'label' => __( 'Icon', 'text-domain' ),
336 + 'label' => __( 'Icon', 'wpdirectorykit' ),
311 337 'type' => Controls_Manager::ICONS,
312 338 ]
313 339 );
314 340
@@ -314,13 +340,13 @@
314 340
315 341 $this->add_control(
316 342 'field_button_icon_position',
317 343 [
318 - 'label' => esc_html__('icon Position', 'wdk-compare-listing'),
344 + 'label' => esc_html__('icon Position', 'wpdirectorykit'),
319 345 'type' => Controls_Manager::SELECT,
320 346 'options' => [
321 - 'left' => esc_html__('Left', 'wdk-compare-listing'),
322 - 'right' => esc_html__('Right', 'wdk-compare-listing'),
347 + 'left' => esc_html__('Left', 'wpdirectorykit'),
348 + 'right' => esc_html__('Right', 'wpdirectorykit'),
323 349 ],
324 350 'default' => 'left',
325 351 ]
326 352 );
@@ -348,16 +374,27 @@
348 374 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
349 375 $order_i = 0;
350 376 foreach($fields as $field)
351 377 {
352 - $fields_list[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field);
378 + $fields_list[wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field);
353 379 }
380 +
381 + // build raw_options preserving order
382 + $raw = [];
383 + foreach ( $fields_list as $k => $v ) {
384 + $raw[] = [
385 + 'value' => (string) $k,
386 + 'label' => $v,
387 + ];
388 + }
389 +
354 390 $this->add_control(
355 391 'tab_field',
356 392 [
357 393 'label' => __( 'Tab', 'wpdirectorykit' ),
358 - 'type' => Controls_Manager::SELECT2,
394 + 'type' => \Wdk\Includes\Controls\Wdk_Field_Selector::INIT,
359 395 'options' => $fields_list,
396 + 'raw_options' => $raw,
360 397 'default' => 'results',
361 398 ]
362 399 );
363 400
@@ -377,8 +414,9 @@
377 414 'important_note',
378 415 [
379 416 'label' => '',
380 417 'type' => \Elementor\Controls_Manager::RAW_HTML,
418 + /* translators: 1: URL. */
381 419 'raw' => wdk_sprintf(__( 'Manage Search Form <a href="%1$s" target="_blank"> open </a>', 'wpdirectorykit' ), admin_url('admin.php?page=wdk_searchform')),
382 420 'content_classes' => 'wdk_elementor_hint',
383 421 'separator' => 'after',
384 422 ]
@@ -449,24 +487,26 @@
449 487 );
450 488
451 489 $fields_data = wdk_cached_field_get();
452 490 $fields_list = array('' => esc_html__('Not Selected', 'wpdirectorykit'));
453 - $order_i = 0;
454 491 $fields_allow_types = array();
455 492 $fields_allow_tree_types = array();
456 493
457 - $fields_list [(++$order_i).'__section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
458 - $fields_list [(++$order_i).'__search'] = esc_html__('Smart Search', 'wpdirectorykit');
494 + $fields_list ['section'] = esc_html__('-- Section Custom fields --', 'wpdirectorykit');
495 + $fields_list ['search'] = esc_html__('Smart Search', 'wpdirectorykit');
459 496
460 - if(function_exists('run_wdk_bookings'))
461 - $fields_list [(++$order_i).'__booking_date'] = esc_html__('Booking Date', 'wpdirectorykit');
497 + if(function_exists('run_wdk_bookings')) {
498 + $fields_list ['booking_date'] = esc_html__('Booking Date', 'wpdirectorykit');
499 + $fields_list ['booking_guest'] = esc_html__('Booking Guests', 'wpdirectorykit');
500 + }
462 501
463 - $fields_list [(++$order_i).'__post_title'] = esc_html__('WP Title', 'wpdirectorykit');
464 - $fields_list [(++$order_i).'__address'] = esc_html__('Address', 'wpdirectorykit');
465 - $fields_list [(++$order_i).'__category_id'] = esc_html__('Category', 'wpdirectorykit');
466 - $fields_allow_tree_types[] = $order_i.'__category_id';
467 - $fields_list [(++$order_i).'__location_id'] = esc_html__('Location', 'wpdirectorykit');
468 - $fields_allow_tree_types[] = $order_i.'__location_id';
502 + $fields_list ['post_title'] = esc_html__('WP Title', 'wpdirectorykit');
503 + $fields_list ['post_title'] = esc_html__('WP Title', 'wpdirectorykit');
504 + $fields_list ['address'] = esc_html__('Address', 'wpdirectorykit');
505 + $fields_list ['category_id'] = esc_html__('Category', 'wpdirectorykit');
506 + $fields_allow_tree_types[] = 'category_id';
507 + $fields_list ['location_id'] = esc_html__('Location', 'wpdirectorykit');
508 + $fields_allow_tree_types[] = 'location_id';
469 509
470 510 foreach($fields_data as $field)
471 511 {
472 512 if(in_array(wmvc_show_data('field_type', $field),array('TEXTAREA','TEXTAREA_WYSIWYG'))) {
@@ -471,18 +511,27 @@
471 511 {
472 512 if(in_array(wmvc_show_data('field_type', $field),array('TEXTAREA','TEXTAREA_WYSIWYG'))) {
473 513 continue;
474 514 } else if(in_array(wmvc_show_data('field_type', $field),array('SECTION'))) {
475 - $fields_list [(++$order_i).'section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
515 + $fields_list ['section__'.wmvc_show_data('idfield', $field)] = '-- '.esc_html__('Section', 'wpdirectorykit').' '.wmvc_show_data('field_label', $field).' --';
476 516 } else {
477 - $fields_list[(++$order_i).'__'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
517 + $fields_list[wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
478 518 }
479 519
480 520 if(wmvc_show_data('field_type', $field) == 'NUMBER') {
481 - $fields_allow_types[] = $order_i.'__'.wmvc_show_data('idfield', $field);
521 + $fields_allow_types[] = ''.wmvc_show_data('idfield', $field);
482 522 }
483 523 }
484 524
525 + // build raw_options preserving order
526 + $raw = [];
527 + foreach ( $fields_list as $k => $v ) {
528 + $raw[] = [
529 + 'value' => (string) $k,
530 + 'label' => $v,
531 + ];
532 + }
533 +
485 534 $repeater = new Repeater();
486 535 $repeater->start_controls_tabs( 'custom_fields_repeat' );
487 536
488 537 $repeater->add_control(
@@ -488,11 +537,12 @@
488 537 $repeater->add_control(
489 538 'field_id',
490 539 [
491 540 'label' => __( 'Field id', 'wpdirectorykit' ),
492 - 'type' => \Elementor\Controls_Manager::SELECT2,
541 + 'type' => \Wdk\Includes\Controls\Wdk_Field_Selector::INIT,
493 542 'default' => '',
494 543 'options' => $fields_list,
544 + 'raw_options' => $raw,
495 545 'separator' => 'after',
496 546 ]
497 547 );
498 548
@@ -671,9 +721,42 @@
671 721 'default' => 'results',
672 722 ]
673 723 );
674 724
725 +
675 726 $this->add_responsive_control(
727 + 'form_fields_align',
728 + [
729 + 'label' => __( 'Align', 'wpdirectorykit' ),
730 + 'type' => Controls_Manager::CHOOSE,
731 + 'options' => [
732 + 'left' => [
733 + 'title' => esc_html__( 'Left', 'wpdirectorykit' ),
734 + 'icon' => 'eicon-text-align-left',
735 + ],
736 + 'center' => [
737 + 'title' => esc_html__( 'Center', 'wpdirectorykit' ),
738 + 'icon' => 'eicon-text-align-center',
739 + ],
740 + 'right' => [
741 + 'title' => esc_html__( 'Right', 'wpdirectorykit' ),
742 + 'icon' => 'eicon-text-align-right',
743 + ],
744 + ],
745 + 'render_type' => 'template',
746 + 'selectors_dictionary' => [
747 + 'left' => 'justify-content: flex-start;',
748 + 'center' => 'justify-content: center;',
749 + 'right' => 'justify-content: flex-end;',
750 + ],
751 +
752 + 'selectors' => [
753 + '{{WRAPPER}} .wdk-search .wdk-search-form > .wdk-row ' => '{{VALUE}};',
754 + ],
755 + ]
756 + );
757 +
758 + $this->add_responsive_control(
676 759 'design_layout',
677 760 [
678 761 'label' => __( 'Design Layout', 'wpdirectorykit' ),
679 762 'type' => Controls_Manager::SELECT,
@@ -944,8 +1027,23 @@
944 1027 ]
945 1028 );
946 1029
947 1030 $this->add_responsive_control(
1031 + 'button_wrapper',
1032 + [
1033 + 'label' => __( 'Button Wrapper Hide', 'wpdirectorykit' ),
1034 + 'type' => Controls_Manager::SWITCHER,
1035 + 'label_on' => __( 'Show', 'wpdirectorykit' ),
1036 + 'label_off' => __( 'Hide', 'wpdirectorykit' ),
1037 + 'return_value' => 'none',
1038 + 'default' => '',
1039 + 'selectors' => [
1040 + '{{WRAPPER}} .wdk-search .wdk-col-btns' => 'display: {{VALUE}};',
1041 + ],
1042 + ]
1043 + );
1044 +
1045 + $this->add_responsive_control(
948 1046 'button_column_inline',
949 1047 [
950 1048 'label' => __( 'Column Buttons Cell', 'wpdirectorykit' ),
951 1049 'type' => Controls_Manager::SELECT,
@@ -1528,9 +1626,9 @@
1528 1626 ],
1529 1627 [
1530 1628 'key'=>'field_button',
1531 1629 'label'=> esc_html__('Search Button', 'wpdirectorykit'),
1532 - 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-btn button.wdk-search-start',
1630 + 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-group-search button.wdk-search-start',
1533 1631 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-start',
1534 1632 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-start%1$s',
1535 1633 'options'=>'full',
1536 1634 ],
@@ -1542,8 +1640,16 @@
1542 1640 'selector_hover'=>'{{WRAPPER}} .wdk-field button.wdk-search-start.wdk-search-reset%1$s',
1543 1641 'options'=>['typo','color','border','border_radius','shadow','transition','background_group'],
1544 1642 ],
1545 1643 [
1644 + 'key'=>'field_button_ai_search',
1645 + 'label'=> esc_html__('Ai Search Button', 'wpdirectorykit'),
1646 + 'selector_hide'=>'{{WRAPPER}} .wdk-field-group.wdk-field-group-ai-search',
1647 + 'selector'=>'{{WRAPPER}} .wdk-field .wdk-ai-search',
1648 + 'selector_hover'=>'{{WRAPPER}} .wdk-field .wdk-ai-search%1$s',
1649 + 'options'=>['typo','color','border','border_radius','shadow','transition','background_group'],
1650 + ],
1651 + [
1546 1652 'key'=>'field_button_more',
1547 1653 'label'=> esc_html__('Button More', 'wpdirectorykit'),
1548 1654 'selector_hide'=>'{{WRAPPER}} .wdk-field .wdk-field-group-additional',
1549 1655 'selector'=>'{{WRAPPER}} .wdk-field button.wdk-search-additional-btn',
@@ -1669,12 +1775,12 @@
1669 1775 if(!empty($item['selector_hide'])) {
1670 1776 $this->add_responsive_control(
1671 1777 $item['key'].'_hide',
1672 1778 [
1673 - 'label' => esc_html__( 'Hide Element', 'wdk-svg-map' ),
1779 + 'label' => esc_html__( 'Hide Element', 'wpdirectorykit' ),
1674 1780 'type' => Controls_Manager::SWITCHER,
1675 - 'none' => esc_html__( 'Hide', 'wdk-svg-map' ),
1676 - 'block' => esc_html__( 'Show', 'wdk-svg-map' ),
1781 + 'none' => esc_html__( 'Hide', 'wpdirectorykit' ),
1782 + 'block' => esc_html__( 'Show', 'wpdirectorykit' ),
1677 1783 'return_value' => 'none',
1678 1784 'default' => ($item['key'] == 'field_button_reset' ) ? 'none':'',
1679 1785 'selectors' => [
1680 1786 $item['selector_hide'] => 'display: {{VALUE}};',
@@ -2033,16 +2139,19 @@
2033 2139 wp_enqueue_script('wdk-suggestion');
2034 2140 wp_enqueue_style('wdk-treefield');
2035 2141
2036 2142
2037 - wp_enqueue_script('select2');
2143 + wp_enqueue_script('select2-select2');
2038 2144 wp_enqueue_script('wdk-select2');
2039 - wp_enqueue_style('select2');
2145 + wp_enqueue_style('select2-select2');
2040 2146
2041 2147 wp_enqueue_script( 'ion.range-slider' );
2042 2148 wp_enqueue_style('ion.range-slider');
2043 2149 wp_enqueue_style('wdk-slider-range');
2044 2150 wp_enqueue_script('wdk-slider-range');
2151 +
2152 + wp_enqueue_style('jquery-confirm');
2153 + wp_enqueue_script('jquery-confirm');
2045 2154
2046 2155 wp_enqueue_style( 'wdk-treefield-checkboxes');
2047 2156 wp_enqueue_script( 'wdk-treefield-checkboxes');
2048 2157