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