PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.3.4
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.3.4
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 +58 -28 3.1.33.3.4 View file →
@@ -159,8 +159,31 @@
159 159 );
160 160 }
161 161
162 162 /**
163 + * Add the correct description for the manual configuration box.
164 + */
165 + protected function _renderManualConfigDescription() {
166 + self::_renderSectionStart();
167 + 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>' );
168 + }
169 +
170 + /**
171 + * Add the correct example for the manual configuration box.
172 + */
173 + protected function _renderManualConfigExample() {
174 + return '{
175 + "vAxis": {
176 + "ticks": [5, 10, 15, 20],
177 + "titleTextStyle": {
178 + "color": "red"
179 + },
180 + "textPosition": "in"
181 + }
182 + }';
183 + }
184 +
185 + /**
163 186 * Renders chart advanced settings group.
164 187 *
165 188 * @access protected
166 189 */
@@ -166,9 +189,9 @@
166 189 */
167 190 protected function _renderAdvancedSettings() {
168 191 self::_renderGroupStart( esc_html__( 'Frontend Actions', 'visualizer' ) );
169 192 self::_renderSectionStart();
170 - self::_renderSectionDescription( esc_html__( 'Configure frontend actions here.', 'visualizer' ) );
193 + self::_renderSectionDescription( esc_html__( 'Configure frontend actions that need to be shown.', 'visualizer' ) );
171 194 self::_renderSectionEnd();
172 195
173 196 $this->_renderActionSettings();
174 197 self::_renderGroupEnd();
@@ -173,22 +196,9 @@
173 196 $this->_renderActionSettings();
174 197 self::_renderGroupEnd();
175 198
176 199 self::_renderGroupStart( esc_html__( 'Manual Configuration', 'visualizer' ) );
177 - self::_renderSectionStart();
178 - 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>' );
179 -
180 - $example = '
181 -{
182 - "vAxis": {
183 - "ticks": [5, 10, 15, 20],
184 - "titleTextStyle": {
185 - "color": "red"
186 - },
187 - "textPosition": "in"
188 - }
189 -}';
190 -
200 + $this->_renderManualConfigDescription();
191 201 self::_renderTextAreaItem(
192 202 esc_html__( 'Configuration', 'visualizer' ),
193 203 'manual',
194 204 $this->manual,
@@ -193,9 +203,9 @@
193 203 'manual',
194 204 $this->manual,
195 205 sprintf(
196 206 esc_html__( 'One per line in valid JSON (key:value) format e.g. %s', 'visualizer' ),
197 - '<br><code>' . $example . '</code>'
207 + '<br><code>' . $this->_renderManualConfigExample() . '</code>'
198 208 ),
199 209 '',
200 210 array( 'rows' => 5 )
201 211 );
@@ -216,9 +226,9 @@
216 226 self::_renderSectionStart( esc_html__( 'Actions', 'visualizer' ), false );
217 227 self::_renderCheckboxItem(
218 228 esc_html__( 'Print', 'visualizer' ),
219 229 'actions[]',
220 - isset( $this->actions ) && in_array( 'print', $this->actions ) ? true : false,
230 + isset( $this->actions ) && in_array( 'print', $this->actions, true ) ? true : false,
221 231 'print',
222 232 $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable printing the chart/data.', 'visualizer' ),
223 233 $disable_actions
224 234 );
@@ -224,9 +234,9 @@
224 234 );
225 235 self::_renderCheckboxItem(
226 236 esc_html__( 'CSV', 'visualizer' ),
227 237 'actions[]',
228 - isset( $this->actions ) && in_array( 'csv;application/csv', $this->actions ) ? true : false,
238 + isset( $this->actions ) && in_array( 'csv;application/csv', $this->actions, true ) ? true : false,
229 239 'csv;application/csv',
230 240 $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as a CSV.', 'visualizer' ),
231 241 $disable_actions
232 242 );
@@ -234,9 +244,9 @@
234 244 $disabled = ! self::is_excel_enabled();
235 245 self::_renderCheckboxItem(
236 246 esc_html__( 'Excel', 'visualizer' ),
237 247 'actions[]',
238 - isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions ) ? true : false,
248 + isset( $this->actions ) && in_array( 'xls;application/vnd.ms-excel', $this->actions, true ) ? true : false,
239 249 'xls;application/vnd.ms-excel',
240 250 $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : ( $disabled ? '<span class="viz-section-error">' . esc_html__( 'Enable the ZIP and XML extensions to use this setting.', 'visualizer' ) . '</span>' : esc_html__( 'To enable downloading the data as an Excel spreadsheet.', 'visualizer' ) ),
241 251 $disable_actions || $disabled
242 252 );
@@ -242,9 +252,9 @@
242 252 );
243 253 self::_renderCheckboxItem(
244 254 esc_html__( 'Copy', 'visualizer' ),
245 255 'actions[]',
246 - isset( $this->actions ) && in_array( 'copy', $this->actions ) ? true : false,
256 + isset( $this->actions ) && in_array( 'copy', $this->actions, true ) ? true : false,
247 257 'copy',
248 258 $disable_actions ? '<span class="viz-section-error">' . esc_html__( 'Upgrade to at least WordPress 4.7 to use this.', 'visualizer' ) . '</span>' : esc_html__( 'To enable copying the data to the clipboard.', 'visualizer' ),
249 259 $disable_actions
250 260 );
@@ -259,9 +269,14 @@
259 269 if ( is_readable( $vendor_file ) ) {
260 270 include_once( $vendor_file );
261 271 }
262 272
263 - return class_exists( 'PhpOffice\PhpSpreadsheet\Spreadsheet' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && extension_loaded( 'fileinfo' ) && version_compare( PHP_VERSION, '5.6.0', '>' );
273 + if ( version_compare( phpversion(), '5.6.0', '<' ) ) {
274 + do_action( 'themeisle_log_event', Visualizer_Plugin::NAME, sprintf( 'PHP version %s not supported', phpversion() ), 'error', __FILE__, __LINE__ );
275 + return false;
276 + }
277 +
278 + return class_exists( 'PhpOffice\PhpSpreadsheet\Spreadsheet' ) && extension_loaded( 'zip' ) && extension_loaded( 'xml' ) && extension_loaded( 'fileinfo' );
264 279 }
265 280
266 281 /**
267 282 * Renders chart general settings group.
@@ -431,10 +446,10 @@
431 446 *
432 447 * @access protected
433 448 */
434 449 protected function _renderViewSettings() {
435 - self::_renderGroupStart( esc_html__( 'Layout & Chart Area', 'visualizer' ) );
436 - self::_renderSectionStart( esc_html__( 'Layout', 'visualizer' ), false );
450 + self::_renderGroupStart( esc_html__( 'Chart Size & Placement', 'visualizer' ) );
451 + self::_renderSectionStart( esc_html__( 'Chart Size/Layout', 'visualizer' ), false );
437 452 self::_renderSectionDescription( esc_html__( 'Configure the total size of the chart. Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage.', 'visualizer' ) );
438 453
439 454 echo '<div class="viz-section-item">';
440 455 echo '<a class="more-info" href="javascript:;">[?]</a>';
@@ -451,9 +466,9 @@
451 466 echo '</tr>';
452 467 echo '</table>';
453 468
454 469 echo '<p class="viz-section-description">';
455 - esc_html_e( 'Determines the total width and height of the chart.', 'visualizer' );
470 + esc_html_e( 'Determines the total width and height of the chart. This will only show in the front-end.', 'visualizer' );
456 471 echo '</p>';
457 472 echo '</div>';
458 473
459 474 echo '<div class="viz-section-delimiter"></div>';
@@ -490,9 +505,9 @@
490 505 echo '</label>';
491 506 echo '</div>';
492 507 self::_renderSectionEnd();
493 508
494 - self::_renderSectionStart( esc_html__( 'Chart Area', 'visualizer' ), false );
509 + self::_renderSectionStart( esc_html__( 'Placement', 'visualizer' ), false );
495 510 self::_renderSectionDescription( esc_html__( 'Configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends). Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage.', 'visualizer' ) );
496 511
497 512 echo '<div class="viz-section-item">';
498 513 echo '<a class="more-info" href="javascript:;">[?]</a>';
@@ -564,8 +579,9 @@
564 579 echo '<a class="more-info" href="javascript:;">[?]</a>';
565 580 echo '<b>', $title, '</b>';
566 581 echo '<select class="control-select ', implode( ' ', $classes ) , '" name="', $name, '" ', ( $multiple ? 'multiple' : '' ), ' ' , $atts, '>';
567 582 foreach ( $options as $key => $label ) {
583 + // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
568 584 $extra = $multiple && is_array( $value ) ? ( in_array( $key, $value ) ? 'selected' : '' ) : selected( $key, $value, false );
569 585 echo '<option value="', $key, '"', $extra, '>';
570 586 echo $label;
571 587 echo '</option>';
@@ -590,9 +606,9 @@
590 606 protected static function _renderColorPickerItem( $title, $name, $value, $default ) {
591 607 echo '<div class="viz-section-item">';
592 608 echo '<b>', $title, '</b>';
593 609 echo '<div>';
594 - echo '<input type="text" class="color-picker-hex" name="', $name, '" maxlength="7" placeholder="', esc_attr__( 'Hex Value', 'visualizer' ), '" value="', is_null( $value ) ? $default : esc_attr( $value ), '" data-default-color="', $default, '">';
610 + 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, '">';
595 611 echo '</div>';
596 612 echo '</div>';
597 613 }
598 614
@@ -701,11 +717,11 @@
701 717 * @static
702 718 * @access public
703 719 * @param string $description The description text.
704 720 */
705 - public static function _renderSectionDescription( $description ) {
721 + public static function _renderSectionDescription( $description, $classes = '' ) {
706 722 echo '<div class="viz-section-item">';
707 - echo '<div class="viz-section-description">', $description, '</div>';
723 + echo '<div class="viz-section-description ' . $classes . '">', $description, '</div>';
708 724 echo '</div>';
709 725 }
710 726
711 727 /**
@@ -747,8 +763,9 @@
747 763 protected static function _renderCheckboxItem( $title, $name, $value, $default, $desc, $disabled = false ) {
748 764 echo '<div class="viz-section-item">';
749 765 echo '<a class="more-info" href="javascript:;">[?]</a>';
750 766 echo '<b>', $title, '</b>';
767 + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
751 768 echo '<input type="checkbox" class="control-check" value="', $default, '" name="', $name, '" ', ( $value == $default ? 'checked' : '' ), ' ', ( $disabled ? 'disabled=disabled' : '' ), '>';
752 769 echo '<p class="viz-section-description">', $desc, '</p>';
753 770 echo '</div>';
754 771 }
@@ -777,5 +794,18 @@
777 794 public function getLibrary() {
778 795 return $this->_library;
779 796 }
780 797
798 + /**
799 + * Loads generic libraries conditionally.
800 + */
801 + protected function load_dependent_assets( $libs ) {
802 + if ( in_array( 'moment', $libs, true ) && ! wp_script_is( 'moment', 'registered' ) ) {
803 + wp_register_script( 'moment', VISUALIZER_ABSURL . 'js/lib/moment.min.js', array(), Visualizer_Plugin::VERSION );
804 + }
805 +
806 + if ( in_array( 'numeral', $libs, true ) && ! wp_script_is( 'numeral', 'registered' ) ) {
807 + wp_register_script( 'numeral', VISUALIZER_ABSURL . 'js/lib/numeral.min.js', array(), Visualizer_Plugin::VERSION );
808 + }
809 +
810 + }
781 811 }