WordPress Page Builder – Beaver Builder - Version 2.2.0.6

Version Description

Download this release

Release Info

Developer pross
Plugin Icon 128x128 WordPress Page Builder – Beaver Builder
Version 2.2.0.6
Comparing to
See all releases

Code changes from version 2.1.7.2 to 2.2.0.6

Files changed (152) hide show
  1. changelog.txt +420 -3
  2. classes/class-fl-builder-admin-posts.php +2 -3
  3. classes/class-fl-builder-ajax-layout.php +51 -44
  4. classes/class-fl-builder-ajax.php +4 -3
  5. classes/class-fl-builder-art.php +798 -0
  6. classes/class-fl-builder-color.php +178 -24
  7. classes/class-fl-builder-css.php +530 -0
  8. classes/class-fl-builder-debug.php +7 -1
  9. classes/class-fl-builder-fonts.php +132 -57
  10. classes/class-fl-builder-loader.php +5 -1
  11. classes/class-fl-builder-model.php +136 -69
  12. classes/class-fl-builder-module.php +15 -2
  13. classes/class-fl-builder-settings-compat-column.php +46 -0
  14. classes/class-fl-builder-settings-compat-generic.php +20 -0
  15. classes/class-fl-builder-settings-compat-helper.php +164 -0
  16. classes/class-fl-builder-settings-compat-module.php +21 -0
  17. classes/class-fl-builder-settings-compat-row.php +24 -0
  18. classes/class-fl-builder-settings-compat.php +101 -0
  19. classes/class-fl-builder-settings-presets.php +104 -0
  20. classes/class-fl-builder-ui-content-panel.php +4 -0
  21. classes/class-fl-builder-ui-settings-forms.php +20 -0
  22. classes/class-fl-builder-wp-blocks-layout.php +12 -8
  23. classes/class-fl-builder.php +277 -76
  24. css/animations/bounce-down.css +68 -0
  25. css/animations/bounce-in.css +80 -0
  26. css/animations/bounce-left.css +68 -0
  27. css/animations/bounce-right.css +68 -0
  28. css/animations/bounce-up.css +68 -0
  29. css/animations/bounce.css +64 -0
  30. css/animations/fade-down.css +28 -0
  31. css/animations/fade-in.css +20 -0
  32. css/animations/fade-left.css +28 -0
  33. css/animations/fade-right.css +28 -0
  34. css/animations/fade-up.css +28 -0
  35. css/animations/fancy-flash.css +26 -0
  36. css/animations/fancy-jack-box.css +48 -0
  37. css/animations/fancy-jello.css +78 -0
  38. css/animations/fancy-light-speed.css +48 -0
  39. css/animations/fancy-pulse.css +32 -0
  40. css/animations/fancy-roll-in.css +28 -0
  41. css/animations/fancy-rubber-band.css +64 -0
  42. css/animations/fancy-shake.css +48 -0
  43. css/animations/fancy-swing.css +50 -0
  44. css/animations/fancy-tada.css +60 -0
  45. css/animations/fancy-wobble.css +64 -0
  46. css/animations/flip-horizontal.css +62 -0
  47. css/animations/flip-vertical.css +62 -0
  48. css/animations/rotate-down-left.css +36 -0
  49. css/animations/rotate-down-right.css +36 -0
  50. css/animations/rotate-in.css +36 -0
  51. css/animations/rotate-up-left.css +36 -0
  52. css/animations/rotate-up-right.css +36 -0
  53. css/animations/slide-in-down.css +26 -0
  54. css/animations/slide-in-left.css +26 -0
  55. css/animations/slide-in-right.css +26 -0
  56. css/animations/slide-in-up.css +26 -0
  57. css/animations/zoom-down.css +36 -0
  58. css/animations/zoom-in.css +24 -0
  59. css/animations/zoom-left.css +36 -0
  60. css/animations/zoom-right.css +36 -0
  61. css/animations/zoom-up.css +36 -0
  62. css/build/builder.bundle.css +11 -3
  63. css/build/builder.bundle.min.css +1 -1
  64. css/editor.css +6 -1
  65. css/fl-builder-layout.css +93 -107
  66. css/fl-builder-rtl.css +151 -33
  67. css/fl-builder-ui-skin-dark.css +130 -38
  68. css/fl-builder.css +1070 -247
  69. css/fl-builder.min.css +1 -1
  70. css/fl-color-picker.css +16 -7
  71. css/fl-lightbox.css +26 -13
  72. css/jquery.tiptip.css +1 -0
  73. fl-builder.php +1 -1
  74. fonts/fontawesome/css/all.min.css +2 -2
  75. fonts/fontawesome/webfonts/fa-brands-400.eot +0 -0
  76. fonts/fontawesome/webfonts/fa-brands-400.svg +2 -2
  77. fonts/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  78. fonts/fontawesome/webfonts/fa-brands-400.woff +0 -0
  79. fonts/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  80. fonts/fontawesome/webfonts/fa-regular-400.eot +0 -0
  81. fonts/fontawesome/webfonts/fa-regular-400.svg +1 -1
  82. fonts/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  83. fonts/fontawesome/webfonts/fa-regular-400.woff +0 -0
  84. fonts/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  85. fonts/fontawesome/webfonts/fa-solid-900.eot +0 -0
  86. fonts/fontawesome/webfonts/fa-solid-900.svg +5 -2
  87. fonts/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  88. fonts/fontawesome/webfonts/fa-solid-900.woff +0 -0
  89. fonts/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  90. img/svg/select-arrow-down-alt2-light.svg +1 -1
  91. img/svg/select-arrow-down-alt2.svg +1 -1
  92. img/transp_bg.png +0 -0
  93. includes/admin-settings-welcome.php +7 -8
  94. includes/column-css.php +137 -76
  95. includes/column-settings.php +203 -188
  96. includes/column.php +3 -2
  97. includes/compatibility.php +24 -0
  98. includes/global-settings.php +80 -11
  99. includes/jquery.php +0 -8
  100. includes/module-settings.php +46 -43
  101. includes/module.php +4 -2
  102. includes/row-css.php +182 -112
  103. includes/row-settings.php +237 -145
  104. includes/row.php +4 -3
  105. includes/shape-layer.php +42 -0
  106. includes/shapes/circle.svg.php +1 -0
  107. includes/shapes/concave.svg.php +1 -0
  108. includes/shapes/dot-cluster.svg.php +28 -0
  109. includes/shapes/edge-slant.svg.php +1 -0
  110. includes/shapes/midpoint.svg.php +1 -0
  111. includes/shapes/rect.svg.php +1 -0
  112. includes/shapes/star.svg.php +1 -0
  113. includes/shapes/topography.svg.php +1 -0
  114. includes/shapes/triangle.svg.php +1 -0
  115. includes/shapes/triangles.svg.php +8 -0
  116. includes/shapes/wavy.svg.php +1 -0
  117. includes/ui-field-align.php +31 -0
  118. includes/ui-field-animation.php +143 -0
  119. includes/ui-field-border.php +162 -0
  120. includes/ui-field-button-group.php +31 -0
  121. includes/ui-field-color.php +7 -1
  122. includes/ui-field-date.php +7 -0
  123. includes/ui-field-dimension.php +106 -45
  124. includes/ui-field-font.php +30 -7
  125. includes/ui-field-form.php +3 -1
  126. includes/ui-field-gradient.php +112 -0
  127. includes/ui-field-icon.php +21 -2
  128. includes/ui-field-link.php +24 -0
  129. includes/ui-field-photo.php +21 -5
  130. includes/ui-field-preset.php +5 -0
  131. includes/ui-field-raw.php +1 -0
  132. includes/ui-field-select.php +16 -0
  133. includes/ui-field-shadow.php +82 -0
  134. includes/ui-field-shape-transform.php +105 -0
  135. includes/ui-field-typography.php +237 -0
  136. includes/ui-field-unit.php +52 -6
  137. includes/ui-field.php +8 -9
  138. includes/ui-js-config.php +3 -1
  139. includes/ui-js-templates.php +55 -18
  140. includes/ui-settings-form-row.php +8 -2
  141. includes/ui-settings-form.php +25 -9
  142. includes/updater-config.php +1 -1
  143. includes/updater/classes/class-fl-updater.php +2 -0
  144. includes/vendor/activecampaign/Connector.class.php +4 -6
  145. includes/vendor/aweber/oauth_application.php +5 -5
  146. includes/vendor/drip/Drip_API.class.php +18 -19
  147. includes/vendor/enormail/Enormail/Rest.php +37 -38
  148. includes/vendor/icontact/iContactApi.php +63 -64
  149. includes/vendor/mailerlite/FL_ML_Rest_Base.php +1 -2
  150. includes/vendor/mautic/MauticApi.php +0 -2
  151. includes/vendor/sendinblue/Mailin.php +1 -4
  152. js/build/builder.bundle.js +55 -58
