PageRenderTime 28ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/framework/3rd-party/visual-composer/shortcodes/animated_text.php

https://bitbucket.org/aronwp/total
PHP | 283 lines | 242 code | 12 blank | 29 comment | 1 complexity | e5eb19341ad1e1a312ba7256fdc53389 MD5 | raw file
  1. <?php
  2. /**
  3. * Visual Composer Animated Text Shortcode
  4. *
  5. * @package Total WordPress Theme
  6. * @subpackage VC Functions
  7. * @version 4.5
  8. */
  9. if ( ! class_exists( 'VCEX_Animated_Text_Shortcode' ) ) {
  10. class VCEX_Animated_Text_Shortcode {
  11. /**
  12. * Main constructor
  13. *
  14. * @since 3.5.0
  15. */
  16. public function __construct() {
  17. // Add shortcode
  18. add_shortcode( 'vcex_animated_text', array( 'VCEX_Animated_Text_Shortcode', 'output' ) );
  19. // Map to VC
  20. vc_lean_map( 'vcex_animated_text', array( 'VCEX_Animated_Text_Shortcode', 'map' ) );
  21. }
  22. /**
  23. * Shortcode output => Get template file and display shortcode
  24. *
  25. * @since 3.5.0
  26. */
  27. public static function output( $atts, $content = null ) {
  28. ob_start();
  29. include( locate_template( 'vcex_templates/vcex_animated_text.php' ) );
  30. return ob_get_clean();
  31. }
  32. /**
  33. * Map shortcode to VC
  34. *
  35. * @since 3.5.0
  36. */
  37. public static function map() {
  38. return array(
  39. 'name' => __( 'Animated Text', 'total' ),
  40. 'description' => __( 'Animated text', 'total' ),
  41. 'base' => 'vcex_animated_text',
  42. 'icon' => 'vcex-animated-text vcex-icon fa fa-text-width',
  43. 'category' => wpex_get_theme_branding(),
  44. 'params' => array(
  45. // General
  46. array(
  47. 'type' => 'vcex_visibility',
  48. 'heading' => __( 'Visibility', 'total' ),
  49. 'param_name' => 'visibility',
  50. ),
  51. vcex_vc_map_add_css_animation(),
  52. array(
  53. 'type' => 'textfield',
  54. 'heading' => __( 'Extra class name', 'total' ),
  55. 'param_name' => 'el_class',
  56. 'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', 'total' ),
  57. ),
  58. array(
  59. 'type' => 'vcex_text_alignments',
  60. 'heading' => __( 'Align', 'total' ),
  61. 'param_name' => 'text_align',
  62. ),
  63. array(
  64. 'type' => 'textfield',
  65. 'heading' => __( 'Speed', 'total' ),
  66. 'param_name' => 'speed',
  67. 'description' => __( 'Enter a value in milliseconds.', 'total' ),
  68. ),
  69. array(
  70. 'type' => 'textfield',
  71. 'heading' => __( 'Back Delay', 'total' ),
  72. 'param_name' => 'back_delay',
  73. 'std' => '500',
  74. 'description' => __( 'Enter a value in milliseconds.', 'total' ),
  75. ),
  76. array(
  77. 'type' => 'textfield',
  78. 'heading' => __( 'Back Speed', 'total' ),
  79. 'param_name' => 'back_speed',
  80. 'description' => __( 'Enter a value in milliseconds.', 'total' ),
  81. ),
  82. array(
  83. 'type' => 'textfield',
  84. 'heading' => __( 'Start Delay', 'total' ),
  85. 'param_name' => 'start_delay',
  86. 'description' => __( 'Enter a value in milliseconds.', 'total' ),
  87. ),
  88. array(
  89. 'type' => 'vcex_ofswitch',
  90. 'std' => 'true',
  91. 'heading' => __( 'Loop', 'total' ),
  92. 'param_name' => 'loop',
  93. ),
  94. array(
  95. 'type' => 'vcex_ofswitch',
  96. 'std' => 'false',
  97. 'heading' => __( 'Cursor', 'total' ),
  98. 'param_name' => 'type_cursor',
  99. ),
  100. // Typography
  101. array(
  102. 'type' => 'vcex_font_family_select',
  103. 'heading' => __( 'Font Family', 'total' ),
  104. 'param_name' => 'font_family',
  105. 'group' => __( 'Typography', 'total' ),
  106. ),
  107. array(
  108. 'heading' => __( 'Tag', 'total' ),
  109. 'param_name' => 'tag',
  110. 'type' => 'vcex_select_buttons',
  111. 'std' => 'div',
  112. 'choices' => 'html_tag',
  113. 'group' => __( 'Typography', 'total' ),
  114. ),
  115. array(
  116. 'type' => 'colorpicker',
  117. 'heading' => __( 'Color', 'total' ),
  118. 'param_name' => 'color',
  119. 'group' => __( 'Typography', 'total' ),
  120. ),
  121. array(
  122. 'type' => 'vcex_font_weight',
  123. 'param_name' => 'font_weight',
  124. 'heading' => __( 'Font Weight', 'total' ),
  125. 'group' => __( 'Typography', 'total' ),
  126. ),
  127. array(
  128. 'type' => 'vcex_responsive_sizes',
  129. 'heading' => __( 'Font Size', 'total' ),
  130. 'param_name' => 'font_size',
  131. 'group' => __( 'Typography', 'total' ),
  132. 'target' => 'font-size',
  133. ),
  134. array(
  135. 'heading' => __( 'Font Style', 'total' ),
  136. 'param_name' => 'font_style',
  137. 'type' => 'vcex_select_buttons',
  138. 'std' => '',
  139. 'choices' => array(
  140. '' => __( 'Normal', 'total' ),
  141. 'italic' => __( 'Italic', 'total' ),
  142. ),
  143. 'group' => __( 'Typography', 'total' ),
  144. ),
  145. // Animated Text
  146. array(
  147. 'type' => 'textfield',
  148. 'heading' => __( 'Fixed Width', 'total' ),
  149. 'param_name' => 'animated_span_width',
  150. 'group' => __( 'Animated Text', 'total' ),
  151. 'description' => __( 'Enter a custom width to keep the animated container fixed. Useful when adding custom background or static text after the animated text.', 'total' ),
  152. ),
  153. array(
  154. 'type' => 'vcex_text_alignments',
  155. 'heading' => __( 'Text Align', 'total' ),
  156. 'param_name' => 'animated_text_align',
  157. 'group' => __( 'Animated Text', 'total' ),
  158. 'exclude_choices' => array( 'default' ),
  159. 'std' => 'left',
  160. 'dependency' => array( 'element' => 'animated_span_width', 'not_empty' => true )
  161. ),
  162. array(
  163. 'type' => 'param_group',
  164. 'param_name' => 'strings',
  165. 'group' => __( 'Animated Text', 'total' ),
  166. 'value' => urlencode( json_encode( array(
  167. array(
  168. 'text' => __( 'Welcome', 'total' ),
  169. ),
  170. array(
  171. 'text' => __( 'Bienvenido', 'total' ),
  172. ),
  173. array(
  174. 'text' => __( 'Welkom', 'total' ),
  175. ),
  176. array(
  177. 'text' => __( 'Bienvenue', 'total' ),
  178. ),
  179. ) ) ),
  180. 'params' => array(
  181. array(
  182. 'type' => 'textfield',
  183. 'heading' => __( 'Text', 'total' ),
  184. 'param_name' => 'text',
  185. 'admin_label' => true,
  186. ),
  187. ),
  188. ),
  189. array(
  190. 'type' => 'vcex_font_family_select',
  191. 'heading' => __( 'Font Family', 'total' ),
  192. 'param_name' => 'animated_font_family',
  193. 'dependency' => array( 'element' => 'static_text', 'value' => 'true' ),
  194. 'group' => __( 'Animated Text', 'total' ),
  195. ),
  196. array(
  197. 'type' => 'colorpicker',
  198. 'heading' => __( 'Color', 'total' ),
  199. 'param_name' => 'animated_color',
  200. 'dependency' => array( 'element' => 'static_text', 'value' => 'true' ),
  201. 'group' => __( 'Animated Text', 'total' ),
  202. ),
  203. array(
  204. 'type' => 'vcex_font_weight',
  205. 'param_name' => 'animated_font_weight',
  206. 'heading' => __( 'Font Weight', 'total' ),
  207. 'std' => '',
  208. 'dependency' => array( 'element' => 'static_text', 'value' => 'true' ),
  209. 'group' => __( 'Animated Text', 'total' ),
  210. ),
  211. array(
  212. 'heading' => __( 'Font Style', 'total' ),
  213. 'param_name' => 'animated_font_style',
  214. 'type' => 'vcex_select_buttons',
  215. 'std' => '',
  216. 'choices' => array(
  217. '' => __( 'Normal', 'total' ),
  218. 'italic' => __( 'Italic', 'total' ),
  219. ),
  220. 'dependency' => array( 'element' => 'static_text', 'value' => 'true' ),
  221. 'group' => __( 'Animated Text', 'total' ),
  222. ),
  223. array(
  224. 'type' => 'vcex_select_buttons',
  225. 'heading' => __( 'Text Decoration', 'total' ),
  226. 'param_name' => 'animated_text_decoration',
  227. 'choices' => 'text_decoration',
  228. 'dependency' => array( 'element' => 'static_text', 'value' => 'true' ),
  229. 'group' => __( 'Animated Text', 'total' ),
  230. ),
  231. array(
  232. 'type' => 'css_editor',
  233. 'heading' => __( 'CSS', 'total' ),
  234. 'param_name' => 'animated_css',
  235. 'group' => __( 'Animated Text', 'total' ),
  236. ),
  237. // Static Text
  238. array(
  239. 'type' => 'vcex_ofswitch',
  240. 'heading' => __( 'Enable', 'total' ),
  241. 'param_name' => 'static_text',
  242. 'group' => __( 'Static Text', 'total' ),
  243. 'std' => 'false',
  244. ),
  245. array(
  246. 'type' => 'textfield',
  247. 'heading' => __( 'Before', 'total' ),
  248. 'param_name' => 'static_before',
  249. 'group' => __( 'Static Text', 'total' ),
  250. 'dependency' => array( 'element' => 'static_text', 'value' => 'true' ),
  251. ),
  252. array(
  253. 'type' => 'textfield',
  254. 'heading' => __( 'After', 'total' ),
  255. 'param_name' => 'static_after',
  256. 'group' => __( 'Static Text', 'total' ),
  257. 'dependency' => array( 'element' => 'static_text', 'value' => 'true' ),
  258. ),
  259. // Container Design
  260. array(
  261. 'type' => 'css_editor',
  262. 'heading' => __( 'Container Design', 'total' ),
  263. 'param_name' => 'css',
  264. 'group' => __( 'Container Design', 'total' ),
  265. ),
  266. ),
  267. );
  268. }
  269. }
  270. }
  271. new VCEX_Animated_Text_Shortcode;