| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace EverCompare\Admin; |
| 3 | + | |
| 4 | +defined( 'ABSPATH' ) || exit; | |
| 3 | 5 | /** |
| 4 | 6 | * Admin Page Fields handlers class |
| 5 | 7 | */ |
| 6 | 8 | class Admin_Fields { |
| @@ -43,8 +45,13 @@ | ||
| 43 | 45 | public function get_settings_sections() { |
| 44 | 46 | $sections = array( |
| 45 | 47 | |
| 46 | 48 | array( |
| 49 | + 'id' => 'ever_compare_settings_general', | |
| 50 | + 'title' => esc_html__( 'General Settings', 'ever-compare' ), | |
| 51 | + ), | |
| 52 | + | |
| 53 | + array( | |
| 47 | 54 | 'id' => 'ever_compare_settings_tabs', |
| 48 | 55 | 'title' => esc_html__( 'Button Settings', 'ever-compare' ), |
| 49 | 56 | ), |
| 50 | 57 | |
| @@ -65,8 +72,45 @@ | ||
| 65 | 72 | protected function fields_settings() { |
| 66 | 73 | |
| 67 | 74 | $settings_fields = array( |
| 68 | 75 | |
| 76 | + 'ever_compare_settings_general' => array( | |
| 77 | + | |
| 78 | + array( | |
| 79 | + 'name' => 'enable_success_notification', | |
| 80 | + 'label' => __( 'Show successful notification', 'ever-compare' ), | |
| 81 | + 'type' => 'checkbox', | |
| 82 | + 'default' => 'off', | |
| 83 | + 'desc' => esc_html__( 'Enable this option to display a notification when a client adds or removes a product from the compare.', 'ever-compare' ), | |
| 84 | + ), | |
| 85 | + | |
| 86 | + array( | |
| 87 | + 'name' => 'success_added_notification_text', | |
| 88 | + 'label' => __( '"Product added to compare" Text', 'ever-compare' ), | |
| 89 | + 'type' => 'text', | |
| 90 | + 'default' => __( '{product_name} added to compare.', 'ever-compare'), | |
| 91 | + 'desc' => esc_html__( 'You can use the placeholder {product_name} to get the current product name.', 'ever-compare' ), | |
| 92 | + 'class' => 'depend_enable_success_notification' | |
| 93 | + ), | |
| 94 | + array( | |
| 95 | + 'name' => 'success_removed_notification_text', | |
| 96 | + 'label' => __( '"Product removed from compare" Text', 'ever-compare' ), | |
| 97 | + 'type' => 'text', | |
| 98 | + 'default' => __( '{product_name} removed from compare.', 'ever-compare'), | |
| 99 | + 'desc' => esc_html__( 'You can use the placeholder {product_name} to get the current product name.', 'ever-compare' ), | |
| 100 | + 'class' => 'depend_enable_success_notification' | |
| 101 | + ), | |
| 102 | + array( | |
| 103 | + 'name' => 'removed_notification_after', | |
| 104 | + 'label' => __( 'Remove Notification automatically after (seconds)', 'ever-compare' ), | |
| 105 | + 'type' => 'number', | |
| 106 | + 'default' => 4, | |
| 107 | + 'min' => -1, | |
| 108 | + 'desc' => esc_html__( 'If you wish to always display the notification, please input the value "-1".', 'ever-compare' ), | |
| 109 | + 'class' => 'depend_enable_success_notification' | |
| 110 | + ), | |
| 111 | + ), | |
| 112 | + | |
| 69 | 113 | 'ever_compare_settings_tabs' => array( |
| 70 | 114 | |
| 71 | 115 | array( |
| 72 | 116 | 'name' => 'btn_show_shoppage', |
| @@ -84,8 +128,16 @@ | ||
| 84 | 128 | 'default' => 'on', |
| 85 | 129 | ), |
| 86 | 130 | |
| 87 | 131 | array( |
| 132 | + 'name' => 'remove_on_click', | |
| 133 | + 'label' => __( 'Remove product from compare on second click', 'ever-compare' ), | |
| 134 | + 'type' => 'checkbox', | |
| 135 | + 'default' => 'off', | |
| 136 | + 'desc' => __( 'Remove the product from the compare if it has already been added.', 'ever-compare' ), | |
| 137 | + ), | |
| 138 | + | |
| 139 | + array( | |
| 88 | 140 | 'name' => 'shop_btn_position', |
| 89 | 141 | 'label' => __( 'Shop page button position', 'ever-compare' ), |
| 90 | 142 | 'desc' => __( 'You can manage compare button position in product list page.', 'ever-compare' ), |
| 91 | 143 | 'type' => 'select', |
| @@ -205,8 +257,18 @@ | ||
| 205 | 257 | 'placeholder' => __( 'Added', 'ever-compare' ), |
| 206 | 258 | ), |
| 207 | 259 | |
| 208 | 260 | array( |
| 261 | + 'name' => 'remove_button_text', | |
| 262 | + 'label' => __( 'Remove button text', 'ever-compare' ), | |
| 263 | + 'desc' => __( 'Enter the compare remove button text.', 'ever-compare' ), | |
| 264 | + 'type' => 'text', | |
| 265 | + 'default' => __( 'Remove', 'ever-compare' ), | |
| 266 | + 'placeholder' => __( 'Remove', 'ever-compare' ), | |
| 267 | + 'class' => 'depend_remove_on_click', | |
| 268 | + ), | |
| 269 | + | |
| 270 | + array( | |
| 209 | 271 | 'name' => 'button_icon_type', |
| 210 | 272 | 'label' => esc_html__( 'Button icon type', 'ever-compare' ), |
| 211 | 273 | 'desc' => esc_html__( 'Choose an icon type for the compare button from here.', 'ever-compare' ), |
| 212 | 274 | 'type' => 'select', |
| @@ -305,10 +367,10 @@ | ||
| 305 | 367 | ), |
| 306 | 368 | |
| 307 | 369 | array( |
| 308 | 370 | 'name' => 'limit', |
| 309 | - 'label' => esc_html__( 'Limit', 'quickswish' ), | |
| 310 | - 'desc' => esc_html__( 'You can manage your maximum compare quantity from here.', 'quickswish' ), | |
| 371 | + 'label' => esc_html__( 'Limit', 'ever-compare' ), | |
| 372 | + 'desc' => esc_html__( 'You can manage your maximum compare quantity from here.', 'ever-compare' ), | |
| 311 | 373 | 'type' => 'number', |
| 312 | 374 | 'min' => 1, |
| 313 | 375 | 'max' => 1500, |
| 314 | 376 | 'step' => 1, |
| @@ -323,9 +385,9 @@ | ||
| 323 | 385 | 'type' => 'multicheckshort', |
| 324 | 386 | 'options' => ever_compare_get_available_attributes(), |
| 325 | 387 | 'default' => [ |
| 326 | 388 | 'title' => esc_html__( 'title', 'ever-compare' ), |
| 327 | - 'ratting' => esc_html__( 'ratting', 'ever-compare' ), | |
| 389 | + 'ratting' => esc_html__( 'Rating', 'ever-compare' ), | |
| 328 | 390 | 'price' => esc_html__( 'price', 'ever-compare' ), |
| 329 | 391 | 'add_to_cart' => esc_html__( 'add_to_cart', 'ever-compare' ), |
| 330 | 392 | 'description' => esc_html__( 'description', 'ever-compare' ), |
| 331 | 393 | 'availability' => esc_html__( 'availability', 'ever-compare' ), |
| @@ -425,8 +487,20 @@ | ||
| 425 | 487 | ] |
| 426 | 488 | ), |
| 427 | 489 | |
| 428 | 490 | array( |
| 491 | + 'name' => 'notification_style', | |
| 492 | + 'label' => __( 'Notification style', 'ever-compare' ), | |
| 493 | + 'desc' => __( 'Choose a style for the compare notification here.', 'ever-compare' ), | |
| 494 | + 'type' => 'select', | |
| 495 | + 'default' => 'default', | |
| 496 | + 'options' => [ | |
| 497 | + 'default' => esc_html__( 'Default', 'ever-compare' ), | |
| 498 | + 'custom' => esc_html__( 'Custom', 'ever-compare' ), | |
| 499 | + ] | |
| 500 | + ), | |
| 501 | + | |
| 502 | + array( | |
| 429 | 503 | 'name' => 'button_custom_style_area_title', |
| 430 | 504 | 'headding'=> esc_html__( 'Button custom style', 'ever-compare' ), |
| 431 | 505 | 'type' => 'title', |
| 432 | 506 | 'size' => 'margin_0 regular', |
| @@ -435,9 +509,9 @@ | ||
| 435 | 509 | |
| 436 | 510 | array( |
| 437 | 511 | 'name' => 'button_color', |
| 438 | 512 | 'label' => esc_html__( 'Color', 'ever-compare' ), |
| 439 | - 'desc' => wp_kses_post( 'Set the color of the button.', 'ever-compare' ), | |
| 513 | + 'desc' => wp_kses_post( __( 'Set the color of the button.', 'ever-compare' ) ), | |
| 440 | 514 | 'type' => 'color', |
| 441 | 515 | 'class' => 'depend_button_custom_style', |
| 442 | 516 | ), |
| 443 | 517 | |
| @@ -443,9 +517,9 @@ | ||
| 443 | 517 | |
| 444 | 518 | array( |
| 445 | 519 | 'name' => 'button_hover_color', |
| 446 | 520 | 'label' => esc_html__( 'Hover Color', 'ever-compare' ), |
| 447 | - 'desc' => wp_kses_post( 'Set the hover color of the button.', 'ever-compare' ), | |
| 521 | + 'desc' => wp_kses_post( __( 'Set the hover color of the button.', 'ever-compare' ) ), | |
| 448 | 522 | 'type' => 'color', |
| 449 | 523 | 'class' => 'depend_button_custom_style', |
| 450 | 524 | ), |
| 451 | 525 | |
| @@ -451,9 +525,9 @@ | ||
| 451 | 525 | |
| 452 | 526 | array( |
| 453 | 527 | 'name' => 'background_color', |
| 454 | 528 | 'label' => esc_html__( 'Background Color', 'ever-compare' ), |
| 455 | - 'desc' => wp_kses_post( 'Set the background color of the button.', 'ever-compare' ), | |
| 529 | + 'desc' => wp_kses_post( __( 'Set the background color of the button.', 'ever-compare' ) ), | |
| 456 | 530 | 'type' => 'color', |
| 457 | 531 | 'class' => 'depend_button_custom_style', |
| 458 | 532 | ), |
| 459 | 533 | |
| @@ -459,9 +533,9 @@ | ||
| 459 | 533 | |
| 460 | 534 | array( |
| 461 | 535 | 'name' => 'hover_background_color', |
| 462 | 536 | 'label' => esc_html__( 'Hover Background Color', 'ever-compare' ), |
| 463 | - 'desc' => wp_kses_post( 'Set the hover background color of the button.', 'ever-compare' ), | |
| 537 | + 'desc' => wp_kses_post( __( 'Set the hover background color of the button.', 'ever-compare' ) ), | |
| 464 | 538 | 'type' => 'color', |
| 465 | 539 | 'class' => 'depend_button_custom_style', |
| 466 | 540 | ), |
| 467 | 541 | |
| @@ -508,9 +582,9 @@ | ||
| 508 | 582 | ), |
| 509 | 583 | array( |
| 510 | 584 | 'name' => 'button_custom_border_color', |
| 511 | 585 | 'label' => esc_html__( 'Border Color', 'ever-compare' ), |
| 512 | - 'desc' => wp_kses_post( 'Set the button color of the button.', 'ever-compare' ), | |
| 586 | + 'desc' => wp_kses_post( __( 'Set the border color of the button.', 'ever-compare' ) ), | |
| 513 | 587 | 'type' => 'color', |
| 514 | 588 | 'class' => 'depend_button_custom_style', |
| 515 | 589 | ), |
| 516 | 590 | |
| @@ -538,9 +612,9 @@ | ||
| 538 | 612 | |
| 539 | 613 | array( |
| 540 | 614 | 'name' => 'table_border_color', |
| 541 | 615 | 'label' => esc_html__( 'Border color', 'ever-compare' ), |
| 542 | - 'desc' => wp_kses_post( 'Set the border color of the table.', 'ever-compare' ), | |
| 616 | + 'desc' => wp_kses_post( __( 'Set the border color of the table.', 'ever-compare' ) ), | |
| 543 | 617 | 'type' => 'color', |
| 544 | 618 | 'class' => 'depend_table_custom_style', |
| 545 | 619 | ), |
| 546 | 620 | |
| @@ -560,9 +634,9 @@ | ||
| 560 | 634 | |
| 561 | 635 | array( |
| 562 | 636 | 'name' => 'table_event_color', |
| 563 | 637 | 'label' => esc_html__( 'Column background color (Event)', 'ever-compare' ), |
| 564 | - 'desc' => wp_kses_post( 'Set the background color of the table event column.', 'ever-compare' ), | |
| 638 | + 'desc' => wp_kses_post( __( 'Set the background color of the table event column.', 'ever-compare' ) ), | |
| 565 | 639 | 'type' => 'color', |
| 566 | 640 | 'class' => 'depend_table_custom_style', |
| 567 | 641 | ), |
| 568 | 642 | |
| @@ -568,9 +642,9 @@ | ||
| 568 | 642 | |
| 569 | 643 | array( |
| 570 | 644 | 'name' => 'table_odd_color', |
| 571 | 645 | 'label' => esc_html__( 'Column background color (Odd)', 'ever-compare' ), |
| 572 | - 'desc' => wp_kses_post( 'Set the background color of the table odd column.', 'ever-compare' ), | |
| 646 | + 'desc' => wp_kses_post( __( 'Set the background color of the table odd column.', 'ever-compare' ) ), | |
| 573 | 647 | 'type' => 'color', |
| 574 | 648 | 'class' => 'depend_table_custom_style', |
| 575 | 649 | ), |
| 576 | 650 | |
| @@ -576,9 +650,9 @@ | ||
| 576 | 650 | |
| 577 | 651 | array( |
| 578 | 652 | 'name' => 'table_heading_event_color', |
| 579 | 653 | 'label' => esc_html__( 'Heading color (Event)', 'ever-compare' ), |
| 580 | - 'desc' => wp_kses_post( 'Set the heading color of the table event column.', 'ever-compare' ), | |
| 654 | + 'desc' => wp_kses_post( __( 'Set the heading color of the table event column.', 'ever-compare' ) ), | |
| 581 | 655 | 'type' => 'color', |
| 582 | 656 | 'class' => 'depend_table_custom_style', |
| 583 | 657 | ), |
| 584 | 658 | |
| @@ -584,9 +658,9 @@ | ||
| 584 | 658 | |
| 585 | 659 | array( |
| 586 | 660 | 'name' => 'table_heading_odd_color', |
| 587 | 661 | 'label' => esc_html__( 'Heading color (Odd)', 'ever-compare' ), |
| 588 | - 'desc' => wp_kses_post( 'Set the heading color of the table odd column.', 'ever-compare' ), | |
| 662 | + 'desc' => wp_kses_post( __( 'Set the heading color of the table odd column.', 'ever-compare' ) ), | |
| 589 | 663 | 'type' => 'color', |
| 590 | 664 | 'class' => 'depend_table_custom_style', |
| 591 | 665 | ), |
| 592 | 666 | |
| @@ -592,9 +666,9 @@ | ||
| 592 | 666 | |
| 593 | 667 | array( |
| 594 | 668 | 'name' => 'table_content_event_color', |
| 595 | 669 | 'label' => esc_html__( 'Content color (Event)', 'ever-compare' ), |
| 596 | - 'desc' => wp_kses_post( 'Set the content color of the table event column.', 'ever-compare' ), | |
| 670 | + 'desc' => wp_kses_post( __( 'Set the content color of the table event column.', 'ever-compare' ) ), | |
| 597 | 671 | 'type' => 'color', |
| 598 | 672 | 'class' => 'depend_table_custom_style', |
| 599 | 673 | ), |
| 600 | 674 | |
| @@ -600,9 +674,9 @@ | ||
| 600 | 674 | |
| 601 | 675 | array( |
| 602 | 676 | 'name' => 'table_content_odd_color', |
| 603 | 677 | 'label' => esc_html__( 'Content color (Odd)', 'ever-compare' ), |
| 604 | - 'desc' => wp_kses_post( 'Set the content color of the table odd column.', 'ever-compare' ), | |
| 678 | + 'desc' => wp_kses_post( __( 'Set the content color of the table odd column.', 'ever-compare' ) ), | |
| 605 | 679 | 'type' => 'color', |
| 606 | 680 | 'class' => 'depend_table_custom_style', |
| 607 | 681 | ), |
| 608 | 682 | |
| @@ -608,9 +682,9 @@ | ||
| 608 | 682 | |
| 609 | 683 | array( |
| 610 | 684 | 'name' => 'table_content_link_color', |
| 611 | 685 | 'label' => esc_html__( 'Content link color', 'ever-compare' ), |
| 612 | - 'desc' => wp_kses_post( 'Set the content link color of the table.', 'ever-compare' ), | |
| 686 | + 'desc' => wp_kses_post( __( 'Set the content link color of the table.', 'ever-compare' ) ), | |
| 613 | 687 | 'type' => 'color', |
| 614 | 688 | 'class' => 'depend_table_custom_style', |
| 615 | 689 | ), |
| 616 | 690 | |
| @@ -616,13 +690,57 @@ | ||
| 616 | 690 | |
| 617 | 691 | array( |
| 618 | 692 | 'name' => 'table_content_link_hover_color', |
| 619 | 693 | 'label' => esc_html__( 'Content link hover color', 'ever-compare' ), |
| 620 | - 'desc' => wp_kses_post( 'Set the content link hover color of the table.', 'ever-compare' ), | |
| 694 | + 'desc' => wp_kses_post( __( 'Set the content link hover color of the table.', 'ever-compare' ) ), | |
| 621 | 695 | 'type' => 'color', |
| 622 | 696 | 'class' => 'depend_table_custom_style', |
| 623 | 697 | ), |
| 624 | 698 | |
| 699 | + array( | |
| 700 | + 'name' => 'notification_custom_style_title', | |
| 701 | + 'headding'=> __( 'Notification custom style', 'ever-compare' ), | |
| 702 | + 'type' => 'title', | |
| 703 | + 'size' => 'margin_0 regular', | |
| 704 | + 'class' => 'depend_notification_custom_style element_section_title_area', | |
| 705 | + ), | |
| 706 | + | |
| 707 | + array( | |
| 708 | + 'name' => 'notification_bg_color', | |
| 709 | + 'label' => esc_html__( 'Background Color', 'ever-compare' ), | |
| 710 | + 'desc' => __( 'Set the background color of the notification.', 'ever-compare' ), | |
| 711 | + 'type' => 'color', | |
| 712 | + 'class' => 'depend_notification_custom_style', | |
| 713 | + ), | |
| 714 | + array( | |
| 715 | + 'name' => 'notification_border_color', | |
| 716 | + 'label' => esc_html__( 'Border Color', 'ever-compare' ), | |
| 717 | + 'desc' => __( 'Set the border color of the notification.', 'ever-compare' ), | |
| 718 | + 'type' => 'color', | |
| 719 | + 'class' => 'depend_notification_custom_style', | |
| 720 | + ), | |
| 721 | + array( | |
| 722 | + 'name' => 'notification_text_color', | |
| 723 | + 'label' => esc_html__( 'Content Color', 'ever-compare' ), | |
| 724 | + 'desc' => __( 'Set the content color of the notification.', 'ever-compare' ), | |
| 725 | + 'type' => 'color', | |
| 726 | + 'class' => 'depend_notification_custom_style', | |
| 727 | + ), | |
| 728 | + array( | |
| 729 | + 'name' => 'notification_btn_color', | |
| 730 | + 'label' => esc_html__( 'Close Button Color', 'ever-compare' ), | |
| 731 | + 'desc' => __( 'Set the close button color of the notification.', 'ever-compare' ), | |
| 732 | + 'type' => 'color', | |
| 733 | + 'class' => 'depend_notification_custom_style', | |
| 734 | + ), | |
| 735 | + array( | |
| 736 | + 'name' => 'notification_btn_color_hover', | |
| 737 | + 'label' => esc_html__( 'Close Button Hover Color', 'ever-compare' ), | |
| 738 | + 'desc' => __( 'Set the close button hover color of the notification.', 'ever-compare' ), | |
| 739 | + 'type' => 'color', | |
| 740 | + 'class' => 'depend_notification_custom_style', | |
| 741 | + ), | |
| 742 | + | |
| 625 | 743 | ), |
| 626 | 744 | |
| 627 | 745 | ); |
| 628 | 746 | |
| @@ -638,9 +756,9 @@ | ||
| 638 | 756 | echo '</div>'; |
| 639 | 757 | } |
| 640 | 758 | |
| 641 | 759 | public function save_message() { |
| 642 | - if( isset( $_GET['settings-updated'] ) ) { | |
| 760 | + if( isset( $_GET['settings-updated'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 643 | 761 | ?> |
| 644 | 762 | <div class="updated notice is-dismissible"> |
| 645 | 763 | <p><strong><?php esc_html_e('Successfully Settings Saved.', 'ever-compare') ?></strong></p> |
| 646 | 764 | </div> |