PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 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.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
← All changes | includes/Elementor/Search.php +43 -117 2.4.12.2.0 View file →
@@ -17,13 +17,13 @@
17 17 return 'ama_search';
18 18 }
19 19
20 20 public function get_title() {
21 - return esc_html__( 'Search (Forumax)', 'forumax' );
21 + return esc_html__( 'Forumax Search', 'forumax' );
22 22 }
23 23
24 24 public function get_icon() {
25 - return 'bbpc_icon_ama_search eicon-search';
25 + return 'bbpc_icon_ama_search';
26 26 }
27 27
28 28 public function get_style_depends() {
29 29 return [ 'ama-core-style', 'bbpc-el-widgets' ];
@@ -53,47 +53,8 @@
53 53 'default' => 'Search for Topics....',
54 54 ]
55 55 );
56 56
57 - $this->add_control(
58 - 'search_post_type', [
59 - 'label' => esc_html__( 'Post Type', 'forumax' ),
60 - 'type' => Controls_Manager::SELECT,
61 - 'default' => 'forum',
62 - 'options' => [
63 - 'forum' => esc_html__( 'Forum', 'forumax' ),
64 - 'topic' => esc_html__( 'Topic', 'forumax' ),
65 - 'reply' => esc_html__( 'Reply', 'forumax' ),
66 - 'post' => esc_html__( 'Post', 'forumax' ),
67 - 'page' => esc_html__( 'Page', 'forumax' ),
68 - 'docs' => esc_html__( 'Docs', 'forumax' ),
69 - ],
70 - ]
71 - );
72 -
73 - $this->add_control(
74 - 'is_ajax_search', [
75 - 'label' => esc_html__( 'AJAX Live Search', 'forumax' ),
76 - 'description' => esc_html__( 'Show search results instantly as users type without page reload.', 'forumax' ),
77 - 'type' => Controls_Manager::SWITCHER,
78 - 'return_value' => 'yes',
79 - 'default' => '',
80 - ]
81 - );
82 -
83 - $this->add_control(
84 - 'search_highlight', [
85 - 'label' => esc_html__( 'Highlight Keywords', 'forumax' ),
86 - 'description' => esc_html__( 'Highlight the matching keyword in search results.', 'forumax' ),
87 - 'type' => Controls_Manager::SWITCHER,
88 - 'return_value' => 'yes',
89 - 'default' => '',
90 - 'condition' => [
91 - 'is_ajax_search' => 'yes',
92 - ],
93 - ]
94 - );
95 -
96 57 // select controls
97 58 $this->add_control(
98 59 'submit_btn_type', [
99 60 'label' => __( 'Search Type', 'forumax' ),
@@ -136,19 +97,19 @@
136 97 'submit_btn_align', [
137 98 'label' => __( 'Submit Alignment', 'forumax' ),
138 99 'type' => \Elementor\Controls_Manager::CHOOSE,
139 100 'options' => [
140 - 'left' => [
101 + 'right' => [
141 102 'title' => __( 'Left', 'forumax' ),
142 103 'icon' => 'fa fa-align-left',
143 104 ],
144 - 'right' => [
105 + 'left' => [
145 106 'title' => __( 'Right', 'forumax' ),
146 107 'icon' => 'fa fa-align-right',
147 108 ],
148 109 ],
149 110 'toggle' => false,
150 - 'default' => 'left',
111 + 'default' => 'left'
151 112 ]
152 113 );
153 114
154 115 $this->add_control(
@@ -389,9 +350,9 @@
389 350 ]
390 351 );
391 352
392 353
393 - // Spacing slider when icon is on the LEFT.
354 + // slider controls
394 355 $this->add_control(
395 356 'submit_btn_align_left', [
396 357 'label' => esc_html__( 'Spacing', 'forumax' ),
397 358 'type' => Controls_Manager::SLIDER,
@@ -396,22 +357,23 @@
396 357 'label' => esc_html__( 'Spacing', 'forumax' ),
397 358 'type' => Controls_Manager::SLIDER,
398 359 'range' => [
399 360 'px' => [
400 - 'min' => 0,
361 + 'min' => 10,
401 362 'max' => 100,
402 363 ],
403 364 ],
404 365 'selectors' => [
405 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-left' => 'left: {{SIZE}}{{UNIT}};',
366 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-left' => 'right: {{SIZE}}{{UNIT}};',
406 367 ],
407 368 'condition' => [
408 - 'submit_btn_align' => 'left',
369 + 'submit_btn_align' => 'left'
409 370 ],
410 371 ]
411 372 );
412 373
413 - // Spacing slider when icon is on the RIGHT.
374 +
375 + // slider controls
414 376 $this->add_control(
415 377 'submit_btn_align_right', [
416 378 'label' => esc_html__( 'Spacing', 'forumax' ),
417 379 'type' => Controls_Manager::SLIDER,
@@ -416,17 +378,17 @@
416 378 'label' => esc_html__( 'Spacing', 'forumax' ),
417 379 'type' => Controls_Manager::SLIDER,
418 380 'range' => [
419 381 'px' => [
420 - 'min' => 0,
382 + 'min' => 10,
421 383 'max' => 100,
422 384 ],
423 385 ],
424 386 'selectors' => [
425 - '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-right' => 'right: {{SIZE}}{{UNIT}};',
387 + '{{WRAPPER}} .bbpc_search_form_wrapper .input-wrapper .submit-btn-right' => 'left: {{SIZE}}{{UNIT}};',
426 388 ],
427 389 'condition' => [
428 - 'submit_btn_align' => 'right',
390 + 'submit_btn_align' => 'right'
429 391 ],
430 392 ]
431 393 );
432 394
@@ -585,88 +547,52 @@
585 547
586 548 }
587 549
588 550 protected function render() {
589 - $settings = $this->get_settings();
590 - $widget_id = 'frmx-search-' . $this->get_id();
591 - $input_id = $widget_id . '-input';
592 - $result_id = $widget_id . '-result';
593 - $post_type_id = $widget_id . '-post-type';
594 -
595 - /*
596 - * $btn_position holds the raw saved value: 'left' or 'right'.
597 - * It is used directly — no inversion needed — so the span class
598 - * and the input-wrapper class both reflect the actual chosen side.
599 - */
600 - $btn_position = $settings['submit_btn_align'] ?? 'left';
601 -
602 - $search_post_type = ! empty( $settings['search_post_type'] ) ? $settings['search_post_type'] : 'forum';
603 - $is_ajax_search = ! empty( $settings['is_ajax_search'] ) ? 'true' : 'false';
604 - $search_highlight = ! empty( $settings['search_highlight'] ) ? 'true' : 'false';
551 + $settings = $this->get_settings();
552 + $title_tag = ! empty( $settings['title_tag'] ) ? $settings['title_tag'] : 'h2';
553 + $cross_position = $settings['submit_btn_align'] ?? 'right';
554 + if ( $cross_position == 'right' ) {
555 + $cross_position = 'left';
556 + } else {
557 + $cross_position = 'right';
558 + }
605 559 ?>
606 -
607 - <div class="bbpc-search-overlay" data-widget-id="<?php echo esc_attr( $widget_id ); ?>"></div>
608 -
609 - <form
610 - action="<?php echo esc_url( home_url( '/' ) ); ?>"
611 - role="search"
612 - method="get"
613 - class="bbpc_search_form_wrapper"
614 - data-widget-id="<?php echo esc_attr( $widget_id ); ?>"
615 - data-input-id="<?php echo esc_attr( $input_id ); ?>"
616 - data-result-id="<?php echo esc_attr( $result_id ); ?>"
617 - >
618 - <div class="form-group">
619 - <div class="input-wrapper <?php echo esc_attr( $btn_position ); ?>">
620 -
621 - <span class="submit-btn-<?php echo esc_attr( $btn_position ); ?>">
622 - <button type="submit">
560 +
561 + <div class="bbpc-search-overlay"></div>
562 +
563 + <form action="<?php echo esc_url( home_url( '/' ) ) ?>" role="search" method="get" class="bbpc_search_form_wrapper">
564 + <div class="form-group">
565 + <div class="input-wrapper <?php echo esc_attr( $cross_position ); ?>">
566 +
567 + <span class="submit-btn-<?php echo esc_attr( $settings['submit_btn_align'] ?? 'left' ); ?>">
568 + <button type="submit">
623 569 <?php
624 570 $submit_btn = $settings['submit_btn_type'] ?? 'icon';
625 - if ( 'icon' === $submit_btn ) {
571 + if ( $submit_btn == 'icon' ) {
626 572 \Elementor\Icons_Manager::render_icon( $settings['submit_btn_icon'], [ 'aria-hidden' => 'true' ] );
627 573 } else {
628 574 echo esc_html( $settings['submit_btn_text'] );
629 575 }
630 576 ?>
631 - </button>
577 + </button>
632 578 </span>
633 579
634 - <input
635 - type="search"
636 - id="<?php echo esc_attr( $input_id ); ?>"
637 - class="frmx-search-input"
638 - autocomplete="off"
639 - name="s"
640 - placeholder="<?php echo esc_attr( $settings['placeholder'] ); ?>"
641 - data-post-type="<?php echo esc_attr( $search_post_type ); ?>"
642 - data-ajax-search="<?php echo esc_attr( $is_ajax_search ); ?>"
643 - data-highlight="<?php echo esc_attr( $search_highlight ); ?>"
644 - data-result-id="<?php echo esc_attr( $result_id ); ?>"
645 - >
580 + <input type='search' id="searchInput" autocomplete="off" name="s" placeholder="<?php echo esc_attr( $settings['placeholder'] ) ?>">
646 581
647 - <!-- Ajax Search Loading Spinner -->
582 + <!-- Ajax Search Loading Spinner -->
648 583 <?php include( 'Search/search-spinner.php' ); ?>
649 584
650 - <!-- WPML Language Code -->
585 + <!-- WPML Language Code -->
651 586 <?php if ( defined( 'ICL_LANGUAGE_CODE' ) ) : ?>
652 - <input type="hidden" name="lang" value="<?php echo esc_attr( ICL_LANGUAGE_CODE ); ?>"/>
587 + <input type="hidden" name="lang" value="<?php echo esc_attr( ICL_LANGUAGE_CODE ); ?>"/>
653 588 <?php endif; ?>
654 589
655 - <input
656 - type="hidden"
657 - id="<?php echo esc_attr( $post_type_id ); ?>"
658 - name="post_type"
659 - value="<?php echo esc_attr( $search_post_type ); ?>"
660 - />
661 - </div>
662 - </div>
663 - <?php
664 - // Pass unique result ID to the partials via a local variable.
665 - $frmx_result_id = $result_id;
666 - include 'Search/ajax-sarch-results.php';
667 - include 'Search/keywords.php';
668 - ?>
669 - </form>
590 + <input type="hidden" id="hidden_post_type" name="post_type" value="docs"/>
591 + </div>
592 + </div>
593 + <?php include( 'Search/ajax-sarch-results.php' ); ?>
594 + <?php include( 'Search/keywords.php' ); ?>
595 + </form>
670 596 <?php
671 597 }
672 598 }