get_new_styler_data

The Contact Form 7 Style get new styler data function.

Description

get_new_styler_data( $a ); 

Parameters (1)

0. $a
The a.

Usage

  1. if ( !function_exists( 'get_new_styler_data' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7-style/cf7-style-match-old.php'; 
  3.  
  4. // The a. 
  5. $a = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_new_styler_data($a); 
  9.  

Defined (1)

The function is defined in the following location(s).

/cf7-style-match-old.php  
  1. function get_new_styler_data($a) { 
  2. $t = array(); 
  3. $u = "px"; 
  4. foreach ( $a as $k => $d ) { 
  5. if( $d != 'Default' && $d != '') { 
  6. if($k=="form-padding" || $k=="form-margin" ||$k=="input-margin" ||$k=="input-padding" ) { 
  7. $d = str_replace("px", "", $d);  
  8. $da = explode(" ", $d); 
  9. $nr = count($da); 
  10. $tfn = ""; 
  11. }  
  12. switch($k) { 
  13. case 'form-background' :  
  14. $t['form_background-color'] = $d;  
  15. break; 
  16. case 'form-width' : $t['form_width'] = $d; 
  17. $t['form_width_unit'] = $u;  
  18. break; 
  19. case 'form-border-width' :  
  20. $t['form_border-top-width'] = $d; 
  21. $t['form_border-top-width_unit'] = $u; 
  22. $t['form_border-right-width'] = $d; 
  23. $t['form_border-right-width_unit'] = $u; 
  24. $t['form_border-bottom-width'] = $d; 
  25. $t['form_border-bottom-width_unit'] = $u; 
  26. $t['form_border-left-width'] = $d; 
  27. $t['form_border-left-width_unit'] = $u; 
  28. break; 
  29. case 'form-border-style' : 
  30. $t['form_border-style'] = $d; 
  31. break; 
  32. case 'form-padding' : 
  33. $tfn = "form_padding"; 
  34. break; 
  35. case 'form-margin' : 
  36. $tfn = "form_margin"; 
  37. break; 
  38. case 'form-border-color' :  
  39. $t['form_border-color'] = $d; 
  40. break; 
  41. case 'form-border-radius' :  
  42. $t['form_border-top-left-radius'] = $d; 
  43. $t['form_border-top-left-radius_unit'] = $u; 
  44. $t['form_border-top-right-radius'] = $d; 
  45. $t['form_border-top-right-radius_unit'] = $u; 
  46. $t['form_border-bottom-left-radius'] = $d; 
  47. $t['form_border-bottom-left-radius_unit'] = $u; 
  48. $t['form_border-bottom-right-radius'] = $d; 
  49. $t['form_border-bottom-right-radius_unit'] = $u; 
  50. break; 
  51. case 'form-line-height' :  
  52. $t['form_line-height']= $d; 
  53. $t['form_line-height_unit']= $u; 
  54. break; 
  55. case 'input-background' : 
  56. $t['input_background-color'] = $d; 
  57. break; 
  58. case 'input-color' :  
  59. $t['input_color'] = $d; 
  60. break; 
  61. case 'input-border-color' :  
  62. $t['input_border-color'] = $d; 
  63. break; 
  64. case 'input-font-size' :  
  65. $t['input_font-size'] = $d; 
  66. $t['input_font-size_unit'] = $u; 
  67. break; 
  68. case 'input-line-height' :  
  69. $t['input_line-height'] = $d; 
  70. $t['input_line-height_unit'] = $u;  
  71. break; 
  72. case 'input-border-width' : 
  73. $t['input_border-top-width'] = $d; 
  74. $t['input_border-top-width_unit'] = $u; 
  75. $t['input_border-right-width'] = $d; 
  76. $t['input_border-right-width_unit'] = $u; 
  77. $t['input_border-bottom-width'] = $d; 
  78. $t['input_border-bottom-width_unit'] = $u; 
  79. $t['input_border-left-width'] = $d; 
  80. $t['input_border-left-width_unit'] = $u; 
  81. break; 
  82. case 'input-border-style' :  
  83. $t['input_border-style'] = $d;  
  84. break; 
  85. case 'input-border-radius' :  
  86. $t['input_border-top-left-radius'] = $d; 
  87. $t['input_border-top-left-radius_unit'] = $u; 
  88. $t['input_border-top-right-radius'] = $d; 
  89. $t['input_border-top-right-radius_unit'] = $u; 
  90. $t['input_border-bottom-left-radius'] = $d; 
  91. $t['input_border-bottom-left-radius_unit'] = $u; 
  92. $t['input_border-bottom-right-radius'] = $d; 
  93. $t['input_border-bottom-right-radius_unit'] = $u;  
  94. break; 
  95. case 'input-font-style' : 
  96. $t['input_font-style'] = $d;  
  97. break; 
  98. case 'input-font-weight' :  
  99. $t['input_font-weight'] = $d;  
  100. break; 
  101. case 'input-width' : $t['input_width'] = $d; 
  102. $t['input_width_unit'] = $u; 
  103. break; 
  104. case 'input-box-sizing' : 
  105. $t['input_box-sizing']= $d; 
  106. break; 
  107. case 'input-height' :  
  108. $t['input_height'] = $d; 
  109. $t['input_height_unit'] = $u; 
  110. break; 
  111. case 'input-padding' : 
  112. $tfn = "input_padding"; 
  113. break; 
  114. case 'input-margin' : 
  115. $tfn = "input_margin"; 
  116. break; 
  117. case 'textarea-background-color' :  
  118. $t['textarea_background-color'] = $d; 
  119. break; 
  120. case 'textarea-height' : 
  121. $t['textarea_height'] = $d; 
  122. $t['textarea_height_unit'] = $u; 
  123. break; 
  124. case 'textarea-width' : 
  125. $t['textarea_width'] = $d; 
  126. $t['textarea_width_unit'] = $u; 
  127. break; 
  128. case 'textarea-box-sizing' :  
  129. $t['textarea_box-sizing'] = $d; 
  130. break; 
  131. case 'textarea-border-size' : 
  132. $t['textarea_border-top-width'] = $d; 
  133. $t['textarea_border-top-width_unit'] = $u; 
  134. $t['textarea_border-right-width'] = $d; 
  135. $t['textarea_border-right-width_unit'] = $u; 
  136. $t['textarea_border-bottom-width'] = $d; 
  137. $t['textarea_border-bottom-width_unit'] = $u; 
  138. $t['textarea_border-left-width'] = $d; 
  139. $t['textarea_border-left-width_unit'] = $u; 
  140. break; 
  141. case 'textarea-border-color' :  
  142. $t['textarea_border-color']= $d; 
  143. break; 
  144. case 'textarea-border-style' :  
  145. $t['textarea_border-style'] = $d; 
  146. break; 
  147. case 'textarea-border-radius' :  
  148. $t['textarea_border-top-left-radius'] = $d; 
  149. $t['textarea_border-top-left-radius_unit'] = $u; 
  150. $t['textarea_border-top-right-radius'] = $d; 
  151. $t['textarea_border-top-right-radius_unit'] = $u; 
  152. $t['textarea_border-bottom-left-radius'] = $d; 
  153. $t['textarea_border-bottom-left-radius_unit'] = $u; 
  154. $t['textarea_border-bottom-right-radius'] = $d; 
  155. $t['textarea_border-bottom-right-radius_unit'] = $u; 
  156. break; 
  157. case 'textarea-font-size' :  
  158. $t['textarea_font-size'] = $d;  
  159. $t['textarea_font-size_unit'] = $u; 
  160. break; 
  161. case 'textarea-line-height' :  
  162. $t['textarea_line-height'] = $d;  
  163. $t['textarea_line-height_unit'] = $u; 
  164. break; 
  165. case 'textarea-font-style' :  
  166. $t['textarea_font-style'] = $d; 
  167. break; 
  168. case 'label-font-style' :  
  169. $t['label_font-style']= $d; 
  170. $t['p_font-style']= $d; 
  171. break; 
  172. case 'label-font-weight' :  
  173. $t['label_font-weight'] = $d; 
  174. $t['p_font-weight'] = $d; 
  175. break; 
  176. case 'label-font-size' :  
  177. $t['label_font-size'] = $d;  
  178. $t['label_font-size_unit'] = $u; 
  179. $t['p_font-size'] = $d;  
  180. $t['p_font-size_unit'] = $u; 
  181. break; 
  182. case 'label-line-height' :  
  183. $t['label_line-height']= $d;  
  184. $t['label_line-height_unit']= $u; 
  185. $t['p_line-height']= $d;  
  186. $t['p_line-height_unit']= $u; 
  187. break; 
  188. case 'label-color' :  
  189. $t['label_color'] = $d; 
  190. $t['p_color'] = $d; 
  191. break; 
  192. case 'submit-button-width' :  
  193. $t['submit_width'] = $d; 
  194. $t['submit_width_unit'] = $u; 
  195. break; 
  196. case 'submit-button-box-sizing' :  
  197. $t['submit_box-sizing'] = $d; 
  198. break; 
  199. case 'submit-button-height' :  
  200. $t['submit_height'] = $d; 
  201. $t['submit_height_unit'] = $u; 
  202. break; 
  203. case 'submit-button-border-radius' :  
  204. $t['submit_border-top-left-radius'] = $d; 
  205. $t['submit_border-top-left-radius_unit'] = $u; 
  206. $t['submit_border-top-right-radius'] = $d; 
  207. $t['submit_border-top-right-radius_unit'] = $u; 
  208. $t['submit_border-bottom-left-radius'] = $d; 
  209. $t['submit_border-bottom-left-radius_unit'] = $u; 
  210. $t['submit_border-bottom-right-radius'] = $d; 
  211. $t['submit_border-bottom-right-radius_unit'] = $u; 
  212. break; 
  213. case 'submit-button-font-size' :  
  214. $t['submit_font-size'] = $d;  
  215. $t['submit_font-size_unit'] = $u; 
  216. break; 
  217. case 'submit-button-line-height' :  
  218. $t['submit_line-height'] = $d;  
  219. $t['submit_line-height_unit'] = $u; 
  220. break; 
  221. case 'submit-button-border-width' :  
  222. $t['submit_border-top-width'] = $d; 
  223. $t['submit_border-top-width_unit'] = $u; 
  224. $t['submit_border-right-width'] = $d; 
  225. $t['submit_border-right-width_unit'] = $u; 
  226. $t['submit_border-bottom-width'] = $d; 
  227. $t['submit_border-bottom-width_unit']= $u; 
  228. $t['submit_border-left-width']= $d; 
  229. $t['submit_border-left-width_unit']= $u; 
  230. break; 
  231. case 'submit-button-border-style':  
  232. $t['submit_border-style'] = $d; 
  233. break; 
  234. case 'submit-button-border-color' : 
  235. $t['submit_border-color'] = $d; 
  236. break; 
  237. case 'submit-button-color' : 
  238. $t['submit_color'] = $d; 
  239. break; 
  240. case 'submit-button-background' : 
  241. $t['submit_background-color'] = $d; 
  242. break; 
  243. if($k=="form-padding" || $k=="form-margin" ||$k=="input-margin" ||$k=="input-padding" ) { 
  244. switch($nr) { 
  245. case 1:  
  246. $t[$tfn.'-top'] = $d; 
  247. $t[$tfn.'-top_unit'] = $u; 
  248. $t[$tfn.'-right'] = $d; 
  249. $t[$tfn.'-right_unit'] = $u; 
  250. $t[$tfn.'-bottom'] = $d; 
  251. $t[$tfn.'-bottom_unit'] = $u; 
  252. $t[$tfn.'-left'] = $d; 
  253. $t[$tfn.'-left_unit'] = $u; 
  254. break; 
  255. case 2: 
  256. $t[$tfn.'-top'] = $da[0]; 
  257. $t[$tfn.'-top_unit'] = $u; 
  258. $t[$tfn.'-right'] = $da[1]; 
  259. $t[$tfn.'-right_unit'] = $u; 
  260. $t[$tfn.'-bottom'] = $da[0]; 
  261. $t[$tfn.'-bottom_unit'] = $u; 
  262. $t[$tfn.'-left'] = $da[1]; 
  263. $t[$tfn.'-left_unit'] = $u; 
  264. break; 
  265. case 3:  
  266. $t[$tfn.'-top'] = $da[0]; 
  267. $t[$tfn.'-top_unit'] = $u; 
  268. $t[$tfn.'-right'] = $da[1]; 
  269. $t[$tfn.'-right_unit'] = $u; 
  270. $t[$tfn.'-bottom'] = $da[2]; 
  271. $t[$tfn.'-bottom_unit'] = $u; 
  272. $t[$tfn.'-left'] = $da[1]; 
  273. $t[$tfn.'-left_unit'] = $u; 
  274. break; 
  275. case 4:  
  276. $t[$tfn.'-top'] = $da[0]; 
  277. $t[$tfn.'-top_unit'] = $u; 
  278. $t[$tfn.'-right'] = $da[1]; 
  279. $t[$tfn.'-right_unit'] = $u; 
  280. $t[$tfn.'-bottom'] = $da[2]; 
  281. $t[$tfn.'-bottom_unit'] = $u; 
  282. $t[$tfn.'-left'] = $da[3]; 
  283. $t[$tfn.'-left_unit'] = $u; 
  284. break; 
  285. return $t;