| 1 |
<?php |
| 2 |
|
| 3 |
if( !class_exists( 'Chart_Builder_Functions' ) ){ |
| 4 |
|
| 5 |
/** |
| 6 |
* Class Chart_Builder_Functions |
| 7 |
* Class contains useful functions that uses in common |
| 8 |
* |
| 9 |
* |
| 10 |
* Hooks used in the class |
| 11 |
* There are not hooks yet |
| 12 |
* @hooks @actions |
| 13 |
* @filters |
| 14 |
* |
| 15 |
* |
| 16 |
* @param $plugin_name |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
* @package Chart_Builder |
| 20 |
* @subpackage Chart_Builder/includes |
| 21 |
* @author Chart Builder Team <info@ays-pro.com> |
| 22 |
*/ |
| 23 |
class Chart_Builder_Functions { |
| 24 |
|
| 25 |
/** |
| 26 |
* The ID of this plugin. |
| 27 |
* |
| 28 |
* @since 1.0.0 |
| 29 |
* @access private |
| 30 |
* @var string $plugin_name The ID of this plugin. |
| 31 |
*/ |
| 32 |
private $plugin_name; |
| 33 |
|
| 34 |
/** |
| 35 |
* The database table name |
| 36 |
* |
| 37 |
* @since 1.0.0 |
| 38 |
* @access private |
| 39 |
* @var string $db_table The database table name |
| 40 |
*/ |
| 41 |
private $db_table; |
| 42 |
|
| 43 |
/** |
| 44 |
* The constructor of the class |
| 45 |
* |
| 46 |
* @since 1.0.0 |
| 47 |
* @param $plugin_name |
| 48 |
*/ |
| 49 |
public function __construct( $plugin_name ) { |
| 50 |
global $wpdb; |
| 51 |
/** |
| 52 |
* Assigning $plugin_name to the @plugin_name property |
| 53 |
*/ |
| 54 |
$this->plugin_name = $plugin_name; |
| 55 |
$this->db_table = $wpdb->prefix . CHART_BUILDER_DB_PREFIX . "charts"; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Get instance of this class |
| 60 |
* |
| 61 |
* @access public |
| 62 |
* @since 1.0.0 |
| 63 |
* @param $plugin_name |
| 64 |
* @return Chart_Builder_Functions |
| 65 |
*/ |
| 66 |
public static function get_instance( $plugin_name ){ |
| 67 |
return new self( $plugin_name ); |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* Date validation function |
| 72 |
* |
| 73 |
* @accept two parameters |
| 74 |
* @param $date |
| 75 |
* @param string $format |
| 76 |
* |
| 77 |
* @return bool |
| 78 |
*/ |
| 79 |
public function validateDate( $date, $format = 'Y-m-d H:i:s' ){ |
| 80 |
$d = DateTime::createFromFormat($format, $date); |
| 81 |
return $d && $d->format($format) == $date; |
| 82 |
} |
| 83 |
|
| 84 |
/** |
| 85 |
* Version compare function |
| 86 |
* |
| 87 |
* @accept two parameters |
| 88 |
* @param $version1 |
| 89 |
* @param $operator |
| 90 |
* @param $version2 |
| 91 |
* |
| 92 |
* @return bool|int |
| 93 |
*/ |
| 94 |
public function versionCompare( $version1, $operator, $version2 ) { |
| 95 |
|
| 96 |
$_fv = intval ( trim ( str_replace ( '.', '', $version1 ) ) ); |
| 97 |
$_sv = intval ( trim ( str_replace ( '.', '', $version2 ) ) ); |
| 98 |
|
| 99 |
if (strlen ( $_fv ) > strlen ( $_sv )) { |
| 100 |
$_sv = str_pad ( $_sv, strlen ( $_fv ), 0 ); |
| 101 |
} |
| 102 |
|
| 103 |
if (strlen ( $_fv ) < strlen ( $_sv )) { |
| 104 |
$_fv = str_pad ( $_fv, strlen ( $_sv ), 0 ); |
| 105 |
} |
| 106 |
|
| 107 |
return version_compare ( ( string ) $_fv, ( string ) $_sv, $operator ); |
| 108 |
} |
| 109 |
|
| 110 |
public function get_all_charts_count() { |
| 111 |
global $wpdb; |
| 112 |
$where = str_replace("WHERE", "AND", Chart_Builder_DB_Actions::get_where_condition()); |
| 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 |
| 116 |
} |
| 117 |
|
| 118 |
/** |
| 119 |
* Gets the allowed types |
| 120 |
* |
| 121 |
* @access private |
| 122 |
*/ |
| 123 |
public function getAllowedTypes() { |
| 124 |
return array( |
| 125 |
'string', |
| 126 |
'number', |
| 127 |
'boolean', |
| 128 |
'date', |
| 129 |
'datetime', |
| 130 |
'timeofday', |
| 131 |
); |
| 132 |
} |
| 133 |
|
| 134 |
/** |
| 135 |
* Gets the properties of the post type |
| 136 |
* |
| 137 |
* @access private |
| 138 |
*/ |
| 139 |
public function get_post_type_properties( $post_type ) { |
| 140 |
$array = null; |
| 141 |
|
| 142 |
$query = new WP_Query( |
| 143 |
array( |
| 144 |
'post_type' => $post_type, |
| 145 |
'no_rows_found' => false, |
| 146 |
'post_per_page' => 1, |
| 147 |
'orderby' => 'post_date', |
| 148 |
'order' => 'DESC', |
| 149 |
'fields' => 'ids', |
| 150 |
'update_post_meta_cache' => false, |
| 151 |
'update_post_term_cache' => false, |
| 152 |
) |
| 153 |
); |
| 154 |
|
| 155 |
$array = array( |
| 156 |
'post_title', |
| 157 |
'post_status', |
| 158 |
'comment_count', |
| 159 |
'post_date', |
| 160 |
'post_modified', |
| 161 |
); |
| 162 |
|
| 163 |
if ( $query->have_posts() ) { |
| 164 |
$id = $query->posts[0]; |
| 165 |
$meta = get_post_meta( $id, '', true ); |
| 166 |
foreach ( $meta as $key => $values ) { |
| 167 |
$array[] = $key; |
| 168 |
} |
| 169 |
} |
| 170 |
|
| 171 |
return $array; |
| 172 |
} |
| 173 |
|
| 174 |
/** |
| 175 |
* Gets all tables and their columns. |
| 176 |
* |
| 177 |
* @access public |
| 178 |
* @return array |
| 179 |
*/ |
| 180 |
public function get_all_db_tables_column_mapping( $chart_id, $use_filter = true ) { |
| 181 |
$mapping = array(); |
| 182 |
$tables = $this->get_db_tables(); |
| 183 |
foreach ( $tables as $table ) { |
| 184 |
$cols = $this->get_db_table_columns( $table, true ); |
| 185 |
$names = wp_list_pluck( $cols, 'name' ); |
| 186 |
$mapping[ $table ] = $names; |
| 187 |
} |
| 188 |
|
| 189 |
return $mapping; |
| 190 |
} |
| 191 |
|
| 192 |
/** |
| 193 |
* Gets the tables in the database; |
| 194 |
* |
| 195 |
* @access public |
| 196 |
* @return array |
| 197 |
*/ |
| 198 |
public function get_db_tables() { |
| 199 |
global $wpdb; |
| 200 |
$tables = get_transient( CHART_BUILDER_DB_PREFIX . 'db_tables' ); |
| 201 |
if ( $tables ) { |
| 202 |
return $tables; |
| 203 |
} |
| 204 |
$tables = array(); |
| 205 |
|
| 206 |
$sql = $wpdb->get_col( 'SHOW TABLES', 0 );// phpcs:ignore |
| 207 |
foreach ( $sql as $table ) { |
| 208 |
if ( empty( $prefix ) || 0 === strpos( $table, $wpdb->prefix ) ) { |
| 209 |
$tables[] = $table; |
| 210 |
} |
| 211 |
} |
| 212 |
|
| 213 |
set_transient( CHART_BUILDER_DB_PREFIX . 'db_tables', $tables, HOUR_IN_SECONDS ); |
| 214 |
return $tables; |
| 215 |
} |
| 216 |
|
| 217 |
/** |
| 218 |
* Gets the column information for the table. |
| 219 |
* |
| 220 |
* @param string $table The table. |
| 221 |
* @param bool $prefix_with_table Whether to prefix column name with the name of the table. |
| 222 |
* @access private |
| 223 |
* @return array |
| 224 |
*/ |
| 225 |
private function get_db_table_columns( $table, $prefix_with_table = false ) { |
| 226 |
global $wpdb; |
| 227 |
$columns = get_transient( CHART_BUILDER_DB_PREFIX . "db_{$table}_columns" ); |
| 228 |
if ( $columns ) { |
| 229 |
return $columns; |
| 230 |
} |
| 231 |
$columns = array(); |
| 232 |
// @codingStandardsIgnoreStart |
| 233 |
$rows = $wpdb->get_results( "SHOW COLUMNS IN `$table`", ARRAY_N ); |
| 234 |
// @codingStandardsIgnoreEnd |
| 235 |
if ( $rows ) { |
| 236 |
// n => numeric, d => date-ish, s => string-ish. |
| 237 |
foreach ( $rows as $row ) { |
| 238 |
$col = ( $prefix_with_table ? "$table." : '' ) . $row[0]; |
| 239 |
$type = $row[1]; |
| 240 |
if ( strpos( $type, 'int' ) !== false || strpos( $type, 'float' ) !== false ) { |
| 241 |
$type = 'n'; |
| 242 |
} elseif ( strpos( $type, 'date' ) !== false || strpos( $type, 'time' ) !== false ) { |
| 243 |
$type = 'd'; |
| 244 |
} else { |
| 245 |
$type = 's'; |
| 246 |
} |
| 247 |
$columns[] = array( 'name' => $col, 'type' => $type ); |
| 248 |
} |
| 249 |
} |
| 250 |
|
| 251 |
set_transient( CHART_BUILDER_DB_PREFIX . "db_{$table}_columns", $columns, DAY_IN_SECONDS ); |
| 252 |
return $columns; |
| 253 |
} |
| 254 |
|
| 255 |
/** |
| 256 |
* Gets the dependent tables and then gets column information for all the tables. |
| 257 |
* |
| 258 |
* @param string $table The table. |
| 259 |
* @access public |
| 260 |
* @return array |
| 261 |
*/ |
| 262 |
public function get_table_columns( $table ) { |
| 263 |
$columns = array(); |
| 264 |
if ( ! $table ) { |
| 265 |
return $columns; |
| 266 |
} |
| 267 |
|
| 268 |
$tables = array( $table ); |
| 269 |
$mapping = $this->get_db_table_mapping(); |
| 270 |
if ( array_key_exists( $table, $mapping ) ) { |
| 271 |
$tables[] = $mapping[ $table ]; |
| 272 |
} |
| 273 |
foreach ( $tables as $table ) { |
| 274 |
$cols = $this->get_db_table_columns( $table, count( $tables ) > 1 ); |
| 275 |
$columns = array_merge( $columns, $cols ); |
| 276 |
} |
| 277 |
return $columns; |
| 278 |
} |
| 279 |
|
| 280 |
/** |
| 281 |
* Gets the relationship between tables in the database. |
| 282 |
* |
| 283 |
* @access public |
| 284 |
* @return array |
| 285 |
*/ |
| 286 |
public function get_db_table_mapping() { |
| 287 |
global $wpdb; |
| 288 |
$mapping = get_transient( CHART_BUILDER_DB_PREFIX . 'db_table_mapping' ); |
| 289 |
if ( $mapping ) { |
| 290 |
return $mapping; |
| 291 |
} |
| 292 |
// no need to provide x=>y and then y=>x as we will flip the array shortly. |
| 293 |
$mapping = array( |
| 294 |
$wpdb->prefix . 'posts' => $wpdb->prefix . 'postmeta', |
| 295 |
$wpdb->prefix . 'users' => $wpdb->prefix . 'usermeta', |
| 296 |
$wpdb->prefix . 'terms' => $wpdb->prefix . 'termmeta', |
| 297 |
$wpdb->prefix . 'comments' => $wpdb->prefix . 'commentmeta', |
| 298 |
); |
| 299 |
|
| 300 |
$mapping += array_flip( $mapping ); |
| 301 |
set_transient( CHART_BUILDER_DB_PREFIX . 'db_table_mapping', $mapping, HOUR_IN_SECONDS ); |
| 302 |
return $mapping; |
| 303 |
} |
| 304 |
|
| 305 |
/** |
| 306 |
* Creates HTML table from passed data |
| 307 |
* |
| 308 |
* @access public |
| 309 |
* @return string |
| 310 |
*/ |
| 311 |
public function get_table_html( $headers, $rows, $table_id = 'results' ) { |
| 312 |
ob_start(); |
| 313 |
?> |
| 314 |
<table cellspacing="0" width="100%" id="<?php echo esc_attr($table_id) ?>"> |
| 315 |
<thead> |
| 316 |
<tr> |
| 317 |
<?php |
| 318 |
foreach ( $headers as $header ) { |
| 319 |
if( empty( $header ) ){ |
| 320 |
continue; |
| 321 |
} |
| 322 |
echo '<th>' . esc_html($header) . '</th>'; |
| 323 |
} |
| 324 |
?> |
| 325 |
</tr> |
| 326 |
</thead> |
| 327 |
<tfoot> |
| 328 |
</tfoot> |
| 329 |
<tbody> |
| 330 |
<?php |
| 331 |
foreach ( $rows as $row ) { |
| 332 |
if( empty( $row ) ){ |
| 333 |
continue; |
| 334 |
} |
| 335 |
echo '<tr>'; |
| 336 |
foreach ( $row as $r ) { |
| 337 |
echo '<td>' . esc_html($r) . '</td>'; |
| 338 |
} |
| 339 |
echo '</tr>'; |
| 340 |
} |
| 341 |
?> |
| 342 |
</tbody> |
| 343 |
</table> |
| 344 |
<?php |
| 345 |
return ob_get_clean(); |
| 346 |
} |
| 347 |
|
| 348 |
/** |
| 349 |
* Gets the the queries from quiz maker database tables. |
| 350 |
* |
| 351 |
* @access public |
| 352 |
* @return array |
| 353 |
*/ |
| 354 |
public function get_quiz_query ($query, $quiz_id = null, $user_id = null) { |
| 355 |
global $wpdb; |
| 356 |
$reports_table = $wpdb->prefix . 'aysquiz_reports'; |
| 357 |
$quizes_table = $wpdb->prefix . 'aysquiz_quizes'; |
| 358 |
|
| 359 |
switch ($query) { |
| 360 |
case 'q1': |
| 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 |
| 363 |
break; |
| 364 |
case 'q2': |
| 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 |
| 367 |
break; |
| 368 |
case 'q3': |
| 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 |
| 371 |
break; |
| 372 |
case 'q4': |
| 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 |
| 375 |
break; |
| 376 |
case 'q5': |
| 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 |
| 379 |
break; |
| 380 |
case 'q6': |
| 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 |
| 383 |
break; |
| 384 |
default: |
| 385 |
break; |
| 386 |
} |
| 387 |
|
| 388 |
|
| 389 |
$message = empty($result) ? __( "There is no data for your query.", "chart-builder" ) : ""; |
| 390 |
return array( |
| 391 |
'message' => $message, |
| 392 |
'result' => $result, |
| 393 |
'query' => $sql |
| 394 |
); |
| 395 |
} |
| 396 |
|
| 397 |
/** |
| 398 |
* Gets all settings of google charts for admin area. |
| 399 |
* |
| 400 |
* @access public |
| 401 |
* @return array |
| 402 |
*/ |
| 403 |
public function get_chart_settings_google_admin($settings, $action, $source) { |
| 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'); |
| 405 |
|
| 406 |
$tooltip_trigger_options = array( |
| 407 |
"hover" => __("While hovering", "chart-builder"), |
| 408 |
"selection" => __("When selected", "chart-builder"), |
| 409 |
"none" => __("Disable", "chart-builder") |
| 410 |
); |
| 411 |
|
| 412 |
$tooltip_bold_options = array( |
| 413 |
"default" => __("Default", "chart-builder"), |
| 414 |
"true" => __("Enable", "chart-builder"), |
| 415 |
"false" => __("Disable", "chart-builder") |
| 416 |
); |
| 417 |
|
| 418 |
$tooltip_text_options = array( |
| 419 |
"value" => __("Value", "chart-builder"), |
| 420 |
"percentage" => __("Percent", "chart-builder"), |
| 421 |
"both" => __("Value & Percent", "chart-builder") |
| 422 |
); |
| 423 |
|
| 424 |
$focus_target_options = array( |
| 425 |
"datum" => __("Single data", "chart-builder"), |
| 426 |
"category" => __("Group data", "chart-builder"), |
| 427 |
); |
| 428 |
|
| 429 |
$legend_positions = array( |
| 430 |
"left" => __("Left of the chart", "chart-builder"), |
| 431 |
"right" => __("Right of the chart", "chart-builder"), |
| 432 |
"top" => __("Above the chart", "chart-builder"), |
| 433 |
"bottom" => __("Below the chart", "chart-builder"), |
| 434 |
"in" => __("Inside the chart", "chart-builder"), |
| 435 |
"labeled" => __("Labeled", "chart-builder"), |
| 436 |
"none" => __("Hide", "chart-builder") |
| 437 |
); |
| 438 |
|
| 439 |
$legend_alignments = array( |
| 440 |
"start" => __("Start", "chart-builder"), |
| 441 |
"center" => __("Center", "chart-builder"), |
| 442 |
"end" => __("End", "chart-builder"), |
| 443 |
); |
| 444 |
|
| 445 |
$slice_texts = array( |
| 446 |
"percentage" => __("Percentage", "chart-builder"), |
| 447 |
"value" => __("Quantitative value", "chart-builder"), |
| 448 |
"label" => __("Name", "chart-builder"), |
| 449 |
"none" => __("Disable", "chart-builder") |
| 450 |
); |
| 451 |
|
| 452 |
$axes_text_positions = array( |
| 453 |
"in" => __("Inside the chart", "chart-builder"), |
| 454 |
"out" => __("Outside the chart", "chart-builder"), |
| 455 |
"none" => __("Hide", "chart-builder") |
| 456 |
); |
| 457 |
|
| 458 |
$haxis_slanted_options = array( |
| 459 |
"automatic" => __("Automatic", "chart-builder"), |
| 460 |
"true" => __("True", "chart-builder"), |
| 461 |
"false" => __("False", "chart-builder") |
| 462 |
); |
| 463 |
|
| 464 |
$title_positions = array( |
| 465 |
"left" => __("Left", "chart-builder"), |
| 466 |
"right" => __("Right", "chart-builder"), |
| 467 |
"center" => __("Center", "chart-builder") |
| 468 |
); |
| 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 |
|
| 481 |
$animation_easing_options = array( |
| 482 |
"linear" => __("Linear", "chart-builder"), |
| 483 |
"in" => __("Ease in", "chart-builder"), |
| 484 |
"out" => __("Ease out", "chart-builder"), |
| 485 |
"inAndOut" => __("Ease in and out", "chart-builder") |
| 486 |
); |
| 487 |
|
| 488 |
$multiple_data_format_options = array( |
| 489 |
"category" => __("Category", "chart-builder"), |
| 490 |
"series" => __("Series", "chart-builder"), |
| 491 |
"auto" => __("Auto", "chart-builder"), |
| 492 |
"none" => __("None", "chart-builder"), |
| 493 |
); |
| 494 |
|
| 495 |
$point_shape_options = array( |
| 496 |
"circle" => __("Circle", "chart-builder"), |
| 497 |
"triangle" => __("Triangle", "chart-builder"), |
| 498 |
"square" => __("Square", "chart-builder"), |
| 499 |
"diamond" => __("Diamond", "chart-builder"), |
| 500 |
"star" => __("Star", "chart-builder"), |
| 501 |
"polygon" => __("Polygon", "chart-builder"), |
| 502 |
); |
| 503 |
|
| 504 |
$crosshair_trigger_options = array( |
| 505 |
"focus" => __("Focus", "chart-builder"), |
| 506 |
"selection" => __("Selection", "chart-builder"), |
| 507 |
"both" => __("Focus and Selection", "chart-builder"), |
| 508 |
"none" => __("Disable", "chart-builder"), |
| 509 |
); |
| 510 |
|
| 511 |
$crosshair_orientation_options = array( |
| 512 |
"vertical" => __("Vertical", "chart-builder"), |
| 513 |
"horizontal" => __("Horizontal", "chart-builder"), |
| 514 |
"both" => __("Both", "chart-builder"), |
| 515 |
); |
| 516 |
|
| 517 |
$axes_format_options = array( |
| 518 |
"" => __("None", "chart-builder"), |
| 519 |
"decimal" => __("Decimal", "chart-builder"), |
| 520 |
"scientific" => __("Scientific", "chart-builder"), |
| 521 |
"currency" => __("Currency", "chart-builder"), |
| 522 |
"percent" => __("Percent", "chart-builder"), |
| 523 |
"short" => __("Short", "chart-builder"), |
| 524 |
"long" => __("Long", "chart-builder"), |
| 525 |
); |
| 526 |
|
| 527 |
$group_width_format_options = array( |
| 528 |
"%" => __("%", "chart-builder"), |
| 529 |
"px" => __("px", "chart-builder"), |
| 530 |
); |
| 531 |
|
| 532 |
$position_styles = array( |
| 533 |
"left" => 'margin-left:0', |
| 534 |
"right" => 'margin-right:0', |
| 535 |
"center" => 'margin:auto', |
| 536 |
); |
| 537 |
|
| 538 |
$org_chart_font_size_options = array( |
| 539 |
"small" => __("Small", "chart-builder"), |
| 540 |
"medium" => __("Medium", "chart-builder"), |
| 541 |
"large" => __("Large", "chart-builder"), |
| 542 |
); |
| 543 |
|
| 544 |
$text_transforms = array( |
| 545 |
"uppercase" => __("Uppercase", "chart-builder"), |
| 546 |
"lowercase" => __("Lowercase", "chart-builder"), |
| 547 |
"capitalize" => __("Capitalize", "chart-builder"), |
| 548 |
"none" => __("None", "chart-builder"), |
| 549 |
); |
| 550 |
|
| 551 |
$text_decorations = array( |
| 552 |
"overline" => __("Overline", "chart-builder"), |
| 553 |
"underline" => __("Underline", "chart-builder"), |
| 554 |
"line-through" => __("Line through", "chart-builder"), |
| 555 |
"none" => __("None", "chart-builder"), |
| 556 |
); |
| 557 |
|
| 558 |
// Width |
| 559 |
$settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100'; |
| 560 |
$settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%'; |
| 561 |
$settings['width_format_options'] = $group_width_format_options; |
| 562 |
|
| 563 |
// responsive width |
| 564 |
$settings['responsive_width'] = ( isset( $settings['responsive_width'] ) && $settings['responsive_width'] != '' ) ? $settings['responsive_width'] : 'off'; |
| 565 |
$settings['responsive_width'] = isset( $settings['responsive_width'] ) && $settings['responsive_width'] == 'on' ? 'checked' : ''; |
| 566 |
|
| 567 |
// position |
| 568 |
$settings['position'] = isset( $settings['position'] ) && $settings['position'] != '' ? esc_attr( $settings['position'] ) : 'center'; |
| 569 |
$settings['position_styles'] = $position_styles; |
| 570 |
|
| 571 |
// Height |
| 572 |
$settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '400'; |
| 573 |
$settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : 'px'; |
| 574 |
|
| 575 |
// Font size |
| 576 |
$settings['font_size'] = isset( $settings['font_size'] ) && $settings['font_size'] != '' ? esc_attr( $settings['font_size'] ) : '15'; |
| 577 |
|
| 578 |
// Background color |
| 579 |
$settings['background_color'] = isset( $settings['background_color'] ) && $settings['background_color'] != '' ? esc_attr( $settings['background_color'] ) : '#ffffff'; |
| 580 |
|
| 581 |
// Transparent background |
| 582 |
$settings['transparent_background'] = isset( $settings['transparent_background'] ) && $settings['transparent_background'] != '' ? esc_attr( $settings['transparent_background'] ) : 'off'; |
| 583 |
$settings['transparent_background'] = isset( $settings['transparent_background'] ) && $settings['transparent_background'] == 'on' ? 'checked' : ''; |
| 584 |
|
| 585 |
// Box shadow |
| 586 |
$settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off'; |
| 587 |
$settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : ''; |
| 588 |
|
| 589 |
// Border width |
| 590 |
$settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0'; |
| 591 |
|
| 592 |
// Border radius |
| 593 |
$settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0'; |
| 594 |
|
| 595 |
// Border color |
| 596 |
$settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#666666'; |
| 597 |
|
| 598 |
// Border style |
| 599 |
$settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid'; |
| 600 |
|
| 601 |
// Border width with title |
| 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'; |
| 603 |
|
| 604 |
// Border radius with title |
| 605 |
$settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0'; |
| 606 |
|
| 607 |
// Border color with title |
| 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'; |
| 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 |
|
| 617 |
// Box shadow color |
| 618 |
$settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color']; |
| 619 |
|
| 620 |
// Chart Area background color |
| 621 |
$settings['chart_background_color'] = isset( $settings['chart_background_color'] ) && $settings['chart_background_color'] != '' ? esc_attr( $settings['chart_background_color'] ) : '#ffffff'; |
| 622 |
|
| 623 |
// Chart Area border width |
| 624 |
$settings['chart_border_width'] = isset( $settings['chart_border_width'] ) && $settings['chart_border_width'] != '' ? esc_attr( $settings['chart_border_width'] ) : '0'; |
| 625 |
|
| 626 |
// Chart Area border color |
| 627 |
$settings['chart_border_color'] = isset( $settings['chart_border_color'] ) && $settings['chart_border_color'] != '' ? esc_attr( $settings['chart_border_color'] ) : '#666666'; |
| 628 |
|
| 629 |
// Chart Area left margin |
| 630 |
$settings['chart_left_margin'] = isset( $settings['chart_left_margin'] ) && $settings['chart_left_margin'] != '' ? esc_attr( $settings['chart_left_margin'] ) : ''; |
| 631 |
$settings['chart_left_margin_for_js'] = isset( $settings['chart_left_margin'] ) && $settings['chart_left_margin'] != '' ? esc_attr( $settings['chart_left_margin'] ) : 'auto'; |
| 632 |
|
| 633 |
// Chart Area right margin |
| 634 |
$settings['chart_right_margin'] = isset( $settings['chart_right_margin'] ) && $settings['chart_right_margin'] != '' ? esc_attr( $settings['chart_right_margin'] ) : ''; |
| 635 |
$settings['chart_right_margin_for_js'] = isset( $settings['chart_right_margin'] ) && $settings['chart_right_margin'] != '' ? esc_attr( $settings['chart_right_margin'] ) : 'auto'; |
| 636 |
|
| 637 |
// Chart Area top margin |
| 638 |
$settings['chart_top_margin'] = isset( $settings['chart_top_margin'] ) && $settings['chart_top_margin'] != '' ? esc_attr( $settings['chart_top_margin'] ) : ''; |
| 639 |
$settings['chart_top_margin_for_js'] = isset( $settings['chart_top_margin'] ) && $settings['chart_top_margin'] != '' ? esc_attr( $settings['chart_top_margin'] ) : 'auto'; |
| 640 |
|
| 641 |
// Chart Area bottom margin |
| 642 |
$settings['chart_bottom_margin'] = isset( $settings['chart_bottom_margin'] ) && $settings['chart_bottom_margin'] != '' ? esc_attr( $settings['chart_bottom_margin'] ) : ''; |
| 643 |
$settings['chart_bottom_margin_for_js'] = isset( $settings['chart_bottom_margin'] ) && $settings['chart_bottom_margin'] != '' ? esc_attr( $settings['chart_bottom_margin'] ) : 'auto'; |
| 644 |
|
| 645 |
// Title color |
| 646 |
$settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000'; |
| 647 |
|
| 648 |
// Title color |
| 649 |
$settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color']; |
| 650 |
|
| 651 |
// Title font size |
| 652 |
$settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30'; |
| 653 |
|
| 654 |
// Title Bold text |
| 655 |
$settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on'; |
| 656 |
$settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] == 'on' ? 'checked' : ''; |
| 657 |
|
| 658 |
// Title text shadow |
| 659 |
$settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off'; |
| 660 |
$settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : ''; |
| 661 |
|
| 662 |
// Title italic text |
| 663 |
$settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off'; |
| 664 |
$settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] == 'on' ? 'checked' : ''; |
| 665 |
|
| 666 |
// Title gap |
| 667 |
$settings['title_gap'] = isset( $settings['title_gap'] ) && $settings['title_gap'] != '' ? esc_attr( $settings['title_gap'] ) : '5'; |
| 668 |
|
| 669 |
// Title gap |
| 670 |
$settings['title_gap_description'] = isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '' ? esc_attr( $settings['title_gap_description'] ) : '5'; |
| 671 |
|
| 672 |
// Title letter spacing |
| 673 |
$settings['title_letter_spacing'] = isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '' ? esc_attr( $settings['title_letter_spacing'] ) : 0; |
| 674 |
|
| 675 |
// Title position |
| 676 |
$settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left'; |
| 677 |
$settings['title_positions'] = $title_positions; |
| 678 |
|
| 679 |
// Title text transform |
| 680 |
$settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none'; |
| 681 |
$settings['text_transforms'] = $text_transforms; |
| 682 |
|
| 683 |
// Title text decoration |
| 684 |
$settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none'; |
| 685 |
$settings['text_decorations'] = $text_decorations; |
| 686 |
|
| 687 |
// description color |
| 688 |
$settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c'; |
| 689 |
|
| 690 |
// description font size |
| 691 |
$settings['description_font_size'] = isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '' ? esc_attr( $settings['description_font_size'] ) : '16'; |
| 692 |
|
| 693 |
// description Bold text |
| 694 |
$settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off'; |
| 695 |
$settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] == 'on' ? 'checked' : ''; |
| 696 |
|
| 697 |
// description text shadow |
| 698 |
$settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off'; |
| 699 |
$settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : ''; |
| 700 |
|
| 701 |
// description color |
| 702 |
$settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color']; |
| 703 |
|
| 704 |
// description italic text |
| 705 |
$settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off'; |
| 706 |
$settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] == 'on' ? 'checked' : ''; |
| 707 |
|
| 708 |
// description position |
| 709 |
$settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left'; |
| 710 |
|
| 711 |
// description text transform |
| 712 |
$settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none'; |
| 713 |
|
| 714 |
// description letter spacing |
| 715 |
$settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0; |
| 716 |
|
| 717 |
// description text decoration |
| 718 |
$settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none'; |
| 719 |
|
| 720 |
// Rotation degree |
| 721 |
$settings['rotation_degree'] = isset( $settings['rotation_degree'] ) && $settings['rotation_degree'] != '' ? esc_attr( $settings['rotation_degree'] ) : '0'; |
| 722 |
|
| 723 |
// Is stacked |
| 724 |
$settings['is_stacked'] = ( isset( $settings['is_stacked'] ) && $settings['is_stacked'] != '' ) ? $settings['is_stacked'] : 'off'; |
| 725 |
$settings['is_stacked'] = isset( $settings['is_stacked'] ) && $settings['is_stacked'] == 'on' ? 'checked' : ''; |
| 726 |
|
| 727 |
// Line width |
| 728 |
$settings['line_width'] = isset( $settings['line_width'] ) && $settings['line_width'] != '' ? esc_attr( $settings['line_width'] ) : '2'; |
| 729 |
|
| 730 |
// Slice border color |
| 731 |
$settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff'; |
| 732 |
|
| 733 |
// Reverse categories |
| 734 |
$settings['reverse_categories'] = ( isset( $settings['reverse_categories'] ) && $settings['reverse_categories'] != '' ) ? $settings['reverse_categories'] : 'off'; |
| 735 |
$settings['reverse_categories'] = isset( $settings['reverse_categories'] ) && $settings['reverse_categories'] == 'on' ? 'checked' : ''; |
| 736 |
|
| 737 |
// Slice text |
| 738 |
$settings['slice_text'] = isset( $settings['slice_text'] ) && $settings['slice_text'] != '' ? esc_attr( $settings['slice_text'] ) : 'percentage'; |
| 739 |
$settings['slice_texts'] = $slice_texts; |
| 740 |
|
| 741 |
// Tooltip trigger |
| 742 |
$settings['tooltip_trigger'] = isset( $settings['tooltip_trigger'] ) && $settings['tooltip_trigger'] != '' ? esc_attr( $settings['tooltip_trigger'] ) : 'hover'; |
| 743 |
$settings['tooltip_trigger_options'] = $tooltip_trigger_options; |
| 744 |
|
| 745 |
// Tooltip text |
| 746 |
$settings['tooltip_text'] = isset( $settings['tooltip_text'] ) && $settings['tooltip_text'] != '' ? esc_attr( $settings['tooltip_text'] ) : 'both'; |
| 747 |
$settings['tooltip_text_options'] = $tooltip_text_options; |
| 748 |
|
| 749 |
// Multiple data format |
| 750 |
$settings['multiple_data_format'] = isset( $settings['multiple_data_format'] ) && $settings['multiple_data_format'] != '' ? esc_attr( $settings['multiple_data_format'] ) : 'auto'; |
| 751 |
$settings['multiple_data_format_options'] = $multiple_data_format_options; |
| 752 |
|
| 753 |
// Data grouping settings |
| 754 |
$settings['data_grouping_limit'] = isset( $settings['data_grouping_limit'] ) && $settings['data_grouping_limit'] != '' ? esc_attr( $settings['data_grouping_limit'] ) : '0.5'; |
| 755 |
$settings['data_grouping_label'] = isset( $settings['data_grouping_label'] ) && $settings['data_grouping_label'] != '' ? esc_attr( $settings['data_grouping_label'] ) : 'Other'; |
| 756 |
$settings['data_grouping_color'] = isset( $settings['data_grouping_color'] ) && $settings['data_grouping_color'] != '' ? esc_attr( $settings['data_grouping_color'] ) : '#ccc'; |
| 757 |
|
| 758 |
// Focus target |
| 759 |
$settings['focus_target'] = isset( $settings['focus_target'] ) && $settings['focus_target'] != '' ? esc_attr( $settings['focus_target'] ) : 'datum'; |
| 760 |
$settings['focus_target_options'] = $focus_target_options; |
| 761 |
|
| 762 |
// Show color code |
| 763 |
$settings['show_color_code'] = ( isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ) ? $settings['show_color_code'] : 'off'; |
| 764 |
$settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : ''; |
| 765 |
|
| 766 |
// Italic text |
| 767 |
$settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off'; |
| 768 |
$settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'on' ? 'checked' : ''; |
| 769 |
|
| 770 |
// Bold text |
| 771 |
$settings['tooltip_bold'] = isset( $settings['tooltip_bold'] ) && $settings['tooltip_bold'] != '' ? esc_attr( $settings['tooltip_bold'] ) : 'default'; |
| 772 |
$settings['tooltip_bold_options'] = $tooltip_bold_options; |
| 773 |
|
| 774 |
// Tooltip text color |
| 775 |
$settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#000000'; |
| 776 |
|
| 777 |
// Tooltip font size |
| 778 |
$settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : $settings['font_size']; |
| 779 |
|
| 780 |
// Legend position |
| 781 |
$settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'right'; |
| 782 |
$settings['legend_positions'] = $legend_positions; |
| 783 |
|
| 784 |
// Legend alignment |
| 785 |
$settings['legend_alignment'] = isset( $settings['legend_alignment'] ) && $settings['legend_alignment'] != '' ? esc_attr( $settings['legend_alignment'] ) : 'start'; |
| 786 |
$settings['legend_alignments'] = $legend_alignments; |
| 787 |
|
| 788 |
// Legend font color |
| 789 |
$settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000'; |
| 790 |
|
| 791 |
// Legend font size |
| 792 |
$settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : $settings['font_size']; |
| 793 |
|
| 794 |
// Legend Italic text |
| 795 |
$settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off'; |
| 796 |
$settings['legend_italic'] = isset( $settings['legend_italic'] ) && $settings['legend_italic'] == 'on' ? 'checked' : ''; |
| 797 |
|
| 798 |
// Legend Bold text |
| 799 |
$settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off'; |
| 800 |
$settings['legend_bold'] = isset( $settings['legend_bold'] ) && $settings['legend_bold'] == 'on' ? 'checked' : ''; |
| 801 |
|
| 802 |
// Opacity |
| 803 |
$settings['opacity'] = isset( $settings['opacity'] ) && $settings['opacity'] != '' ? esc_attr( $settings['opacity'] ) : '1.0'; |
| 804 |
|
| 805 |
// Group width |
| 806 |
$settings['group_width'] = isset( $settings['group_width'] ) && $settings['group_width'] != '' ? esc_attr( $settings['group_width'] ) : '61.8'; |
| 807 |
$settings['group_width_format'] = isset( $settings['group_width_format'] ) && $settings['group_width_format'] != '' ? esc_attr( $settings['group_width_format'] ) : '%'; |
| 808 |
$settings['group_width_format_options'] = $group_width_format_options; |
| 809 |
|
| 810 |
// Show chart description |
| 811 |
if (!isset($settings['show_description'])) { |
| 812 |
$settings['show_description'] = 'checked'; |
| 813 |
} else { |
| 814 |
$settings['show_description'] = ( $settings['show_description'] != '' ) ? $settings['show_description'] : 'off'; |
| 815 |
$settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] == 'on' ? 'checked' : ''; |
| 816 |
} |
| 817 |
|
| 818 |
// Show chart title |
| 819 |
if (!isset($settings['show_title'])) { |
| 820 |
$settings['show_title'] = 'checked'; |
| 821 |
} else { |
| 822 |
$settings['show_title'] = ( $settings['show_title'] != '' ) ? $settings['show_title'] : 'off'; |
| 823 |
$settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] == 'on' ? 'checked' : ''; |
| 824 |
} |
| 825 |
|
| 826 |
// Enable interactivity |
| 827 |
if (!isset($settings['enable_interactivity'])) { |
| 828 |
$settings['enable_interactivity'] = 'checked'; |
| 829 |
} else { |
| 830 |
$settings['enable_interactivity'] = ( $settings['enable_interactivity'] != '' ) ? $settings['enable_interactivity'] : 'off'; |
| 831 |
$settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] == 'on' ? 'checked' : ''; |
| 832 |
} |
| 833 |
|
| 834 |
// Maximized view |
| 835 |
$settings['maximized_view'] = ( isset( $settings['maximized_view'] ) && $settings['maximized_view'] != '' ) ? $settings['maximized_view'] : 'off'; |
| 836 |
$settings['maximized_view'] = isset( $settings['maximized_view'] ) && $settings['maximized_view'] == 'on' ? 'checked' : ''; |
| 837 |
|
| 838 |
// Multiple data selection |
| 839 |
$settings['multiple_selection'] = ( isset( $settings['multiple_selection'] ) && $settings['multiple_selection'] != '' ) ? $settings['multiple_selection'] : 'off'; |
| 840 |
$settings['multiple_selection'] = isset( $settings['multiple_selection'] ) && $settings['multiple_selection'] == 'on' ? 'checked' : ''; |
| 841 |
|
| 842 |
// Point shape |
| 843 |
$settings['point_shape'] = isset( $settings['point_shape'] ) && $settings['point_shape'] != '' ? esc_attr( $settings['point_shape'] ) : 'circle'; |
| 844 |
$settings['point_shape_options'] = $point_shape_options; |
| 845 |
|
| 846 |
// Point size |
| 847 |
$settings['point_size'] = isset( $settings['point_size'] ) && $settings['point_size'] != '' ? absint(esc_attr( $settings['point_size'] )) : '0'; |
| 848 |
|
| 849 |
// Crosshair trigger |
| 850 |
$settings['crosshair_trigger'] = isset( $settings['crosshair_trigger'] ) && $settings['crosshair_trigger'] != '' ? esc_attr( $settings['crosshair_trigger'] ) : 'none'; |
| 851 |
$settings['crosshair_trigger_options'] = $crosshair_trigger_options; |
| 852 |
|
| 853 |
// Crosshair orientation |
| 854 |
$settings['crosshair_orientation'] = isset( $settings['crosshair_orientation'] ) && $settings['crosshair_orientation'] != '' ? esc_attr( $settings['crosshair_orientation'] ) : 'both'; |
| 855 |
$settings['crosshair_orientation_options'] = $crosshair_orientation_options; |
| 856 |
|
| 857 |
// Crosshair opacity |
| 858 |
$settings['crosshair_opacity'] = isset( $settings['crosshair_opacity'] ) && $settings['crosshair_opacity'] != '' ? esc_attr( $settings['crosshair_opacity'] ) : '1.0'; |
| 859 |
|
| 860 |
// Dash style |
| 861 |
$settings['dash_style'] = isset( $settings['dash_style'] ) && $settings['dash_style'] != '' ? esc_attr( str_replace(' ', '', $settings['dash_style']) ) : ''; |
| 862 |
|
| 863 |
// Orientation |
| 864 |
$settings['orientation'] = ( isset( $settings['orientation'] ) && $settings['orientation'] != '' ) ? $settings['orientation'] : 'off'; |
| 865 |
$settings['orientation'] = isset( $settings['orientation'] ) && $settings['orientation'] == 'on' ? 'checked' : ''; |
| 866 |
|
| 867 |
// Fill nulls |
| 868 |
$settings['fill_nulls'] = ( isset( $settings['fill_nulls'] ) && $settings['fill_nulls'] != '' ) ? $settings['fill_nulls'] : 'off'; |
| 869 |
$settings['fill_nulls'] = isset( $settings['fill_nulls'] ) && $settings['fill_nulls'] == 'on' ? 'checked' : ''; |
| 870 |
|
| 871 |
// Font size for org chart |
| 872 |
$settings['org_chart_font_size'] = isset( $settings['org_chart_font_size'] ) && $settings['org_chart_font_size'] != '' ? esc_attr( $settings['org_chart_font_size'] ) : 'medium'; |
| 873 |
$settings['org_chart_font_size_options'] = $org_chart_font_size_options; |
| 874 |
|
| 875 |
// Donut hole size |
| 876 |
$settings['donut_hole_size'] = isset( $settings['donut_hole_size'] ) && $settings['donut_hole_size'] != '' ? esc_attr( $settings['donut_hole_size'] ) : '0.4'; |
| 877 |
|
| 878 |
// Allow collapse |
| 879 |
$settings['allow_collapse'] = ( isset( $settings['allow_collapse'] ) && $settings['allow_collapse'] != '' ) ? $settings['allow_collapse'] : 'off'; |
| 880 |
$settings['allow_collapse'] = isset( $settings['allow_collapse'] ) && $settings['allow_collapse'] == 'on' ? 'checked' : ''; |
| 881 |
|
| 882 |
// Org custom css class |
| 883 |
$settings['org_classname'] = isset( $settings['org_classname'] ) && $settings['org_classname'] != '' ? esc_attr( $settings['org_classname'] ) : ''; |
| 884 |
|
| 885 |
$settings['org_node_background_color'] = isset( $settings['org_node_background_color'] ) && $settings['org_node_background_color'] != '' ? esc_attr( $settings['org_node_background_color'] ) : '#edf7ff'; |
| 886 |
$settings['org_node_padding'] = isset( $settings['org_node_padding'] ) && $settings['org_node_padding'] != '' ? esc_attr( $settings['org_node_padding'] ) : '2'; |
| 887 |
$settings['org_node_border_radius'] = isset( $settings['org_node_border_radius'] ) && $settings['org_node_border_radius'] != '' ? esc_attr( $settings['org_node_border_radius'] ) : '5'; |
| 888 |
$settings['org_node_border_width'] = isset( $settings['org_node_border_width'] ) && $settings['org_node_border_width'] != '' ? esc_attr( $settings['org_node_border_width'] ) : '0'; |
| 889 |
$settings['org_node_border_color'] = isset( $settings['org_node_border_color'] ) && $settings['org_node_border_color'] != '' ? esc_attr( $settings['org_node_border_color'] ) : '#b5d9ea'; |
| 890 |
$settings['org_node_text_color'] = isset( $settings['org_node_text_color'] ) && $settings['org_node_text_color'] != '' ? esc_attr( $settings['org_node_text_color'] ) : '#000000'; |
| 891 |
$settings['org_node_text_font_size'] = isset( $settings['org_node_text_font_size'] ) && $settings['org_node_text_font_size'] != '' ? esc_attr( $settings['org_node_text_font_size'] ) : '13'; |
| 892 |
$settings['org_node_description_font_color'] = isset( $settings['org_node_description_font_color'] ) && $settings['org_node_description_font_color'] != '' ? esc_attr( $settings['org_node_description_font_color'] ) : '#ff0000'; |
| 893 |
$settings['org_node_description_font_size'] = isset( $settings['org_node_description_font_size'] ) && $settings['org_node_description_font_size'] != '' ? esc_attr( $settings['org_node_description_font_size'] ) : '13'; |
| 894 |
|
| 895 |
// Org custom selected css class |
| 896 |
$settings['org_selected_classname'] = isset( $settings['org_selected_classname'] ) && $settings['org_selected_classname'] != '' ? esc_attr( $settings['org_selected_classname'] ) : ''; |
| 897 |
|
| 898 |
$settings['org_selected_node_background_color'] = isset( $settings['org_selected_node_background_color'] ) && $settings['org_selected_node_background_color'] != '' ? esc_attr( $settings['org_selected_node_background_color'] ) : '#fff7ae'; |
| 899 |
$settings['org_selected_node_text_color'] = isset( $settings['org_selected_node_text_color'] ) && $settings['org_selected_node_text_color'] != '' ? esc_attr( $settings['org_selected_node_text_color'] ) : $settings['org_node_text_color']; |
| 900 |
|
| 901 |
|
| 902 |
$settings['axes_text_positions'] = $axes_text_positions; |
| 903 |
$settings['axes_format_options'] = $axes_format_options; |
| 904 |
// Horizontal axis settings |
| 905 |
$settings['haxis_title'] = isset( $settings['haxis_title'] ) && $settings['haxis_title'] != '' ? esc_attr( $settings['haxis_title'] ) : ''; |
| 906 |
$settings['haxis_label_font_size'] = isset( $settings['haxis_label_font_size'] ) && $settings['haxis_label_font_size'] != '' ? esc_attr( $settings['haxis_label_font_size'] ) : $settings['font_size']; |
| 907 |
$settings['haxis_label_color'] = isset( $settings['haxis_label_color'] ) && $settings['haxis_label_color'] != '' ? esc_attr( $settings['haxis_label_color'] ) : '#000000'; |
| 908 |
$settings['haxis_text_position'] = isset( $settings['haxis_text_position'] ) && $settings['haxis_text_position'] != '' ? esc_attr( $settings['haxis_text_position'] ) : 'out'; |
| 909 |
$settings['haxis_direction'] = ( isset( $settings['haxis_direction'] ) && $settings['haxis_direction'] != '' ) ? $settings['haxis_direction'] : '1'; |
| 910 |
$settings['haxis_direction'] = isset( $settings['haxis_direction'] ) && $settings['haxis_direction'] == '-1' ? 'checked' : ''; |
| 911 |
$settings['haxis_text_color'] = isset( $settings['haxis_text_color'] ) && $settings['haxis_text_color'] != '' ? esc_attr( $settings['haxis_text_color'] ) : '#000000'; |
| 912 |
$settings['haxis_baseline_color'] = isset( $settings['haxis_baseline_color'] ) && $settings['haxis_baseline_color'] != '' ? esc_attr( $settings['haxis_baseline_color'] ) : '#000000'; |
| 913 |
$settings['haxis_text_font_size'] = isset( $settings['haxis_text_font_size'] ) && $settings['haxis_text_font_size'] != '' ? absint(esc_attr( $settings['haxis_text_font_size'] )) : $settings['font_size']; |
| 914 |
$settings['haxis_slanted_options'] = $haxis_slanted_options; |
| 915 |
$settings['haxis_slanted'] = isset( $settings['haxis_slanted'] ) && $settings['haxis_slanted'] != '' ? esc_attr( $settings['haxis_slanted'] ) : 'automatic'; |
| 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'; |
| 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'; |
| 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' : ''; |
| 921 |
$settings['haxis_max_value'] = isset( $settings['haxis_max_value'] ) && $settings['haxis_max_value'] != '' ? esc_attr( $settings['haxis_max_value'] ) : null; |
| 922 |
$settings['haxis_min_value'] = isset( $settings['haxis_min_value'] ) && $settings['haxis_min_value'] != '' ? esc_attr( $settings['haxis_min_value'] ) : null; |
| 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'; |
| 924 |
$settings['haxis_italic'] = isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] == 'on' ? 'checked' : ''; |
| 925 |
$settings['haxis_bold'] = ( isset( $settings['haxis_bold'] ) && $settings['haxis_bold'] != '' ) ? $settings['haxis_bold'] : 'off'; |
| 926 |
$settings['haxis_bold'] = isset( $settings['haxis_bold'] ) && $settings['haxis_bold'] == 'on' ? 'checked' : ''; |
| 927 |
$settings['haxis_title_italic'] = ( isset( $settings['haxis_title_italic'] ) && $settings['haxis_title_italic'] != '' ) ? $settings['haxis_title_italic'] : 'off'; |
| 928 |
$settings['haxis_title_italic'] = isset( $settings['haxis_title_italic'] ) && $settings['haxis_title_italic'] == 'on' ? 'checked' : ''; |
| 929 |
$settings['haxis_title_bold'] = ( isset( $settings['haxis_title_bold'] ) && $settings['haxis_title_bold'] != '' ) ? $settings['haxis_title_bold'] : 'off'; |
| 930 |
$settings['haxis_title_bold'] = isset( $settings['haxis_title_bold'] ) && $settings['haxis_title_bold'] == 'on' ? 'checked' : ''; |
| 931 |
$settings['haxis_gridlines_color'] = isset( $settings['haxis_gridlines_color'] ) && $settings['haxis_gridlines_color'] != '' ? esc_attr( $settings['haxis_gridlines_color'] ) : '#cccccc'; |
| 932 |
$settings['haxis_minor_gridlines_color'] = isset( $settings['haxis_minor_gridlines_color'] ) && $settings['haxis_minor_gridlines_color'] != '' ? esc_attr( $settings['haxis_minor_gridlines_color'] ) : $settings['haxis_gridlines_color']; |
| 933 |
|
| 934 |
// Vertical axis settings |
| 935 |
$settings['vaxis_title'] = isset( $settings['vaxis_title'] ) && $settings['vaxis_title'] != '' ? esc_attr( $settings['vaxis_title'] ) : ''; |
| 936 |
$settings['vaxis_label_font_size'] = isset( $settings['vaxis_label_font_size'] ) && $settings['vaxis_label_font_size'] != '' ? esc_attr( $settings['vaxis_label_font_size'] ) : $settings['font_size']; |
| 937 |
$settings['vaxis_label_color'] = isset( $settings['vaxis_label_color'] ) && $settings['vaxis_label_color'] != '' ? esc_attr( $settings['vaxis_label_color'] ) : '#000000'; |
| 938 |
$settings['vaxis_text_position'] = isset( $settings['vaxis_text_position'] ) && $settings['vaxis_text_position'] != '' ? esc_attr( $settings['vaxis_text_position'] ) : 'out'; |
| 939 |
$settings['vaxis_direction'] = ( isset( $settings['vaxis_direction'] ) && $settings['vaxis_direction'] != '' ) ? $settings['vaxis_direction'] : '1'; |
| 940 |
$settings['vaxis_direction'] = isset( $settings['vaxis_direction'] ) && $settings['vaxis_direction'] == '-1' ? 'checked' : ''; |
| 941 |
$settings['vaxis_text_color'] = isset( $settings['vaxis_text_color'] ) && $settings['vaxis_text_color'] != '' ? esc_attr( $settings['vaxis_text_color'] ) : '#000000'; |
| 942 |
$settings['vaxis_baseline_color'] = isset( $settings['vaxis_baseline_color'] ) && $settings['vaxis_baseline_color'] != '' ? esc_attr( $settings['vaxis_baseline_color'] ) : '#000000'; |
| 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']; |
| 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' : ''; |
| 947 |
$settings['vaxis_max_value'] = isset( $settings['vaxis_max_value'] ) && $settings['vaxis_max_value'] != '' ? esc_attr( $settings['vaxis_max_value'] ) : null; |
| 948 |
$settings['vaxis_min_value'] = isset( $settings['vaxis_min_value'] ) && $settings['vaxis_min_value'] != '' ? esc_attr( $settings['vaxis_min_value'] ) : null; |
| 949 |
$settings['vaxis_gridlines_count'] = isset( $settings['vaxis_gridlines_count'] ) && $settings['vaxis_gridlines_count'] != '' ? esc_attr( $settings['vaxis_gridlines_count'] ) : -1; |
| 950 |
$settings['vaxis_italic'] = ( isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] != '' ) ? $settings['vaxis_italic'] : 'off'; |
| 951 |
$settings['vaxis_italic'] = isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] == 'on' ? 'checked' : ''; |
| 952 |
$settings['vaxis_bold'] = ( isset( $settings['vaxis_bold'] ) && $settings['vaxis_bold'] != '' ) ? $settings['vaxis_bold'] : 'off'; |
| 953 |
$settings['vaxis_bold'] = isset( $settings['vaxis_bold'] ) && $settings['vaxis_bold'] == 'on' ? 'checked' : ''; |
| 954 |
$settings['vaxis_title_italic'] = ( isset( $settings['vaxis_title_italic'] ) && $settings['vaxis_title_italic'] != '' ) ? $settings['vaxis_title_italic'] : 'off'; |
| 955 |
$settings['vaxis_title_italic'] = isset( $settings['vaxis_title_italic'] ) && $settings['vaxis_title_italic'] == 'on' ? 'checked' : ''; |
| 956 |
$settings['vaxis_title_bold'] = ( isset( $settings['vaxis_title_bold'] ) && $settings['vaxis_title_bold'] != '' ) ? $settings['vaxis_title_bold'] : 'off'; |
| 957 |
$settings['vaxis_title_bold'] = isset( $settings['vaxis_title_bold'] ) && $settings['vaxis_title_bold'] == 'on' ? 'checked' : ''; |
| 958 |
$settings['vaxis_gridlines_color'] = isset( $settings['vaxis_gridlines_color'] ) && $settings['vaxis_gridlines_color'] != '' ? esc_attr( $settings['vaxis_gridlines_color'] ) : '#cccccc'; |
| 959 |
$settings['vaxis_minor_gridlines_color'] = isset( $settings['vaxis_minor_gridlines_color'] ) && $settings['vaxis_minor_gridlines_color'] != '' ? esc_attr( $settings['vaxis_minor_gridlines_color'] ) : $settings['vaxis_gridlines_color']; |
| 960 |
|
| 961 |
// Animation settings |
| 962 |
$settings['enable_animation'] = ( isset( $settings['enable_animation'] ) && $settings['enable_animation'] != '' ) ? $settings['enable_animation'] : 'off'; |
| 963 |
$settings['enable_animation'] = isset( $settings['enable_animation'] ) && $settings['enable_animation'] == 'on' ? 'checked' : ''; |
| 964 |
$settings['animation_duration'] = isset( $settings['animation_duration'] ) && $settings['animation_duration'] != '' ? absint(esc_attr( $settings['animation_duration'] )) : '1000'; |
| 965 |
$settings['animation_startup'] = ( isset( $settings['animation_startup'] ) && $settings['animation_startup'] != '' ) ? $settings['animation_startup'] : 'on'; |
| 966 |
$settings['animation_startup'] = isset( $settings['animation_startup'] ) && $settings['animation_startup'] == 'on' ? 'checked' : ''; |
| 967 |
$settings['animation_easing_options'] = $animation_easing_options; |
| 968 |
$settings['animation_easing'] = isset( $settings['animation_easing'] ) && $settings['animation_easing'] != '' ? esc_attr( $settings['animation_easing'] ) : 'linear'; |
| 969 |
|
| 970 |
$settings['enable_img'] = ( isset( $settings['enable_img'] ) && $settings['enable_img'] != '' ) ? $settings['enable_img'] : 'off'; |
| 971 |
$settings['enable_img'] = isset( $settings['enable_img'] ) && $settings['enable_img'] == 'on' ? 'checked' : ''; |
| 972 |
|
| 973 |
$counting_source = !empty($source) ? $source : array(); |
| 974 |
|
| 975 |
$count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0; |
| 976 |
$count_series = (isset($counting_source[0]) && !is_null($counting_source[0]) && count($counting_source[0]) > 0) ? count($counting_source[0]) - 1 : 0; |
| 977 |
$count_rows = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count(array_column($counting_source, 0)) - 1 : 0; |
| 978 |
|
| 979 |
// Slices settings |
| 980 |
$settings['slice_colors_default'] = $chart_default_colors; |
| 981 |
$settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : array_slice($chart_default_colors, 0, $count_slices);; |
| 982 |
$settings['slice_offset'] = isset( $settings['slice_offset'] ) && $settings['slice_offset'] != '' ? json_decode($settings['slice_offset'], true) : array_fill(0, $count_slices, 0); |
| 983 |
$settings['slice_text_color'] = isset( $settings['slice_text_color'] ) && $settings['slice_text_color'] != '' ? json_decode($settings['slice_text_color'], true) : array_fill(0, $count_slices, '#ffffff'); |
| 984 |
|
| 985 |
// Series settings |
| 986 |
$settings['series_colors_default'] = $chart_default_colors; |
| 987 |
$settings['series_color'] = isset( $settings['series_color'] ) && $settings['series_color'] != '' ? json_decode($settings['series_color'], true) : array_slice($chart_default_colors, 0, $count_series);; |
| 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'); |
| 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']); |
| 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']); |
| 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']); |
| 992 |
$settings['series_format'] = isset( $settings['series_format'] ) && $settings['series_format'] != '' ? json_decode($settings['series_format'], true) : array_fill(0, $count_series, ''); |
| 993 |
|
| 994 |
// Rows settings |
| 995 |
$settings['enable_row_settings'] = ( isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] != '' ) ? $settings['enable_row_settings'] : 'on'; |
| 996 |
$settings['enable_row_settings'] = isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] == 'on' ? 'checked' : ''; |
| 997 |
|
| 998 |
$settings['rows_color'] = isset( $settings['rows_color'] ) && $settings['rows_color'] != '' ? json_decode($settings['rows_color'], true) : array_fill(0, $count_rows, ''); |
| 999 |
$settings['rows_opacity'] = isset( $settings['rows_opacity'] ) && $settings['rows_opacity'] != '' ? json_decode($settings['rows_opacity'], true) : array_fill(0, $count_rows, 1.0); |
| 1000 |
|
| 1001 |
return $settings; |
| 1002 |
|
| 1003 |
} |
| 1004 |
|
| 1005 |
/** |
| 1006 |
* Gets all settings of google charts for public area. |
| 1007 |
* |
| 1008 |
* @access public |
| 1009 |
* @return array |
| 1010 |
*/ |
| 1011 |
public function get_chart_settings_google_public ($settings, $chartData) { |
| 1012 |
$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'); |
| 1013 |
|
| 1014 |
$position_styles = array( |
| 1015 |
"left" => 'margin-left:0', |
| 1016 |
"right" => 'margin-right:0', |
| 1017 |
"center" => 'margin:auto', |
| 1018 |
); |
| 1019 |
|
| 1020 |
// Width |
| 1021 |
$settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100'; |
| 1022 |
$settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%'; |
| 1023 |
$settings['responsive_width'] = ( isset( $settings['responsive_width'] ) && $settings['responsive_width'] != '' ) ? $settings['responsive_width'] : 'off'; |
| 1024 |
$settings['chart_width'] = isset($settings['responsive_width']) && $settings['responsive_width'] == 'on' ? '100%' : $settings['width'].$settings['width_format']; |
| 1025 |
|
| 1026 |
// position |
| 1027 |
$settings['position'] = isset( $settings['position'] ) && $settings['position'] != '' ? esc_attr( $settings['position'] ) : 'center'; |
| 1028 |
$settings['position'] = isset($position_styles[$settings['position']]) && $position_styles[$settings['position']] != '' ? $position_styles[$settings['position']] : 'margin:auto'; |
| 1029 |
|
| 1030 |
// height |
| 1031 |
$settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '400'; |
| 1032 |
$settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : 'px'; |
| 1033 |
$settings['chart_height'] = $settings['height'].$settings['height_format']; |
| 1034 |
|
| 1035 |
// Font size |
| 1036 |
$settings['font_size'] = isset( $settings['font_size'] ) && $settings['font_size'] != '' ? esc_attr( $settings['font_size'] ) : '15'; |
| 1037 |
|
| 1038 |
// Background color |
| 1039 |
$settings['background_color'] = isset( $settings['background_color'] ) && $settings['background_color'] != '' ? esc_attr( $settings['background_color'] ) : '#ffffff'; |
| 1040 |
|
| 1041 |
// Transparent background |
| 1042 |
$settings['transparent_background'] = isset( $settings['transparent_background'] ) && $settings['transparent_background'] != '' ? esc_attr( $settings['transparent_background'] ) : 'off'; |
| 1043 |
|
| 1044 |
// Box shadow |
| 1045 |
$settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off'; |
| 1046 |
$settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : ''; |
| 1047 |
|
| 1048 |
// Border width |
| 1049 |
$settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0'; |
| 1050 |
|
| 1051 |
// Border radius |
| 1052 |
$settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0'; |
| 1053 |
|
| 1054 |
// Border color |
| 1055 |
$settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#666666'; |
| 1056 |
|
| 1057 |
// Border style |
| 1058 |
$settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid'; |
| 1059 |
|
| 1060 |
// Border width with title |
| 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'; |
| 1062 |
|
| 1063 |
// Border radius with title |
| 1064 |
$settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0'; |
| 1065 |
|
| 1066 |
// Border color with title |
| 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'; |
| 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 |
|
| 1075 |
// Box shadow color |
| 1076 |
$settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color']; |
| 1077 |
|
| 1078 |
// Chart Area background color |
| 1079 |
$settings['chart_background_color'] = isset( $settings['chart_background_color'] ) && $settings['chart_background_color'] != '' ? esc_attr( $settings['chart_background_color'] ) : '#ffffff'; |
| 1080 |
|
| 1081 |
// Chart Area border width |
| 1082 |
$settings['chart_border_width'] = isset( $settings['chart_border_width'] ) && $settings['chart_border_width'] != '' ? esc_attr( $settings['chart_border_width'] ) : '0'; |
| 1083 |
|
| 1084 |
// Chart Area border color |
| 1085 |
$settings['chart_border_color'] = isset( $settings['chart_border_color'] ) && $settings['chart_border_color'] != '' ? esc_attr( $settings['chart_border_color'] ) : '#666666'; |
| 1086 |
|
| 1087 |
// Chart Area left margin |
| 1088 |
$settings['chart_left_margin_for_js'] = isset( $settings['chart_left_margin'] ) && $settings['chart_left_margin'] != '' ? esc_attr( $settings['chart_left_margin'] ) : 'auto'; |
| 1089 |
|
| 1090 |
// Chart Area right margin |
| 1091 |
$settings['chart_right_margin_for_js'] = isset( $settings['chart_right_margin'] ) && $settings['chart_right_margin'] != '' ? esc_attr( $settings['chart_right_margin'] ) : 'auto'; |
| 1092 |
|
| 1093 |
// Chart Area top margin |
| 1094 |
$settings['chart_top_margin_for_js'] = isset( $settings['chart_top_margin'] ) && $settings['chart_top_margin'] != '' ? esc_attr( $settings['chart_top_margin'] ) : 'auto'; |
| 1095 |
|
| 1096 |
// Chart Area bottom margin |
| 1097 |
$settings['chart_bottom_margin_for_js'] = isset( $settings['chart_bottom_margin'] ) && $settings['chart_bottom_margin'] != '' ? esc_attr( $settings['chart_bottom_margin'] ) : 'auto'; |
| 1098 |
|
| 1099 |
// Title color |
| 1100 |
$settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000'; |
| 1101 |
|
| 1102 |
// Title color |
| 1103 |
$settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color']; |
| 1104 |
|
| 1105 |
// Title font size |
| 1106 |
$settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30'; |
| 1107 |
|
| 1108 |
// title bold |
| 1109 |
$settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on'; |
| 1110 |
$settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] != 'off'? 'bold' : 'normal'; |
| 1111 |
|
| 1112 |
// Title text shadow |
| 1113 |
$settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off'; |
| 1114 |
$settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : ''; |
| 1115 |
|
| 1116 |
// title italic |
| 1117 |
$settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off'; |
| 1118 |
$settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] != 'on'? 'normal' : 'italic'; |
| 1119 |
|
| 1120 |
// title gap |
| 1121 |
$settings['title_gap'] = (isset( $settings['title_gap'] ) && $settings['title_gap'] != '') ? esc_attr( $settings['title_gap'] ) : '5'; |
| 1122 |
|
| 1123 |
// title gap |
| 1124 |
$settings['title_gap_description'] = (isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '') ? esc_attr( $settings['title_gap_description'] ) : '5'; |
| 1125 |
|
| 1126 |
// title letter spacing |
| 1127 |
$settings['title_letter_spacing'] = (isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '') ? esc_attr( $settings['title_letter_spacing'] ) : 0; |
| 1128 |
|
| 1129 |
// title position |
| 1130 |
$settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left'; |
| 1131 |
|
| 1132 |
// title text transform |
| 1133 |
$settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none'; |
| 1134 |
|
| 1135 |
// title text decoration |
| 1136 |
$settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none'; |
| 1137 |
|
| 1138 |
// description color |
| 1139 |
$settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c'; |
| 1140 |
|
| 1141 |
// description font size |
| 1142 |
$settings['description_font_size'] = (isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '') ? esc_attr( $settings['description_font_size'] ) : '16'; |
| 1143 |
|
| 1144 |
// description Bold text |
| 1145 |
$settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off'; |
| 1146 |
$settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] != 'on'? 'normal' : 'bold'; |
| 1147 |
|
| 1148 |
// description text shadow |
| 1149 |
$settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off'; |
| 1150 |
$settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : ''; |
| 1151 |
|
| 1152 |
// description color |
| 1153 |
$settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color']; |
| 1154 |
|
| 1155 |
// desctiption italic text |
| 1156 |
$settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off'; |
| 1157 |
$settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] != 'on'? 'normal' : 'italic'; |
| 1158 |
|
| 1159 |
// description position |
| 1160 |
$settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left'; |
| 1161 |
|
| 1162 |
// description text transform |
| 1163 |
$settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none'; |
| 1164 |
|
| 1165 |
// description letter spacing |
| 1166 |
$settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0; |
| 1167 |
|
| 1168 |
// description text decoration |
| 1169 |
$settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none'; |
| 1170 |
|
| 1171 |
// Rotation degree |
| 1172 |
$settings['rotation_degree'] = isset( $settings['rotation_degree'] ) && $settings['rotation_degree'] != '' ? esc_attr( $settings['rotation_degree'] ) : '0'; |
| 1173 |
|
| 1174 |
// Is stacked |
| 1175 |
$settings['is_stacked'] = ( isset( $settings['is_stacked'] ) && $settings['is_stacked'] != '' ) ? $settings['is_stacked'] : 'off'; |
| 1176 |
|
| 1177 |
// Line width |
| 1178 |
$settings['line_width'] = isset( $settings['line_width'] ) && $settings['line_width'] != '' ? esc_attr( $settings['line_width'] ) : '2'; |
| 1179 |
|
| 1180 |
// Slice border color |
| 1181 |
$settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff'; |
| 1182 |
|
| 1183 |
// Reverse categories |
| 1184 |
$settings['reverse_categories'] = ( isset( $settings['reverse_categories'] ) && $settings['reverse_categories'] != '' ) ? $settings['reverse_categories'] : 'off'; |
| 1185 |
|
| 1186 |
// Slice text |
| 1187 |
$settings['slice_text'] = isset( $settings['slice_text'] ) && $settings['slice_text'] != '' ? esc_attr( $settings['slice_text'] ) : 'percentage'; |
| 1188 |
|
| 1189 |
// Tooltip trigger |
| 1190 |
$settings['tooltip_trigger'] = isset( $settings['tooltip_trigger'] ) && $settings['tooltip_trigger'] != '' ? esc_attr( $settings['tooltip_trigger'] ) : 'hover'; |
| 1191 |
|
| 1192 |
// Tooltip text |
| 1193 |
$settings['tooltip_text'] = isset( $settings['tooltip_text'] ) && $settings['tooltip_text'] != '' ? esc_attr( $settings['tooltip_text'] ) : 'both'; |
| 1194 |
|
| 1195 |
// Multiple data format |
| 1196 |
$settings['multiple_data_format'] = isset( $settings['multiple_data_format'] ) && $settings['multiple_data_format'] != '' ? esc_attr( $settings['multiple_data_format'] ) : 'auto'; |
| 1197 |
|
| 1198 |
// Data grouping settings |
| 1199 |
$settings['data_grouping_limit'] = isset( $settings['data_grouping_limit'] ) && $settings['data_grouping_limit'] != '' ? esc_attr( $settings['data_grouping_limit'] ) : '0.5'; |
| 1200 |
$settings['data_grouping_label'] = isset( $settings['data_grouping_label'] ) && $settings['data_grouping_label'] != '' ? esc_attr( $settings['data_grouping_label'] ) : 'Other'; |
| 1201 |
$settings['data_grouping_color'] = isset( $settings['data_grouping_color'] ) && $settings['data_grouping_color'] != '' ? esc_attr( $settings['data_grouping_color'] ) : '#ccc'; |
| 1202 |
|
| 1203 |
// Focus target |
| 1204 |
$settings['focus_target'] = isset( $settings['focus_target'] ) && $settings['focus_target'] != '' ? esc_attr( $settings['focus_target'] ) : 'datum'; |
| 1205 |
|
| 1206 |
// Show color code |
| 1207 |
$settings['show_color_code'] = ( isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ) ? $settings['show_color_code'] : 'off'; |
| 1208 |
|
| 1209 |
// Italic text |
| 1210 |
$settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off'; |
| 1211 |
|
| 1212 |
// Bold text |
| 1213 |
$settings['tooltip_bold'] = isset( $settings['tooltip_bold'] ) && $settings['tooltip_bold'] != '' ? esc_attr( $settings['tooltip_bold'] ) : 'default'; |
| 1214 |
|
| 1215 |
// Tooltip text color |
| 1216 |
$settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#000000'; |
| 1217 |
|
| 1218 |
// Tooltip font size |
| 1219 |
$settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : $settings['font_size']; |
| 1220 |
|
| 1221 |
// Legend position |
| 1222 |
$settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'right'; |
| 1223 |
|
| 1224 |
// Legend alignment |
| 1225 |
$settings['legend_alignment'] = isset( $settings['legend_alignment'] ) && $settings['legend_alignment'] != '' ? esc_attr( $settings['legend_alignment'] ) : 'start'; |
| 1226 |
|
| 1227 |
// Legend font color |
| 1228 |
$settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000'; |
| 1229 |
|
| 1230 |
// Legend font size |
| 1231 |
$settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : $settings['font_size']; |
| 1232 |
|
| 1233 |
// Legend Italic text |
| 1234 |
$settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off'; |
| 1235 |
|
| 1236 |
// Legend Bold text |
| 1237 |
$settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off'; |
| 1238 |
|
| 1239 |
// Opacity |
| 1240 |
$settings['opacity'] = isset( $settings['opacity'] ) && $settings['opacity'] != '' ? esc_attr( $settings['opacity'] ) : '1.0'; |
| 1241 |
|
| 1242 |
// Group width |
| 1243 |
$settings['group_width'] = isset( $settings['group_width'] ) && $settings['group_width'] != '' ? esc_attr( $settings['group_width'] ) : '61.8'; |
| 1244 |
$settings['group_width_format'] = isset( $settings['group_width_format'] ) && $settings['group_width_format'] != '' ? esc_attr( $settings['group_width_format'] ) : '%'; |
| 1245 |
|
| 1246 |
// Show chart description |
| 1247 |
$settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] != '' ? esc_attr( $settings['show_description'] ) : 'on'; |
| 1248 |
|
| 1249 |
// Show chart title |
| 1250 |
$settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] != '' ? esc_attr( $settings['show_title'] ) : 'on'; |
| 1251 |
|
| 1252 |
// Enable interactivity |
| 1253 |
$settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] != '' ? esc_attr( $settings['enable_interactivity'] ) : 'on'; |
| 1254 |
|
| 1255 |
// Maximized view |
| 1256 |
$settings['maximized_view'] = ( isset( $settings['maximized_view'] ) && $settings['maximized_view'] != '' ) ? $settings['maximized_view'] : 'off'; |
| 1257 |
|
| 1258 |
// Multiple data selection |
| 1259 |
$settings['multiple_selection'] = ( isset( $settings['multiple_selection'] ) && $settings['multiple_selection'] != '' ) ? $settings['multiple_selection'] : 'off'; |
| 1260 |
|
| 1261 |
// Point shape |
| 1262 |
$settings['point_shape'] = isset( $settings['point_shape'] ) && $settings['point_shape'] != '' ? esc_attr( $settings['point_shape'] ) : 'circle'; |
| 1263 |
|
| 1264 |
// Point size |
| 1265 |
$settings['point_size'] = isset( $settings['point_size'] ) && $settings['point_size'] != '' ? absint(esc_attr( $settings['point_size'] )) : '0'; |
| 1266 |
|
| 1267 |
// Crosshair trigger |
| 1268 |
$settings['crosshair_trigger'] = isset( $settings['crosshair_trigger'] ) && $settings['crosshair_trigger'] != '' ? esc_attr( $settings['crosshair_trigger'] ) : 'none'; |
| 1269 |
|
| 1270 |
// Crosshair orientation |
| 1271 |
$settings['crosshair_orientation'] = isset( $settings['crosshair_orientation'] ) && $settings['crosshair_orientation'] != '' ? esc_attr( $settings['crosshair_orientation'] ) : 'both'; |
| 1272 |
|
| 1273 |
// Crosshair opacity |
| 1274 |
$settings['crosshair_opacity'] = isset( $settings['crosshair_opacity'] ) && $settings['crosshair_opacity'] != '' ? esc_attr( $settings['crosshair_opacity'] ) : '1.0'; |
| 1275 |
|
| 1276 |
// Dash style |
| 1277 |
$settings['dash_style'] = isset( $settings['dash_style'] ) && $settings['dash_style'] != '' ? esc_attr( str_replace(' ', '', $settings['dash_style']) ) : ''; |
| 1278 |
|
| 1279 |
// Orientation |
| 1280 |
$settings['orientation'] = ( isset( $settings['orientation'] ) && $settings['orientation'] != '' ) ? $settings['orientation'] : 'off'; |
| 1281 |
|
| 1282 |
// Fill nulls |
| 1283 |
$settings['fill_nulls'] = ( isset( $settings['fill_nulls'] ) && $settings['fill_nulls'] != '' ) ? $settings['fill_nulls'] : 'off'; |
| 1284 |
|
| 1285 |
// Font size for org chart |
| 1286 |
$settings['org_chart_font_size'] = isset( $settings['org_chart_font_size'] ) && $settings['org_chart_font_size'] != '' ? esc_attr( $settings['org_chart_font_size'] ) : 'medium'; |
| 1287 |
|
| 1288 |
// Allow collapse |
| 1289 |
$settings['allow_collapse'] = ( isset( $settings['allow_collapse'] ) && $settings['allow_collapse'] != '' ) ? $settings['allow_collapse'] : 'off'; |
| 1290 |
|
| 1291 |
// Donut hole size |
| 1292 |
$settings['donut_hole_size'] = isset( $settings['donut_hole_size'] ) && $settings['donut_hole_size'] != '' ? esc_attr( $settings['donut_hole_size'] ) : '0.4'; |
| 1293 |
|
| 1294 |
// Org custom css class |
| 1295 |
$settings['org_classname'] = isset( $settings['org_classname'] ) && $settings['org_classname'] != '' ? esc_attr( $settings['org_classname'] ) : ''; |
| 1296 |
|
| 1297 |
$settings['org_node_background_color'] = isset( $settings['org_node_background_color'] ) && $settings['org_node_background_color'] != '' ? esc_attr( $settings['org_node_background_color'] ) : '#edf7ff'; |
| 1298 |
$settings['org_node_padding'] = isset( $settings['org_node_padding'] ) && $settings['org_node_padding'] != '' ? esc_attr( $settings['org_node_padding'] ) : '2'; |
| 1299 |
$settings['org_node_border_radius'] = isset( $settings['org_node_border_radius'] ) && $settings['org_node_border_radius'] != '' ? esc_attr( $settings['org_node_border_radius'] ) : '5'; |
| 1300 |
$settings['org_node_border_width'] = isset( $settings['org_node_border_width'] ) && $settings['org_node_border_width'] != '' ? esc_attr( $settings['org_node_border_width'] ) : '0'; |
| 1301 |
$settings['org_node_border_color'] = isset( $settings['org_node_border_color'] ) && $settings['org_node_border_color'] != '' ? esc_attr( $settings['org_node_border_color'] ) : '#b5d9ea'; |
| 1302 |
$settings['org_node_text_color'] = isset( $settings['org_node_text_color'] ) && $settings['org_node_text_color'] != '' ? esc_attr( $settings['org_node_text_color'] ) : '#000000'; |
| 1303 |
$settings['org_node_text_font_size'] = isset( $settings['org_node_text_font_size'] ) && $settings['org_node_text_font_size'] != '' ? esc_attr( $settings['org_node_text_font_size'] ) : '13'; |
| 1304 |
$settings['org_node_description_font_color'] = isset( $settings['org_node_description_font_color'] ) && $settings['org_node_description_font_color'] != '' ? esc_attr( $settings['org_node_description_font_color'] ) : '#ff0000'; |
| 1305 |
$settings['org_node_description_font_size'] = isset( $settings['org_node_description_font_size'] ) && $settings['org_node_description_font_size'] != '' ? esc_attr( $settings['org_node_description_font_size'] ) : '13'; |
| 1306 |
|
| 1307 |
// Org custom selected css class |
| 1308 |
$settings['org_selected_classname'] = isset( $settings['org_selected_classname'] ) && $settings['org_selected_classname'] != '' ? esc_attr( $settings['org_selected_classname'] ) : ''; |
| 1309 |
|
| 1310 |
$settings['org_selected_node_background_color'] = isset( $settings['org_selected_node_background_color'] ) && $settings['org_selected_node_background_color'] != '' ? esc_attr( $settings['org_selected_node_background_color'] ) : '#fff7ae'; |
| 1311 |
$settings['org_selected_node_text_color'] = isset( $settings['org_selected_node_text_color'] ) && $settings['org_selected_node_text_color'] != '' ? esc_attr( $settings['org_selected_node_text_color'] ) : $settings['org_node_text_color']; |
| 1312 |
|
| 1313 |
|
| 1314 |
// Horizontal axis settings |
| 1315 |
$settings['haxis_title'] = isset( $settings['haxis_title'] ) && $settings['haxis_title'] != '' ? esc_attr( $settings['haxis_title'] ) : ''; |
| 1316 |
$settings['haxis_label_font_size'] = isset( $settings['haxis_label_font_size'] ) && $settings['haxis_label_font_size'] != '' ? esc_attr( $settings['haxis_label_font_size'] ) : $settings['font_size']; |
| 1317 |
$settings['haxis_label_color'] = isset( $settings['haxis_label_color'] ) && $settings['haxis_label_color'] != '' ? esc_attr( $settings['haxis_label_color'] ) : '#000000'; |
| 1318 |
$settings['haxis_text_position'] = isset( $settings['haxis_text_position'] ) && $settings['haxis_text_position'] != '' ? esc_attr( $settings['haxis_text_position'] ) : 'out'; |
| 1319 |
$settings['haxis_direction'] = ( isset( $settings['haxis_direction'] ) && $settings['haxis_direction'] != '' ) ? $settings['haxis_direction'] : '1'; |
| 1320 |
$settings['haxis_text_color'] = isset( $settings['haxis_text_color'] ) && $settings['haxis_text_color'] != '' ? esc_attr( $settings['haxis_text_color'] ) : '#000000'; |
| 1321 |
$settings['haxis_baseline_color'] = isset( $settings['haxis_baseline_color'] ) && $settings['haxis_baseline_color'] != '' ? esc_attr( $settings['haxis_baseline_color'] ) : '#000000'; |
| 1322 |
$settings['haxis_text_font_size'] = isset( $settings['haxis_text_font_size'] ) && $settings['haxis_text_font_size'] != '' ? absint(esc_attr( $settings['haxis_text_font_size'] )) : $settings['font_size']; |
| 1323 |
$settings['haxis_slanted'] = isset( $settings['haxis_slanted'] ) && $settings['haxis_slanted'] != '' ? esc_attr( $settings['haxis_slanted'] ) : 'automatic'; |
| 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'; |
| 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'; |
| 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'; |
| 1328 |
$settings['haxis_max_value'] = isset( $settings['haxis_max_value'] ) && $settings['haxis_max_value'] != '' ? esc_attr( $settings['haxis_max_value'] ) : null; |
| 1329 |
$settings['haxis_min_value'] = isset( $settings['haxis_min_value'] ) && $settings['haxis_min_value'] != '' ? esc_attr( $settings['haxis_min_value'] ) : null; |
| 1330 |
$settings['haxis_gridlines_count'] = isset( $settings['haxis_gridlines_count'] ) && $settings['haxis_gridlines_count'] != '' ? esc_attr( $settings['haxis_gridlines_count'] ) : -1; |
| 1331 |
$settings['haxis_italic'] = ( isset( $settings['haxis_italic'] ) && $settings['haxis_italic'] != '' ) ? $settings['haxis_italic'] : 'off'; |
| 1332 |
$settings['haxis_bold'] = ( isset( $settings['haxis_bold'] ) && $settings['haxis_bold'] != '' ) ? $settings['haxis_bold'] : 'off'; |
| 1333 |
$settings['haxis_title_italic'] = ( isset( $settings['haxis_title_italic'] ) && $settings['haxis_title_italic'] != '' ) ? $settings['haxis_title_italic'] : 'off'; |
| 1334 |
$settings['haxis_title_bold'] = ( isset( $settings['haxis_title_bold'] ) && $settings['haxis_title_bold'] != '' ) ? $settings['haxis_title_bold'] : 'off'; |
| 1335 |
$settings['haxis_gridlines_color'] = isset( $settings['haxis_gridlines_color'] ) && $settings['haxis_gridlines_color'] != '' ? esc_attr( $settings['haxis_gridlines_color'] ) : '#cccccc'; |
| 1336 |
$settings['haxis_minor_gridlines_color'] = isset( $settings['haxis_minor_gridlines_color'] ) && $settings['haxis_minor_gridlines_color'] != '' ? esc_attr( $settings['haxis_minor_gridlines_color'] ) : $settings['haxis_gridlines_color']; |
| 1337 |
|
| 1338 |
// Vertical axis settings |
| 1339 |
$settings['vaxis_title'] = isset( $settings['vaxis_title'] ) && $settings['vaxis_title'] != '' ? esc_attr( $settings['vaxis_title'] ) : ''; |
| 1340 |
$settings['vaxis_label_font_size'] = isset( $settings['vaxis_label_font_size'] ) && $settings['vaxis_label_font_size'] != '' ? esc_attr( $settings['vaxis_label_font_size'] ) : $settings['font_size']; |
| 1341 |
$settings['vaxis_label_color'] = isset( $settings['vaxis_label_color'] ) && $settings['vaxis_label_color'] != '' ? esc_attr( $settings['vaxis_label_color'] ) : '#000000'; |
| 1342 |
$settings['vaxis_text_position'] = isset( $settings['vaxis_text_position'] ) && $settings['vaxis_text_position'] != '' ? esc_attr( $settings['vaxis_text_position'] ) : 'out'; |
| 1343 |
$settings['vaxis_direction'] = ( isset( $settings['vaxis_direction'] ) && $settings['vaxis_direction'] != '' ) ? $settings['vaxis_direction'] : '1'; |
| 1344 |
$settings['vaxis_text_color'] = isset( $settings['vaxis_text_color'] ) && $settings['vaxis_text_color'] != '' ? esc_attr( $settings['vaxis_text_color'] ) : '#000000'; |
| 1345 |
$settings['vaxis_baseline_color'] = isset( $settings['vaxis_baseline_color'] ) && $settings['vaxis_baseline_color'] != '' ? esc_attr( $settings['vaxis_baseline_color'] ) : '#000000'; |
| 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']; |
| 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'; |
| 1349 |
$settings['vaxis_max_value'] = isset( $settings['vaxis_max_value'] ) && $settings['vaxis_max_value'] != '' ? esc_attr( $settings['vaxis_max_value'] ) : null; |
| 1350 |
$settings['vaxis_min_value'] = isset( $settings['vaxis_min_value'] ) && $settings['vaxis_min_value'] != '' ? esc_attr( $settings['vaxis_min_value'] ) : null; |
| 1351 |
$settings['vaxis_gridlines_count'] = isset( $settings['vaxis_gridlines_count'] ) && $settings['vaxis_gridlines_count'] != '' ? esc_attr( $settings['vaxis_gridlines_count'] ) : -1; |
| 1352 |
$settings['vaxis_italic'] = ( isset( $settings['vaxis_italic'] ) && $settings['vaxis_italic'] != '' ) ? $settings['vaxis_italic'] : 'off'; |
| 1353 |
$settings['vaxis_bold'] = ( isset( $settings['vaxis_bold'] ) && $settings['vaxis_bold'] != '' ) ? $settings['vaxis_bold'] : 'off'; |
| 1354 |
$settings['vaxis_title_italic'] = ( isset( $settings['vaxis_title_italic'] ) && $settings['vaxis_title_italic'] != '' ) ? $settings['vaxis_title_italic'] : 'off'; |
| 1355 |
$settings['vaxis_title_bold'] = ( isset( $settings['vaxis_title_bold'] ) && $settings['vaxis_title_bold'] != '' ) ? $settings['vaxis_title_bold'] : 'off'; |
| 1356 |
$settings['vaxis_gridlines_color'] = isset( $settings['vaxis_gridlines_color'] ) && $settings['vaxis_gridlines_color'] != '' ? esc_attr( $settings['vaxis_gridlines_color'] ) : '#cccccc'; |
| 1357 |
$settings['vaxis_minor_gridlines_color'] = isset( $settings['vaxis_minor_gridlines_color'] ) && $settings['vaxis_minor_gridlines_color'] != '' ? esc_attr( $settings['vaxis_minor_gridlines_color'] ) : $settings['vaxis_gridlines_color']; |
| 1358 |
|
| 1359 |
// Animation settings |
| 1360 |
$settings['enable_animation'] = ( isset( $settings['enable_animation'] ) && $settings['enable_animation'] != '' ) ? $settings['enable_animation'] : 'off'; |
| 1361 |
$settings['animation_duration'] = isset( $settings['animation_duration'] ) && $settings['animation_duration'] != '' ? absint(esc_attr( $settings['animation_duration'] )) : '1000'; |
| 1362 |
$settings['animation_startup'] = ( isset( $settings['animation_startup'] ) && $settings['animation_startup'] != '' ) ? $settings['animation_startup'] : 'on'; |
| 1363 |
$settings['animation_easing'] = isset( $settings['animation_easing'] ) && $settings['animation_easing'] != '' ? esc_attr( $settings['animation_easing'] ) : 'linear'; |
| 1364 |
|
| 1365 |
$settings['enable_img'] = ( isset( $settings['enable_img'] ) && $settings['enable_img'] != '' ) ? $settings['enable_img'] : 'off'; |
| 1366 |
|
| 1367 |
$count_slices = (isset($chartData['source']) && !is_null($chartData['source']) && count($chartData['source']) > 0) ? count($chartData['source']) - 1 : 0; |
| 1368 |
$count_series = (isset($chartData['source'][0]) && !is_null($chartData['source'][0]) && count($chartData['source'][0]) > 0) ? count($chartData['source'][0]) - 1 : 0; |
| 1369 |
$count_rows = (isset($chartData['source']) && !is_null($chartData['source']) && count($chartData['source']) > 0) ? count(array_column($chartData['source'], 0)) - 1 : 0; |
| 1370 |
|
| 1371 |
// Slices settings |
| 1372 |
$settings['slice_colors_default'] = $chart_default_colors; |
| 1373 |
$settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : $chart_default_colors; |
| 1374 |
$settings['slice_offset'] = isset( $settings['slice_offset'] ) && $settings['slice_offset'] != '' ? json_decode($settings['slice_offset'], true) : array_fill(0, $count_slices, 0); |
| 1375 |
$settings['slice_text_color'] = isset( $settings['slice_text_color'] ) && $settings['slice_text_color'] != '' ? json_decode($settings['slice_text_color'], true) : array_fill(0, $count_slices, '#ffffff'); |
| 1376 |
|
| 1377 |
// Series settings |
| 1378 |
$settings['series_colors_default'] = $chart_default_colors; |
| 1379 |
$settings['series_color'] = isset( $settings['series_color'] ) && $settings['series_color'] != '' ? json_decode($settings['series_color'], true) : $chart_default_colors; |
| 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'); |
| 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']); |
| 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']); |
| 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']); |
| 1384 |
$settings['series_format'] = isset( $settings['series_format'] ) && $settings['series_format'] != '' ? json_decode($settings['series_format'], true) : array_fill(0, $count_series, ''); |
| 1385 |
// Rows settings |
| 1386 |
$settings['enable_row_settings'] = ( isset( $settings['enable_row_settings'] ) && $settings['enable_row_settings'] != '' ) ? $settings['enable_row_settings'] : 'on'; |
| 1387 |
|
| 1388 |
$settings['rows_color'] = isset( $settings['rows_color'] ) && $settings['rows_color'] != '' ? json_decode($settings['rows_color'], true) : array_fill(0, $count_rows, ''); |
| 1389 |
$settings['rows_opacity'] = isset( $settings['rows_opacity'] ) && $settings['rows_opacity'] != '' ? json_decode($settings['rows_opacity'], true) : array_fill(0, $count_rows, 1.0); |
| 1390 |
|
| 1391 |
return $settings; |
| 1392 |
|
| 1393 |
} |
| 1394 |
|
| 1395 |
/** |
| 1396 |
* Gets all settings of chart.js charts for admin area. |
| 1397 |
* |
| 1398 |
* @access public |
| 1399 |
* @return array |
| 1400 |
*/ |
| 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 |
|
| 1404 |
$title_positions = array( |
| 1405 |
"left" => __("Left", "chart-builder"), |
| 1406 |
"right" => __("Right", "chart-builder"), |
| 1407 |
"center" => __("Center", "chart-builder") |
| 1408 |
); |
| 1409 |
|
| 1410 |
$text_transforms = array( |
| 1411 |
"uppercase" => __("Uppercase", "chart-builder"), |
| 1412 |
"lowercase" => __("Lowercase", "chart-builder"), |
| 1413 |
"capitalize" => __("Capitalize", "chart-builder"), |
| 1414 |
"none" => __("None", "chart-builder"), |
| 1415 |
); |
| 1416 |
|
| 1417 |
$text_decorations = array( |
| 1418 |
"overline" => __("Overline", "chart-builder"), |
| 1419 |
"underline" => __("Underline", "chart-builder"), |
| 1420 |
"line-through" => __("Line through", "chart-builder"), |
| 1421 |
"none" => __("None", "chart-builder"), |
| 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 |
); |
| 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 |
|
| 1462 |
// Title color |
| 1463 |
$settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000'; |
| 1464 |
|
| 1465 |
// Title color |
| 1466 |
$settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color']; |
| 1467 |
|
| 1468 |
// Title font size |
| 1469 |
$settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30'; |
| 1470 |
|
| 1471 |
// Title Bold text |
| 1472 |
$settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on'; |
| 1473 |
$settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] == 'on' ? 'checked' : ''; |
| 1474 |
|
| 1475 |
// Title text shadow |
| 1476 |
$settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off'; |
| 1477 |
$settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : ''; |
| 1478 |
|
| 1479 |
// Title italic text |
| 1480 |
$settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off'; |
| 1481 |
$settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] == 'on' ? 'checked' : ''; |
| 1482 |
|
| 1483 |
// Title gap |
| 1484 |
$settings['title_gap'] = isset( $settings['title_gap'] ) && $settings['title_gap'] != '' ? esc_attr( $settings['title_gap'] ) : '5'; |
| 1485 |
|
| 1486 |
// Title gap |
| 1487 |
$settings['title_gap_description'] = isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '' ? esc_attr( $settings['title_gap_description'] ) : '5'; |
| 1488 |
|
| 1489 |
// Title letter spacing |
| 1490 |
$settings['title_letter_spacing'] = isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '' ? esc_attr( $settings['title_letter_spacing'] ) : 0; |
| 1491 |
|
| 1492 |
// Title position |
| 1493 |
$settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left'; |
| 1494 |
$settings['title_positions'] = $title_positions; |
| 1495 |
|
| 1496 |
// Title text transform |
| 1497 |
$settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none'; |
| 1498 |
$settings['text_transforms'] = $text_transforms; |
| 1499 |
|
| 1500 |
// Title text decoration |
| 1501 |
$settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none'; |
| 1502 |
$settings['text_decorations'] = $text_decorations; |
| 1503 |
|
| 1504 |
// description color |
| 1505 |
$settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c'; |
| 1506 |
|
| 1507 |
// description font size |
| 1508 |
$settings['description_font_size'] = isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '' ? esc_attr( $settings['description_font_size'] ) : '16'; |
| 1509 |
|
| 1510 |
// description Bold text |
| 1511 |
$settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off'; |
| 1512 |
$settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] == 'on' ? 'checked' : ''; |
| 1513 |
|
| 1514 |
// description text shadow |
| 1515 |
$settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off'; |
| 1516 |
$settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : ''; |
| 1517 |
|
| 1518 |
// description color |
| 1519 |
$settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color']; |
| 1520 |
|
| 1521 |
// description italic text |
| 1522 |
$settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off'; |
| 1523 |
$settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] == 'on' ? 'checked' : ''; |
| 1524 |
|
| 1525 |
// description position |
| 1526 |
$settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left'; |
| 1527 |
|
| 1528 |
// description text transform |
| 1529 |
$settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none'; |
| 1530 |
|
| 1531 |
// description letter spacing |
| 1532 |
$settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0; |
| 1533 |
|
| 1534 |
// description text decoration |
| 1535 |
$settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none'; |
| 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 |
|
| 1576 |
// outer_radius |
| 1577 |
$settings['outer_radius'] = isset( $settings['outer_radius'] ) && $settings['outer_radius'] != '' ? esc_attr( absint($settings['outer_radius']) ) : 100; |
| 1578 |
|
| 1579 |
// Padding outer |
| 1580 |
$settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0'; |
| 1581 |
|
| 1582 |
// circumference |
| 1583 |
$settings['circumference'] = isset( $settings['circumference'] ) && $settings['circumference'] != '' ? esc_attr( absint($settings['circumference']) ) : 360; |
| 1584 |
|
| 1585 |
// start_angle |
| 1586 |
$settings['start_angle'] = isset( $settings['start_angle'] ) && $settings['start_angle'] != '' ? esc_attr( absint($settings['start_angle']) ) : 0; |
| 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 |
// Show chart description |
| 1603 |
if (!isset($settings['show_description'])) { |
| 1604 |
$settings['show_description'] = 'checked'; |
| 1605 |
} else { |
| 1606 |
$settings['show_description'] = ( $settings['show_description'] != '' ) ? $settings['show_description'] : 'off'; |
| 1607 |
$settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] == 'on' ? 'checked' : ''; |
| 1608 |
} |
| 1609 |
|
| 1610 |
// Show chart title |
| 1611 |
if (!isset($settings['show_title'])) { |
| 1612 |
$settings['show_title'] = 'checked'; |
| 1613 |
} else { |
| 1614 |
$settings['show_title'] = ( $settings['show_title'] != '' ) ? $settings['show_title'] : 'off'; |
| 1615 |
$settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] == 'on' ? 'checked' : ''; |
| 1616 |
} |
| 1617 |
|
| 1618 |
// Enable interactivity |
| 1619 |
if (!isset($settings['enable_interactivity'])) { |
| 1620 |
$settings['enable_interactivity'] = 'checked'; |
| 1621 |
} else { |
| 1622 |
$settings['enable_interactivity'] = ( $settings['enable_interactivity'] != '' ) ? $settings['enable_interactivity'] : 'off'; |
| 1623 |
$settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] == 'on' ? 'checked' : ''; |
| 1624 |
} |
| 1625 |
|
| 1626 |
$counting_source = !empty($source) ? $source : array(); |
| 1627 |
$count_slices = (isset($counting_source) && !is_null($counting_source) && count($counting_source) > 0) ? count($counting_source) - 1 : 0; |
| 1628 |
|
| 1629 |
// Slices settings |
| 1630 |
$settings['slice_colors_default'] = $chart_default_colors; |
| 1631 |
$settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : array_slice($chart_default_colors, 0, $count_slices); |
| 1632 |
|
| 1633 |
// Slice border color |
| 1634 |
$settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff'; |
| 1635 |
|
| 1636 |
// Slice border color |
| 1637 |
$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']); |
| 1638 |
|
| 1639 |
// Slices border width |
| 1640 |
$settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1'; |
| 1641 |
|
| 1642 |
// Tooltip text color |
| 1643 |
$settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff'; |
| 1644 |
|
| 1645 |
$settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ? esc_attr( $settings['show_color_code'] ) : 'off'; |
| 1646 |
$settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : ''; |
| 1647 |
|
| 1648 |
$settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off'; |
| 1649 |
$settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'on' ? 'checked' : ''; |
| 1650 |
|
| 1651 |
// Tooltip font size |
| 1652 |
$settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : '12'; |
| 1653 |
|
| 1654 |
// Tooltip bold options |
| 1655 |
$tooltip_bold_options = array( |
| 1656 |
"default" => __("Default", "chart-builder"), |
| 1657 |
"true" => __("Enable", "chart-builder"), |
| 1658 |
"false" => __("Disable", "chart-builder") |
| 1659 |
); |
| 1660 |
|
| 1661 |
// Tooltip bold text |
| 1662 |
$settings['tooltip_bold'] = isset( $settings['tooltip_bold'] ) && $settings['tooltip_bold'] != '' ? esc_attr( $settings['tooltip_bold'] ) : 'default'; |
| 1663 |
$settings['tooltip_bold_options'] = $tooltip_bold_options; |
| 1664 |
|
| 1665 |
// Legend font color |
| 1666 |
$settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000'; |
| 1667 |
|
| 1668 |
// Legend font size |
| 1669 |
$settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : 12; |
| 1670 |
|
| 1671 |
// Legend position |
| 1672 |
$settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'top'; |
| 1673 |
$settings['legend_positions'] = $legend_positions; |
| 1674 |
|
| 1675 |
// Legend alignment |
| 1676 |
$settings['legend_alignment'] = isset( $settings['legend_alignment'] ) && $settings['legend_alignment'] != '' ? esc_attr( $settings['legend_alignment'] ) : 'start'; |
| 1677 |
$settings['legend_alignments'] = $legend_alignments; |
| 1678 |
|
| 1679 |
// Legend Italic text |
| 1680 |
$settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off'; |
| 1681 |
$settings['legend_italic'] = isset( $settings['legend_italic'] ) && $settings['legend_italic'] == 'on' ? 'checked' : ''; |
| 1682 |
|
| 1683 |
// Legend Bold text |
| 1684 |
$settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off'; |
| 1685 |
$settings['legend_bold'] = isset( $settings['legend_bold'] ) && $settings['legend_bold'] == 'on' ? 'checked' : ''; |
| 1686 |
|
| 1687 |
// Legend reverse |
| 1688 |
$settings['legend_reverse'] = ( isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] != '' ) ? $settings['legend_reverse'] : 'off'; |
| 1689 |
$settings['legend_reverse'] = isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] == 'on' ? 'checked' : ''; |
| 1690 |
|
| 1691 |
return $settings; |
| 1692 |
|
| 1693 |
} |
| 1694 |
|
| 1695 |
/** |
| 1696 |
* Gets all settings of chart.js charts for public area. |
| 1697 |
* |
| 1698 |
* @access public |
| 1699 |
* @return array |
| 1700 |
*/ |
| 1701 |
public function get_chart_settings_chartjs_public($settings, $chartData) { |
| 1702 |
$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'); |
| 1703 |
// echo "<pre>"; var_dump($settings); echo "</pre>"; |
| 1704 |
// Width |
| 1705 |
$settings['width'] = isset( $settings['width'] ) && $settings['width'] != '' ? esc_attr( $settings['width'] ) : '100'; |
| 1706 |
$settings['width_format'] = isset( $settings['width_format'] ) && $settings['width_format'] != '' ? esc_attr( $settings['width_format'] ) : '%'; |
| 1707 |
$settings['chart_width'] = $settings['width'].$settings['width_format']; |
| 1708 |
|
| 1709 |
// height |
| 1710 |
$settings['height'] = isset( $settings['height'] ) && $settings['height'] != '' ? esc_attr( $settings['height'] ) : '100'; |
| 1711 |
$settings['height_format'] = isset( $settings['height_format'] ) && $settings['height_format'] != '' ? esc_attr( $settings['height_format'] ) : '%'; |
| 1712 |
$settings['chart_height'] = $settings['height'].$settings['height_format']; |
| 1713 |
|
| 1714 |
// Show chart description |
| 1715 |
$settings['show_description'] = isset( $settings['show_description'] ) && $settings['show_description'] != '' ? esc_attr( $settings['show_description'] ) : 'on'; |
| 1716 |
|
| 1717 |
// Show chart title |
| 1718 |
$settings['show_title'] = isset( $settings['show_title'] ) && $settings['show_title'] != '' ? esc_attr( $settings['show_title'] ) : 'on'; |
| 1719 |
|
| 1720 |
// Enable interactivity |
| 1721 |
$settings['enable_interactivity'] = isset( $settings['enable_interactivity'] ) && $settings['enable_interactivity'] != '' ? esc_attr( $settings['enable_interactivity'] ) : 'on'; |
| 1722 |
|
| 1723 |
// Title color |
| 1724 |
$settings['title_color'] = isset( $settings['title_color'] ) && $settings['title_color'] != '' ? esc_attr( $settings['title_color'] ) : '#000000'; |
| 1725 |
|
| 1726 |
// Title color |
| 1727 |
$settings['title_shadow_color'] = isset( $settings['title_shadow_color'] ) && $settings['title_shadow_color'] != '' ? esc_attr( $settings['title_shadow_color'] ) : $settings['title_color']; |
| 1728 |
|
| 1729 |
// Title font size |
| 1730 |
$settings['title_font_size'] = isset( $settings['title_font_size'] ) && $settings['title_font_size'] != '' ? esc_attr( $settings['title_font_size'] ) : '30'; |
| 1731 |
|
| 1732 |
// title bold |
| 1733 |
$settings['title_bold'] = ( isset( $settings['title_bold'] ) && $settings['title_bold'] != '' ) ? esc_attr($settings['title_bold']) : 'on'; |
| 1734 |
$settings['title_bold'] = isset( $settings['title_bold'] ) && $settings['title_bold'] != 'off'? 'bold' : 'normal'; |
| 1735 |
|
| 1736 |
// Title text shadow |
| 1737 |
$settings['title_text_shadow'] = ( isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] != '' ) ? esc_attr($settings['title_text_shadow']) : 'off'; |
| 1738 |
$settings['title_text_shadow'] = isset( $settings['title_text_shadow'] ) && $settings['title_text_shadow'] == 'on' ? 'checked' : ''; |
| 1739 |
|
| 1740 |
// title italic |
| 1741 |
$settings['title_italic'] = ( isset( $settings['title_italic'] ) && $settings['title_italic'] != '' ) ? esc_attr($settings['title_italic']) : 'off'; |
| 1742 |
$settings['title_italic'] = isset( $settings['title_italic'] ) && $settings['title_italic'] != 'on'? 'normal' : 'italic'; |
| 1743 |
|
| 1744 |
// title gap |
| 1745 |
$settings['title_gap'] = (isset( $settings['title_gap'] ) && $settings['title_gap'] != '') ? esc_attr( $settings['title_gap'] ) : '5'; |
| 1746 |
|
| 1747 |
// title gap |
| 1748 |
$settings['title_gap_description'] = (isset( $settings['title_gap_description'] ) && $settings['title_gap_description'] != '') ? esc_attr( $settings['title_gap_description'] ) : '5'; |
| 1749 |
|
| 1750 |
// title letter spacing |
| 1751 |
$settings['title_letter_spacing'] = (isset( $settings['title_letter_spacing'] ) && $settings['title_letter_spacing'] != '') ? esc_attr( $settings['title_letter_spacing'] ) : 0; |
| 1752 |
|
| 1753 |
// title position |
| 1754 |
$settings['title_position'] = isset( $settings['title_position'] ) && $settings['title_position'] != '' ? esc_attr( $settings['title_position'] ) : 'left'; |
| 1755 |
|
| 1756 |
// title text transform |
| 1757 |
$settings['title_text_transform'] = isset( $settings['title_text_transform'] ) && $settings['title_text_transform'] != '' ? esc_attr( $settings['title_text_transform'] ) : 'none'; |
| 1758 |
|
| 1759 |
// title text decoration |
| 1760 |
$settings['title_text_decoration'] = isset( $settings['title_text_decoration'] ) && $settings['title_text_decoration'] != '' ? esc_attr( $settings['title_text_decoration'] ) : 'none'; |
| 1761 |
|
| 1762 |
// description color |
| 1763 |
$settings['description_color'] = isset( $settings['description_color'] ) && $settings['description_color'] != '' ? esc_attr( $settings['description_color'] ) : '#4c4c4c'; |
| 1764 |
|
| 1765 |
// description font size |
| 1766 |
$settings['description_font_size'] = (isset( $settings['description_font_size'] ) && $settings['description_font_size'] != '') ? esc_attr( $settings['description_font_size'] ) : '16'; |
| 1767 |
|
| 1768 |
// description Bold text |
| 1769 |
$settings['description_bold'] = ( isset( $settings['description_bold'] ) && $settings['description_bold'] != '' ) ? esc_attr($settings['description_bold']) : 'off'; |
| 1770 |
$settings['description_bold'] = isset( $settings['description_bold'] ) && $settings['description_bold'] != 'on'? 'normal' : 'bold'; |
| 1771 |
|
| 1772 |
// description text shadow |
| 1773 |
$settings['description_text_shadow'] = ( isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] != '' ) ? esc_attr($settings['description_text_shadow']) : 'off'; |
| 1774 |
$settings['description_text_shadow'] = isset( $settings['description_text_shadow'] ) && $settings['description_text_shadow'] == 'on' ? 'checked' : ''; |
| 1775 |
|
| 1776 |
// description color |
| 1777 |
$settings['description_shadow_color'] = isset( $settings['description_shadow_color'] ) && $settings['description_shadow_color'] != '' ? esc_attr( $settings['description_shadow_color'] ) : $settings['description_color']; |
| 1778 |
|
| 1779 |
// desctiption italic text |
| 1780 |
$settings['description_italic'] = ( isset( $settings['description_italic'] ) && $settings['description_italic'] != '' ) ? esc_attr($settings['description_italic']) : 'off'; |
| 1781 |
$settings['description_italic'] = isset( $settings['description_italic'] ) && $settings['description_italic'] != 'on'? 'normal' : 'italic'; |
| 1782 |
|
| 1783 |
// description position |
| 1784 |
$settings['description_position'] = isset( $settings['description_position'] ) && $settings['description_position'] != '' ? esc_attr( $settings['description_position'] ) : 'left'; |
| 1785 |
|
| 1786 |
// description text transform |
| 1787 |
$settings['description_text_transform'] = isset( $settings['description_text_transform'] ) && $settings['description_text_transform'] != '' ? esc_attr( $settings['description_text_transform'] ) : 'none'; |
| 1788 |
|
| 1789 |
// description letter spacing |
| 1790 |
$settings['description_letter_spacing'] = isset( $settings['description_letter_spacing'] ) && $settings['description_letter_spacing'] != '' ? esc_attr( $settings['description_letter_spacing'] ) : 0; |
| 1791 |
|
| 1792 |
// description text decoration |
| 1793 |
$settings['description_text_decoration'] = isset( $settings['description_text_decoration'] ) && $settings['description_text_decoration'] != '' ? esc_attr( $settings['description_text_decoration'] ) : 'none'; |
| 1794 |
|
| 1795 |
// Box shadow |
| 1796 |
$settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] != '' ? esc_attr( $settings['box_shadow'] ) : 'off'; |
| 1797 |
$settings['box_shadow'] = isset( $settings['box_shadow'] ) && $settings['box_shadow'] == 'on' ? 'checked' : ''; |
| 1798 |
|
| 1799 |
// Border width |
| 1800 |
$settings['border_width'] = isset( $settings['border_width'] ) && $settings['border_width'] != '' ? esc_attr( $settings['border_width'] ) : '0'; |
| 1801 |
|
| 1802 |
// Border radius |
| 1803 |
$settings['border_radius'] = isset( $settings['border_radius'] ) && $settings['border_radius'] != '' ? esc_attr( $settings['border_radius'] ) : '0'; |
| 1804 |
|
| 1805 |
// Border color |
| 1806 |
$settings['border_color'] = isset( $settings['border_color'] ) && $settings['border_color'] != '' ? esc_attr( $settings['border_color'] ) : '#000000'; |
| 1807 |
|
| 1808 |
//Box shadow color |
| 1809 |
$settings['box_shadow_color'] = isset( $settings['box_shadow_color'] ) && $settings['box_shadow_color'] != '' ? esc_attr( $settings['box_shadow_color'] ) : $settings['border_color']; |
| 1810 |
|
| 1811 |
// Border style |
| 1812 |
$settings['border_style'] = isset( $settings['border_style'] ) && $settings['border_style'] != '' ? esc_attr( $settings['border_style'] ) : 'solid'; |
| 1813 |
|
| 1814 |
// Background color |
| 1815 |
$settings['background_color_chart'] = isset( $settings['background_color_chart'] ) && $settings['background_color_chart'] != '' ? esc_attr( $settings['background_color_chart'] ) : '#ffffff'; |
| 1816 |
|
| 1817 |
// Border width with title |
| 1818 |
$settings['border_width_with_title'] = isset( $settings['border_width_with_title'] ) && $settings['border_width_with_title'] != '' ? esc_attr( $settings['border_width_with_title'] ) : '0'; |
| 1819 |
|
| 1820 |
// Border radius with title |
| 1821 |
$settings['border_radius_with_title'] = isset( $settings['border_radius_with_title'] ) && $settings['border_radius_with_title'] != '' ? esc_attr( $settings['border_radius_with_title'] ) : '0'; |
| 1822 |
|
| 1823 |
// Border color with title |
| 1824 |
$settings['border_color_with_title'] = isset( $settings['border_color_with_title'] ) && $settings['border_color_with_title'] != '' ? esc_attr( $settings['border_color_with_title'] ) : '#000000'; |
| 1825 |
|
| 1826 |
// Border style with title |
| 1827 |
$settings['border_style_with_title'] = isset( $settings['border_style_with_title'] ) && $settings['border_style_with_title'] != '' ? esc_attr( $settings['border_style_with_title'] ) : 'solid'; |
| 1828 |
|
| 1829 |
// Padding outer |
| 1830 |
$settings['padding_outer'] = isset( $settings['padding_outer'] ) && $settings['padding_outer'] != '' ? esc_attr( $settings['padding_outer'] ) : '0'; |
| 1831 |
|
| 1832 |
// outer_radius |
| 1833 |
$settings['outer_radius'] = isset( $settings['outer_radius'] ) && $settings['outer_radius'] != '' ? esc_attr( absint($settings['outer_radius']) ) : 100; |
| 1834 |
|
| 1835 |
// slice_spacing |
| 1836 |
$settings['slice_spacing'] = isset( $settings['slice_spacing'] ) && $settings['slice_spacing'] != '' ? esc_attr( absint($settings['slice_spacing']) ) : 1; |
| 1837 |
|
| 1838 |
// circumference |
| 1839 |
$settings['circumference'] = isset( $settings['circumference'] ) && $settings['circumference'] != '' ? esc_attr( absint($settings['circumference']) ) : 360; |
| 1840 |
|
| 1841 |
// start_angle |
| 1842 |
$settings['start_angle'] = isset( $settings['start_angle'] ) && $settings['start_angle'] != '' ? esc_attr( absint($settings['start_angle']) ) : 0; |
| 1843 |
|
| 1844 |
// rotation_degree |
| 1845 |
$settings['rotation_degree'] = isset( $settings['rotation_degree'] ) && $settings['rotation_degree'] != '' ? esc_attr( absint($settings['rotation_degree']) ) : 0; |
| 1846 |
|
| 1847 |
// Tooltip text |
| 1848 |
$settings['tooltip_text'] = isset( $settings['tooltip_text'] ) && $settings['tooltip_text'] != '' ? esc_attr( $settings['tooltip_text'] ) : 'value'; |
| 1849 |
|
| 1850 |
$count_slices = (isset($chartData['source']) && !is_null($chartData['source']) && count($chartData['source']) > 0) ? count($chartData['source']) - 1 : 0; |
| 1851 |
// Slices settings |
| 1852 |
$settings['slice_colors_default'] = $chart_default_colors; |
| 1853 |
$settings['slice_color'] = isset( $settings['slice_color'] ) && $settings['slice_color'] != '' ? json_decode($settings['slice_color'], true) : $chart_default_colors; |
| 1854 |
|
| 1855 |
// Slice border color |
| 1856 |
$settings['slice_border_color'] = isset( $settings['slice_border_color'] ) && $settings['slice_border_color'] != '' ? esc_attr( $settings['slice_border_color'] ) : '#ffffff'; |
| 1857 |
|
| 1858 |
// Slice border color |
| 1859 |
$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']); |
| 1860 |
|
| 1861 |
// Slices border width |
| 1862 |
$settings['slice_border_width'] = isset( $settings['slice_border_width'] ) && $settings['slice_border_width'] != '' ? esc_attr( $settings['slice_border_width'] ) : '1'; |
| 1863 |
|
| 1864 |
// Tooltip text color |
| 1865 |
$settings['tooltip_text_color'] = isset( $settings['tooltip_text_color'] ) && $settings['tooltip_text_color'] != '' ? esc_attr( $settings['tooltip_text_color'] ) : '#fff'; |
| 1866 |
|
| 1867 |
// Tooltip font size |
| 1868 |
$settings['tooltip_font_size'] = isset( $settings['tooltip_font_size'] ) && intval($settings['tooltip_font_size']) > 0 ? esc_attr( $settings['tooltip_font_size'] ) : 12; |
| 1869 |
|
| 1870 |
// Show color code |
| 1871 |
$settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] != '' ? esc_attr( $settings['show_color_code'] ) : 'off'; |
| 1872 |
$settings['show_color_code'] = isset( $settings['show_color_code'] ) && $settings['show_color_code'] == 'on' ? 'checked' : ''; |
| 1873 |
|
| 1874 |
// Tooltip Italic text |
| 1875 |
$settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] != '' ) ? $settings['tooltip_italic'] : 'off'; |
| 1876 |
//$settings['tooltip_italic'] = isset( $settings['tooltip_italic'] ) && $settings['tooltip_italic'] == 'checked' ? 'italic' : 'normal'; |
| 1877 |
$settings['tooltip_italic'] = ( isset( $settings['tooltip_italic'] ) && ($settings['tooltip_italic'] == 'checked' || $settings['tooltip_italic'] == 'on') ) ? 'italic' : 'normal'; |
| 1878 |
// Legend font color |
| 1879 |
$settings['legend_color'] = isset( $settings['legend_color'] ) && $settings['legend_color'] != '' ? esc_attr( $settings['legend_color'] ) : '#000000'; |
| 1880 |
|
| 1881 |
// Legend font size |
| 1882 |
$settings['legend_font_size'] = isset( $settings['legend_font_size'] ) && intval($settings['legend_font_size']) > 0 ? esc_attr( $settings['legend_font_size'] ) : 12; |
| 1883 |
|
| 1884 |
// Legend position |
| 1885 |
$settings['legend_position'] = isset( $settings['legend_position'] ) && $settings['legend_position'] != '' ? esc_attr( $settings['legend_position'] ) : 'top'; |
| 1886 |
|
| 1887 |
// Legend Italic text |
| 1888 |
$settings['legend_italic'] = ( isset( $settings['legend_italic'] ) && $settings['legend_italic'] != '' ) ? $settings['legend_italic'] : 'off'; |
| 1889 |
|
| 1890 |
// Legend Bold text |
| 1891 |
$settings['legend_bold'] = ( isset( $settings['legend_bold'] ) && $settings['legend_bold'] != '' ) ? $settings['legend_bold'] : 'off'; |
| 1892 |
|
| 1893 |
// Legend reverse |
| 1894 |
$settings['legend_reverse'] = ( isset( $settings['legend_reverse'] ) && $settings['legend_reverse'] != '' ) ? $settings['legend_reverse'] : 'off'; |
| 1895 |
|
| 1896 |
return $settings; |
| 1897 |
|
| 1898 |
} |
| 1899 |
} |
| 1900 |
} |
| 1901 |
|
| 1902 |
if( ! function_exists( 'CBFunctions' ) ){ |
| 1903 |
/** |
| 1904 |
* Function for quick access to Chart_Builder_Functions class |
| 1905 |
* |
| 1906 |
* @since 1.0.0 |
| 1907 |
* @return Chart_Builder_Functions |
| 1908 |
*/ |
| 1909 |
function CBFunctions(){ |
| 1910 |
|
| 1911 |
static $instance = null; |
| 1912 |
|
| 1913 |
if( $instance === null ){ |
| 1914 |
$instance = Chart_Builder_Functions::get_instance( CHART_BUILDER_NAME ); |
| 1915 |
} |
| 1916 |
|
| 1917 |
if( $instance instanceof Chart_Builder_Functions ){ |
| 1918 |
return $instance; |
| 1919 |
} |
| 1920 |
|
| 1921 |
return Chart_Builder_Functions::get_instance( CHART_BUILDER_NAME ); |
| 1922 |
} |
| 1923 |
} |