PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.7
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
← All changes | classes/Visualizer/Render/Sidebar.php +37 -71 4.0.33.11.7 View file →
@@ -124,14 +124,9 @@
124 124 self::_renderTextAreaItem(
125 125 esc_html__( 'Chart Description', 'visualizer' ),
126 126 'description',
127 127 $this->description,
128 - sprintf(
129 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
130 - esc_html__( 'Description to display in the structured data schema as explained %1$shere%2$s', 'visualizer' ),
131 - '<a href="https://developers.google.com/search/docs/data-types/dataset#dataset" target="_blank">',
132 - '</a>'
133 - )
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>' )
134 129 );
135 130 }
136 131
137 132 /**
@@ -138,17 +133,9 @@
138 133 * Add the correct description for the manual configuration box.
139 134 */
140 135 protected function _renderManualConfigDescription() {
141 136 self::_renderSectionStart();
142 - self::_renderSectionDescription(
143 - '<span class="viz-gvlink">' . sprintf(
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">',
146 - '</a>',
147 - '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">',
148 - '</a>'
149 - ) . '</span>'
150 - );
137 + self::_renderSectionDescription( '<span class="viz-gvlink">' . sprintf( __( '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">', '</a>', '<a href="https://docs.themeisle.com/article/728-manual-configuration" target="_blank">', '</a>' ) . '</span>' );
151 138 }
152 139
153 140 /**
154 141 * Add the correct example for the manual configuration box.
@@ -153,18 +140,17 @@
153 140 /**
154 141 * Add the correct example for the manual configuration box.
155 142 */
156 143 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 - );
144 + return '{
145 + "vAxis": {
146 + "ticks": [5, 10, 15, 20],
147 + "titleTextStyle": {
148 + "color": "red"
149 + },
150 + "textPosition": "in"
151 + }
152 + }';
167 153 }
168 154
169 155 /**
170 156 * Renders chart advanced settings group.
@@ -174,9 +160,9 @@
174 160 protected function _renderAdvancedSettings() {
175 161 // Chart control settings.
176 162 $this->_renderChartControlsGroup();
177 163
178 - if ( Visualizer_Module_Admin::proFeaturesEnabled() ) {
164 + if ( Visualizer_Module_Admin::proFeaturesLocked() ) {
179 165 self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) );
180 166 } else {
181 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' );
182 168 echo '<div style="position: relative">';
@@ -185,9 +171,9 @@
185 171 self::_renderSectionDescription( esc_html__( 'Configure frontend actions that need to be shown.', 'visualizer' ) );
186 172 self::_renderSectionEnd();
187 173
188 174 $this->_renderActionSettings();
189 - if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) {
175 + if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) {
190 176 echo apply_filters( 'visualizer_pro_upsell', '', 'frontend-actions' );
191 177 echo '</div>';
192 178 }
193 179 self::_renderGroupEnd();
@@ -198,11 +184,10 @@
198 184 esc_html__( 'Configuration', 'visualizer' ),
199 185 'manual',
200 186 $this->manual,
201 187 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>'
188 + esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ),
189 + '<br><code>' . $this->_renderManualConfigExample() . '</code>'
205 190 ),
206 191 '',
207 192 array( 'rows' => 5 )
208 193 );
@@ -208,8 +193,9 @@
208 193 );
209 194
210 195 self::_renderSectionEnd();
211 196 self::_renderGroupEnd();
197 +
212 198 }
213 199
214 200 /**
215 201 * Renders chart action buttons group.
@@ -220,9 +206,9 @@
220 206 global $wp_version;
221 207 $disable_actions = version_compare( $wp_version, '4.7.0', '<' );
222 208 // default open this section when not testing through cypress because cypress expects to click and open each section
223 209 // and may not like finding a section is already open.
224 - self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), ! defined( 'TI_E2E_TESTING' ) );
210 + self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), ! defined( 'TI_CYPRESS_TESTING' ) );
225 211 self::_renderCheckboxItem(
226 212 esc_html__( 'Print', 'visualizer' ),
227 213 'actions[]',
228 214 isset( $this->actions ) && in_array( 'print', $this->actions, true ) ? true : false,
@@ -275,9 +261,9 @@
275 261 */
276 262 private static function is_excel_enabled() {
277 263 $vendor_file = VISUALIZER_ABSPATH . '/vendor/autoload.php';
278 264 if ( is_readable( $vendor_file ) ) {
279 - include_once $vendor_file;
265 + include_once( $vendor_file );
280 266 }
281 267
282 268 if ( version_compare( phpversion(), '5.6.0', '<' ) ) {
283 269 do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'PHP version %s not supported', phpversion() ), 'error', __FILE__, __LINE__ );
@@ -312,9 +298,9 @@
312 298 }
313 299 echo '<div class="viz-section-item">';
314 300 echo '<a class="more-info" href="javascript:;">[?]</a>';
315 301 echo '<b>', $title, '</b>';
316 - echo '<select class="control-select ', implode( ' ', $classes ), '" name="', $name, '" ', ( $multiple ? 'multiple' : '' ), ' ', $atts, '>';
302 + echo '<select class="control-select ', implode( ' ', $classes ) , '" name="', $name, '" ', ( $multiple ? 'multiple' : '' ), ' ' , $atts, '>';
317 303 foreach ( $options as $key => $label ) {
318 304 // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
319 305 $extra = $multiple && is_array( $value ) ? ( in_array( $key, $value ) ? 'selected' : '' ) : selected( $key, $value, false );
320 306 echo '<option value="', $key, '"', $extra, '>';
@@ -335,15 +321,15 @@
335 321 * @access protected
336 322 * @param string $title The title of the select item.
337 323 * @param string $name The name of the select item.
338 324 * @param string $value The actual value of the select item.
339 - * @param string $default_color The default value of the color picker.
325 + * @param string $default The default value of the color picker.
340 326 */
341 - protected static function _renderColorPickerItem( $title, $name, $value, $default_color ) {
327 + protected static function _renderColorPickerItem( $title, $name, $value, $default ) {
342 328 echo '<div class="viz-section-item">';
343 329 echo '<b>', $title, '</b>';
344 330 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, '">';
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, '">';
346 332 echo '</div>';
347 333 echo '</div>';
348 334 }
349 335
@@ -386,12 +372,12 @@
386 372 * @static
387 373 * @access public
388 374 * @param string $title The title of this group.
389 375 * @param string $html Any additional HTML.
390 - * @param string $extra_class Any additional classes.
376 + * @param string $class Any additional classes.
391 377 */
392 - public static function _renderGroupStart( $title, $html = '', $extra_class = '', $id = '' ) {
393 - echo '<li id="' . $id . '" class="viz-group ' . $extra_class . '">';
378 + public static function _renderGroupStart( $title, $html = '', $class = '', $id = '' ) {
379 + echo '<li id="' . $id . '" class="viz-group ' . $class . '">';
394 380 echo '<h3 class="viz-group-title">', $title, '</h3>';
395 381 echo $html;
396 382 echo '<ul class="viz-group-content">';
397 383 }
@@ -474,14 +460,9 @@
474 460 self::_renderTextItem(
475 461 esc_html__( 'Number Format', 'visualizer' ),
476 462 'series[' . $index . '][format]',
477 463 isset( $this->series[ $index ]['format'] ) ? $this->series[ $index ]['format'] : '',
478 - sprintf(
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 &#37; percentage format will multiply your values by 100.', 'visualizer' ),
481 - '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">',
482 - '</a>'
483 - ),
464 + sprintf( 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 &#37; percentage format then your values will be multiplied by 100.', 'visualizer' ), '<a href="http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details" target="_blank">', '</a>' ),
484 465 '#,###.##'
485 466 );
486 467 break;
487 468 case 'date':
@@ -490,14 +471,9 @@
490 471 self::_renderTextItem(
491 472 esc_html__( 'Date Format', 'visualizer' ),
492 473 'series[' . $index . '][format]',
493 474 isset( $this->series[ $index ]['format'] ) ? $this->series[ $index ]['format'] : '',
494 - sprintf(
495 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
496 - esc_html__( 'Enter custom format pattern to apply to this series value, similar to the %1$sICU date and time format%2$s.', 'visualizer' ),
497 - '<a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax" target="_blank">',
498 - '</a>'
499 - ),
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>' ),
500 476 'eeee, dd LLLL yyyy'
501 477 );
502 478 break;
503 479 }
@@ -505,13 +481,14 @@
505 481
506 482 /**
507 483 * Render a checkbox item
508 484 */
509 - protected static function _renderCheckboxItem( $title, $name, $value, $default_value, $desc, $disabled = false ) {
485 + protected static function _renderCheckboxItem( $title, $name, $value, $default, $desc, $disabled = false ) {
510 486 echo '<div class="viz-section-item">';
511 487 echo '<a class="more-info" href="javascript:;">[?]</a>';
512 488 echo '<b>', $title, '</b>';
513 - echo '<input type="checkbox" class="control-check" value="', $default_value, '" name="', $name, '" ', ( $value ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>';
489 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
490 + echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ( $value == $default ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>';
514 491 echo '<p class="viz-section-description">', $desc, '</p>';
515 492 echo '</div>';
516 493 }
517 494
@@ -550,8 +527,9 @@
550 527
551 528 if ( in_array( 'numeral', $libs, true ) && ! wp_script_is( 'numeral', 'registered' ) ) {
552 529 wp_register_script( 'numeral', VISUALIZER_ABSURL . 'js/lib/numeral.min.js', array(), Visualizer_Plugin::VERSION );
553 530 }
531 +
554 532 }
555 533
556 534 /**
557 535 * Renders save chart as image setting group.
@@ -602,9 +580,9 @@
602 580 protected function _renderChartControlsGroup() {
603 581 if ( 'google' !== $this->getLibrary() ) {
604 582 return;
605 583 }
606 - if ( Visualizer_Module_Admin::proFeaturesEnabled() ) {
584 + if ( Visualizer_Module_Admin::proFeaturesLocked() ) {
607 585 self::_renderGroupStart( esc_html__( 'Chart Data Filter Configuration', 'visualizer' ) );
608 586 } else {
609 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' );
610 588 echo '<div style="position: relative">';
@@ -609,19 +587,12 @@
609 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' );
610 588 echo '<div style="position: relative">';
611 589 }
612 590 self::_renderSectionStart();
613 - self::_renderSectionDescription(
614 - '<span class="viz-gvlink">' . sprintf(
615 - // translators: %1$s - HTML link tag, %2$s - HTML closing link tag.
616 - __( 'Configure the data filter controls by providing configuration variables right from the %1$sChart Controls API%2$s. ', 'visualizer' ),
617 - '<a href="https://developers.google.com/chart/interactive/docs/gallery/controls#controls-gallery" target="_blank">',
618 - '</a>'
619 - ) . '</span>'
620 - );
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>' );
621 592 self::_renderSectionEnd();
622 593 $this->_renderChartControlsSettings();
623 - if ( ! Visualizer_Module_Admin::proFeaturesEnabled() ) {
594 + if ( ! Visualizer_Module_Admin::proFeaturesLocked() ) {
624 595 echo apply_filters( 'visualizer_pro_upsell', '', 'data-filter-configuration' );
625 596 echo '</div>';
626 597 }
627 598 self::_renderGroupEnd();
@@ -653,21 +624,16 @@
653 624 false,
654 625 array( 'vz-controls-opt' )
655 626 );
656 627
657 - $column_index = array( 'false' => '' );
658 - $column_label = array( 'false' => '' );
628 + $column_index = [ 'false' => '' ];
629 + $column_label = [ 'false' => '' ];
659 630 if ( ! empty( $this->__series ) ) {
660 631 foreach ( $this->__series as $key => $column ) {
661 632 $column_type = isset( $column['type'] ) ? $column['type'] : '';
662 633 $label = isset( $column['label'] ) ? $column['label'] : '';
663 634 $column_label[ $label ] = $label;
664 - $column_index[ $key ] = sprintf(
665 - // translators: %1$d - the column key, %2$s - the column type.
666 - __( '%1$d — Column Type: %2$s ', 'visualizer' ),
667 - $key,
668 - ucfirst( $column_type )
669 - );
635 + $column_index[ $key ] = sprintf( __( '%1$d — Column Type: %2$s ', 'visualizer' ), $key, ucfirst( $column_type ) );
670 636 }
671 637 }
672 638
673 639 self::_renderSelectItem(