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