PluginProbe
Chartify – WordPress Chart Plugin / 3.8.1
Chartify – WordPress Chart Plugin v3.8.1
3.8.1 3.8.0 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 trunk 1.0.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 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.1.4 3.1.5 All 84 releases
← All changes | includes/class-chart-builder-functions.php +357 -33 3.1.0 → 3.8.1 View file →
@@ -109,10 +109,11 @@
109 109
110 110 public function get_all_charts_count() {
111 111 global $wpdb;
112 112 $where = str_replace("WHERE", "AND", Chart_Builder_DB_Actions::get_where_condition());
113 - $sql = "SELECT COUNT(id) FROM " . $this->db_table . " WHERE `status`='published' " . $where;
114 - return intval( $wpdb->get_var( $sql ) );
113 +
114 + $sql = "SELECT COUNT(id) FROM {$this->db_table} WHERE `status` = %s {$where}";
115 + return intval( $wpdb->get_var( $wpdb->prepare($sql, 'published') ));// phpcs:ignore
115 116 }
116 117
117 118 /**
118 119 * Gets the allowed types
@@ -201,9 +202,9 @@
201 202 return $tables;
202 203 }
203 204 $tables = array();
204 205
205 - $sql = $wpdb->get_col( 'SHOW TABLES', 0 );
206 + $sql = $wpdb->get_col( 'SHOW TABLES', 0 );// phpcs:ignore
206 207 foreach ( $sql as $table ) {
207 208 if ( empty( $prefix ) || 0 === strpos( $table, $wpdb->prefix ) ) {
208 209 $tables[] = $table;
209 210 }
@@ -309,9 +310,9 @@
309 310 */
310 311 public function get_table_html( $headers, $rows, $table_id = 'results' ) {
311 312 ob_start();
312 313 ?>
313 - <table cellspacing="0" width="100%" id="<?= $table_id ?>">
314 + <table cellspacing="0" width="100%" id="<?php echo esc_attr($table_id) ?>">
314 315 <thead>
315 316 <tr>
316 317 <?php
317 318 foreach ( $headers as $header ) {
@@ -317,9 +318,9 @@
317 318 foreach ( $headers as $header ) {
318 319 if( empty( $header ) ){
319 320 continue;
320 321 }
321 - echo '<th>' . $header . '</th>';
322 + echo '<th>' . esc_html($header) . '</th>';
322 323 }
323 324 ?>
324 325 </tr>
325 326 </thead>
@@ -332,9 +333,9 @@
332 333 continue;
333 334 }
334 335 echo '<tr>';
335 336 foreach ( $row as $r ) {
336 - echo '<td>' . $r . '</td>';
337 + echo '<td>' . esc_html($r) . '</td>';
337 338 }
338 339 echo '</tr>';
339 340 }
340 341 ?>
@@ -356,30 +357,36 @@
356 357 $quizes_table = $wpdb->prefix . 'aysquiz_quizes';
357 358
358 359 switch ($query) {
359 360 case 'q1':
360 - $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM ".$reports_table." WHERE quiz_id = ".$quiz_id." GROUP BY CAST(end_date AS date)";
361 + $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM {$reports_table} WHERE quiz_id = %d GROUP BY CAST(end_date AS date)";
362 + $result = $wpdb->get_results($wpdb->prepare($sql, $quiz_id), "ARRAY_A");// phpcs:ignore
361 363 break;
362 364 case 'q2':
363 - $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM ".$reports_table." WHERE user_id = ".$user_id." GROUP BY CAST(end_date AS date)";
365 + $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM {$reports_table} WHERE user_id = %d GROUP BY CAST(end_date AS date)";
366 + $result = $wpdb->get_results($wpdb->prepare($sql, $user_id), "ARRAY_A");// phpcs:ignore
364 367 break;
365 368 case 'q3':
366 - $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM ".$reports_table." WHERE user_id = ".$user_id." AND quiz_id = ".$quiz_id." GROUP BY CAST(end_date AS date)";
369 + $sql = "SELECT CAST(end_date AS date) AS `Date`, COUNT(id) AS `Count` FROM {$reports_table} WHERE user_id = %d AND quiz_id = %d GROUP BY CAST(end_date AS date)";
370 + $result = $wpdb->get_results($wpdb->prepare($sql, $user_id, $quiz_id), "ARRAY_A");// phpcs:ignore
367 371 break;
368 372 case 'q4':
369 - $sql = "SELECT ".$quizes_table.".title AS `Quiz`, AVG(".$reports_table.".score) AS `Average` FROM ".$reports_table." LEFT JOIN ".$quizes_table." ON ".$reports_table.".quiz_id = ".$quizes_table.".id WHERE ".$reports_table.".user_id = ".$user_id." GROUP BY ".$quizes_table.".title";
373 + $sql = "SELECT {$quizes_table}.title AS `Quiz`, AVG({$reports_table}.score) AS `Average` FROM {$reports_table} LEFT JOIN {$quizes_table} ON {$reports_table}.quiz_id = {$quizes_table}.id WHERE {$reports_table}.user_id = %d GROUP BY {$quizes_table}.title";
374 + $result = $wpdb->get_results($wpdb->prepare($sql, $user_id), "ARRAY_A");// phpcs:ignore
370 375 break;
371 376 case 'q5':
372 - $sql = "SELECT ".$quizes_table.".title AS `Quiz`, COUNT(".$reports_table.".score) AS `Count` FROM ".$reports_table." LEFT JOIN ".$quizes_table." ON ".$reports_table.".quiz_id = ".$quizes_table.".id WHERE ".$reports_table.".user_id = ".$user_id." GROUP BY ".$quizes_table.".title";
377 + $sql = "SELECT {$quizes_table}.title AS `Quiz`, COUNT({$reports_table}.score) AS `Count` FROM {$reports_table} LEFT JOIN {$quizes_table} ON {$reports_table}.quiz_id = {$quizes_table}.id WHERE {$reports_table}.user_id = %d GROUP BY {$quizes_table}.title";
378 + $result = $wpdb->get_results($wpdb->prepare($sql, $user_id), "ARRAY_A");// phpcs:ignore
373 379 break;
374 380 case 'q6':
375 - $sql = "SELECT score AS `Score` FROM ".$reports_table." WHERE user_id = ".$user_id." AND quiz_id = ".$quiz_id."";
381 + $sql = "SELECT score AS `Score` FROM {$reports_table} WHERE user_id = %d AND quiz_id = %d";
382 + $result = $wpdb->get_results($wpdb->prepare($sql, $user_id, $quiz_id), "ARRAY_A");// phpcs:ignore
376 383 break;
377 384 default:
378 385 break;
379 386 }
380 387
381 - $result = $wpdb->get_results($sql, "ARRAY_A");
388 +
382 389 $message = empty($result) ? __( "There is no data for your query.", "chart-builder" ) : "";
383 390 return array(
384 391 'message' => $message,
385 392 'result' => $result,
@@ -392,9 +399,9 @@
392 399 *
393 400 * @access public
394 401 * @return array
395 402 */
396 - public function get_chart_settings_google_admin ($settings, $action, $source) {
403 + public function get_chart_settings_google_admin($settings, $action, $source) {
397 404 $chart_default_colors = array('#3366cc','#dc3912','#ff9900','#109618', '#990099','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411');
398 405
399 406 $tooltip_trigger_options = array(
400 407 "hover" => __("While hovering", "chart-builder"),
@@ -459,8 +466,19 @@
459 466 "right" => __("Right", "chart-builder"),
460 467 "center" => __("Center", "chart-builder")
461 468 );
462 469
470 + $border_styles = array(
471 + "solid" => __("Solid", "chart-builder"),
472 + "dashed" => __("Dashed", "chart-builder"),
473 + "dotted" => __("Dotted", "chart-builder"),
474 + "double" => __("Double", "chart-builder"),
475 + "groove" => __("Groove", "chart-builder"),
476 + "inset" => __("Inset", "chart-builder"),
477 + "outset" => __("Outset", "chart-builder"),
478 + "ridge" => __("Ridge", "chart-builder")
479 + );
480 +
463 481 $animation_easing_options = array(
464 482 "linear" => __("Linear", "chart-builder"),
465 483 "in" => __("Ease in", "chart-builder"),
466 484 "out" => __("Ease out", "chart-builder"),
@@ -576,8 +594,11 @@
576 594
577 595 // Border color
578 596 $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#666666';
579 597
598 + // Border style
599 + $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
600 +
580 601 // Border width with title
581 602 $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
582 603
583 604 // Border radius with title
@@ -585,8 +606,15 @@
585 606
586 607 // Border color with title
587 608 $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
588 609
610 + // Border style with title
611 + $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
612 + $settings['border_styles'] = $border_styles;
613 +
614 + // Padding outer
615 + $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
616 +
589 617 // Box shadow color
590 618 $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
591 619
592 620 // Chart Area background color
@@ -887,8 +915,10 @@
887 915 $settings['haxis_slanted'] = isset( $settings['haxis_slanted'] ) && $settings['haxis_slanted'] != '' ? esc_attr( $settings['haxis_slanted'] ) : 'automatic';
888 916 $settings['haxis_slanted_text_angle'] = isset( $settings['haxis_slanted_text_angle'] ) && $settings['haxis_slanted_text_angle'] != '' && $settings['haxis_slanted_text_angle'] != '0' ? esc_attr( $settings['haxis_slanted_text_angle'] ) : '30';
889 917 $settings['haxis_show_text_every'] = isset( $settings['haxis_show_text_every'] ) && $settings['haxis_show_text_every'] != '' ? esc_attr( $settings['haxis_show_text_every'] ) : '0';
890 918 $settings['haxis_format'] = isset( $settings['haxis_format'] ) && $settings['haxis_format'] != '' ? esc_attr( $settings['haxis_format'] ) : '';
919 + $settings['haxis_enable_divide_percent'] = ( isset( $settings['haxis_enable_divide_percent'] ) && $settings['haxis_enable_divide_percent'] != '' ) ? $settings['haxis_enable_divide_percent'] : 'off';
920 + $settings['haxis_enable_divide_percent'] = isset( $settings['haxis_enable_divide_percent'] ) && $settings['haxis_enable_divide_percent'] == 'on' ? 'checked' : '';
891 921 $settings['haxis_max_value'] = isset( $settings['haxis_max_value'] ) && $settings['haxis_max_value'] != '' ? esc_attr( $settings['haxis_max_value'] ) : null;
892 922 $settings['haxis_min_value'] = isset( $settings['haxis_min_value'] ) && $settings['haxis_min_value'] != '' ? esc_attr( $settings['haxis_min_value'] ) : null;
893 923 $settings['haxis_gridlines_count'] = isset( $settings['haxis_gridlines_count'] ) && $settings['haxis_gridlines_count'] != '' ? esc_attr( $settings['haxis_gridlines_count'] ) : -1;$settings['haxis_italic'] = ( isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] != '' ) ? $settings['haxis_italic'] : 'off';
894 924 $settings['haxis_italic'] = isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] == 'on' ? 'checked' : '';
@@ -911,8 +941,10 @@
911 941 $settings['vaxis_text_color'] = isset( $settings['vaxis_text_color'] ) && $settings['vaxis_text_color'] != '' ? esc_attr( $settings['vaxis_text_color'] ) : '#000000';
912 942 $settings['vaxis_baseline_color'] = isset( $settings['vaxis_baseline_color'] ) && $settings['vaxis_baseline_color'] != '' ? esc_attr( $settings['vaxis_baseline_color'] ) : '#000000';
913 943 $settings['vaxis_text_font_size'] = isset( $settings['vaxis_text_font_size'] ) && $settings['vaxis_text_font_size'] != '' ? absint(esc_attr( $settings['vaxis_text_font_size'] )) : $settings['font_size'];
914 944 $settings['vaxis_format'] = isset( $settings['vaxis_format'] ) && $settings['vaxis_format'] != '' ? esc_attr( $settings['vaxis_format'] ) : '';
945 + $settings['vaxis_enable_divide_percent'] = ( isset( $settings['vaxis_enable_divide_percent'] ) && $settings['vaxis_enable_divide_percent'] != '' ) ? $settings['vaxis_enable_divide_percent'] : 'off';
946 + $settings['vaxis_enable_divide_percent'] = isset( $settings['vaxis_enable_divide_percent'] ) && $settings['vaxis_enable_divide_percent'] == 'on' ? 'checked' : '';
915 947 $settings['vaxis_max_value'] = isset( $settings['vaxis_max_value'] ) && $settings['vaxis_max_value'] != '' ? esc_attr( $settings['vaxis_max_value'] ) : null;
916 948 $settings['vaxis_min_value'] = isset( $settings['vaxis_min_value'] ) && $settings['vaxis_min_value'] != '' ? esc_attr( $settings['vaxis_min_value'] ) : null;
917 949 $settings['vaxis_gridlines_count'] = isset( $settings['vaxis_gridlines_count'] ) && $settings['vaxis_gridlines_count'] != '' ? esc_attr( $settings['vaxis_gridlines_count'] ) : -1;
918 950 $settings['vaxis_italic'] = ( isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] != '' ) ? $settings['vaxis_italic'] : 'off';
@@ -937,9 +969,9 @@
937 969
938 970 $settings['enable_img'] = ( isset( $settings['enable_img'] ) && $settings['enable_img'] != '' ) ? $settings['enable_img'] : 'off';
939 971 $settings['enable_img'] = isset( $settings['enable_img'] ) && $settings['enable_img'] == 'on' ? 'checked' : '';
940 972
941 - $counting_source = $source;
973 + $counting_source = !empty($source) ? $source : array();
942 974
943 975 $count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0;
944 976 $count_series = (isset($counting_source[0]) && !is_null($counting_source[0]) && count($counting_source[0]) > 0) ? count($counting_source[0]) - 1 : 0;
945 977 $count_rows = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count(array_column($counting_source, 0)) - 1 : 0;
@@ -956,9 +988,10 @@
956 988 $settings['series_visible_in_legend'] = isset( $settings['series_visible_in_legend'] ) && $settings['series_visible_in_legend'] != '' ? json_decode($settings['series_visible_in_legend'], true) : array_fill(0, $count_series, 'on');
957 989 $settings['series_line_width'] = isset( $settings['series_line_width'] ) && $settings['series_line_width'] != '' ? json_decode($settings['series_line_width'], true) : array_fill(0, $count_series, $settings['line_width']);
958 990 $settings['series_point_size'] = isset( $settings['series_point_size'] ) && $settings['series_point_size'] != '' ? json_decode($settings['series_point_size'], true) : array_fill(0, $count_series, $settings['point_size']);
959 991 $settings['series_point_shape'] = isset( $settings['series_point_shape'] ) && $settings['series_point_shape'] != '' ? json_decode($settings['series_point_shape'], true) : array_fill(0, $count_series, $settings['point_shape']);
960 -
992 + $settings['series_format'] = isset( $settings['series_format'] ) && $settings['series_format'] != '' ? json_decode($settings['series_format'], true) : array_fill(0, $count_series, '');
993 +
961 994 // Rows settings
962 995 $settings['enable_row_settings'] = ( isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] != '' ) ? $settings['enable_row_settings'] : 'on';
963 996 $settings['enable_row_settings'] = isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] == 'on' ? 'checked' : '';
964 997
@@ -1020,8 +1053,11 @@
1020 1053
1021 1054 // Border color
1022 1055 $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#666666';
1023 1056
1057 + // Border style
1058 + $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
1059 +
1024 1060 // Border width with title
1025 1061 $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
1026 1062
1027 1063 // Border radius with title
@@ -1029,8 +1065,14 @@
1029 1065
1030 1066 // Border color with title
1031 1067 $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
1032 1068
1069 + // Border style with title
1070 + $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
1071 +
1072 + // Padding outer
1073 + $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
1074 +
1033 1075 // Box shadow color
1034 1076 $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
1035 1077
1036 1078 // Chart Area background color
@@ -1281,8 +1323,9 @@
1281 1323 $settings['haxis_slanted'] = isset( $settings['haxis_slanted'] ) && $settings['haxis_slanted'] != '' ? esc_attr( $settings['haxis_slanted'] ) : 'automatic';
1282 1324 $settings['haxis_slanted_text_angle'] = isset( $settings['haxis_slanted_text_angle'] ) && $settings['haxis_slanted_text_angle'] != '' && $settings['haxis_slanted_text_angle'] != '0' ? esc_attr( $settings['haxis_slanted_text_angle'] ) : '30';
1283 1325 $settings['haxis_show_text_every'] = isset( $settings['haxis_show_text_every'] ) && $settings['haxis_show_text_every'] != '' ? esc_attr( $settings['haxis_show_text_every'] ) : '0';
1284 1326 $settings['haxis_format'] = isset( $settings['haxis_format'] ) && $settings['haxis_format'] != '' ? esc_attr( $settings['haxis_format'] ) : '';
1327 + $settings['haxis_enable_divide_percent'] = ( isset( $settings['haxis_enable_divide_percent'] ) && $settings['haxis_enable_divide_percent'] != '' ) ? $settings['haxis_enable_divide_percent'] : 'off';
1285 1328 $settings['haxis_max_value'] = isset( $settings['haxis_max_value'] ) && $settings['haxis_max_value'] != '' ? esc_attr( $settings['haxis_max_value'] ) : null;
1286 1329 $settings['haxis_min_value'] = isset( $settings['haxis_min_value'] ) && $settings['haxis_min_value'] != '' ? esc_attr( $settings['haxis_min_value'] ) : null;
1287 1330 $settings['haxis_gridlines_count'] = isset( $settings['haxis_gridlines_count'] ) && $settings['haxis_gridlines_count'] != '' ? esc_attr( $settings['haxis_gridlines_count'] ) : -1;
1288 1331 $settings['haxis_italic'] = ( isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] != '' ) ? $settings['haxis_italic'] : 'off';
@@ -1301,8 +1344,9 @@
1301 1344 $settings['vaxis_text_color'] = isset( $settings['vaxis_text_color'] ) && $settings['vaxis_text_color'] != '' ? esc_attr( $settings['vaxis_text_color'] ) : '#000000';
1302 1345 $settings['vaxis_baseline_color'] = isset( $settings['vaxis_baseline_color'] ) && $settings['vaxis_baseline_color'] != '' ? esc_attr( $settings['vaxis_baseline_color'] ) : '#000000';
1303 1346 $settings['vaxis_text_font_size'] = isset( $settings['vaxis_text_font_size'] ) && $settings['vaxis_text_font_size'] != '' ? absint(esc_attr( $settings['vaxis_text_font_size'] )) : $settings['font_size'];
1304 1347 $settings['vaxis_format'] = isset( $settings['vaxis_format'] ) && $settings['vaxis_format'] != '' ? esc_attr( $settings['vaxis_format'] ) : '';
1348 + $settings['vaxis_enable_divide_percent'] = ( isset( $settings['vaxis_enable_divide_percent'] ) && $settings['vaxis_enable_divide_percent'] != '' ) ? $settings['vaxis_enable_divide_percent'] : 'off';
1305 1349 $settings['vaxis_max_value'] = isset( $settings['vaxis_max_value'] ) && $settings['vaxis_max_value'] != '' ? esc_attr( $settings['vaxis_max_value'] ) : null;
1306 1350 $settings['vaxis_min_value'] = isset( $settings['vaxis_min_value'] ) && $settings['vaxis_min_value'] != '' ? esc_attr( $settings['vaxis_min_value'] ) : null;
1307 1351 $settings['vaxis_gridlines_count'] = isset( $settings['vaxis_gridlines_count'] ) && $settings['vaxis_gridlines_count'] != '' ? esc_attr( $settings['vaxis_gridlines_count'] ) : -1;
1308 1352 $settings['vaxis_italic'] = ( isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] != '' ) ? $settings['vaxis_italic'] : 'off';
@@ -1336,9 +1380,9 @@
1336 1380 $settings['series_visible_in_legend'] = isset( $settings['series_visible_in_legend'] ) && $settings['series_visible_in_legend'] != '' ? json_decode($settings['series_visible_in_legend'], true) : array_fill(0, $count_series, 'on');
1337 1381 $settings['series_line_width'] = isset( $settings['series_line_width'] ) && $settings['series_line_width'] != '' ? json_decode($settings['series_line_width'], true) : array_fill(0, $count_series, $settings['line_width']);
1338 1382 $settings['series_point_size'] = isset( $settings['series_point_size'] ) && $settings['series_point_size'] != '' ? json_decode($settings['series_point_size'], true) : array_fill(0, $count_series, $settings['point_size']);
1339 1383 $settings['series_point_shape'] = isset( $settings['series_point_shape'] ) && $settings['series_point_shape'] != '' ? json_decode($settings['series_point_shape'], true) : array_fill(0, $count_series, $settings['point_shape']);
1340 -
1384 + $settings['series_format'] = isset( $settings['series_format'] ) && $settings['series_format'] != '' ? json_decode($settings['series_format'], true) : array_fill(0, $count_series, '');
1341 1385 // Rows settings
1342 1386 $settings['enable_row_settings'] = ( isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] != '' ) ? $settings['enable_row_settings'] : 'on';
1343 1387
1344 1388 $settings['rows_color'] = isset( $settings['rows_color'] ) && $settings['rows_color'] != '' ? json_decode($settings['rows_color'], true) : array_fill(0, $count_rows, '');
@@ -1353,29 +1397,69 @@
1353 1397 *
1354 1398 * @access public
1355 1399 * @return array
1356 1400 */
1357 - public function get_chart_settings_chartjs_admin ($settings) {
1401 + public function get_chart_settings_chartjs_admin($settings, $source) {
1402 + $chart_default_colors = array('#36A2EB','#FF6384','#FF9F40','#FFCD56', '#4BC0C0','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411');
1403 +
1358 1404 $title_positions = array(
1359 - "left" => __("Left", "chart-builder"),
1360 - "right" => __("Right", "chart-builder"),
1361 - "center" => __("Center", "chart-builder")
1405 + "left" => __("Left", "chart-builder"),
1406 + "right" => __("Right", "chart-builder"),
1407 + "center" => __("Center", "chart-builder")
1362 1408 );
1363 1409
1364 1410 $text_transforms = array(
1365 - "uppercase" => __("Uppercase", "chart-builder"),
1366 - "lowercase" => __("Lowercase", "chart-builder"),
1367 - "capitalize" => __("Capitalize", "chart-builder"),
1368 - "none" => __("None", "chart-builder"),
1411 + "uppercase" => __("Uppercase", "chart-builder"),
1412 + "lowercase" => __("Lowercase", "chart-builder"),
1413 + "capitalize" => __("Capitalize", "chart-builder"),
1414 + "none" => __("None", "chart-builder"),
1369 1415 );
1370 1416
1371 1417 $text_decorations = array(
1372 - "overline" => __("Overline", "chart-builder"),
1373 - "underline" => __("Underline", "chart-builder"),
1374 - "line-through" => __("Line through", "chart-builder"),
1375 - "none" => __("None", "chart-builder"),
1418 + "overline" => __("Overline", "chart-builder"),
1419 + "underline" => __("Underline", "chart-builder"),
1420 + "line-through" => __("Line through", "chart-builder"),
1421 + "none" => __("None", "chart-builder"),
1376 1422 );
1423 +
1424 + $border_styles = array(
1425 + "solid" => __("Solid", "chart-builder"),
1426 + "dashed" => __("Dashed", "chart-builder"),
1427 + "dotted" => __("Dotted", "chart-builder"),
1428 + "double" => __("Double", "chart-builder"),
1429 + "groove" => __("Groove", "chart-builder"),
1430 + "inset" => __("Inset", "chart-builder"),
1431 + "outset" => __("Outset", "chart-builder"),
1432 + "ridge" => __("Ridge", "chart-builder")
1433 + );
1434 +
1435 + $legend_positions = array(
1436 + "top" => __("Above the chart", "chart-builder"),
1437 + "bottom" => __("Below the chart", "chart-builder"),
1438 + "left" => __("Left of the chart", "chart-builder"),
1439 + "right" => __("Right of the chart", "chart-builder"),
1440 + );
1377 1441
1442 + $legend_alignments = array(
1443 + "start" => __("Start", "chart-builder"),
1444 + "center" => __("Center", "chart-builder"),
1445 + "end" => __("End", "chart-builder"),
1446 + );
1447 +
1448 + $group_width_format_options = array(
1449 + "%" => __("%", "chart-builder"),
1450 + "px" => __("px", "chart-builder"),
1451 + );
1452 +
1453 + // Width
1454 + $settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100';
1455 + $settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%';
1456 + $settings['width_format_options'] = $group_width_format_options;
1457 +
1458 + // Height
1459 + $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '100';
1460 + $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : '%';
1461 +
1378 1462 // Title color
1379 1463 $settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000';
1380 1464
1381 1465 // Title color
@@ -1449,13 +1533,52 @@
1449 1533
1450 1534 // description text decoration
1451 1535 $settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none';
1452 1536
1537 + // Box shadow
1538 + $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off';
1539 + $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : '';
1540 +
1541 + // Border width
1542 + $settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0';
1543 +
1544 + // Border radius
1545 + $settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0';
1546 +
1547 + // Border color
1548 + $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#000000';
1549 +
1550 + // Background color
1551 + $settings['background_color_chart'] = isset( $settings['background_color_chart'] ) && $settings['background_color_chart'] != '' ? esc_attr( $settings['background_color_chart'] ) : '#ffffff';
1552 +
1553 + // Border width with title
1554 + $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
1555 +
1556 + // Border radius with title
1557 + $settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0';
1558 +
1559 + // Border color with title
1560 + $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
1561 +
1562 + // Border style with title
1563 + $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
1564 + $settings['border_styles'] = $border_styles;
1565 +
1566 + //Box shadow color
1567 + $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
1568 +
1569 + // Border style
1570 + $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
1571 + $settings['border_styles'] = $border_styles;
1572 +
1573 + // slice_spacing
1574 + $settings['slice_spacing'] = isset( $settings['slice_spacing'] ) && $settings['slice_spacing'] != '' ? esc_attr( absint($settings['slice_spacing']) ) : 1;
1575 +
1453 1576 // outer_radius
1454 1577 $settings['outer_radius'] = isset( $settings['outer_radius'] ) && $settings['outer_radius'] != '' ? esc_attr( absint($settings['outer_radius']) ) : 100;
1455 1578
1456 - // slice_spacing
1457 - $settings['slice_spacing'] = isset( $settings['slice_spacing'] ) && $settings['slice_spacing'] != '' ? esc_attr( absint($settings['slice_spacing']) ) : 1;
1579 + // Padding outer
1580 + $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
1458 1581
1459 1582 // circumference
1460 1583 $settings['circumference'] = isset( $settings['circumference'] ) && $settings['circumference'] != '' ? esc_attr( absint($settings['circumference']) ) : 360;
1461 1584
@@ -1461,8 +1584,27 @@
1461 1584
1462 1585 // start_angle
1463 1586 $settings['start_angle'] = isset( $settings['start_angle'] ) && $settings['start_angle'] != '' ? esc_attr( absint($settings['start_angle']) ) : 0;
1464 1587
1588 + // rotation_degree
1589 + $settings['rotation_degree'] = isset( $settings['rotation_degree'] ) && $settings['rotation_degree'] != '' ? esc_attr( absint($settings['rotation_degree']) ) : 0;
1590 +
1591 + // Tooltip text options
1592 + $tooltip_text_options = array(
1593 + "value" => __("Value", "chart-builder"),
1594 + "percentage" => __("Percent", "chart-builder"),
1595 + "both" => __("Value & Percent", "chart-builder")
1596 + );
1597 + $settings['tooltip_text_options'] = $tooltip_text_options;
1598 +
1599 + // Tooltip text
1600 + $settings['tooltip_text'] = isset( $settings['tooltip_text'] ) && $settings['tooltip_text'] != '' ? esc_attr( $settings['tooltip_text'] ) : 'value';
1601 +
1602 + // Data grouping settings
1603 + $settings['data_grouping_limit'] = isset( $settings['data_grouping_limit'] ) && $settings['data_grouping_limit'] != '' ? esc_attr( $settings['data_grouping_limit'] ) : '0.5';
1604 + $settings['data_grouping_label'] = isset( $settings['data_grouping_label'] ) && $settings['data_grouping_label'] != '' ? esc_attr( $settings['data_grouping_label'] ) : 'Other';
1605 + $settings['data_grouping_color'] = isset( $settings['data_grouping_color'] ) && $settings['data_grouping_color'] != '' ? esc_attr( $settings['data_grouping_color'] ) : '#ccc';
1606 +
1465 1607 // Show chart description
1466 1608 if (!isset($settings['show_description'])) {
1467 1609 $settings['show_description'] = 'checked';
1468 1610 } else {
@@ -1476,9 +1618,82 @@
1476 1618 } else {
1477 1619 $settings['show_title'] = ( $settings['show_title'] != '' ) ? $settings['show_title'] : 'off';
1478 1620 $settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] == 'on' ? 'checked' : '';
1479 1621 }
1622 +
1623 + // Enable interactivity
1624 + if (!isset($settings['enable_interactivity'])) {
1625 + $settings['enable_interactivity'] = 'checked';
1626 + } else {
1627 + $settings['enable_interactivity'] = ( $settings['enable_interactivity'] != '' ) ? $settings['enable_interactivity'] : 'off';
1628 + $settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] == 'on' ? 'checked' : '';
1629 + }
1630 +
1631 + $counting_source = !empty($source) ? $source : array();
1632 + $count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0;
1633 +
1634 + // Slices settings
1635 + $settings['slice_colors_default'] = $chart_default_colors;
1636 + $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : array_slice($chart_default_colors, 0, $count_slices);
1637 +
1638 + // Slice border color
1639 + $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff';
1480 1640
1641 + // Slice border color
1642 + $settings['slices_border_color'] = isset( $settings['slices_border_color'] ) && $settings['slices_border_color'] != '' ? json_decode($settings['slices_border_color'], true) : array_fill(0, $count_slices, $settings['slice_border_color']);
1643 +
1644 + // Slices border width
1645 + $settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1';
1646 +
1647 + // Tooltip text color
1648 + $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff';
1649 +
1650 + $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ? esc_attr( $settings['show_color_code'] ) : 'off';
1651 + $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : '';
1652 +
1653 + $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off';
1654 + $settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'on' ? 'checked' : '';
1655 +
1656 + // Tooltip font size
1657 + $settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : '12';
1658 +
1659 + // Tooltip bold options
1660 + $tooltip_bold_options = array(
1661 + "default" => __("Default", "chart-builder"),
1662 + "true" => __("Enable", "chart-builder"),
1663 + "false" => __("Disable", "chart-builder")
1664 + );
1665 +
1666 + // Tooltip bold text
1667 + $settings['tooltip_bold'] = isset( $settings['tooltip_bold'] ) && $settings['tooltip_bold'] != '' ? esc_attr( $settings['tooltip_bold'] ) : 'default';
1668 + $settings['tooltip_bold_options'] = $tooltip_bold_options;
1669 +
1670 + // Legend font color
1671 + $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000';
1672 +
1673 + // Legend font size
1674 + $settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : 12;
1675 +
1676 + // Legend position
1677 + $settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'top';
1678 + $settings['legend_positions'] = $legend_positions;
1679 +
1680 + // Legend alignment
1681 + $settings['legend_alignment'] = isset( $settings['legend_alignment'] ) && $settings['legend_alignment'] != '' ? esc_attr( $settings['legend_alignment'] ) : 'start';
1682 + $settings['legend_alignments'] = $legend_alignments;
1683 +
1684 + // Legend Italic text
1685 + $settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off';
1686 + $settings['legend_italic'] = isset( $settings['legend_italic'] ) && $settings['legend_italic'] == 'on' ? 'checked' : '';
1687 +
1688 + // Legend Bold text
1689 + $settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off';
1690 + $settings['legend_bold'] = isset( $settings['legend_bold'] ) && $settings['legend_bold'] == 'on' ? 'checked' : '';
1691 +
1692 + // Legend reverse
1693 + $settings['legend_reverse'] = ( isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] != '' ) ? $settings['legend_reverse'] : 'off';
1694 + $settings['legend_reverse'] = isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] == 'on' ? 'checked' : '';
1695 +
1481 1696 return $settings;
1482 1697
1483 1698 }
1484 1699
@@ -1487,15 +1702,30 @@
1487 1702 *
1488 1703 * @access public
1489 1704 * @return array
1490 1705 */
1491 - public function get_chart_settings_chartjs_public ($settings) {
1706 + public function get_chart_settings_chartjs_public($settings, $chartData) {
1707 + $chart_default_colors = array('#36A2EB','#FF6384','#FF9F40','#FFCD56', '#4BC0C0','#0099c6','#dd4477','#66aa00', '#b82e2e','#316395','#994499','#22aa99', '#aaaa11','#6633cc','#e67300','#8b0707', '#651067','#329262','#5574a6','#3b3eac', '#b77322','#16d620','#b91383','#f4359e', '#9c5935','#a9c413','#2a778d','#668d1c', '#bea413','#0c5922','#743411');
1708 + // echo "<pre>"; var_dump($settings); echo "</pre>";
1709 + // Width
1710 + $settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100';
1711 + $settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%';
1712 + $settings['chart_width'] = $settings['width'].$settings['width_format'];
1713 +
1714 + // height
1715 + $settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '100';
1716 + $settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : '%';
1717 + $settings['chart_height'] = $settings['height'].$settings['height_format'];
1718 +
1492 1719 // Show chart description
1493 1720 $settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] != '' ? esc_attr( $settings['show_description'] ) : 'on';
1494 1721
1495 1722 // Show chart title
1496 1723 $settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] != '' ? esc_attr( $settings['show_title'] ) : 'on';
1497 -
1724 +
1725 + // Enable interactivity
1726 + $settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] != '' ? esc_attr( $settings['enable_interactivity'] ) : 'on';
1727 +
1498 1728 // Title color
1499 1729 $settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000';
1500 1730
1501 1731 // Title color
@@ -1566,8 +1796,45 @@
1566 1796
1567 1797 // description text decoration
1568 1798 $settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none';
1569 1799
1800 + // Box shadow
1801 + $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off';
1802 + $settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : '';
1803 +
1804 + // Border width
1805 + $settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0';
1806 +
1807 + // Border radius
1808 + $settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0';
1809 +
1810 + // Border color
1811 + $settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#000000';
1812 +
1813 + //Box shadow color
1814 + $settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color'];
1815 +
1816 + // Border style
1817 + $settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid';
1818 +
1819 + // Background color
1820 + $settings['background_color_chart'] = isset( $settings['background_color_chart'] ) && $settings['background_color_chart'] != '' ? esc_attr( $settings['background_color_chart'] ) : '#ffffff';
1821 +
1822 + // Border width with title
1823 + $settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0';
1824 +
1825 + // Border radius with title
1826 + $settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0';
1827 +
1828 + // Border color with title
1829 + $settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000';
1830 +
1831 + // Border style with title
1832 + $settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid';
1833 +
1834 + // Padding outer
1835 + $settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0';
1836 +
1570 1837 // outer_radius
1571 1838 $settings['outer_radius'] = isset( $settings['outer_radius'] ) && $settings['outer_radius'] != '' ? esc_attr( absint($settings['outer_radius']) ) : 100;
1572 1839
1573 1840 // slice_spacing
@@ -1577,9 +1844,66 @@
1577 1844 $settings['circumference'] = isset( $settings['circumference'] ) && $settings['circumference'] != '' ? esc_attr( absint($settings['circumference']) ) : 360;
1578 1845
1579 1846 // start_angle
1580 1847 $settings['start_angle'] = isset( $settings['start_angle'] ) && $settings['start_angle'] != '' ? esc_attr( absint($settings['start_angle']) ) : 0;
1848 +
1849 + // rotation_degree
1850 + $settings['rotation_degree'] = isset( $settings['rotation_degree'] ) && $settings['rotation_degree'] != '' ? esc_attr( absint($settings['rotation_degree']) ) : 0;
1851 +
1852 + // Tooltip text
1853 + $settings['tooltip_text'] = isset( $settings['tooltip_text'] ) && $settings['tooltip_text'] != '' ? esc_attr( $settings['tooltip_text'] ) : 'value';
1854 +
1855 + // Data grouping settings
1856 + $settings['data_grouping_limit'] = isset( $settings['data_grouping_limit'] ) && $settings['data_grouping_limit'] != '' ? esc_attr( $settings['data_grouping_limit'] ) : '0.5';
1857 + $settings['data_grouping_label'] = isset( $settings['data_grouping_label'] ) && $settings['data_grouping_label'] != '' ? esc_attr( $settings['data_grouping_label'] ) : 'Other';
1858 + $settings['data_grouping_color'] = isset( $settings['data_grouping_color'] ) && $settings['data_grouping_color'] != '' ? esc_attr( $settings['data_grouping_color'] ) : '#ccc';
1859 +
1860 + $count_slices = (isset($chartData['source']) && !is_null($chartData['source']) && count($chartData['source']) > 0) ? count($chartData['source']) - 1 : 0;
1861 + // Slices settings
1862 + $settings['slice_colors_default'] = $chart_default_colors;
1863 + $settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : $chart_default_colors;
1581 1864
1865 + // Slice border color
1866 + $settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff';
1867 +
1868 + // Slice border color
1869 + $settings['slices_border_color'] = isset( $settings['slices_border_color'] ) && $settings['slices_border_color'] != '' ? json_decode($settings['slices_border_color'], true) : array_fill(0, $count_slices, $settings['slice_border_color']);
1870 +
1871 + // Slices border width
1872 + $settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1';
1873 +
1874 + // Tooltip text color
1875 + $settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff';
1876 +
1877 + // Tooltip font size
1878 + $settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : 12;
1879 +
1880 + // Show color code
1881 + $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ? esc_attr( $settings['show_color_code'] ) : 'off';
1882 + $settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : '';
1883 +
1884 + // Tooltip Italic text
1885 + $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off';
1886 + //$settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'checked' ? 'italic' : 'normal';
1887 + $settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && ($settings['tooltip_italic'] == 'checked' || $settings['tooltip_italic'] == 'on') ) ? 'italic' : 'normal';
1888 + // Legend font color
1889 + $settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000';
1890 +
1891 + // Legend font size
1892 + $settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : 12;
1893 +
1894 + // Legend position
1895 + $settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'top';
1896 +
1897 + // Legend Italic text
1898 + $settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off';
1899 +
1900 + // Legend Bold text
1901 + $settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off';
1902 +
1903 + // Legend reverse
1904 + $settings['legend_reverse'] = ( isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] != '' ) ? $settings['legend_reverse'] : 'off';
1905 +
1582 1906 return $settings;
1583 1907
1584 1908 }
1585 1909 }