PluginProbe
Chartify – WordPress Chart Plugin / 3.8.1
Chartify – WordPress Chart Plugin v3.8.1
3.8.1 3.8.0 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 trunk 1.0.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 All 84 releases
← All changes | public/class-chart-builder-public.php +63 -23 3.1.4 → 3.8.1 View file →
@@ -191,9 +191,9 @@
191 191 $chart_source_type = $chartData['chart']['type'];
192 192 $user_id = get_current_user_id();
193 193
194 194 if ($source_type == 'quiz_maker' && $user_id == 0 && $chart['quiz_query'] != 'q1') {
195 - return "<p class='ays_chart_not_logged_text'>" . __('You are not logged in. Please log in to view this chart.', $this->plugin_name) . "</p>";
195 + return "<p class='ays_chart_not_logged_text'>" . __('You are not logged in. Please log in to view this chart.', 'chart-builder') . "</p>";
196 196 }
197 197
198 198 $status = isset( $chart['status'] ) && $chart['status'] != '' ? $chart['status'] : '';
199 199
@@ -201,9 +201,9 @@
201 201 return "";
202 202 }
203 203
204 204 if ($chart_source_type === "chart-js") {
205 - $settings = CBFunctions()->get_chart_settings_chartjs_public($settings);
205 + $settings = CBFunctions()->get_chart_settings_chartjs_public($settings, $chartData['source']);
206 206 } else {
207 207 $settings = CBFunctions()->get_chart_settings_google_public($settings, $chartData['source']);
208 208 }
209 209
@@ -209,8 +209,19 @@
209 209
210 210 $data['chart_type'] = $chartData['source_chart_type'];
211 211 $data['source'] = $chartData['source'];
212 212
213 + $ordering = [];
214 + if (isset($data['source']) && !empty($data['source'])) {
215 + foreach($data['source'] as $key => $value) {
216 + if ($key != 0) {
217 + array_push($ordering, $key);
218 + }
219 + }
220 + } else {
221 + $ordering = [1, 2, 3, 4, 5];
222 + }
223 + $data['source_ordering'] = $ordering;
213 224
214 225 $data['options'] = $settings;
215 226
216 227 if ($chart_source_type === "chart-js") {
@@ -285,9 +296,9 @@
285 296 width: " . $settings['chart_width'] . ";
286 297 height: " . $settings['chart_height'] . ";
287 298 " . $settings['position'] . ";
288 299 border-radius: " . $settings['border_radius'] . "px;
289 - border: " . $settings['border_width'] . "px solid " . $settings['border_color'] . ";
300 + border: " . $settings['border_width'] . "px " . $settings['border_style'] . " " . $settings['border_color'] . ";
290 301 overflow: hidden;
291 302 box-shadow: " . ($settings['box_shadow'] === 'checked' ? '2px 2px 10px 2px '.$settings['box_shadow_color'] : '') . ";
292 303 }
293 304
@@ -341,8 +352,19 @@
341 352
342 353 return $content;
343 354 }
344 355
356 + public function add_custom_chart_styles() {
357 + if (is_singular('ays-chart-builder')) {
358 + echo '<style>
359 + .entry-content .ays-chart-container-chartjs {
360 + width: 80% !important;
361 + margin:0 auto;
362 + }
363 + </style>';
364 + }
365 + }
366 +
345 367 public function chartJsContent($chart, $settings, $chartData, $id) {
346 368 $chart_title = (isset($chart['title']) && $chart['title'] != '') ? stripslashes ( sanitize_text_field( $chart['title'] ) ) : '';
347 369 $chart_description = (isset($chart['description']) && $chart['description'] != '') ? stripslashes ( sanitize_text_field( $chart['description'] ) ) : '';
348 370
@@ -372,35 +394,53 @@
372 394
373 395 $content[] = "</div>";
374 396
375 397 $custom_css = "
398 + #" . $this->html_class_prefix . "container" . $this->unique_id . " {
399 + border: " . esc_attr($settings['border_width_with_title']) . "px " . $settings['border_style_with_title'] . " " . $settings['border_color_with_title'] . ";
400 + border-radius: " . $settings['border_radius_with_title'] . "px;
401 + padding: " . $settings['padding_outer'] . "px;
402 + }
403 +
404 + #" . $this->html_class_prefix . "container" . $this->unique_id . " div." . $this->html_class_prefix . "charts-main-container" . $this->unique_id . " {
405 + width: " . esc_attr($settings['width'] ?: '100') . esc_attr($settings['width_format'] ?: '%') . ";
406 + height: " . esc_attr($settings['height']).esc_attr($settings['height_format']) . ";
407 + border: " . esc_attr($settings['border_width']) . "px " . esc_attr($settings['border_style']) . " " . esc_attr($settings['border_color']) . ";
408 + border-radius: " . esc_attr($settings['border_radius']) . "px;
409 + box-shadow: " . ($settings['box_shadow'] === 'checked' ? '2px 2px 10px 2px '. $settings['box_shadow_color'] : '') . ";
410 + background-color: " . esc_attr($settings['background_color_chart']) . ";
411 + }
412 + #" . $this->html_class_prefix . "container" . $this->unique_id . " div." . $this->html_class_prefix . "charts-main-container" . $this->unique_id . " canvas {
413 + width: 100% !important;
414 + height: 100% !important;
415 + }
376 416 #" . $this->html_class_prefix . "container" . $this->unique_id . " div." . $this->html_class_prefix . "header-container {
377 - margin-bottom: " . $settings['title_gap'] . "px !important;
417 + margin-bottom: " . esc_attr($settings['title_gap']) . "px !important;
378 418 }
379 419
380 420 #" . $this->html_class_prefix . "container" . $this->unique_id . " div." . $this->html_class_prefix . "header-container>." . $this->html_class_prefix . "charts-title" . $this->unique_id . " {
381 - color: " . $settings['title_color'] . ";
382 - font-size: " . $settings['title_font_size'] . "px;
383 - font-weight: " . $settings['title_bold'] . ";
384 - text-shadow: " . ($settings['title_text_shadow'] === 'checked' ? '2px 2px 5px '.$settings['title_shadow_color'] : '') . ";
385 - font-style: " . $settings['title_italic'] . ";
386 - text-align: " . $settings['title_position'] . ";
387 - text-transform: " . $settings['title_text_transform'] . ";
388 - text-decoration: " . $settings['title_text_decoration'] . ";
389 - letter-spacing: " . $settings['title_letter_spacing'] . "px;
390 - margin-bottom: " . $settings['title_gap_description'] . "px;
421 + color: " . esc_attr($settings['title_color']) . ";
422 + font-size: " . esc_attr($settings['title_font_size']) . "px;
423 + font-weight: " . esc_attr($settings['title_bold'] ). ";
424 + text-shadow: " . ($settings['title_text_shadow'] === 'checked' ? '2px 2px 5px '.esc_attr($settings['title_shadow_color'] ): '') . ";
425 + font-style: " . esc_attr($settings['title_italic']) . ";
426 + text-align: " . esc_attr($settings['title_position'] ). ";
427 + text-transform: " . esc_attr($settings['title_text_transform'] ). ";
428 + text-decoration: " . esc_attr($settings['title_text_decoration']) . ";
429 + letter-spacing: " . esc_attr($settings['title_letter_spacing'] ). "px;
430 + margin-bottom: " . esc_attr($settings['title_gap_description']) . "px;
391 431 }
392 432
393 433 #" . $this->html_class_prefix . "container" . $this->unique_id . " div." . $this->html_class_prefix . "header-container>." . $this->html_class_prefix . "charts-description" . $this->unique_id . " {
394 - color: " . $settings['description_color'] . ";
395 - font-size: " . $settings['description_font_size'] . "px;
396 - font-weight: " . $settings['description_bold'] . ";
397 - text-shadow: " . ($settings['description_text_shadow'] === 'checked' ? '2px 2px 5px '.$settings['description_shadow_color'] : '') . ";
398 - font-style: " . $settings['description_italic'] . ";
399 - text-align: " . $settings['description_position'] . ";
400 - text-transform: " . $settings['description_text_transform'] . ";
401 - text-decoration: " . $settings['description_text_decoration'] . ";
402 - letter-spacing: " . $settings['description_letter_spacing'] . "px;
434 + color: " . esc_attr($settings['description_color']) . ";
435 + font-size: " . esc_attr($settings['description_font_size']) . "px;
436 + font-weight: " . esc_attr($settings['description_bold']) . ";
437 + text-shadow: " . ($settings['description_text_shadow'] === 'checked' ? '2px 2px 5px '. esc_attr($settings['description_shadow_color']) : '') . ";
438 + font-style: " . esc_attr($settings['description_italic']) . ";
439 + text-align: " . esc_attr($settings['description_position']) . ";
440 + text-transform: " . esc_attr($settings['description_text_transform']) . ";
441 + text-decoration: " . esc_attr($settings['description_text_decoration']) . ";
442 + letter-spacing: " . esc_attr($settings['description_letter_spacing']) . "px;
403 443 }
404 444 ";
405 445 wp_add_inline_style($this->plugin_name, $custom_css);
406 446