shortcode-vc-message.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. die( '-1' );
  4. }
  5. $pixel_icons = vc_pixel_icons();
  6. $custom_colors = array(
  7. esc_html__( 'Informational', 'js_composer' ) => 'info',
  8. esc_html__( 'Warning', 'js_composer' ) => 'warning',
  9. esc_html__( 'Success', 'js_composer' ) => 'success',
  10. esc_html__( 'Error', 'js_composer' ) => 'danger',
  11. esc_html__( 'Informational Classic', 'js_composer' ) => 'alert-info',
  12. esc_html__( 'Warning Classic', 'js_composer' ) => 'alert-warning',
  13. esc_html__( 'Success Classic', 'js_composer' ) => 'alert-success',
  14. esc_html__( 'Error Classic', 'js_composer' ) => 'alert-danger',
  15. );
  16. return array(
  17. 'name' => esc_html__( 'Message Box', 'js_composer' ),
  18. 'base' => 'vc_message',
  19. 'icon' => 'icon-wpb-information-white',
  20. 'category' => esc_html__( 'Content', 'js_composer' ),
  21. 'description' => esc_html__( 'Notification box', 'js_composer' ),
  22. 'params' => array(
  23. array(
  24. 'type' => 'params_preset',
  25. 'heading' => esc_html__( 'Message Box Presets', 'js_composer' ),
  26. 'param_name' => 'color',
  27. // due to backward compatibility, really it is message_box_type
  28. 'value' => '',
  29. 'options' => array(
  30. array(
  31. 'label' => esc_html__( 'Custom', 'js_composer' ),
  32. 'value' => '',
  33. 'params' => array(),
  34. ),
  35. array(
  36. 'label' => esc_html__( 'Informational', 'js_composer' ),
  37. 'value' => 'info',
  38. 'params' => array(
  39. 'message_box_color' => 'info',
  40. 'icon_type' => 'fontawesome',
  41. 'icon_fontawesome' => 'fa fa-info-circle',
  42. ),
  43. ),
  44. array(
  45. 'label' => esc_html__( 'Warning', 'js_composer' ),
  46. 'value' => 'warning',
  47. 'params' => array(
  48. 'message_box_color' => 'warning',
  49. 'icon_type' => 'fontawesome',
  50. 'icon_fontawesome' => 'fa fa-exclamation-triangle',
  51. ),
  52. ),
  53. array(
  54. 'label' => esc_html__( 'Success', 'js_composer' ),
  55. 'value' => 'success',
  56. 'params' => array(
  57. 'message_box_color' => 'success',
  58. 'icon_type' => 'fontawesome',
  59. 'icon_fontawesome' => 'fa fa-check',
  60. ),
  61. ),
  62. array(
  63. 'label' => esc_html__( 'Error', 'js_composer' ),
  64. 'value' => 'danger',
  65. 'params' => array(
  66. 'message_box_color' => 'danger',
  67. 'icon_type' => 'fontawesome',
  68. 'icon_fontawesome' => 'fa fa-times',
  69. ),
  70. ),
  71. array(
  72. 'label' => esc_html__( 'Informational Classic', 'js_composer' ),
  73. 'value' => 'alert-info',
  74. // due to backward compatibility
  75. 'params' => array(
  76. 'message_box_color' => 'alert-info',
  77. 'icon_type' => 'pixelicons',
  78. 'icon_pixelicons' => 'vc_pixel_icon vc_pixel_icon-info',
  79. ),
  80. ),
  81. array(
  82. 'label' => esc_html__( 'Warning Classic', 'js_composer' ),
  83. 'value' => 'alert-warning',
  84. // due to backward compatibility
  85. 'params' => array(
  86. 'message_box_color' => 'alert-warning',
  87. 'icon_type' => 'pixelicons',
  88. 'icon_pixelicons' => 'vc_pixel_icon vc_pixel_icon-alert',
  89. ),
  90. ),
  91. array(
  92. 'label' => esc_html__( 'Success Classic', 'js_composer' ),
  93. 'value' => 'alert-success',
  94. // due to backward compatibility
  95. 'params' => array(
  96. 'message_box_color' => 'alert-success',
  97. 'icon_type' => 'pixelicons',
  98. 'icon_pixelicons' => 'vc_pixel_icon vc_pixel_icon-tick',
  99. ),
  100. ),
  101. array(
  102. 'label' => esc_html__( 'Error Classic', 'js_composer' ),
  103. 'value' => 'alert-danger',
  104. // due to backward compatibility
  105. 'params' => array(
  106. 'message_box_color' => 'alert-danger',
  107. 'icon_type' => 'pixelicons',
  108. 'icon_pixelicons' => 'vc_pixel_icon vc_pixel_icon-explanation',
  109. ),
  110. ),
  111. ),
  112. 'description' => esc_html__( 'Select predefined message box design or choose "Custom" for custom styling.', 'js_composer' ),
  113. 'param_holder_class' => 'vc_message-type vc_colored-dropdown',
  114. ),
  115. array(
  116. 'type' => 'dropdown',
  117. 'heading' => esc_html__( 'Style', 'js_composer' ),
  118. 'param_name' => 'message_box_style',
  119. 'value' => vc_get_shared( 'message_box_styles' ),
  120. 'description' => esc_html__( 'Select message box design style.', 'js_composer' ),
  121. ),
  122. array(
  123. 'type' => 'dropdown',
  124. 'heading' => esc_html__( 'Shape', 'js_composer' ),
  125. 'param_name' => 'style',
  126. // due to backward compatibility message_box_shape
  127. 'std' => 'rounded',
  128. 'value' => array(
  129. esc_html__( 'Square', 'js_composer' ) => 'square',
  130. esc_html__( 'Rounded', 'js_composer' ) => 'rounded',
  131. esc_html__( 'Round', 'js_composer' ) => 'round',
  132. ),
  133. 'description' => esc_html__( 'Select message box shape.', 'js_composer' ),
  134. ),
  135. array(
  136. 'type' => 'dropdown',
  137. 'heading' => esc_html__( 'Color', 'js_composer' ),
  138. 'param_name' => 'message_box_color',
  139. 'value' => $custom_colors + vc_get_shared( 'colors' ),
  140. 'description' => esc_html__( 'Select message box color.', 'js_composer' ),
  141. 'param_holder_class' => 'vc_message-type vc_colored-dropdown',
  142. ),
  143. array(
  144. 'type' => 'dropdown',
  145. 'heading' => esc_html__( 'Icon library', 'js_composer' ),
  146. 'value' => array(
  147. esc_html__( 'Font Awesome', 'js_composer' ) => 'fontawesome',
  148. esc_html__( 'Open Iconic', 'js_composer' ) => 'openiconic',
  149. esc_html__( 'Typicons', 'js_composer' ) => 'typicons',
  150. esc_html__( 'Entypo', 'js_composer' ) => 'entypo',
  151. esc_html__( 'Linecons', 'js_composer' ) => 'linecons',
  152. esc_html__( 'Pixel', 'js_composer' ) => 'pixelicons',
  153. esc_html__( 'Mono Social', 'js_composer' ) => 'monosocial',
  154. ),
  155. 'param_name' => 'icon_type',
  156. 'description' => esc_html__( 'Select icon library.', 'js_composer' ),
  157. ),
  158. array(
  159. 'type' => 'iconpicker',
  160. 'heading' => esc_html__( 'Icon', 'js_composer' ),
  161. 'param_name' => 'icon_fontawesome',
  162. 'value' => 'fa fa-info-circle',
  163. 'settings' => array(
  164. 'emptyIcon' => false,
  165. // default true, display an "EMPTY" icon?
  166. 'iconsPerPage' => 4000,
  167. // default 100, how many icons per/page to display
  168. ),
  169. 'dependency' => array(
  170. 'element' => 'icon_type',
  171. 'value' => 'fontawesome',
  172. ),
  173. 'description' => esc_html__( 'Select icon from library.', 'js_composer' ),
  174. ),
  175. array(
  176. 'type' => 'iconpicker',
  177. 'heading' => esc_html__( 'Icon', 'js_composer' ),
  178. 'param_name' => 'icon_openiconic',
  179. 'settings' => array(
  180. 'emptyIcon' => false,
  181. // default true, display an "EMPTY" icon?
  182. 'type' => 'openiconic',
  183. 'iconsPerPage' => 4000,
  184. // default 100, how many icons per/page to display
  185. ),
  186. 'dependency' => array(
  187. 'element' => 'icon_type',
  188. 'value' => 'openiconic',
  189. ),
  190. 'description' => esc_html__( 'Select icon from library.', 'js_composer' ),
  191. ),
  192. array(
  193. 'type' => 'iconpicker',
  194. 'heading' => esc_html__( 'Icon', 'js_composer' ),
  195. 'param_name' => 'icon_typicons',
  196. 'settings' => array(
  197. 'emptyIcon' => false,
  198. // default true, display an "EMPTY" icon?
  199. 'type' => 'typicons',
  200. 'iconsPerPage' => 4000,
  201. // default 100, how many icons per/page to display
  202. ),
  203. 'dependency' => array(
  204. 'element' => 'icon_type',
  205. 'value' => 'typicons',
  206. ),
  207. 'description' => esc_html__( 'Select icon from library.', 'js_composer' ),
  208. ),
  209. array(
  210. 'type' => 'iconpicker',
  211. 'heading' => esc_html__( 'Icon', 'js_composer' ),
  212. 'param_name' => 'icon_entypo',
  213. 'settings' => array(
  214. 'emptyIcon' => false,
  215. // default true, display an "EMPTY" icon?
  216. 'type' => 'entypo',
  217. 'iconsPerPage' => 4000,
  218. // default 100, how many icons per/page to display
  219. ),
  220. 'dependency' => array(
  221. 'element' => 'icon_type',
  222. 'value' => 'entypo',
  223. ),
  224. ),
  225. array(
  226. 'type' => 'iconpicker',
  227. 'heading' => esc_html__( 'Icon', 'js_composer' ),
  228. 'param_name' => 'icon_linecons',
  229. 'settings' => array(
  230. 'emptyIcon' => false,
  231. // default true, display an "EMPTY" icon?
  232. 'type' => 'linecons',
  233. 'iconsPerPage' => 4000,
  234. // default 100, how many icons per/page to display
  235. ),
  236. 'dependency' => array(
  237. 'element' => 'icon_type',
  238. 'value' => 'linecons',
  239. ),
  240. 'description' => esc_html__( 'Select icon from library.', 'js_composer' ),
  241. ),
  242. array(
  243. 'type' => 'iconpicker',
  244. 'heading' => esc_html__( 'Icon', 'js_composer' ),
  245. 'param_name' => 'icon_pixelicons',
  246. 'settings' => array(
  247. 'emptyIcon' => false,
  248. // default true, display an "EMPTY" icon?
  249. 'type' => 'pixelicons',
  250. 'source' => $pixel_icons,
  251. ),
  252. 'dependency' => array(
  253. 'element' => 'icon_type',
  254. 'value' => 'pixelicons',
  255. ),
  256. 'description' => esc_html__( 'Select icon from library.', 'js_composer' ),
  257. ),
  258. array(
  259. 'type' => 'iconpicker',
  260. 'heading' => esc_html__( 'Icon', 'js_composer' ),
  261. 'param_name' => 'icon_monosocial',
  262. 'value' => 'vc-mono vc-mono-fivehundredpx',
  263. // default value to backend editor admin_label
  264. 'settings' => array(
  265. 'emptyIcon' => false,
  266. // default true, display an "EMPTY" icon?
  267. 'type' => 'monosocial',
  268. 'iconsPerPage' => 4000,
  269. // default 100, how many icons per/page to display
  270. ),
  271. 'dependency' => array(
  272. 'element' => 'icon_type',
  273. 'value' => 'monosocial',
  274. ),
  275. 'description' => esc_html__( 'Select icon from library.', 'js_composer' ),
  276. ),
  277. array(
  278. 'type' => 'textarea_html',
  279. 'holder' => 'div',
  280. 'class' => 'messagebox_text',
  281. 'heading' => esc_html__( 'Message text', 'js_composer' ),
  282. 'param_name' => 'content',
  283. 'value' => '<p>' . esc_html__( 'I am message box. Click edit button to change this text.', 'js_composer' ) . '</p>',
  284. ),
  285. vc_map_add_css_animation( false ),
  286. array(
  287. 'type' => 'el_id',
  288. 'heading' => esc_html__( 'Element ID', 'js_composer' ),
  289. 'param_name' => 'el_id',
  290. '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>' ),
  291. ),
  292. array(
  293. 'type' => 'textfield',
  294. 'heading' => esc_html__( 'Extra class name', 'js_composer' ),
  295. 'param_name' => 'el_class',
  296. 'description' => esc_html__( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'js_composer' ),
  297. ),
  298. array(
  299. 'type' => 'css_editor',
  300. 'heading' => esc_html__( 'CSS box', 'js_composer' ),
  301. 'param_name' => 'css',
  302. 'group' => esc_html__( 'Design Options', 'js_composer' ),
  303. ),
  304. ),
  305. 'js_view' => 'VcMessageView_Backend',
  306. );