changelog.txt CHANGED
@@ -1,3 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <h4>2.1.7.2 - 01/02/2019</h4>
2
  <p><strong>Hot Fix</strong></p>
3
  <ul>
@@ -62,7 +482,6 @@
62
  <li>Fixed issue with layout shortcodes in Wocommerce description not rendering their assets.</li>
63
  </ul>
64
 
65
-
66
  <h4>2.1.6.3 - 10/30/2018</h4>
67
  <p><strong>Halloween Hot Fix</strong></p>
68
  <ul>
@@ -176,7 +595,6 @@
176
  <li>Fixed CORS issue on Pantheon hosting.</li>
177
  </ul>
178
 
179
-
180
  <h4>2.1.4.5 - 09/10/2018</h4>
181
  <p><strong>HotFix</strong></p>
182
  <ul>
@@ -229,7 +647,6 @@
229
  </ul>
230
  </li>
231
  </ul>
232
-
233
  <p><strong>Bug Fixes</strong></p>
234
  <ul>
235
  <li>Fixed issue with paginated category archives not correctly returning a 404 when there are no posts.</li>
1
+ <h4>2.2.0.6 - 01/24/2019</h4>
2
+ <p><strong>Hot Fix</strong></p>
3
+ <ul>
4
+ <li>Update Font Awesome to 5.6.3</li>
5
+ <li>Fixed PHP warnings in Heading module if non existent font is selected when upgrading to 2.2</li>
6
+ <li>Fixed theme white labeling not escaping apostrophes.</li>
7
+ <li>Fixed Themer Preview menu being incorrectly centered.</li>
8
+ <li>Fixed Content Slider button alignment.</li>
9
+ <li>Fixed margin/padding placeholders not showing as zero when the global settings are empty.</li>
10
+ <li>Fixed posts not being converted to the BB block when updating to 5.0</li>
11
+ <li>Fixed Builder link missing on new page when classic editor plugin is active.</li>
12
+ </ul>
13
+
14
+ <h4>2.2.0.5 - 01/14/2019</h4>
15
+ <p><strong>Bug Fixes</strong></p>
16
+ <ul>
17
+ <li>Fixed fatal error with Livemesh addons.</li>
18
+ <li>Fixed Google Fonts showing italic when set to default/normal.</li>
19
+ <li>Fixed Menu Module font sizes.</li>
20
+ </ul>
21
+
22
+ <h4>2.2.0.4 - 01/10/2019</h4>
23
+ <p><strong>Bug Fixes</strong></p>
24
+ <ul>
25
+ <li>Fixed fade left/right animations being reversed when updating to 2.2.</li>
26
+ <li>Fixed row width unit not applying to new rows when changed in the global settings.</li>
27
+ <li>Fixed Powerpack overlay setting not showing in 2.2.</li>
28
+ </ul>
29
+
30
+ <h4>2.2.0.3 - 01/08/2019</h4>
31
+ <p><strong>Enhancements</strong></p>
32
+ <ul>
33
+ <li>Added 12 new pre-built row templates for a total of 100.</li>
34
+ <li>Added typography settings for the caption in the photo module.</li>
35
+ <li>You can now select font weights for the default font.</li>
36
+ </ul>
37
+ <p><strong>Bug Fixes</strong></p>
38
+ <ul>
39
+ <li>Fixed various RTL issues with 2.2.</li>
40
+ <li>Fixed BB's admin UI for the Classic Editor plugin not showing in certain cases.</li>
41
+ <li>Fixed typography settings only falling back to sans-serif.</li>
42
+ <li>Fixed 'Default' showing twice for the default font weight.</li>
43
+ <li>Fixed responsive editing mode not always picking up the medium size as a fallback for the small size.</li>
44
+ </ul>
45
+
46
+ <h4>2.2.0.2 - 12/12/2018</h4>
47
+ <p><strong>Hot Fix</strong></p>
48
+ <ul>
49
+ <li>Update Font Awesome to 5.6.1</li>
50
+ <li>Fixed hidden editor when ACF is active on post/page edit screen.</li>
51
+ <li>Fixed PHP fatal error caused by SEO Press plugin when adding layouts/templates.</li>
52
+ <li>Fixed a JS error when using Cloudfront platform.</li>
53
+ <li>Fixed missing excerpts for posts module in WP 5.0</li>
54
+ </ul>
55
+
56
+ <h4>2.2.0.1 - 12/03/2018</h4>
57
+ <p><strong>Bug Fixes</strong></p>
58
+ <ul>
59
+ <li>Fixed internal server error with the video module when bcmath is not enabled in PHP.</li>
60
+ <li>Fixed JS error when using CloudFront.</li>
61
+ </ul>
62
+
63
+ <h4>2.2 - 11/27/2018</h4>
64
+ <p>Beaver Builder 2.2 is here! This is a major update and will be released as the official download on the <u>My Account page first</u>. Remote updates to all existing sites will begin in early January.</p>
65
+ <p><strong>Enhancements</strong></p>
66
+ <ul>
67
+ <li>Added settings for selecting either div, article or li containers for posts in the posts module.</li>
68
+ <li>Renamed "Header" prebuilt rows to "Heroes."</li>
69
+ </ul>
70
+ <p><strong>Bug Fixes</strong></p>
71
+ <ul>
72
+ <li>Fixed duplicate prebuilt rows showing in the content panel.</li>
73
+ <li>Fixed not being able to select 0% alpha or 100% black in the color picker.</li>
74
+ <li>Fixed settings panels rendering off screen in certain cases.</li>
75
+ <li>Fixed featured images not respecting the posts module border radius setting.</li>
76
+ <li>Fixed posts module box shadows being cut off.</li>
77
+ <li>Fixed photo module responsive alignment not working correctly.</li>
78
+ <li>Fixed low contrast text in the module search input while using dark mode.</li>
79
+ <li>Fixed columns disappearing when clicking the move option without moving the column.</li>
80
+ <li>Fixed row and column background overlays not respecting the border radius settings.</li>
81
+ </ul>
82
+
83
+ <h4>2.2-beta.3 - 11/13/2018</h4>
84
+ <p><strong>Bug Fixes</strong></p>
85
+ <ul>
86
+ <li>Fixed vertically aligned columns not working on small devices.</li>
87
+ <li>Fixed equal height columns not working while the builder is active when device size logic has been applied to the column.</li>
88
+ <li>Fixed responsive preview not correctly rendering image widths with an empty setting value.</li>
89
+ <li>Fixed menu module link spacing when updating to 2.2.</li>
90
+ <li>Fixed menu module background color when updating to 2.2.</li>
91
+ <li>Fixed icons with backgrounds having wrong line height.</li>
92
+ <li>Fixed settings menus cut off in responsive editing mode.</li>
93
+ </ul>
94
+
95
+ <h4>2.2-beta.2 - 11/09/2018</h4>
96
+ <p><strong>Enhancements</strong></p>
97
+ <ul>
98
+ <li>Added labels to the first row of the border field's general section.</li>
99
+ <li>Added structured data settings to the video module.</li>
100
+ <li>Added a remove button for row background videos.</li>
101
+ <li>Added default option for font weights so strong tags still work when a family is selected.</li>
102
+ <li>Added the ability to collapse settings sections by clicking the entire section header.</li>
103
+ </ul>
104
+ <p><strong>Bug Fixes</strong></p>
105
+ <ul>
106
+ <li>Fixed italic Google fonts not working correctly.</li>
107
+ <li>Fixed CSS errors with empty icon group styles.</li>
108
+ <li>Fixed CSS/JS for hidden nodes still rendering on the page.</li>
109
+ <li>Fixed responsive photo fields not working correctly.</li>
110
+ <li>Fixed repeater photo fields not working correctly.</li>
111
+ <li>Fixed menu module font size defaulting to zero.</li>
112
+ <li>Fixed responsive preview not working when parsing a stylesheet fails with a CORS error.</li>
113
+ </ul>
114
+
115
+ <h4>2.2-beta.1 - 10/24/2018</h4>
116
+ <p><strong>Enhancements</strong></p>
117
+ <ul>
118
+ <li>Added prebuilt rows to the content panel.</li>
119
+ </ul>
120
+
121
+ <h4>2.2-alpha.2 - 10/04/2018</h4>
122
+ <p><strong>Enhancements</strong></p>
123
+ <ul>
124
+ <li>Hardened UI styles to prevent style creep from themes.</li>
125
+ <li>Added Themer custom field connections to all color fields.</li>
126
+ </ul>
127
+ <p><strong>Bug Fixes</strong></p>
128
+ <ul>
129
+ <li>Fixed drag and drop breaking when dragging while another element hasn't finished refreshing after save.</li>
130
+ <li>Fixed some changes not saving when done quickly on slow connections.</li>
131
+ <li>Fixed the position of duplicated elements being incorrect when moving the original element during the duplicate process.</li>
132
+ <li>Fixed modules disappearing if moved and the the old column is deleted while the move is saving.</li>
133
+ <li>Fixed dragging into rows that are being saved. That causes things to disappear until the page is refreshed.</li>
134
+ <li>Fixed columns being highlighted as empty after dropping a module to create a new column.</li>
135
+ <li>Fixed pasting into inline editors retaining the copied formatting.</li>
136
+ </ul>
137
+
138
+ <h4>2.2-alpha.1 - 09/05/2018</h4>
139
+ <p><strong>Bug Fixes</strong></p>
140
+ <ul>
141
+ <li>Fixed row shape issues and refined internal logic.</li>
142
+ <li>Fixed black borders in the video module when aspect ratio is not maintained.</li>
143
+ <li>Fixed Google map markers not displaying properly in accordions and tabs.</li>
144
+ </ul>
145
+
146
+ <h4>2.2-dev.9 - 08/28/2018</h4>
147
+ <p><strong>Button Module</strong></p>
148
+ <ul>
149
+ <li>Added responsive border settings.</li>
150
+ <li>Added live preview to button background colors.</li>
151
+ <li>Converted font size setting to a responsive typography setting.</li>
152
+ <li>Converted padding setting to a responsive dimension setting.</li>
153
+ <li>Removed transparent button style. That is now done with alpha backgrounds and border settings.</li>
154
+ <li>Reorganized style settings to work with the new settings.</li>
155
+ <li>Updated all modules that use buttons with new settings.</li>
156
+ </ul>
157
+ <p><strong>Callout Module</strong></p>
158
+ <ul>
159
+ <li>Added background color, border, and padding settings.</li>
160
+ <li>Added link color and typography settings.</li>
161
+ </ul>
162
+ <p><strong>Fixes</strong></p>
163
+ <ul>
164
+ <li>Fixed dark UI affecting buttons in the WordPress media library.</li>
165
+ </ul>
166
+
167
+ <h4>2.2-dev.8 - 08/21/2018</h4>
168
+ <p><strong>Fixes</strong></p>
169
+ <ul>
170
+ <li>Fixed dimension and unit fields not previewing correctly in compound settings (typography, border, etc).</li>
171
+ <li>Fixed JS error when dropping in a new module to create a new column.</li>
172
+ </ul>
173
+
174
+ <h4>2.2-dev.7 - 08/21/2018</h4>
175
+ <p><strong>General Enhancements</strong></p>
176
+ <ul>
177
+ <li>Added duration input for animation settings.</li>
178
+ </ul>
179
+ <p><strong>Callout Module</strong></p>
180
+ <ul>
181
+ <li>Added responsive icon size setting with custom units.</li>
182
+ </ul>
183
+ <p><strong>Icon Module</strong></p>
184
+ <ul>
185
+ <li>Added responsive icon size setting with custom units.</li>
186
+ </ul>
187
+ <p><strong>Icon Group Module</strong></p>
188
+ <ul>
189
+ <li>Added responsive icon size setting with custom units.</li>
190
+ </ul>
191
+ <p><strong>Text Editor Module</strong></p>
192
+ <ul>
193
+ <li>Fixed color setting not overriding colors set by the row.</li>
194
+ </ul>
195
+ <p><strong>API</strong></p>
196
+ <ul>
197
+ <li>Added API for date settings using the HTML date input.</li>
198
+ </ul>
199
+ <p><strong>Fixes</strong></p>
200
+ <ul>
201
+ <li>Fixed layout going off the page when editing a Themer part in responsive editing mode.</li>
202
+ </ul>
203
+
204
+ <h4>2.2-dev.6 - 08/10/2018</h4>
205
+ <p><strong>Fixes</strong></p>
206
+ <ul>
207
+ <li>Fixed duplicating rows and modules leaving an extra copy when the duplicate completes.</li>
208
+ <li>Fixed general loading issues when working in the builder.</li>
209
+ </ul>
210
+
211
+ <h4>2.2-dev.5 - 08/08/2018</h4>
212
+ <p><strong>General Enhancements</strong></p>
213
+ <ul>
214
+ <li>Added a publish layout item to the tools menu for publishing and remaining in the builder.</li>
215
+ <li>Finished work for alpha pickers, live preview, responsive settings, etc. for remaining modules.</li>
216
+ <li>Added advanced setting for changing the HTML wrapper element of rows, columns, and modules.</li>
217
+ <li>Row, column, and module animations are now enabled for mobile devices.</li>
218
+ <li>Moved column settings to the first item in the column dropdown menu.</li>
219
+ <li>Added "None" option for the background overlay setting.</li>
220
+ <li>Streamline the overall visual appearance, specifically of settings forms.</li>
221
+ <li>Allow pinned settings panels to resize down to 320px (formally 380px min) and widen to 600px.</li>
222
+ <li>Rich text and code editor fields now display edge-to-edge on slim settings panels.</li>
223
+ <li>Field connection icons now appear the top of the field for rich text and code editors.</li>
224
+ <li>Settings sections can now be collapsed. Developers can specify if they'd like a section in their custom module to be collapsed by default.</li>
225
+ </ul>
226
+ <p><strong>General Fixes</strong></p>
227
+ <ul>
228
+ <li>Fixed font weights not loading for the selected font in typography settings.</li>
229
+ <li>Fixed border settings not cascading down to smaller device sizes.</li>
230
+ <li>Fixed target and nofollow inputs not showing for link fields with a field connection.</li>
231
+ <li>Fixed PHP warning leaking into row CSS preventing backgrounds from showing.</li>
232
+ <li>Fixed not being able to set a minimum height on columns with no siblings.</li>
233
+ <li>Fixed row and column animations not working because of the waypoint script not being enqueued.</li>
234
+ <li>Fixed color pickers showing the wrong color after saving settings and then editing the color again.</li>
235
+ <li>Fixed row actions in responsive editing mode not showing up and causing a horizontal scrollbar.</li>
236
+ <li>Fixed row min-height not resetting when switching back to default.</li>
237
+ <li>Fixed column dropdown being cut off in responsive editing mode.</li>
238
+ <li>Fixed not being able to resize columns that are too small.</li>
239
+ </ul>
240
+ <p><strong>Shape Layers</strong></p>
241
+ <ul>
242
+ <li>Shape layer controls (formerly Edges tab) have been moved into the style tab.</li>
243
+ <li>Shapes can now be aligned vertically as well as horizontally.</li>
244
+ <li>4 new shapes have been added. More to come.</li>
245
+ </ul>
246
+ <p><strong>Gallery Module</strong></p>
247
+ <ul>
248
+ <li>Added photo border settings to the new style tab.</li>
249
+ <li>Moved photo spacing setting to the new style tab.</li>
250
+ </ul>
251
+ <p><strong>Icon Group Module</strong></p>
252
+ <ul>
253
+ <li>Fixed icon colors only applying to the first icon.</li>
254
+ </ul>
255
+ <p><strong>Menu Module</strong></p>
256
+ <ul>
257
+ <li>Added mobile menu layout options for off-canvas / flyout menus.</li>
258
+ <li>Converted font, text size, and text transform settings to a responsive typography setting.</li>
259
+ <li>The first submenu is now opened when editing a menu to preview changes.</li>
260
+ <li>Added submenu link spacing setting.</li>
261
+ <li>Converted submenu spacing setting to a dimension field.</li>
262
+ </ul>
263
+ <p><strong>Number Counter Module</strong></p>
264
+ <ul>
265
+ <li>Converted number size setting to a responsive setting with custom units.</li>
266
+ </ul>
267
+ <p><strong>Posts Module</strong></p>
268
+ <ul>
269
+ <li>Converted border settings to a responsive border setting.</li>
270
+ <li>Converted font size settings to responsive typography settings.</li>
271
+ </ul>
272
+ <p><strong>Testimonials Module</strong></p>
273
+ <ul>
274
+ <li>Added new style tab with text color and typography settings.</li>
275
+ </ul>
276
+ <p><strong>Text Editor Module</strong></p>
277
+ <ul>
278
+ <li>Fixed style settings not overriding those set by the theme for headings in the Customizer.</li>
279
+ </ul>
280
+
281
+ <h4>2.2-dev.4 - 6/28/2018</h4>
282
+ <p><strong>Enhancements</strong></p>
283
+ <ul>
284
+ <li>Added the ability to set row edges and shapes. More to come!</li>
285
+ <li>Added the option to set background overlay gradients on rows and columns.</li>
286
+ </ul>
287
+ <p><strong>Tweaks</strong></p>
288
+ <ul>
289
+ <li>Refined responsive editing logic to make it even more accurate.</li>
290
+ <li>Added labels to the font family and weight selects in the typography field.</li>
291
+ </ul>
292
+ <p><strong>Fixes</strong></p>
293
+ <ul>
294
+ <li>Fixed multiple issues with animation settings not working correctly.</li>
295
+ <li>Fixed PHP warning caused by the typography field on PHP 5.6 and below.</li>
296
+ <li>Fixed border style and width settings not previewing and rendering correctly.</li>
297
+ <li>Fixed Callout module overall alignment setting not applying to buttons.</li>
298
+ <li>Fixed not being able to edit RGBA values in color picker fields.</li>
299
+ </ul>
300
+ <p><strong>Menu Module</strong></p>
301
+ <ul>
302
+ <li>Converted link spacing fields to a single dimension field.</li>
303
+ </ul>
304
+
305
+ <h4>2.2-dev.3 - 6/20/2018</h4>
306
+ <p><strong>General</strong></p>
307
+ <ul>
308
+ <li>Added unit select to margin and padding settings.</li>
309
+ <li>Added unit select to the row width setting.</li>
310
+ <li>Added minimum height setting with unit select and responsive editing to rows and columns.</li>
311
+ <li>Added border radius setting with responsive editing to rows and columns.</li>
312
+ <li>Added box shadow setting to rows and columns.</li>
313
+ <li>Added unit select to all margin and padding settings in the global settings.</li>
314
+ <li>Added global settings for column margins and padding.</li>
315
+ <li>Added unit selects to various module unit settings.</li>
316
+ <li>Added responsive editing to row and column background photos.</li>
317
+ <li>Added responsive editing to the column width setting and removed old responsive column settings in the advanced tab.</li>
318
+ <li>Added background gradient setting for rows and columns.</li>
319
+ <li>Added entrance animations for rows and columns.</li>
320
+ <li>Added more entrance animations from animate.css.</li>
321
+ <li>Added live preview for editing entrance animations.</li>
322
+ <li>Added alpha slider to all color picker settings and removed old opacity settings.</li>
323
+ <li>Added live preview to more module settings so changes don’t require a refresh.</li>
324
+ <li>Added popup slider control to various unit and dimension settings.</li>
325
+ <li>Added the ability to link values for all dimension settings.</li>
326
+ <li>Added new align setting to various modules in place of the old align selects.</li>
327
+ <li>Added dev feedback button within the builder UI. This is ONLY shown for pre-release versions.</li>
328
+ </ul>
329
+ <p><strong>Responsive Editing Mode</strong></p>
330
+ <ul>
331
+ <li>You can now stay in responsive editing mode after closing settings.</li>
332
+ <li>Added toggle and exit buttons within responsive editing mode.</li>
333
+ <li>Added menu item for switching to responsive editing mode.</li>
334
+ <li>Added keyboard shortcut for switching to responsive editing mode.</li>
335
+ </ul>
336
+ <p><strong>API</strong></p>
337
+ <ul>
338
+ <li>Added API for enabling a unit select (%, em, vh, etc.) on dimension and unit settings.</li>
339
+ <li>Added API for enabling a popup slider input on unit and dimension settings.</li>
340
+ <li>Added API for responsive editing to photo and select settings.</li>
341
+ <li>Added API for making backwards compatible changes to settings.</li>
342
+ <li>Added API for making live preview rules !important.</li>
343
+ <li>Added API for align, animation, border, button group, gradient, shadow, and typography settings.</li>
344
+ <li>Added API for toggling other settings when icon or photo settings are set.</li>
345
+ <li>Added API for adding target and nofollow checkboxes to the link field.</li>
346
+ </ul>
347
+ <p><strong>Tweaks</strong></p>
348
+ <ul>
349
+ <li>FontAwesome is now loaded locally instead of from the CDN.</li>
350
+ </ul>
351
+ <p><strong>Accordion Module</strong></p>
352
+ <ul>
353
+ <li>Added border, color, icon, padding, and typography settings.</li>
354
+ <li>The first item is now open when editing to preview content style changes.</li>
355
+ <li>Moved collapse inactive and expand first item settings to the items tab.</li>
356
+ </ul>
357
+ <p><strong>Button Module</strong></p>
358
+ <ul>
359
+ <li>Added unit select to custom width field.</li>
360
+ <li>Added responsive editing to the alignment setting.</li>
361
+ <li>Icon position and visibility settings only show when an icon is set.</li>
362
+ </ul>
363
+ <p><strong>Call to Action Module</strong></p>
364
+ <ul>
365
+ <li>Converted spacing setting to a responsive padding setting with custom units.</li>
366
+ <li>Added border, text color, and typography settings.</li>
367
+ <li>Moved heading tag setting to the general tab.</li>
368
+ </ul>
369
+ <p><strong>Callout Module</strong></p>
370
+ <ul>
371
+ <li>Added text color and typography settings.</li>
372
+ <li>Added photo width, align, and border settings.</li>
373
+ <li>Moved heading tag setting to the general tab.</li>
374
+ </ul>
375
+ <p><strong>Heading Module</strong></p>
376
+ <ul>
377
+ <li>Converted style settings to the new responsive typography setting.</li>
378
+ <li>Moved HTML tag setting to the general tab.</li>
379
+ <li>Change HTML tag setting default to H2.</li>
380
+ </ul>
381
+ <p><strong>Icon Module</strong></p>
382
+ <ul>
383
+ <li>Added responsive editing to the alignment setting.</li>
384
+ <li>Added color, typography, and spacing settings for the icon text.</li>
385
+ </ul>
386
+ <p><strong>Map Module</strong></p>
387
+ <ul>
388
+ <li>Added custom units and responsive editing to the height setting.</li>
389
+ <li>Added border settings with responsive editing.</li>
390
+ </ul>
391
+ <p><strong>Menu Module</strong></p>
392
+ <ul>
393
+ <li>Added responsive editing to the alignment setting.</li>
394
+ <li>Regrouped style settings for consistency with other modules.</li>
395
+ </ul>
396
+ <p><strong>Photo Module</strong></p>
397
+ <ul>
398
+ <li>Moved alignment and crop settings to the new style tab.</li>
399
+ <li>Added responsive editing to the alignment setting.</li>
400
+ <li>Added new width setting with unit select and responsive editing.</li>
401
+ <li>Added border type, color, width, and radius settings.</li>
402
+ <li>Added box shadow setting.</li>
403
+ </ul>
404
+ <p><strong>Separator Module</strong></p>
405
+ <ul>
406
+ <li>Removed the width select in favor of a single width setting.</li>
407
+ </ul>
408
+ <p><strong>Social Buttons Module</strong></p>
409
+ <ul>
410
+ <li>Fixed spacing issues.</li>
411
+ </ul>
412
+ <p><strong>Tabs Module</strong></p>
413
+ <ul>
414
+ <li>Added border, color, padding, and typography settings.</li>
415
+ </ul>
416
+ <p><strong>Text Editor Module</strong></p>
417
+ <ul>
418
+ <li>Added new style tab with text color and typography settings.</li>
419
+ </ul>
420
+
421
  <h4>2.1.7.2 - 01/02/2019</h4>
