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