| @@ -141,9 +141,9 @@ | ||
| 141 | 141 | self::_renderSectionStart(); |
| 142 | 142 | self::_renderSectionDescription( |
| 143 | 143 | '<span class="viz-gvlink">' . sprintf( |
| 144 | 144 | // translators: %1$s - HTML link tag, %2$s - HTML closing link tag, %3$s - HTML link tag, %4$s - HTML closing link tag. |
| 145 | - __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to %3$sCommon Snippets%4$s for examples.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">', | |
| 145 | + __( 'Configure the graph by providing configuration variables right from the %1$sGoogle Visualization API%2$s. You can refer to to some examples %3$shere%4$s.', 'visualizer' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/?#configuration-options" target="_blank">', | |
| 146 | 146 | '</a>', |
| 147 | 147 | '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', |
| 148 | 148 | '</a>' |
| 149 | 149 | ) . '</span>' |
| @@ -153,18 +153,17 @@ | ||
| 153 | 153 | /** |
| 154 | 154 | * Add the correct example for the manual configuration box. |
| 155 | 155 | */ |
| 156 | 156 | protected function _renderManualConfigExample() { |
| 157 | - return json_encode( | |
| 158 | - array( | |
| 159 | - 'vAxis' => array( | |
| 160 | - 'ticks' => array( 5, 10, 15, 20 ), | |
| 161 | - 'titleTextStyle' => array( 'color' => 'red' ), | |
| 162 | - 'textPosition' => 'in', | |
| 163 | - ), | |
| 164 | - ), | |
| 165 | - JSON_PRETTY_PRINT | |
| 166 | - ); | |
| 157 | + return '{ | |
| 158 | + "vAxis": { | |
| 159 | + "ticks": [5, 10, 15, 20], | |
| 160 | + "titleTextStyle": { | |
| 161 | + "color": "red" | |
| 162 | + }, | |
| 163 | + "textPosition": "in" | |
| 164 | + } | |
| 165 | + }'; | |
| 167 | 166 | } |
| 168 | 167 | |
| 169 | 168 | /** |
| 170 | 169 | * Renders chart advanced settings group. |
| @@ -174,9 +173,9 @@ | ||
| 174 | 173 | protected function _renderAdvancedSettings() { |
| 175 | 174 | // Chart control settings. |
| 176 | 175 | $this->_renderChartControlsGroup(); |
| 177 | 176 | |
| 178 | - if ( Visualizer_Module_Admin::proFeaturesEnabled() ) { | |
| 177 | + if ( Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 179 | 178 | self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) ); |
| 180 | 179 | } else { |
| 181 | 180 | 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' ); |
| 182 | 181 | echo '<div style="position: relative">'; |
| @@ -185,9 +184,9 @@ | ||
| 185 | 184 | self::_renderSectionDescription( esc_html__( 'Configure frontend actions that need to be shown.', 'visualizer' ) ); |
| 186 | 185 | self::_renderSectionEnd(); |
| 187 | 186 | |
| 188 | 187 | $this->_renderActionSettings(); |
| 189 | - if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) { | |
| 188 | + if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 190 | 189 | echo apply_filters( 'visualizer_pro_upsell', '', 'frontend-actions' ); |
| 191 | 190 | echo '</div>'; |
| 192 | 191 | } |
| 193 | 192 | self::_renderGroupEnd(); |
| @@ -198,11 +197,11 @@ | ||
| 198 | 197 | esc_html__( 'Configuration', 'visualizer' ), |
| 199 | 198 | 'manual', |
| 200 | 199 | $this->manual, |
| 201 | 200 | sprintf( |
| 202 | - // translators: %s - JSON example. | |
| 203 | - esc_html__( 'Provide a valid JSON configuration object. Example: %s', 'visualizer' ), | |
| 204 | - '<code class="viz-manual-config-example">' . esc_html( $this->_renderManualConfigExample() ) . '</code>' | |
| 201 | + // translators: %s - the format. | |
| 202 | + esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ), | |
| 203 | + '<br><code>' . $this->_renderManualConfigExample() . '</code>' | |
| 205 | 204 | ), |
| 206 | 205 | '', |
| 207 | 206 | array( 'rows' => 5 ) |
| 208 | 207 | ); |
| @@ -208,8 +207,9 @@ | ||
| 208 | 207 | ); |
| 209 | 208 | |
| 210 | 209 | self::_renderSectionEnd(); |
| 211 | 210 | self::_renderGroupEnd(); |
| 211 | + | |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * Renders chart action buttons group. |
| @@ -220,9 +220,9 @@ | ||
| 220 | 220 | global $wp_version; |
| 221 | 221 | $disable_actions = version_compare( $wp_version, '4.7.0', '<' ); |
| 222 | 222 | // default open this section when not testing through cypress because cypress expects to click and open each section |
| 223 | 223 | // and may not like finding a section is already open. |
| 224 | - self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), ! defined( 'TI_E2E_TESTING' ) ); | |
| 224 | + self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), ! defined( 'TI_CYPRESS_TESTING' ) ); | |
| 225 | 225 | self::_renderCheckboxItem( |
| 226 | 226 | esc_html__( 'Print', 'visualizer' ), |
| 227 | 227 | 'actions[]', |
| 228 | 228 | isset( $this->actions ) && in_array( 'print', $this->actions, true ) ? true : false, |
| @@ -275,9 +275,9 @@ | ||
| 275 | 275 | */ |
| 276 | 276 | private static function is_excel_enabled() { |
| 277 | 277 | $vendor_file = VISUALIZER_ABSPATH . '/vendor/autoload.php'; |
| 278 | 278 | if ( is_readable( $vendor_file ) ) { |
| 279 | - include_once $vendor_file; | |
| 279 | + include_once( $vendor_file ); | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | if ( version_compare( phpversion(), '5.6.0', '<' ) ) { |
| 283 | 283 | do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'PHP version %s not supported', phpversion() ), 'error', __FILE__, __LINE__ ); |
| @@ -312,9 +312,9 @@ | ||
| 312 | 312 | } |
| 313 | 313 | echo '<div class="viz-section-item">'; |
| 314 | 314 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 315 | 315 | echo '<b>', $title, '</b>'; |
| 316 | - echo '<select class="control-select ', implode( ' ', $classes ), '" name="', $name, '" ', ( $multiple ? 'multiple' : '' ), ' ', $atts, '>'; | |
| 316 | + echo '<select class="control-select ', implode( ' ', $classes ) , '" name="', $name, '" ', ( $multiple ? 'multiple' : '' ), ' ' , $atts, '>'; | |
| 317 | 317 | foreach ( $options as $key => $label ) { |
| 318 | 318 | // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict |
| 319 | 319 | $extra = $multiple && is_array( $value ) ? ( in_array( $key, $value ) ? 'selected' : '' ) : selected( $key, $value, false ); |
| 320 | 320 | echo '<option value="', $key, '"', $extra, '>'; |
| @@ -335,15 +335,15 @@ | ||
| 335 | 335 | * @access protected |
| 336 | 336 | * @param string $title The title of the select item. |
| 337 | 337 | * @param string $name The name of the select item. |
| 338 | 338 | * @param string $value The actual value of the select item. |
| 339 | - * @param string $default_color The default value of the color picker. | |
| 339 | + * @param string $default The default value of the color picker. | |
| 340 | 340 | */ |
| 341 | - protected static function _renderColorPickerItem( $title, $name, $value, $default_color ) { | |
| 341 | + protected static function _renderColorPickerItem( $title, $name, $value, $default ) { | |
| 342 | 342 | echo '<div class="viz-section-item">'; |
| 343 | 343 | echo '<b>', $title, '</b>'; |
| 344 | 344 | echo '<div>'; |
| 345 | - echo '<input type="text" class="color-picker-hex color-picker" data-alpha-enabled="true" name="', $name, '" maxlength="7" placeholder="', esc_attr__( 'Hex Color Code', 'visualizer' ), '" value="', is_null( $value ) ? $default_color : esc_attr( $value ), '" data-default-color="', $default_color, '">'; | |
| 345 | + 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, '">'; | |
| 346 | 346 | echo '</div>'; |
| 347 | 347 | echo '</div>'; |
| 348 | 348 | } |
| 349 | 349 | |
| @@ -386,12 +386,12 @@ | ||
| 386 | 386 | * @static |
| 387 | 387 | * @access public |
| 388 | 388 | * @param string $title The title of this group. |
| 389 | 389 | * @param string $html Any additional HTML. |
| 390 | - * @param string $extra_class Any additional classes. | |
| 390 | + * @param string $class Any additional classes. | |
| 391 | 391 | */ |
| 392 | - public static function _renderGroupStart( $title, $html = '', $extra_class = '', $id = '' ) { | |
| 393 | - echo '<li id="' . $id . '" class="viz-group ' . $extra_class . '">'; | |
| 392 | + public static function _renderGroupStart( $title, $html = '', $class = '', $id = '' ) { | |
| 393 | + echo '<li id="' . $id . '" class="viz-group ' . $class . '">'; | |
| 394 | 394 | echo '<h3 class="viz-group-title">', $title, '</h3>'; |
| 395 | 395 | echo $html; |
| 396 | 396 | echo '<ul class="viz-group-content">'; |
| 397 | 397 | } |
| @@ -476,9 +476,9 @@ | ||
| 476 | 476 | 'series[' . $index . '][format]', |
| 477 | 477 | isset( $this->series[ $index ]['format'] ) ? $this->series[ $index ]['format'] : '', |
| 478 | 478 | sprintf( |
| 479 | 479 | // translators: %1$s - HTML link tag, %2$s - HTML closing link tag. |
| 480 | - esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU pattern set%2$s. Use something like #,### to get 1,234 as output, or $# to add dollar sign before digits. Note: Using the % percentage format will multiply your values by 100.', 'visualizer' ), | |
| 480 | + esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU pattern set%2$s. Use something like #,### to get 1,234 as output, or $# to add dollar sign before digits. Pay attention that if you use % percentage format then your values will be multiplied by 100.', 'visualizer' ), | |
| 481 | 481 | '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">', |
| 482 | 482 | '</a>' |
| 483 | 483 | ), |
| 484 | 484 | '#,###.##' |
| @@ -505,13 +505,14 @@ | ||
| 505 | 505 | |
| 506 | 506 | /** |
| 507 | 507 | * Render a checkbox item |
| 508 | 508 | */ |
| 509 | - protected static function _renderCheckboxItem( $title, $name, $value, $default_value, $desc, $disabled = false ) { | |
| 509 | + protected static function _renderCheckboxItem( $title, $name, $value, $default, $desc, $disabled = false ) { | |
| 510 | 510 | echo '<div class="viz-section-item">'; |
| 511 | 511 | echo '<a class="more-info" href="javascript:;">[?]</a>'; |
| 512 | 512 | echo '<b>', $title, '</b>'; |
| 513 | - echo '<input type="checkbox" class="control-check" value="', $default_value, '" name="', $name, '" ', ( $value ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>'; | |
| 513 | + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison | |
| 514 | + echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ( $value == $default ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>'; | |
| 514 | 515 | echo '<p class="viz-section-description">', $desc, '</p>'; |
| 515 | 516 | echo '</div>'; |
| 516 | 517 | } |
| 517 | 518 | |
| @@ -550,8 +551,9 @@ | ||
| 550 | 551 | |
| 551 | 552 | if ( in_array( 'numeral', $libs, true ) && ! wp_script_is( 'numeral', 'registered' ) ) { |
| 552 | 553 | wp_register_script( 'numeral', VISUALIZER_ABSURL . 'js/lib/numeral.min.js', array(), Visualizer_Plugin::VERSION ); |
| 553 | 554 | } |
| 555 | + | |
| 554 | 556 | } |
| 555 | 557 | |
| 556 | 558 | /** |
| 557 | 559 | * Renders save chart as image setting group. |
| @@ -602,9 +604,9 @@ | ||
| 602 | 604 | protected function _renderChartControlsGroup() { |
| 603 | 605 | if ( 'google' !== $this->getLibrary() ) { |
| 604 | 606 | return; |
| 605 | 607 | } |
| 606 | - if ( Visualizer_Module_Admin::proFeaturesEnabled() ) { | |
| 608 | + if ( Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 607 | 609 | self::_renderGroupStart( esc_html__( 'Chart Data Filter Configuration', 'visualizer' ) ); |
| 608 | 610 | } else { |
| 609 | 611 | 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' ); |
| 610 | 612 | echo '<div style="position: relative">'; |
| @@ -619,9 +621,9 @@ | ||
| 619 | 621 | ) . '</span>' |
| 620 | 622 | ); |
| 621 | 623 | self::_renderSectionEnd(); |
| 622 | 624 | $this->_renderChartControlsSettings(); |
| 623 | - if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) { | |
| 625 | + if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) { | |
| 624 | 626 | echo apply_filters( 'visualizer_pro_upsell', '', 'data-filter-configuration' ); |
| 625 | 627 | echo '</div>'; |
| 626 | 628 | } |
| 627 | 629 | self::_renderGroupEnd(); |
| @@ -653,10 +655,10 @@ | ||
| 653 | 655 | false, |
| 654 | 656 | array( 'vz-controls-opt' ) |
| 655 | 657 | ); |
| 656 | 658 | |
| 657 | - $column_index = array( 'false' => '' ); | |
| 658 | - $column_label = array( 'false' => '' ); | |
| 659 | + $column_index = [ 'false' => '' ]; | |
| 660 | + $column_label = [ 'false' => '' ]; | |
| 659 | 661 | if ( ! empty( $this->__series ) ) { |
| 660 | 662 | foreach ( $this->__series as $key => $column ) { |
| 661 | 663 | $column_type = isset( $column['type'] ) ? $column['type'] : ''; |
| 662 | 664 | $label = isset( $column['label'] ) ? $column['label'] : ''; |