vc-pie.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. /**
  6. * Class WPBakeryShortCode_Vc_Pie
  7. */
  8. class WPBakeryShortCode_Vc_Pie extends WPBakeryShortCode {
  9. /**
  10. * WPBakeryShortCode_Vc_Pie constructor.
  11. * @param $settings
  12. */
  13. public function __construct( $settings ) {
  14. parent::__construct( $settings );
  15. $this->jsScripts();
  16. }
  17. public function jsScripts() {
  18. wp_register_script( 'vc_waypoints', vc_asset_url( 'lib/vc_waypoints/vc-waypoints.min.js' ), array( 'jquery' ), WPB_VC_VERSION, true );
  19. wp_register_script( 'progressCircle', vc_asset_url( 'lib/bower/progress-circle/ProgressCircle.min.js' ), array(), WPB_VC_VERSION, true );
  20. wp_register_script( 'vc_pie', vc_asset_url( 'lib/vc_chart/jquery.vc_chart.min.js' ), array(
  21. 'jquery',
  22. 'vc_waypoints',
  23. 'progressCircle',
  24. ), WPB_VC_VERSION, true );
  25. }
  26. /**
  27. * Convert old color names to new ones for BC
  28. *
  29. * @param array $atts
  30. *
  31. * @return array
  32. */
  33. public static function convertOldColorsToNew( $atts ) {
  34. $map = array(
  35. 'btn-primary' => '#0088cc',
  36. 'btn-success' => '#6ab165',
  37. 'btn-warning' => '#ff9900',
  38. 'btn-inverse' => '#555555',
  39. 'btn-danger' => '#ff675b',
  40. 'btn-info' => '#58b9da',
  41. 'primary' => '#0088cc',
  42. 'success' => '#6ab165',
  43. 'warning' => '#ff9900',
  44. 'inverse' => '#555555',
  45. 'danger' => '#ff675b',
  46. 'info' => '#58b9da',
  47. 'default' => '#f7f7f7',
  48. );
  49. if ( isset( $atts['color'] ) && isset( $map[ $atts['color'] ] ) ) {
  50. $atts['custom_color'] = $map[ $atts['color'] ];
  51. $atts['color'] = 'custom';
  52. }
  53. return $atts;
  54. }
  55. }