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 +66 -24 3.0.8 → 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") {
@@ -275,9 +286,11 @@
275 286 $content[] = "</div>";
276 287
277 288 $custom_css = "
278 289 #" . $this->html_class_prefix . "container" . $this->unique_id . " {
279 - border: " . $settings['border_width_with_title'] . "px solid #000000;
290 + border: " . $settings['border_width_with_title'] . "px " . $settings['border_style_with_title'] . " " . $settings['border_color_with_title'] . ";
291 + border-radius: " . $settings['border_radius_with_title'] . "px;
292 + padding: " . $settings['padding_outer'] . "px;
280 293 }
281 294
282 295 #" . $this->html_class_prefix . "container" . $this->unique_id . " div." . $this->html_class_prefix . "charts-main-container" . $this->unique_id . " {
283 296 width: " . $settings['chart_width'] . ";
@@ -283,9 +296,9 @@
283 296 width: " . $settings['chart_width'] . ";
284 297 height: " . $settings['chart_height'] . ";
285 298 " . $settings['position'] . ";
286 299 border-radius: " . $settings['border_radius'] . "px;
287 - border: " . $settings['border_width'] . "px solid " . $settings['border_color'] . ";
300 + border: " . $settings['border_width'] . "px " . $settings['border_style'] . " " . $settings['border_color'] . ";
288 301 overflow: hidden;
289 302 box-shadow: " . ($settings['box_shadow'] === 'checked' ? '2px 2px 10px 2px '.$settings['box_shadow_color'] : '') . ";
290 303 }
291 304
@@ -339,8 +352,19 @@
339 352
340 353 return $content;
341 354 }
342 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 +
343 367 public function chartJsContent($chart, $settings, $chartData, $id) {
344 368 $chart_title = (isset($chart['title']) && $chart['title'] != '') ? stripslashes ( sanitize_text_field( $chart['title'] ) ) : '';
345 369 $chart_description = (isset($chart['description']) && $chart['description'] != '') ? stripslashes ( sanitize_text_field( $chart['description'] ) ) : '';
346 370
@@ -370,35 +394,53 @@
370 394
371 395 $content[] = "</div>";
372 396
373 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 + }
374 416 #" . $this->html_class_prefix . "container" . $this->unique_id . " div." . $this->html_class_prefix . "header-container {
375 - margin-bottom: " . $settings['title_gap'] . "px !important;
417 + margin-bottom: " . esc_attr($settings['title_gap']) . "px !important;
376 418 }
377 419
378 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 . " {
379 - color: " . $settings['title_color'] . ";
380 - font-size: " . $settings['title_font_size'] . "px;
381 - font-weight: " . $settings['title_bold'] . ";
382 - text-shadow: " . ($settings['title_text_shadow'] === 'checked' ? '2px 2px 5px '.$settings['title_shadow_color'] : '') . ";
383 - font-style: " . $settings['title_italic'] . ";
384 - text-align: " . $settings['title_position'] . ";
385 - text-transform: " . $settings['title_text_transform'] . ";
386 - text-decoration: " . $settings['title_text_decoration'] . ";
387 - letter-spacing: " . $settings['title_letter_spacing'] . "px;
388 - 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;
389 431 }
390 432
391 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 . " {
392 - color: " . $settings['description_color'] . ";
393 - font-size: " . $settings['description_font_size'] . "px;
394 - font-weight: " . $settings['description_bold'] . ";
395 - text-shadow: " . ($settings['description_text_shadow'] === 'checked' ? '2px 2px 5px '.$settings['description_shadow_color'] : '') . ";
396 - font-style: " . $settings['description_italic'] . ";
397 - text-align: " . $settings['description_position'] . ";
398 - text-transform: " . $settings['description_text_transform'] . ";
399 - text-decoration: " . $settings['description_text_decoration'] . ";
400 - 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;
401 443 }
402 444 ";
403 445 wp_add_inline_style($this->plugin_name, $custom_css);
404 446