shortcode-vc-progress-bar.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. $color_value = array_merge( array(
  6. esc_html__( 'Default', 'js_composer' ) => '',
  7. ), array(
  8. esc_html__( 'Classic Grey', 'js_composer' ) => 'bar_grey',
  9. esc_html__( 'Classic Blue', 'js_composer' ) => 'bar_blue',
  10. esc_html__( 'Classic Turquoise', 'js_composer' ) => 'bar_turquoise',
  11. esc_html__( 'Classic Green', 'js_composer' ) => 'bar_green',
  12. esc_html__( 'Classic Orange', 'js_composer' ) => 'bar_orange',
  13. esc_html__( 'Classic Red', 'js_composer' ) => 'bar_red',
  14. esc_html__( 'Classic Black', 'js_composer' ) => 'bar_black',
  15. ), vc_get_shared( 'colors-dashed' ), array(
  16. esc_html__( 'Custom Color', 'js_composer' ) => 'custom',
  17. ) );
  18. $bg_color_value = array_merge( array(
  19. esc_html__( 'Classic Grey', 'js_composer' ) => 'bar_grey',
  20. esc_html__( 'Classic Blue', 'js_composer' ) => 'bar_blue',
  21. esc_html__( 'Classic Turquoise', 'js_composer' ) => 'bar_turquoise',
  22. esc_html__( 'Classic Green', 'js_composer' ) => 'bar_green',
  23. esc_html__( 'Classic Orange', 'js_composer' ) => 'bar_orange',
  24. esc_html__( 'Classic Red', 'js_composer' ) => 'bar_red',
  25. esc_html__( 'Classic Black', 'js_composer' ) => 'bar_black',
  26. ), vc_get_shared( 'colors-dashed' ), array(
  27. esc_html__( 'Custom Color', 'js_composer' ) => 'custom',
  28. ) );
  29. return array(
  30. 'name' => esc_html__( 'Progress Bar', 'js_composer' ),
  31. 'base' => 'vc_progress_bar',
  32. 'icon' => 'icon-wpb-graph',
  33. 'category' => esc_html__( 'Content', 'js_composer' ),
  34. 'description' => esc_html__( 'Animated progress bar', 'js_composer' ),
  35. 'params' => array(
  36. array(
  37. 'type' => 'textfield',
  38. 'heading' => esc_html__( 'Widget title', 'js_composer' ),
  39. 'param_name' => 'title',
  40. 'description' => esc_html__( 'Enter text used as widget title (Note: located above content element).', 'js_composer' ),
  41. ),
  42. array(
  43. 'type' => 'param_group',
  44. 'heading' => esc_html__( 'Values', 'js_composer' ),
  45. 'param_name' => 'values',
  46. 'description' => esc_html__( 'Enter values for graph - value, title and color.', 'js_composer' ),
  47. 'value' => rawurlencode( wp_json_encode( array(
  48. array(
  49. 'label' => esc_html__( 'Development', 'js_composer' ),
  50. 'value' => '90',
  51. ),
  52. array(
  53. 'label' => esc_html__( 'Design', 'js_composer' ),
  54. 'value' => '80',
  55. ),
  56. array(
  57. 'label' => esc_html__( 'Marketing', 'js_composer' ),
  58. 'value' => '70',
  59. ),
  60. ) ) ),
  61. 'params' => array(
  62. array(
  63. 'type' => 'textfield',
  64. 'heading' => esc_html__( 'Label', 'js_composer' ),
  65. 'param_name' => 'label',
  66. 'description' => esc_html__( 'Enter text used as title of bar.', 'js_composer' ),
  67. 'admin_label' => true,
  68. ),
  69. array(
  70. 'type' => 'textfield',
  71. 'heading' => esc_html__( 'Value', 'js_composer' ),
  72. 'param_name' => 'value',
  73. 'description' => esc_html__( 'Enter value of bar.', 'js_composer' ),
  74. 'admin_label' => true,
  75. ),
  76. array(
  77. 'type' => 'dropdown',
  78. 'heading' => esc_html__( 'Color', 'js_composer' ),
  79. 'param_name' => 'color',
  80. 'value' => $color_value,
  81. 'description' => esc_html__( 'Select single bar background color.', 'js_composer' ),
  82. 'admin_label' => true,
  83. 'param_holder_class' => 'vc_colored-dropdown',
  84. ),
  85. array(
  86. 'type' => 'colorpicker',
  87. 'heading' => esc_html__( 'Custom color', 'js_composer' ),
  88. 'param_name' => 'customcolor',
  89. 'description' => esc_html__( 'Select custom single bar background color.', 'js_composer' ),
  90. 'dependency' => array(
  91. 'element' => 'color',
  92. 'value' => array( 'custom' ),
  93. ),
  94. ),
  95. array(
  96. 'type' => 'colorpicker',
  97. 'heading' => esc_html__( 'Custom text color', 'js_composer' ),
  98. 'param_name' => 'customtxtcolor',
  99. 'description' => esc_html__( 'Select custom single bar text color.', 'js_composer' ),
  100. 'dependency' => array(
  101. 'element' => 'color',
  102. 'value' => array( 'custom' ),
  103. ),
  104. ),
  105. ),
  106. ),
  107. array(
  108. 'type' => 'textfield',
  109. 'heading' => esc_html__( 'Units', 'js_composer' ),
  110. 'param_name' => 'units',
  111. 'description' => esc_html__( 'Enter measurement units (Example: %, px, points, etc. Note: graph value and units will be appended to graph title).', 'js_composer' ),
  112. ),
  113. array(
  114. 'type' => 'dropdown',
  115. 'heading' => esc_html__( 'Color', 'js_composer' ),
  116. 'param_name' => 'bgcolor',
  117. 'value' => $bg_color_value,
  118. 'description' => esc_html__( 'Select bar background color.', 'js_composer' ),
  119. 'admin_label' => true,
  120. 'param_holder_class' => 'vc_colored-dropdown',
  121. ),
  122. array(
  123. 'type' => 'colorpicker',
  124. 'heading' => esc_html__( 'Bar custom background color', 'js_composer' ),
  125. 'param_name' => 'custombgcolor',
  126. 'description' => esc_html__( 'Select custom background color for bars.', 'js_composer' ),
  127. 'dependency' => array(
  128. 'element' => 'bgcolor',
  129. 'value' => array( 'custom' ),
  130. ),
  131. ),
  132. array(
  133. 'type' => 'colorpicker',
  134. 'heading' => esc_html__( 'Bar custom text color', 'js_composer' ),
  135. 'param_name' => 'customtxtcolor',
  136. 'description' => esc_html__( 'Select custom text color for bars.', 'js_composer' ),
  137. 'dependency' => array(
  138. 'element' => 'bgcolor',
  139. 'value' => array( 'custom' ),
  140. ),
  141. ),
  142. array(
  143. 'type' => 'checkbox',
  144. 'heading' => esc_html__( 'Options', 'js_composer' ),
  145. 'param_name' => 'options',
  146. 'value' => array(
  147. esc_html__( 'Add stripes', 'js_composer' ) => 'striped',
  148. esc_html__( 'Add animation (Note: visible only with striped bar).', 'js_composer' ) => 'animated',
  149. ),
  150. ),
  151. vc_map_add_css_animation(),
  152. array(
  153. 'type' => 'el_id',
  154. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  155. 'param_name' => 'el_id',
  156. 'description' => sprintf( esc_html__( 'Enter element ID (Note: make sure it is unique and valid according to %sw3c specification%s).', 'js_composer' ), '<a href="https://www.w3schools.com/tags/att_global_id.asp" target="_blank">', '</a>' ),
  157. ),
  158. array(
  159. 'type' => 'textfield',
  160. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  161. 'param_name' => 'el_class',
  162. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  163. ),
  164. array(
  165. 'type' => 'css_editor',
  166. 'heading' => esc_html__( 'CSS box', 'js_composer' ),
  167. 'param_name' => 'css',
  168. 'group' => esc_html__( 'Design Options', 'js_composer' ),
  169. ),
  170. ),
  171. );