| @@ -119,15 +119,8 @@ | ||
| 119 | 119 | 'titleTextStyle[color]', |
| 120 | 120 | isset( $this->titleTextStyle['color'] ) ? $this->titleTextStyle['color'] : null, |
| 121 | 121 | '#000' |
| 122 | 122 | ); |
| 123 | - | |
| 124 | - self::_renderTextAreaItem( | |
| 125 | - esc_html__( 'Chart Description', 'visualizer' ), | |
| 126 | - 'description', | |
| 127 | - $this->description, | |
| 128 | - sprintf( esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ), '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">', '</a>' ) | |
| 129 | - ); | |
| 130 | 123 | } |
| 131 | 124 | |
| 132 | 125 | /** |
| 133 | 126 | * Add the correct description for the manual configuration box. |
| @@ -157,26 +150,14 @@ | ||
| 157 | 150 | * |
| 158 | 151 | * @access protected |
| 159 | 152 | */ |
| 160 | 153 | protected function _renderAdvancedSettings() { |
| 161 | - // Chart control settings. | |
| 162 | - $this->_renderChartControlsGroup(); | |
| 163 | - | |
| 164 | - if ( Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 165 | - self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) ); | |
| 166 | - } else { | |
| 167 | - self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) . '<span class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-frontend-actions' ), 'vz-frontend-actions' ); | |
| 168 | - echo '<div style="position: relative">'; | |
| 169 | - } | |
| 154 | + self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) ); | |
| 170 | 155 | self::_renderSectionStart(); |
| 171 | 156 | self::_renderSectionDescription( esc_html__( 'Configure frontend actions that need to be shown.', 'visualizer' ) ); |
| 172 | 157 | self::_renderSectionEnd(); |
| 173 | 158 | |
| 174 | 159 | $this->_renderActionSettings(); |
| 175 | - if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 176 | - echo apply_filters( 'visualizer_pro_upsell', '', 'frontend-actions' ); | |
| 177 | - echo '</div>'; | |
| 178 | - } | |
| 179 | 160 | self::_renderGroupEnd(); |
| 180 | 161 | |
| 181 | 162 | self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) ); |
| 182 | 163 | $this->_renderManualConfigDescription(); |
| @@ -327,9 +308,9 @@ | ||
| 327 | 308 | protected static function _renderColorPickerItem( $title, $name, $value, $default ) { |
| 328 | 309 | echo '<div class="viz-section-item">'; |
| 329 | 310 | echo '<b>', $title, '</b>'; |
| 330 | 311 | echo '<div>'; |
| 331 | - echo '<input type="text" class="color-picker-hex color-picker" data-alpha-enabled="true" name="', $name, '" maxlength="7" placeholder="', esc_attr__( 'Hex Value', 'visualizer' ), '" value="', is_null( $value ) ? $default : esc_attr( $value ), '" data-default-color="', $default, '">'; | |
| 312 | + echo '<input type="text" class="color-picker-hex color-picker" data-alpha="true" name="', $name, '" maxlength="7" placeholder="', esc_attr__( 'Hex Value', 'visualizer' ), '" value="', is_null( $value ) ? $default : esc_attr( $value ), '" data-default-color="', $default, '">'; | |
| 332 | 313 | echo '</div>'; |
| 333 | 314 | echo '</div>'; |
| 334 | 315 | } |
| 335 | 316 | |
| @@ -347,9 +328,9 @@ | ||
| 347 | 328 | * @param string $placeholder The placeholder for the input. |
| 348 | 329 | * @param string $type The type for the input (out of number, email, tel etc., default is text). |
| 349 | 330 | * @param array $custom_attributes The custom attributes. |
| 350 | 331 | */ |
| 351 | - protected static function _renderTextItem( $title, $name, $value, $desc, $placeholder = '', $type = 'text', $custom_attributes = array(), $extra_class = array() ) { | |
| 332 | + protected static function _renderTextItem( $title, $name, $value, $desc, $placeholder = '', $type = 'text', $custom_attributes = array() ) { | |
| 352 | 333 | $attributes = ''; |
| 353 | 334 | if ( $custom_attributes ) { |
| 354 | 335 | foreach ( $custom_attributes as $k => $v ) { |
| 355 | 336 | $attributes .= ' ' . $k . '="' . esc_attr( $v ) . '"'; |
| @@ -354,10 +335,9 @@ | ||
| 354 | 335 | foreach ( $custom_attributes as $k => $v ) { |
| 355 | 336 | $attributes .= ' ' . $k . '="' . esc_attr( $v ) . '"'; |
| 356 | 337 | } |
| 357 | 338 | } |
| 358 | - $extra_class[] = 'viz-section-item'; | |
| 359 | - echo '<div class="' . esc_attr( implode( ' ', $extra_class ) ) . '">'; | |
| 339 | + echo '<div class="viz-section-item">'; | |
| 360 | 340 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 361 | 341 | echo '<b>', $title, '</b>'; |
| 362 | 342 | echo '<input type="', $type, '" class="control-text" ', $attributes, ' name="', $name, '" value="', esc_attr( $value ), '" placeholder="', $placeholder, '">'; |
| 363 | 343 | echo '<p class="viz-section-description">', $desc, '</p>'; |
| @@ -471,9 +451,9 @@ | ||
| 471 | 451 | self::_renderTextItem( |
| 472 | 452 | esc_html__( 'Date Format', 'visualizer' ), |
| 473 | 453 | 'series[' . $index . '][format]', |
| 474 | 454 | isset( $this->series[ $index ]['format'] ) ? $this->series[ $index ]['format'] : '', |
| 475 | - sprintf( esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU date and time format%2$s.', 'visualizer' ), '<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">', '</a>' ), | |
| 455 | + sprintf( esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU date and time format%2$s.', 'visualizer' ), '<a href="http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax" target="_blank">', '</a>' ), | |
| 476 | 456 | 'eeee, dd LLLL yyyy' |
| 477 | 457 | ); |
| 478 | 458 | break; |
| 479 | 459 | } |
| @@ -528,279 +508,6 @@ | ||
| 528 | 508 | if ( in_array( 'numeral', $libs, true ) && ! wp_script_is( 'numeral', 'registered' ) ) { |
| 529 | 509 | wp_register_script( 'numeral', VISUALIZER_ABSURL . 'js/lib/numeral.min.js', array(), Visualizer_Plugin::VERSION ); |
| 530 | 510 | } |
| 531 | 511 | |
| 532 | - } | |
| 533 | - | |
| 534 | - /** | |
| 535 | - * Renders save chart as image setting group. | |
| 536 | - * | |
| 537 | - * @access protected | |
| 538 | - */ | |
| 539 | - protected function _renderChartImageSettings() { | |
| 540 | - // Default enable if amp is active. | |
| 541 | - $is_amp = function_exists( 'amp_is_enabled' ) && amp_is_enabled(); | |
| 542 | - $this->save_chart_image = null === $this->save_chart_image && $is_amp ? true : $this->save_chart_image; | |
| 543 | - | |
| 544 | - $is_create_chart = true; | |
| 545 | - if ( filter_input( INPUT_GET, 'library', FILTER_VALIDATE_BOOLEAN ) ) { | |
| 546 | - if ( filter_input( INPUT_GET, 'action' ) === Visualizer_Plugin::ACTION_EDIT_CHART ) { | |
| 547 | - $is_create_chart = false; | |
| 548 | - } | |
| 549 | - } | |
| 550 | - $this->lazy_load_chart = null === $this->lazy_load_chart && $is_create_chart ? true : $this->lazy_load_chart; | |
| 551 | - | |
| 552 | - self::_renderSectionStart( esc_html__( 'Save chart as an image inside Media Library', 'visualizer' ), false ); | |
| 553 | - self::_renderCheckboxItem( | |
| 554 | - esc_html__( 'Save inside media library?', 'visualizer' ), | |
| 555 | - 'save_chart_image', | |
| 556 | - $this->save_chart_image ? true : false, | |
| 557 | - 'yes', | |
| 558 | - esc_html__( 'To enable save the image as an inside media library.', 'visualizer' ), | |
| 559 | - false | |
| 560 | - ); | |
| 561 | - self::_renderSectionEnd(); | |
| 562 | - | |
| 563 | - self::_renderSectionStart( esc_html__( 'Lazy rendering of chart', 'visualizer' ), false ); | |
| 564 | - self::_renderCheckboxItem( | |
| 565 | - esc_html__( 'Enable lazy rendering of chart?', 'visualizer' ), | |
| 566 | - 'lazy_load_chart', | |
| 567 | - $this->lazy_load_chart ? true : false, | |
| 568 | - 'yes', | |
| 569 | - esc_html__( 'To enable lazy chart rendering.', 'visualizer' ), | |
| 570 | - false | |
| 571 | - ); | |
| 572 | - self::_renderSectionEnd(); | |
| 573 | - } | |
| 574 | - | |
| 575 | - /** | |
| 576 | - * Renders chart controls group. | |
| 577 | - * | |
| 578 | - * @access protected | |
| 579 | - */ | |
| 580 | - protected function _renderChartControlsGroup() { | |
| 581 | - if ( 'google' !== $this->getLibrary() ) { | |
| 582 | - return; | |
| 583 | - } | |
| 584 | - if ( Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 585 | - self::_renderGroupStart( esc_html__( 'Chart Data Filter Configuration', 'visualizer' ) ); | |
| 586 | - } else { | |
| 587 | - self::_renderGroupStart( esc_html__( 'Chart Data Filter Configuration', 'visualizer' ) . '<span class="dashicons dashicons-lock"></span>', '', apply_filters( 'visualizer_pro_upsell_class', 'only-pro-feature', 'chart-filter-controls' ), 'vz-data-controls' ); | |
| 588 | - echo '<div style="position: relative">'; | |
| 589 | - } | |
| 590 | - self::_renderSectionStart(); | |
| 591 | - self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( 'Configure the data filter controls by providing configuration variables right from the %1$sChart Controls API%2$s. ', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/controls#controls-gallery" target="_blank">', '</a>' ) . '</span>' ); | |
| 592 | - self::_renderSectionEnd(); | |
| 593 | - $this->_renderChartControlsSettings(); | |
| 594 | - if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 595 | - echo apply_filters( 'visualizer_pro_upsell', '', 'data-filter-configuration' ); | |
| 596 | - echo '</div>'; | |
| 597 | - } | |
| 598 | - self::_renderGroupEnd(); | |
| 599 | - } | |
| 600 | - | |
| 601 | - /** | |
| 602 | - * Renders chart controls setting. | |
| 603 | - * | |
| 604 | - * @access protected | |
| 605 | - */ | |
| 606 | - protected function _renderChartControlsSettings() { | |
| 607 | - | |
| 608 | - self::_renderSectionStart( esc_html__( 'Options', 'visualizer' ), false ); | |
| 609 | - $control_type = ! empty( $this->controls['controlType'] ) ? $this->controls['controlType'] : ''; | |
| 610 | - | |
| 611 | - self::_renderSelectItem( | |
| 612 | - esc_html__( 'Filter Type', 'visualizer' ), | |
| 613 | - 'controls[controlType]', | |
| 614 | - $control_type, | |
| 615 | - array( | |
| 616 | - '' => '', | |
| 617 | - 'StringFilter' => esc_html__( 'String Filter', 'visualizer' ), | |
| 618 | - 'NumberRangeFilter' => esc_html__( 'Number Range Filter', 'visualizer' ), | |
| 619 | - 'CategoryFilter' => esc_html__( 'Category Filter', 'visualizer' ), | |
| 620 | - 'ChartRangeFilter' => esc_html__( 'Chart Range Filter', 'visualizer' ), | |
| 621 | - 'DateRangeFilter' => esc_html__( 'Date Range Filter', 'visualizer' ), | |
| 622 | - ), | |
| 623 | - '', | |
| 624 | - false, | |
| 625 | - array( 'vz-controls-opt' ) | |
| 626 | - ); | |
| 627 | - | |
| 628 | - $column_index = [ 'false' => '' ]; | |
| 629 | - $column_label = [ 'false' => '' ]; | |
| 630 | - if ( ! empty( $this->__series ) ) { | |
| 631 | - foreach ( $this->__series as $key => $column ) { | |
| 632 | - $column_type = isset( $column['type'] ) ? $column['type'] : ''; | |
| 633 | - $label = isset( $column['label'] ) ? $column['label'] : ''; | |
| 634 | - $column_label[ $label ] = $label; | |
| 635 | - $column_index[ $key ] = sprintf( __( '%1$d — Column Type: %2$s ', 'visualizer' ), $key, ucfirst( $column_type ) ); | |
| 636 | - } | |
| 637 | - } | |
| 638 | - | |
| 639 | - self::_renderSelectItem( | |
| 640 | - esc_html__( 'Filter By Column Index', 'visualizer' ), | |
| 641 | - 'controls[filterColumnIndex]', | |
| 642 | - isset( $this->controls['filterColumnIndex'] ) ? $this->controls['filterColumnIndex'] : '', | |
| 643 | - $column_index, | |
| 644 | - '', | |
| 645 | - false, | |
| 646 | - array( 'vz-controls-opt' ) | |
| 647 | - ); | |
| 648 | - | |
| 649 | - self::_renderSelectItem( | |
| 650 | - esc_html__( 'Filter By Column Label', 'visualizer' ), | |
| 651 | - 'controls[filterColumnLabel]', | |
| 652 | - ! empty( $this->controls['filterColumnLabel'] ) ? $this->controls['filterColumnLabel'] : '', | |
| 653 | - $column_label, | |
| 654 | - '', | |
| 655 | - false, | |
| 656 | - array( 'vz-controls-opt' ) | |
| 657 | - ); | |
| 658 | - | |
| 659 | - self::_renderSelectItem( | |
| 660 | - esc_html__( 'Use Formatted Value', 'visualizer' ), | |
| 661 | - 'controls[useFormattedValue]', | |
| 662 | - ! empty( $this->controls['useFormattedValue'] ) ? $this->controls['useFormattedValue'] : '', | |
| 663 | - array( | |
| 664 | - 'false' => esc_html__( 'False', 'visualizer' ), | |
| 665 | - 'true' => esc_html__( 'True', 'visualizer' ), | |
| 666 | - ), | |
| 667 | - '', | |
| 668 | - false | |
| 669 | - ); | |
| 670 | - | |
| 671 | - self::_renderTextItem( | |
| 672 | - esc_html__( 'Min Value', 'visualizer' ), | |
| 673 | - 'controls[minValue]', | |
| 674 | - ! empty( $this->controls['minValue'] ) ? $this->controls['minValue'] : '', | |
| 675 | - esc_html__( 'Minimum allowed value for the range lower extent.', 'visualizer' ), | |
| 676 | - '', | |
| 677 | - 'text' | |
| 678 | - ); | |
| 679 | - | |
| 680 | - self::_renderTextItem( | |
| 681 | - esc_html__( 'Max Value', 'visualizer' ), | |
| 682 | - 'controls[maxValue]', | |
| 683 | - ! empty( $this->controls['maxValue'] ) ? $this->controls['maxValue'] : '', | |
| 684 | - esc_html__( 'Maximum allowed value for the range higher extent.', 'visualizer' ), | |
| 685 | - '', | |
| 686 | - 'text' | |
| 687 | - ); | |
| 688 | - | |
| 689 | - self::_renderSelectItem( | |
| 690 | - esc_html__( 'Match Type', 'visualizer' ), | |
| 691 | - 'controls[matchType]', | |
| 692 | - ! empty( $this->controls['matchType'] ) ? $this->controls['matchType'] : '', | |
| 693 | - array( | |
| 694 | - 'prefix' => esc_html__( 'Prefix', 'visualizer' ), | |
| 695 | - 'exact' => esc_html__( 'Exact', 'visualizer' ), | |
| 696 | - 'any' => esc_html__( 'Any', 'visualizer' ), | |
| 697 | - ), | |
| 698 | - '', | |
| 699 | - false | |
| 700 | - ); | |
| 701 | - | |
| 702 | - self::_renderSelectItem( | |
| 703 | - esc_html__( 'Case Sensitive', 'visualizer' ), | |
| 704 | - 'controls[caseSensitive]', | |
| 705 | - ! empty( $this->controls['caseSensitive'] ) ? $this->controls['caseSensitive'] : '', | |
| 706 | - array( | |
| 707 | - 'false' => esc_html__( 'False', 'visualizer' ), | |
| 708 | - 'true' => esc_html__( 'True', 'visualizer' ), | |
| 709 | - ), | |
| 710 | - '', | |
| 711 | - false | |
| 712 | - ); | |
| 713 | - | |
| 714 | - self::_renderSectionEnd(); | |
| 715 | - | |
| 716 | - self::_renderSectionStart( esc_html__( 'UI Options', 'visualizer' ), false ); | |
| 717 | - | |
| 718 | - self::_renderTextItem( | |
| 719 | - esc_html__( 'Label', 'visualizer' ), | |
| 720 | - 'controls[ui][label]', | |
| 721 | - ! empty( $this->controls['ui']['label'] ) ? $this->controls['ui']['label'] : '', | |
| 722 | - '', | |
| 723 | - '', | |
| 724 | - 'text' | |
| 725 | - ); | |
| 726 | - | |
| 727 | - self::_renderTextItem( | |
| 728 | - esc_html__( 'Label Separator', 'visualizer' ), | |
| 729 | - 'controls[ui][labelSeparator]', | |
| 730 | - ! empty( $this->controls['ui']['labelSeparator'] ) ? $this->controls['ui']['labelSeparator'] : '', | |
| 731 | - '', | |
| 732 | - '', | |
| 733 | - 'text' | |
| 734 | - ); | |
| 735 | - | |
| 736 | - self::_renderTextItem( | |
| 737 | - esc_html__( 'Caption', 'visualizer' ), | |
| 738 | - 'controls[ui][caption]', | |
| 739 | - ! empty( $this->controls['ui']['caption'] ) ? $this->controls['ui']['caption'] : '', | |
| 740 | - '', | |
| 741 | - '', | |
| 742 | - 'text' | |
| 743 | - ); | |
| 744 | - | |
| 745 | - self::_renderSelectItem( | |
| 746 | - esc_html__( 'Label Stacking', 'visualizer' ), | |
| 747 | - 'controls[ui][labelStacking]', | |
| 748 | - ! empty( $this->controls['ui']['labelStacking'] ) ? $this->controls['ui']['labelStacking'] : '', | |
| 749 | - array( | |
| 750 | - 'horizontal' => esc_html__( 'Horizontal', 'visualizer' ), | |
| 751 | - 'vertical' => esc_html__( 'Vertical', 'visualizer' ), | |
| 752 | - ), | |
| 753 | - '', | |
| 754 | - false | |
| 755 | - ); | |
| 756 | - | |
| 757 | - self::_renderSelectItem( | |
| 758 | - esc_html__( 'Orientation', 'visualizer' ), | |
| 759 | - 'controls[ui][orientation]', | |
| 760 | - ! empty( $this->controls['ui']['orientation'] ) ? $this->controls['ui']['orientation'] : '', | |
| 761 | - array( | |
| 762 | - 'horizontal' => esc_html__( 'Horizontal', 'visualizer' ), | |
| 763 | - 'vertical' => esc_html__( 'Vertical', 'visualizer' ), | |
| 764 | - ), | |
| 765 | - '', | |
| 766 | - false | |
| 767 | - ); | |
| 768 | - | |
| 769 | - self::_renderSelectItem( | |
| 770 | - esc_html__( 'Show Range Values', 'visualizer' ), | |
| 771 | - 'controls[showRangeValues]', | |
| 772 | - ! empty( $this->controls['showRangeValues'] ) ? $this->controls['showRangeValues'] : '', | |
| 773 | - array( | |
| 774 | - 'true' => esc_html__( 'True', 'visualizer' ), | |
| 775 | - 'false' => esc_html__( 'False', 'visualizer' ), | |
| 776 | - ), | |
| 777 | - '', | |
| 778 | - false | |
| 779 | - ); | |
| 780 | - | |
| 781 | - self::_renderSelectItem( | |
| 782 | - esc_html__( 'Allow Multiple', 'visualizer' ), | |
| 783 | - 'controls[allowMultiple]', | |
| 784 | - ! empty( $this->controls['allowMultiple'] ) ? $this->controls['allowMultiple'] : '', | |
| 785 | - array( | |
| 786 | - 'true' => esc_html__( 'True', 'visualizer' ), | |
| 787 | - 'false' => esc_html__( 'False', 'visualizer' ), | |
| 788 | - ), | |
| 789 | - '', | |
| 790 | - false | |
| 791 | - ); | |
| 792 | - | |
| 793 | - self::_renderSelectItem( | |
| 794 | - esc_html__( 'Allow Typing', 'visualizer' ), | |
| 795 | - 'controls[allowTyping]', | |
| 796 | - ! empty( $this->controls['allowTyping'] ) ? $this->controls['allowTyping'] : '', | |
| 797 | - array( | |
| 798 | - 'true' => esc_html__( 'True', 'visualizer' ), | |
| 799 | - 'false' => esc_html__( 'False', 'visualizer' ), | |
| 800 | - ), | |
| 801 | - '', | |
| 802 | - false | |
| 803 | - ); | |
| 804 | - self::_renderSectionEnd(); | |
| 805 | 512 | } |
| 806 | 513 | } |