422
  <p><strong>Hot Fix</strong></p>
423
  <ul>
482
  <li>Fixed issue with layout shortcodes in Wocommerce description not rendering their assets.</li>
483
  </ul>
484
 
 
485
  <h4>2.1.6.3 - 10/30/2018</h4>
486
  <p><strong>Halloween Hot Fix</strong></p>
487
  <ul>
595
  <li>Fixed CORS issue on Pantheon hosting.</li>
596
  </ul>
597
 
 
598
  <h4>2.1.4.5 - 09/10/2018</h4>
599
  <p><strong>HotFix</strong></p>
600
  <ul>
647
  </ul>
648
  </li>
649
  </ul>
 
650
  <p><strong>Bug Fixes</strong></p>
651
  <ul>
652
  <li>Fixed issue with paginated category archives not correctly returning a 404 when there are no posts.</li>
classes/class-fl-builder-admin-posts.php CHANGED
@@ -56,7 +56,7 @@ final class FLBuilderAdminPosts {
56
  * @return bool
57
  */
58
  static public function post_type_supports_block_editor( $post_type ) {
59
- if ( ! function_exists( 'use_block_editor_for_post_type' ) ) {
60
  return false;
61
  }
62
 
@@ -78,9 +78,8 @@ final class FLBuilderAdminPosts {
78
  $render_ui = apply_filters( 'fl_builder_render_admin_edit_ui', true );
79
  $post_type = self::get_post_type();
80
  $post_types = FLBuilderModel::get_post_types();
81
- $supports_blocks = self::post_type_supports_block_editor( $post_type );
82
 
83
- if ( $render_ui && in_array( $post_type, $post_types ) && ! $supports_blocks ) {
84
  add_filter( 'admin_body_class', __CLASS__ . '::body_class', 99 );
85
  add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
86
  add_action( 'edit_form_after_title', __CLASS__ . '::render' );
56
  * @return bool
57
  */
58
  static public function post_type_supports_block_editor( $post_type ) {
59
+ if ( ! function_exists( 'use_block_editor_for_post_type' ) || isset( $_GET['classic-editor'] ) ) {
60
  return false;
61
  }
62
 
78
  $render_ui = apply_filters( 'fl_builder_render_admin_edit_ui', true );
79
  $post_type = self::get_post_type();
80
  $post_types = FLBuilderModel::get_post_types();
 
81
 
82
+ if ( $render_ui && in_array( $post_type, $post_types ) ) {
83
  add_filter( 'admin_body_class', __CLASS__ . '::body_class', 99 );
84
  add_action( 'admin_enqueue_scripts', __CLASS__ . '::styles_scripts' );
85
  add_action( 'edit_form_after_title', __CLASS__ . '::render' );
classes/class-fl-builder-ajax-layout.php CHANGED
@@ -71,48 +71,50 @@ final class FLBuilderAJAXLayout {
71
  * @since 1.7
72
  * @param string $cols The type of column layout to use.
73
  * @param int $position The position of the new row in the layout.
74
- * @param string $template_id The ID of a row template to render.
75
- * @param string $template_type The type of template. Either "user" or "core".
76
  * @return array
77
  */
78
- static public function render_new_row( $cols = '1-col', $position = false, $template_id = null, $template_type = 'user' ) {
79
- // Add a row template?
80
- if ( null !== $template_id ) {
81
-
82
- if ( 'core' == $template_type ) {
83
- $template = FLBuilderModel::get_template( $template_id, 'row' );
84
- $row = FLBuilderModel::apply_node_template( $template_id, null, $position, $template );
85
- } else {
86
- $row = FLBuilderModel::apply_node_template( $template_id, null, $position );
87
- }
88
-
89
- // Return the response.
90
- return array(
91
- 'layout' => self::render( $row->node ),
92
- 'config' => FLBuilderUISettingsForms::get_node_js_config(),
93
- );
94
- } else {
95
-
96
- // Add the row.
97
- $row = FLBuilderModel::add_row( $cols, $position );
98
-
99
- do_action( 'fl_builder_before_render_ajax_layout_html' );
100
 
101
- // Render the row.
102
- ob_start();
103
- FLBuilder::render_row( $row );
104
- $html = ob_get_clean();
 
 
105
 
106
- do_action( 'fl_builder_after_render_ajax_layout_html' );
 
 
 
 
 
 
 
107
 
108
- // Return the response.
109
- return array(
110
- 'partial' => true,
111
- 'nodeType' => $row->type,
112
- 'html' => $html,
113
- 'js' => 'FLBuilder._renderLayoutComplete();',
114
- );
 
 
 
 
 
 
 
 
115
  }
 
 
 
 
 
116
  }
117
 
118
  /**
@@ -137,19 +139,18 @@ final class FLBuilderAJAXLayout {
137
  * @param string $node_id The node ID of a row to add the new group to.
138
  * @param string $cols The type of column layout to use.
139
  * @param int $position The position of the new column group in the row.
 
140
  * @return array
141
  */
142
- static public function render_new_column_group( $node_id, $cols = '1-col', $position = false ) {
143
  // Add the group.
144
- $group = FLBuilderModel::add_col_group( $node_id, $cols, $position );
145
-
146
- do_action( 'fl_builder_before_render_ajax_layout_html' );
147
 
148
  // Render the group.
 
149
  ob_start();
150
  FLBuilder::render_column_group( $group );
151
  $html = ob_get_clean();
152
-
153
  do_action( 'fl_builder_after_render_ajax_layout_html' );
154
 
155
  // Return the response.
@@ -169,11 +170,12 @@ final class FLBuilderAJAXLayout {
169
  * @param string $insert Either before or after.
170
  * @param string $type The type of column(s) to insert.
171
  * @param boolean $nested Whether these columns are nested or not.
 
172
  * @return array
173
  */
174
- static public function render_new_columns( $node_id, $insert, $type, $nested ) {
175
  // Add the column(s).
176
- $group = FLBuilderModel::add_cols( $node_id, $insert, $type, $nested );
177
 
178
  // Return the response.
179
  return self::render( $group->node );
@@ -330,7 +332,8 @@ final class FLBuilderAJAXLayout {
330
 
331
  // Get the node.
332
  $node_id = $post_data['node_id'];
333
- $node = FLBuilderModel::get_node( $post_data['node_id'] );
 
334
 
335
  // Check a module for partial refresh.
336
  if ( $node && 'module' == $node->type ) {
@@ -512,6 +515,10 @@ final class FLBuilderAJAXLayout {
512
  $assets['js'] .= FLBuilder::render_row_modules_js( $partial_refresh_data['node'] );
513
  break;
514
 
 
 
 
 
515
  case 'column':
516
  $assets['js'] = FLBuilder::render_column_modules_js( $partial_refresh_data['node'] );
517
  break;
71
  * @since 1.7
72
  * @param string $cols The type of column layout to use.
73
  * @param int $position The position of the new row in the layout.
74
+ * @param string $module Optional. The node ID of an existing module to move to this row.
 
75
  * @return array
76
  */
77
+ static public function render_new_row( $cols = '1-col', $position = false, $module = null ) {
78
+ // Add the row.
79
+ $row = FLBuilderModel::add_row( $cols, $position, $module );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
+ // Render the row.
82
+ do_action( 'fl_builder_before_render_ajax_layout_html' );
83
+ ob_start();
84
+ FLBuilder::render_row( $row );
85
+ $html = ob_get_clean();
86
+ do_action( 'fl_builder_after_render_ajax_layout_html' );
87
 
88
+ // Return the response.
89
+ return array(
90
+ 'partial' => true,
91
+ 'nodeType' => $row->type,
92
+ 'html' => $html,
93
+ 'js' => 'FLBuilder._renderLayoutComplete();',
94
+ );
95
+ }
96
 
97
+ /**
98
+ * Renders the layout data for a new row template.
99
+ *
100
+ * @since 2.2
101
+ * @param int $position The position of the new row in the layout.
102
+ * @param string $template_id The ID of a row template to render.
103
+ * @param string $template_type The type of template. Either "user" or "core".
104
+ * @return array
105
+ */
106
+ static public function render_new_row_template( $position, $template_id, $template_type = 'user' ) {
107
+ if ( 'core' == $template_type ) {
108
+ $template = FLBuilderModel::get_template( $template_id, 'row' );
109
+ $row = FLBuilderModel::apply_node_template( $template_id, null, $position, $template );
110
+ } else {
111
+ $row = FLBuilderModel::apply_node_template( $template_id, null, $position );
112
  }
113
+
114
+ return array(
115
+ 'layout' => self::render( $row->node ),
116
+ 'config' => FLBuilderUISettingsForms::get_node_js_config(),
117
+ );
118
  }
119
 
120
  /**
139
  * @param string $node_id The node ID of a row to add the new group to.
140
  * @param string $cols The type of column layout to use.
141
  * @param int $position The position of the new column group in the row.
142
+ * @param string $module Optional. The node ID of an existing module to move to this group.
143
  * @return array
144
  */
145
+ static public function render_new_column_group( $node_id, $cols = '1-col', $position = false, $module = null ) {
146
  // Add the group.
147
+ $group = FLBuilderModel::add_col_group( $node_id, $cols, $position, $module );
 
 
148
 
149
  // Render the group.
150
+ do_action( 'fl_builder_before_render_ajax_layout_html' );
151
  ob_start();
152
  FLBuilder::render_column_group( $group );
153
  $html = ob_get_clean();
 
154
  do_action( 'fl_builder_after_render_ajax_layout_html' );
155
 
156
  // Return the response.
170
  * @param string $insert Either before or after.
171
  * @param string $type The type of column(s) to insert.
172
  * @param boolean $nested Whether these columns are nested or not.
173
+ * @param string $module Optional. The node ID of an existing module to move to this group.
174
  * @return array
175
  */
176
+ static public function render_new_columns( $node_id, $insert, $type, $nested, $module = null ) {
177
  // Add the column(s).
178
+ $group = FLBuilderModel::add_cols( $node_id, $insert, $type, $nested, $module );
179
 
180
  // Return the response.
181
  return self::render( $group->node );
332
 
333
  // Get the node.
334
  $node_id = $post_data['node_id'];
335
+ $node = FLBuilderModel::get_node( $post_data['node_id'] );
336
+ $node_type = null;
337
 
338
  // Check a module for partial refresh.
339
  if ( $node && 'module' == $node->type ) {
515
  $assets['js'] .= FLBuilder::render_row_modules_js( $partial_refresh_data['node'] );
516
  break;
517
 
518
+ case 'column-group':
519
+ $assets['js'] = FLBuilder::render_column_group_modules_js( $partial_refresh_data['node'] );
520
+ break;
521
+
522
  case 'column':
523
  $assets['js'] = FLBuilder::render_column_modules_js( $partial_refresh_data['node'] );
524
  break;
classes/class-fl-builder-ajax.php CHANGED
@@ -109,10 +109,11 @@ final class FLBuilderAJAX {
109
  // FLBuilderAJAXLayout
110
  self::add_action( 'render_layout', 'FLBuilderAJAXLayout::render' );
111
  self::add_action( 'render_node', 'FLBuilderAJAXLayout::render', array( 'node_id' ) );
112
- self::add_action( 'render_new_row', 'FLBuilderAJAXLayout::render_new_row', array( 'cols', 'position', 'template_id', 'template_type' ) );
 
113
  self::add_action( 'copy_row', 'FLBuilderAJAXLayout::copy_row', array( 'node_id', 'settings', 'settings_id' ) );
114
- self::add_action( 'render_new_column_group', 'FLBuilderAJAXLayout::render_new_column_group', array( 'node_id', 'cols', 'position' ) );
115
- self::add_action( 'render_new_columns', 'FLBuilderAJAXLayout::render_new_columns', array( 'node_id', 'insert', 'type', 'nested' ) );
116
  self::add_action( 'render_new_col_template', 'FLBuilderAJAXLayout::render_new_col_template', array( 'template_id', 'parent_id', 'position', 'template_type' ) );
117
  self::add_action( 'copy_col', 'FLBuilderAJAXLayout::copy_col', array( 'node_id', 'settings', 'settings_id' ) );
118
  self::add_action( 'render_new_module', 'FLBuilderAJAXLayout::render_new_module', array( 'parent_id', 'position', 'type', 'alias', 'template_id', 'template_type' ) );
109
  // FLBuilderAJAXLayout
110
  self::add_action( 'render_layout', 'FLBuilderAJAXLayout::render' );
111
  self::add_action( 'render_node', 'FLBuilderAJAXLayout::render', array( 'node_id' ) );
112
+ self::add_action( 'render_new_row', 'FLBuilderAJAXLayout::render_new_row', array( 'cols', 'position', 'module' ) );
113
+ self::add_action( 'render_new_row_template', 'FLBuilderAJAXLayout::render_new_row_template', array( 'position', 'template_id', 'template_type' ) );
114
  self::add_action( 'copy_row', 'FLBuilderAJAXLayout::copy_row', array( 'node_id', 'settings', 'settings_id' ) );
115
+ self::add_action( 'render_new_column_group', 'FLBuilderAJAXLayout::render_new_column_group', array( 'node_id', 'cols', 'position', 'module' ) );
116
+ self::add_action( 'render_new_columns', 'FLBuilderAJAXLayout::render_new_columns', array( 'node_id', 'insert', 'type', 'nested', 'module' ) );
117
  self::add_action( 'render_new_col_template', 'FLBuilderAJAXLayout::render_new_col_template', array( 'template_id', 'parent_id', 'position', 'template_type' ) );
118
  self::add_action( 'copy_col', 'FLBuilderAJAXLayout::copy_col', array( 'node_id', 'settings', 'settings_id' ) );
119
  self::add_action( 'render_new_module', 'FLBuilderAJAXLayout::render_new_module', array( 'parent_id', 'position', 'type', 'alias', 'template_id', 'template_type' ) );
classes/class-fl-builder-art.php ADDED
@@ -0,0 +1,798 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Handle SVG Artwork for the system.
4
+ */
5
+ class FLBuilderArt {
6
+
7
+ /**
8
+ * All registered shapes
9
+ */
10
+ static private $artwork = array();
11
+
12
+ /**
13
+ * Which node types support layers
14
+ */
15
+ static private $supported_node_types = array( 'row' );
16
+
17
+ /**
18
+ * Initialize the artwork handling
19
+ *
20
+ * @return void
21
+ */
22
+ static public function init() {
23
+
24
+ // Render layer(s) output into node output
25
+ add_action( 'fl_builder_render_node_layers', 'FLBuilderArt::render_node_layers' );
26
+
27
+ // Setup Shapes and Preset definitions
28
+ add_action( 'fl_register_presets', 'FLBuilderArt::register_shapes' );
29
+
30
+ // Add special <option> sets for js output
31
+ add_filter( 'fl_builder_shared_option_sets', 'FLBuilderArt::filter_shared_option_sets' );
32
+ }
33
+
34
+ /**
35
+ * Register the system art and presets. Called by the fl_register_presets action (see FLBuilderSettingsPresets )
36
+ *
37
+ * @return void
38
+ */
39
+ static public function register_shapes() {
40
+
41
+ $art_dir = FL_BUILDER_DIR . 'includes/shapes/';
42
+
43
+ self::register_shape(array(
44
+ 'label' => __( 'Slanted Edge', 'fl-builder' ),
45
+ 'name' => 'edge-slant',
46
+ 'width' => 422,
47
+ 'height' => 33.98,
48
+ 'render' => $art_dir . 'edge-slant.svg.php',
49
+ ));
50
+
51
+ self::register_shape(array(
52
+ 'label' => __( 'Waves', 'fl-builder' ),
53
+ 'name' => 'wavy',
54
+ 'width' => 800,
55
+ 'height' => 102,
56
+ 'render' => $art_dir . 'wavy.svg.php',
57
+ ));
58
+
59
+ self::register_shape( array(
60
+ 'label' => __( 'Midpoint', 'fl-builder' ),
61
+ 'name' => 'midpoint',
62
+ 'width' => 800,
63
+ 'height' => 50,
64
+ 'render' => $art_dir . 'midpoint.svg.php',
65
+ ));
66
+
67
+ self::register_shape( array(
68
+ 'label' => __( 'Triangle', 'fl-builder' ),
69
+ 'name' => 'triangle',
70
+ 'width' => 50,
71
+ 'height' => 34,
72
+ 'render' => $art_dir . 'triangle.svg.php',
73
+ ));
74
+ self::register_shape( array(
75
+ 'label' => __( 'Circle', 'fl-builder' ),
76
+ 'name' => 'circle',
77
+ 'width' => 100,
78
+ 'height' => 100,
79
+ 'render' => $art_dir . 'circle.svg.php',
80
+ ));
81
+ self::register_shape( array(
82
+ 'label' => __( 'Concave', 'fl-builder' ),
83
+ 'name' => 'concave',
84
+ 'width' => 800,
85
+ 'height' => 50,
86
+ 'render' => $art_dir . 'concave.svg.php',
87
+ ));
88
+ self::register_shape( array(
89
+ 'label' => __( 'Spots', 'fl-builder' ),
90
+ 'name' => 'dot-cluster',
91
+ 'width' => 800,
92
+ 'height' => 315,
93
+ 'render' => $art_dir . 'dot-cluster.svg.php',
94
+ ));
95
+ self::register_shape( array(
96
+ 'label' => __( 'Topography', 'fl-builder' ),
97
+ 'name' => 'topography',
98
+ 'width' => 600,
99
+ 'height' => 600,
100
+ 'render' => $art_dir . 'topography.svg.php',
101
+ ));
102
+ self::register_shape( array(
103
+ 'label' => __( 'Rectangle', 'fl-builder' ),
104
+ 'name' => 'rect',
105
+ 'width' => 800,
106
+ 'height' => 450,
107
+ 'render' => $art_dir . 'rect.svg.php',
108
+ ));
109
+
110
+ // Trigger registration process for external shapes
111
+ do_action( 'fl_register_art' );
112
+ }
113
+
114
+ /**
115
+ * Register a new piece of SVG art into the system
116
+ *
117
+ * @param Array $args - the metadata for a piece of art
118
+ * @return void
119
+ */
120
+ static public function register_shape( $args = array() ) {
121
+ $defaults = array(
122
+ 'label' => __( 'Untitled Shape', 'fl-builder' ),
123
+ 'name' => 'untitled-shape',
124
+ 'x' => 0,
125
+ 'y' => 0,
126
+ 'width' => 0,
127
+ 'height' => 0,
128
+ 'preserve_aspect_ratio' => 'none',
129
+ 'render' => '',
130
+ 'preset_settings' => array(),
131
+ );
132
+
133
+ $args = wp_parse_args( $args, $defaults );
134
+ $key = $args['name'];
135
+
136
+ /**
137
+ * Setup a preset to reference the shape's initial configuration later
138
+ * This is so when you choose a shape, we can also setup other fields for the optimal inital appearance.
139
+ */
140
+ FLBuilderSettingsPresets::register( 'shape', array(
141
+ 'name' => $args['name'],
142
+ 'label' => $args['label'],
143
+ 'settings' => $args['preset_settings'],
144
+ 'data' => array(
145
+ 'viewBox' => array(
146
+ 'x' => $args['x'],
147
+ 'y' => $args['y'],
148
+ 'width' => $args['width'],
149
+ 'height' => $args['height'],
150
+ ),
151
+ ),
152
+ ));
153
+
154
+ self::$artwork[ $key ] = $args;
155
+ }
156
+
157
+ /**
158
+ * Return the array of registered artwork
159
+ *
160
+ * @param String $key - index key in the artwork array
161
+ * @return Array
162
+ */
163
+ static public function get_art( $key = null ) {
164
+ $art = apply_filters( 'fl_shape_artwork', self::$artwork );
165
+
166
+ if ( $key && isset( $art[ $key ] ) ) {
167
+ return $art[ $key ];
168
+ }
169
+
170
+ return $art;
171
+ }
172
+
173
+ /**
174
+ * Create option sets for each preset type and add to FLBuilderConfig.optionSets
175
+ *
176
+ * @param Array $option_sets - previously set option sets
177
+ * @return Array
178
+ */
179
+ static public function filter_shared_option_sets( $option_sets ) {
180
+ $art = self::get_art();
181
+
182
+ $option_sets['shapes'] = array(
183
+ '' => __( 'None', 'fl-builder' ),
184
+ );
185
+
186
+ foreach ( $art as $handle => $shape ) {
187
+ $option_sets['shapes'][ $handle ] = $shape['label'];
188
+ }
189
+
190
+ return $option_sets;
191
+ }
192
+
193
+ /**
194
+ * Render the shape artwork with the current settings.
195
+ *
196
+ * @param Array $shape - the registered metadata for the current shape
197
+ * @param Object $settings - the current node's settings object
198
+ * @return String - the rendered string
199
+ */
200
+ static public function render_art( $shape, $settings ) {
201
+
202
+ // Render artwork into a buffer
203
+ if ( $shape ) {
204
+ ob_start();
205
+ $render = $shape['render'];
206
+
207
+ if ( is_string( $render ) && file_exists( $render ) ) {
208
+ include $render;
209
+ }
210
+ $output = ob_get_clean();
211
+ }
212
+ return $output;
213
+ }
214
+
215
+ /**
216
+ * Get the node types that support layers
217
+ *
218
+ * @return Array
219
+ */
220
+ static public function get_supported_node_types() {
221
+ return self::$supported_node_types;
222
+ }
223
+
224
+ /**
225
+ * Get any layers added to a node
226
+ *
227
+ * @param Object $node being rendered
228
+ * @return Array of layer descriptions
229
+ */
230
+ static public function get_node_layers( $node ) {
231
+ $layers = array();
232
+
233
+ if ( in_array( $node->type, self::get_supported_node_types() ) ) {
234
+
235
+ $settings = $node->settings;
236
+
237
+ if ( ! empty( $settings->{'top_edge_shape'} ) ) {
238
+ $layers['top'] = array(
239
+ 'label' => __( 'Top Shape Layer', 'fl-builder' ),
240
+ 'type' => 'shape',
241
+ 'prefix' => 'top_edge_',
242
+ 'position' => 'top',
243
+ );
244
+ }
245
+ if ( ! empty( $settings->{'bottom_edge_shape'} ) ) {
246
+ $layers['bottom'] = array(
247
+ 'label' => __( 'Bottom Shape Layer', 'fl-builder' ),
248
+ 'type' => 'shape',
249
+ 'prefix' => 'bottom_edge_',
250
+ 'position' => 'bottom',
251
+ );
252
+ }
253
+ }
254
+
255
+ return $layers;
256
+ }
257
+
258
+ /**
259
+ * Render any layers a node has
260
+ *
261
+ * @param Object $node
262
+ * @return void
263
+ */
264
+ static public function render_node_layers( $node ) {
265
+ $layers = self::get_node_layers( $node );
266
+
267
+ if ( ! empty( $layers ) ) {
268
+ foreach ( $layers as $key => $layer ) {
269
+ self::render_node_layer( $layer, $node );
270
+ }
271
+ }
272
+ }
273
+
274
+ /**
275
+ * Render a single layer into a node
276
+ *
277
+ * @param Array $layer meta
278
+ * @param Object $node
279
+ * @return void
280
+ */
281
+ static public function render_node_layer( $layer, $node ) {
282
+ if ( 'shape' === $layer['type'] ) {
283
+ self::render_node_shape_layer( $layer, $node );
284
+ return;
285
+ }
286
+ }
287
+
288
+ /**
289
+ * Render a shape layer into a node
290
+ *
291
+ * @param Array $layer meta
292
+ * @param Object $node
293
+ * @return void
294
+ */
295
+ static public function render_node_shape_layer( $layer, $node ) {
296
+
297
+ $settings = $node->settings;
298
+ $id = $node->node;
299
+ $position = $layer['position'];
300
+ $prefix = $layer['prefix'];
301
+ $shape_name = $settings->{ $prefix . 'shape' };
302
+ $shape_args = self::get_art( $shape_name );
303
+ $content = self::render_art( $shape_args, $settings );
304
+
305
+ $x = $shape_args['x'];
306
+ $y = $shape_args['y'];
307
+ $width = $shape_args['width'];
308
+ $height = $shape_args['height'];
309
+ $view_box = "$x $y $width $height";
310
+ $preserve_aspect_ratio = $shape_args['preserve_aspect_ratio'];
311
+
312
+ $align = $settings->{ $prefix . 'align' };
313
+ $ending = str_replace( ' ', '-', $align );
314
+ $svg_class = 'fl-builder-layer-align-' . $ending;
315
+ include FL_BUILDER_DIR . 'includes/shape-layer.php';
316
+ }
317
+
318
+
319
+ /**
320
+ * Get the settings form for shapes
321
+ *
322
+ * @return void
323
+ */
324
+ static public function get_shape_settings_sections() {
325
+ $sections = array();
326
+ $layers = array(
327
+ 'top' => __( 'Top', 'fl-builder' ),
328
+ 'bottom' => __( 'Bottom', 'fl-builder' ),
329
+ );
330
+
331
+ foreach ( $layers as $position => $position_label ) {
332
+ $prefix = $position . '_edge_';
333
+
334
+ // Preset & Shape Section
335
+ $sections[ $prefix . 'shape' ] = array(
336
+ 'title' => sprintf( __( '%s Shape', 'fl-builder' ), $position_label ),
337
+ 'fields' => array(
338
+ $prefix . 'shape' => array(
339
+ 'type' => 'select',
340
+ 'label' => __( 'Shape', 'fl-builder' ),
341
+ 'options' => 'shapes',
342
+ 'hide' => array(
343
+ '' => array(
344
+ 'sections' => array(
345
+ $prefix . 'style',
346
+ ),
347
+ 'fields' => array(
348
+ $prefix . 'size',
349
+ $prefix . 'align',
350
+ $prefix . 'z_pos',
351
+ ),
352
+ ),
353
+ ),
354
+ 'preview' => array(
355
+ 'type' => 'callback',
356
+ 'callback' => 'previewShape',
357
+ 'prefix' => $prefix,
358
+ 'position' => $position,
359
+ ),
360
+ ),
361
+ $prefix . 'size' => array(
362
+ 'type' => 'dimension',
363
+ 'label' => __( 'Size', 'fl-builder' ),
364
+ 'units' => array( 'px', 'vw', 'vh', '%' ),
365
+ 'slider' => array(
366
+ 'width' => array(
367
+ 'px' => array(
368
+ 'min' => 0,
369
+ 'max' => 5000,
370
+ 'step' => 10,
371
+ ),
372
+ 'vw' => array(
373
+ 'min' => 0,
374
+ 'max' => 500,
375
+ ),
376
+ 'vh' => array(
377
+ 'min' => 0,
378
+ 'max' => 500,
379
+ ),
380
+ '%' => array(
381
+ 'min' => 0,
382
+ 'max' => 300,
383
+ ),
384
+ ),
385
+ 'height' => array(
386
+ 'px' => array(
387
+ 'min' => 0,
388
+ 'max' => 2000,
389
+ 'step' => 10,
390
+ ),
391
+ 'vw' => array(
392
+ 'min' => 0,
393
+ 'max' => 200,
394
+ ),
395
+ 'vh' => array(
396
+ 'min' => 0,
397
+ 'max' => 200,
398
+ ),
399
+ '%' => array(
400
+ 'min' => 0,
401
+ 'max' => 100,
402
+ ),
403
+ ),
404
+ 'top' => array(
405
+ 'px' => array(
406
+ 'min' => -500,
407
+ 'max' => 500,
408
+ ),
409
+ 'vw' => array(
410
+ 'min' => -20,
411
+ 'max' => 20,
412
+ ),
413
+ 'vh' => array(
414
+ 'min' => -20,
415
+ 'max' => 20,
416
+ ),
417
+ '%' => array(
418
+ 'min' => 0,
419
+ 'max' => 100,
420
+ ),
421
+ ),
422
+ ),
423
+ 'keys' => array(
424
+ 'width' => __( 'Width', 'fl-builder' ),
425
+ 'height' => __( 'Height', 'fl-builder' ),
426
+ 'top' => __( 'Y Offset', 'fl-builder' ),
427
+ ),
428
+ 'preview' => array(
429
+ 'type' => 'callback',
430
+ 'callback' => 'previewShapeLayerSize',
431
+ 'prefix' => $prefix,
432
+ 'position' => $position,
433
+ ),
434
+ ),
435
+ $prefix . 'align' => array(
436
+ 'type' => 'select',
437
+ 'label' => __( 'Align', 'fl-builder' ),
438
+ 'default' => $position . ' center',
439
+ 'options' => array(
440
+ 'top left' => __( 'Top Left', 'fl-builder' ),
441
+ 'top center' => __( 'Top Center', 'fl-builder' ),
442
+ 'top right' => __( 'Top Right', 'fl-builder' ),
443
+ 'center left' => __( 'Center Left', 'fl-builder' ),
444
+ 'center center' => __( 'Center', 'fl-builder' ),
445
+