PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmFieldGridHelper.php +8 -23 6.266.7 View file →
@@ -4,11 +4,8 @@
4 4 }
5 5
6 6 class FrmFieldGridHelper {
7 7
8 - /**
9 - * @var bool|string
10 - */
11 8 private $parent_li;
12 9
13 10 /**
14 11 * @var int
@@ -30,9 +27,9 @@
30 27 */
31 28 private $active_field_size;
32 29
33 30 /**
34 - * @var bool flagged while calling get_field_layout_class, true if classes contain frm_first class.
31 + * @var bool $is_frm_first flagged while calling get_field_layout_class, true if classes contain frm_first class.
35 32 */
36 33 private $is_frm_first;
37 34
38 35 /**
@@ -40,30 +37,24 @@
40 37 */
41 38 private $field;
42 39
43 40 /**
44 - * @var FrmFieldGridHelper
41 + * @var FrmFieldGridHelper $section_helper
45 42 */
46 43 private $section_helper;
47 44
48 45 /**
49 - * @var bool
46 + * @var bool $nested
50 47 */
51 48 private $nested;
52 49
53 50 /**
54 - * @var int
51 + * @var int $section_size
55 52 */
56 53 private $section_size;
57 54
58 - /**
59 - * @var bool
60 - */
61 55 private $section_is_open = false;
62 56
63 - /**
64 - * @param bool $nested
65 - */
66 57 public function __construct( $nested = false ) {
67 58 $this->parent_li = false;
68 59 $this->current_list_size = 0;
69 60 $this->current_field_count = 0;
@@ -89,9 +80,9 @@
89 80 $this->section_is_open = false;
90 81 $this->maybe_close_section_helper();
91 82 } else {
92 83 $this->field_layout_class = $this->get_field_layout_class();
93 - $this->active_field_size = self::get_size_of_class( $this->field_layout_class );
84 + $this->active_field_size = $this->get_size_of_class( $this->field_layout_class );
94 85 }
95 86
96 87 if ( 'divider' === $field->type && empty( $this->nested ) ) {
97 88 $this->section_size = $this->active_field_size;
@@ -157,9 +148,8 @@
157 148 private function should_first_close_the_active_field_wrapper() {
158 149 if ( false === $this->parent_li || ! empty( $this->section_helper ) ) {
159 150 return false;
160 151 }
161 -
162 152 if ( 'end_divider' === $this->field->type ) {
163 153 return false;
164 154 }
165 155 return ! $this->can_support_current_layout() || $this->is_frm_first;
@@ -176,9 +166,8 @@
176 166 }
177 167
178 168 /**
179 169 * @param string $class
180 - *
181 170 * @return int
182 171 */
183 172 private static function get_size_of_class( $class ) {
184 173 switch ( $class ) {
@@ -197,9 +186,8 @@
197 186 }
198 187
199 188 if ( 0 === strpos( $class, 'frm' ) ) {
200 189 $substr = substr( $class, 3 );
201 -
202 190 if ( is_numeric( $substr ) ) {
203 191 return (int) $substr;
204 192 }
205 193 }
@@ -211,9 +199,9 @@
211 199 /**
212 200 * @return void
213 201 */
214 202 public function sync_list_size() {
215 - if ( empty( $this->field ) ) {
203 + if ( ! isset( $this->field ) ) {
216 204 return;
217 205 }
218 206
219 207 if ( 'divider' === $this->field->type ) {
@@ -221,9 +209,8 @@
221 209 }
222 210
223 211 if ( ! empty( $this->section_helper ) ) {
224 212 $this->section_helper->sync_list_size();
225 -
226 213 if ( 'end_divider' === $this->field->type ) {
227 214 $this->maybe_close_section_helper();
228 215 }
229 216 return;
@@ -229,11 +216,10 @@
229 216 return;
230 217 }
231 218
232 219 if ( false !== $this->parent_li ) {
233 - ++$this->current_field_count;
220 + $this->current_field_count ++;
234 221 $this->current_list_size += $this->active_field_size;
235 -
236 222 if ( 12 === $this->current_list_size ) {
237 223 $this->close_field_wrapper();
238 224 }
239 225 }
@@ -273,13 +259,12 @@
273 259 }
274 260
275 261 /**
276 262 * @param string $class
277 - *
278 263 * @return bool
279 264 */
280 265 private function can_support_an_additional_layout( $class ) {
281 - $size = self::get_size_of_class( $class );
266 + $size = $this->get_size_of_class( $class );
282 267 return $this->current_list_size + $size <= 12;
283 268 }
284 269
285 270 /**