@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
108 | - if ( isset( self::$messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
108 | + if ( isset( self::$messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
109 | 109 | // Don't replace messages unless required. |
110 | 110 | return; |
111 | 111 | } |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - if ( isset( self::$messages[ $message['key'] ] ) ) { |
|
117 | + if ( isset( self::$messages[$message['key']] ) ) { |
|
118 | 118 | // Move up and mark as new. |
119 | - unset( self::$messages[ $message['key'] ] ); |
|
119 | + unset( self::$messages[$message['key']] ); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | $this->fill_message( $message ); |
123 | - self::$messages[ $message['key'] ] = $message; |
|
123 | + self::$messages[$message['key']] = $message; |
|
124 | 124 | |
125 | 125 | $this->update_list(); |
126 | 126 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | private function clean_messages() { |
158 | 158 | $removed = false; |
159 | 159 | foreach ( self::$messages as $t => $message ) { |
160 | - $read = ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
161 | - $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
160 | + $read = ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
161 | + $dismissed = ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
162 | 162 | $expired = $this->is_expired( $message ); |
163 | 163 | if ( $read || $expired || $dismissed ) { |
164 | - unset( self::$messages[ $t ] ); |
|
164 | + unset( self::$messages[$t] ); |
|
165 | 165 | $removed = true; |
166 | 166 | } |
167 | 167 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | public function filter_messages( &$messages, $type = 'unread' ) { |
180 | 180 | $user_id = get_current_user_id(); |
181 | 181 | foreach ( $messages as $k => $message ) { |
182 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
182 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
183 | 183 | if ( empty( $k ) || $this->is_expired( $message ) || ( $type === 'dismissed' ) !== $dismissed ) { |
184 | - unset( $messages[ $k ] ); |
|
184 | + unset( $messages[$k] ); |
|
185 | 185 | } elseif ( ! $this->is_for_user( $message ) ) { |
186 | - unset( $messages[ $k ] ); |
|
186 | + unset( $messages[$k] ); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | * @return void |
242 | 242 | */ |
243 | 243 | public function mark_read( $key ) { |
244 | - if ( ! $key || ! isset( self::$messages[ $key ] ) ) { |
|
244 | + if ( ! $key || ! isset( self::$messages[$key] ) ) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | |
248 | - if ( ! isset( self::$messages[ $key ]['read'] ) ) { |
|
249 | - self::$messages[ $key ]['read'] = array(); |
|
248 | + if ( ! isset( self::$messages[$key]['read'] ) ) { |
|
249 | + self::$messages[$key]['read'] = array(); |
|
250 | 250 | } |
251 | - self::$messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
251 | + self::$messages[$key]['read'][get_current_user_id()] = time(); |
|
252 | 252 | |
253 | 253 | $this->update_list(); |
254 | 254 | } |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | * @return void |
261 | 261 | */ |
262 | 262 | public function mark_unread( $key ) { |
263 | - $is_read = isset( self::$messages[ $key ] ) && isset( self::$messages[ $key ]['read'] ) && isset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
263 | + $is_read = isset( self::$messages[$key] ) && isset( self::$messages[$key]['read'] ) && isset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
264 | 264 | if ( $is_read ) { |
265 | - unset( self::$messages[ $key ]['read'][ get_current_user_id() ] ); |
|
265 | + unset( self::$messages[$key]['read'][get_current_user_id()] ); |
|
266 | 266 | $this->update_list(); |
267 | 267 | } |
268 | 268 | } |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | - if ( ! isset( self::$messages[ $key ] ) ) { |
|
281 | + if ( ! isset( self::$messages[$key] ) ) { |
|
282 | 282 | return; |
283 | 283 | } |
284 | 284 | |
285 | - if ( ! isset( self::$messages[ $key ]['dismissed'] ) ) { |
|
286 | - self::$messages[ $key ]['dismissed'] = array(); |
|
285 | + if ( ! isset( self::$messages[$key]['dismissed'] ) ) { |
|
286 | + self::$messages[$key]['dismissed'] = array(); |
|
287 | 287 | } |
288 | - self::$messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
288 | + self::$messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
289 | 289 | |
290 | 290 | $this->update_list(); |
291 | 291 | } |
@@ -299,11 +299,11 @@ discard block |
||
299 | 299 | $user_id = get_current_user_id(); |
300 | 300 | foreach ( self::$messages as $key => $message ) { |
301 | 301 | if ( ! isset( $message['dismissed'] ) ) { |
302 | - self::$messages[ $key ]['dismissed'] = array(); |
|
302 | + self::$messages[$key]['dismissed'] = array(); |
|
303 | 303 | } |
304 | 304 | |
305 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
306 | - self::$messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
305 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
306 | + self::$messages[$key]['dismissed'][$user_id] = time(); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | $this->update_list(); |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | $messages = $this->get_messages( 'filter' ); |
314 | 314 | $user_id = get_current_user_id(); |
315 | 315 | foreach ( $messages as $t => $message ) { |
316 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
317 | - unset( $messages[ $t ] ); |
|
316 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
317 | + unset( $messages[$t] ); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | return $messages; |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | * @return void |
354 | 354 | */ |
355 | 355 | public function remove( $key ) { |
356 | - if ( isset( self::$messages[ $key ] ) ) { |
|
357 | - unset( self::$messages[ $key ] ); |
|
356 | + if ( isset( self::$messages[$key] ) ) { |
|
357 | + unset( self::$messages[$key] ); |
|
358 | 358 | $this->update_list(); |
359 | 359 | } |
360 | 360 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @param array $matches The regex results for a single match. |
401 | 401 | * @return string |
402 | 402 | */ |
403 | - function ( $matches ) { |
|
403 | + function( $matches ) { |
|
404 | 404 | $url = $matches[2]; |
405 | 405 | $parts = parse_url( $url ); |
406 | 406 | |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | $inbox = new self(); |
464 | 464 | return array_filter( |
465 | 465 | $inbox->get_messages( 'filter' ), |
466 | - function ( $message ) use ( $key ) { |
|
467 | - return ! empty( $message[ $key ] ); |
|
466 | + function( $message ) use ( $key ) { |
|
467 | + return ! empty( $message[$key] ); |
|
468 | 468 | } |
469 | 469 | ); |
470 | 470 | } |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | |
511 | 511 | return array_reduce( |
512 | 512 | $keys_to_return, |
513 | - function ( $total, $key ) use ( $message ) { |
|
514 | - $total[ $key ] = $message[ $key ]; |
|
513 | + function( $total, $key ) use ( $message ) { |
|
514 | + $total[$key] = $message[$key]; |
|
515 | 515 | return $total; |
516 | 516 | }, |
517 | 517 | array() |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param array $keys |
39 | 39 | */ |
40 | - self::$keys = apply_filters( |
|
40 | + self::$keys = apply_filters( |
|
41 | 41 | 'frm_application_data_keys', |
42 | 42 | array( 'key', 'name', 'description', 'link', 'categories', 'views', 'forms' ) |
43 | 43 | ); |
@@ -115,20 +115,20 @@ discard block |
||
115 | 115 | public function as_js_object() { |
116 | 116 | $application = array(); |
117 | 117 | foreach ( self::$keys as $key ) { |
118 | - if ( ! isset( $this->api_data[ $key ] ) ) { |
|
118 | + if ( ! isset( $this->api_data[$key] ) ) { |
|
119 | 119 | continue; |
120 | 120 | } |
121 | 121 | |
122 | - $value = $this->api_data[ $key ]; |
|
122 | + $value = $this->api_data[$key]; |
|
123 | 123 | |
124 | 124 | if ( 'icon' === $key ) { |
125 | 125 | // Icon is an array. The first array item is the image URL. |
126 | - $application[ $key ] = reset( $value ); |
|
126 | + $application[$key] = reset( $value ); |
|
127 | 127 | } elseif ( 'categories' === $key ) { |
128 | - $application[ $key ] = array_values( |
|
128 | + $application[$key] = array_values( |
|
129 | 129 | array_filter( |
130 | 130 | $value, |
131 | - function ( $category ) { |
|
131 | + function( $category ) { |
|
132 | 132 | return false === strpos( $category, '+Views' ); |
133 | 133 | } |
134 | 134 | ) |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Strip off the " Template" text at the end of the name as it takes up space. |
145 | 145 | $value = substr( $value, 0, -9 ); |
146 | 146 | } |
147 | - $application[ $key ] = $value; |
|
147 | + $application[$key] = $value; |
|
148 | 148 | }//end if |
149 | 149 | }//end foreach |
150 | 150 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * @param string $row_view_file_path |
35 | 35 | * @return void |
36 | 36 | */ |
37 | - function ( $form ) use ( $styles, $default_style, $row_view_file_path ) { |
|
37 | + function( $form ) use ( $styles, $default_style, $row_view_file_path ) { |
|
38 | 38 | $active_style_id = isset( $form->options['custom_style'] ) ? (int) $form->options['custom_style'] : 1; |
39 | 39 | if ( 1 === $active_style_id ) { |
40 | 40 | // use the default style |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $show_messages = apply_filters( 'frm_message_list', $show_messages ); |
20 | 20 | if ( is_array( $show_messages ) && count( $show_messages ) > 0 ) { |
21 | 21 | // Define a callback function to add 'data-action' attribute to allowed HTML tags |
22 | - $add_data_action_callback = function ( $allowed_html ) { |
|
22 | + $add_data_action_callback = function( $allowed_html ) { |
|
23 | 23 | $allowed_html['span']['data-action'] = true; |
24 | 24 | return $allowed_html; |
25 | 25 | }; |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | |
19 | 19 | foreach ( $type as $tb_type ) { |
20 | 20 | |
21 | - if ( ! isset( $tables[ $tb_type ] ) ) { |
|
21 | + if ( ! isset( $tables[$tb_type] ) ) { |
|
22 | 22 | do_action( 'frm_xml_import_' . $tb_type, $args ); |
23 | 23 | continue; |
24 | 24 | } |
25 | 25 | |
26 | - if ( ! isset( $records[ $tb_type ] ) ) { |
|
26 | + if ( ! isset( $records[$tb_type] ) ) { |
|
27 | 27 | // No records. |
28 | 28 | continue; |
29 | 29 | } |
30 | 30 | |
31 | - $item_ids = $records[ $tb_type ]; |
|
31 | + $item_ids = $records[$tb_type]; |
|
32 | 32 | |
33 | 33 | if ( in_array( $tb_type, array( 'styles', 'actions' ), true ) ) { |
34 | 34 | include __DIR__ . '/posts_xml.php'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | include FrmProAppHelper::plugin_path() . '/classes/views/xml/' . $tb_type . '_xml.php'; |
39 | 39 | } |
40 | 40 | |
41 | - unset( $item_ids, $records[ $tb_type ], $tb_type ); |
|
41 | + unset( $item_ids, $records[$tb_type], $tb_type ); |
|
42 | 42 | }//end foreach |
43 | 43 | |
44 | 44 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param object|array $field |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - function ( $position, $field ) { |
|
77 | + function( $position, $field ) { |
|
78 | 78 | if ( is_array( $field ) ) { |
79 | 79 | $this->default_label_position_field_ids[] = (int) $field['id']; |
80 | 80 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param object|array $field |
92 | 92 | * @return string |
93 | 93 | */ |
94 | - function ( $classes, $field ) { |
|
94 | + function( $classes, $field ) { |
|
95 | 95 | if ( is_array( $field ) && in_array( (int) $field['id'], $this->default_label_position_field_ids, true ) ) { |
96 | 96 | $classes .= ' frm-default-label-position'; |
97 | 97 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param string $target_field_type |
119 | 119 | * @return bool |
120 | 120 | */ |
121 | - function ( $show, $field_type ) { |
|
121 | + function( $show, $field_type ) { |
|
122 | 122 | if ( 'captcha' === $field_type ) { |
123 | 123 | $show = false; |
124 | 124 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param int $form_id |
147 | 147 | * @return stdClass|null |
148 | 148 | */ |
149 | - function ( $form ) { |
|
149 | + function( $form ) { |
|
150 | 150 | if ( is_object( $form ) && is_array( $form->options ) ) { |
151 | 151 | $form->options['js_validate'] = false; |
152 | 152 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $frm_settings = FrmAppHelper::get_settings(); |
198 | 198 | if ( 'none' === $frm_settings->load_style ) { |
199 | - $notes[] = function () { |
|
199 | + $notes[] = function() { |
|
200 | 200 | printf( |
201 | 201 | // translators: %1$s: Anchor tag open, %2$s: Anchor tag close. |
202 | 202 | esc_html__( 'Formidable styles are disabled. This needs to be enabled in %1$sGlobal Settings%2$s.', 'formidable' ), |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | return; |
355 | 355 | } |
356 | 356 | |
357 | - unset( $dependencies[ $index ] ); |
|
357 | + unset( $dependencies[$index] ); |
|
358 | 358 | $dependencies = array_values( $dependencies ); |
359 | 359 | |
360 | 360 | $styles->registered['wp-admin']->deps = $dependencies; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | wp_enqueue_script( 'formidable_settings' ); |
29 | 29 | return FrmAppHelper::clip( |
30 | 30 | // @phpstan-ignore-next-line |
31 | - function () use ( $id, $name, $args ) { |
|
31 | + function() use ( $id, $name, $args ) { |
|
32 | 32 | require FrmAppHelper::plugin_path() . '/classes/views/shared/toggle.php'; |
33 | 33 | }, |
34 | 34 | isset( $args['echo'] ) ? $args['echo'] : false |
@@ -417,12 +417,12 @@ |
||
417 | 417 | array_walk( |
418 | 418 | $styles, |
419 | 419 | /** |
420 | - * Echo a style card for a single style in the $styles array. |
|
421 | - * |
|
422 | - * @param WP_Post $style |
|
423 | - * @param int $count Used for pagination. |
|
424 | - * @return void |
|
425 | - */ |
|
420 | + * Echo a style card for a single style in the $styles array. |
|
421 | + * |
|
422 | + * @param WP_Post $style |
|
423 | + * @param int $count Used for pagination. |
|
424 | + * @return void |
|
425 | + */ |
|
426 | 426 | function ( $style ) use ( &$count ) { |
427 | 427 | $hidden = $count > ( self::PAGE_SIZE - 1 ); |
428 | 428 | $this->echo_style_card( $style, $hidden ); |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | private static function has_dark_background( $style ) { |
139 | 139 | $key = 'fieldset_bg_color'; |
140 | 140 | |
141 | - if ( empty( $style->post_content[ $key ] ) ) { |
|
141 | + if ( empty( $style->post_content[$key] ) ) { |
|
142 | 142 | return false; |
143 | 143 | } |
144 | 144 | |
145 | - $color = $style->post_content[ $key ]; |
|
145 | + $color = $style->post_content[$key]; |
|
146 | 146 | |
147 | 147 | if ( 0 === strpos( $color, 'rgba' ) ) { |
148 | 148 | preg_match_all( '/([\\d.]+)/', $color, $matches ); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param stdClass $style_object |
202 | 202 | * @param array $style |
203 | 203 | */ |
204 | - $param_filter = function ( $params, $args ) use ( $style_object, $style ) { |
|
204 | + $param_filter = function( $params, $args ) use ( $style_object, $style ) { |
|
205 | 205 | if ( $args['style'] !== $style_object ) { |
206 | 206 | return $params; |
207 | 207 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ), |
215 | 215 | '/style-templates/' . $style['slug'] |
216 | 216 | ); |
217 | - $params['data-requires'] = FrmFormsHelper::get_plan_required( $style ); |
|
217 | + $params['data-requires'] = FrmFormsHelper::get_plan_required( $style ); |
|
218 | 218 | return $params; |
219 | 219 | }; |
220 | 220 | } else { |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param array $style |
226 | 226 | * @return array |
227 | 227 | */ |
228 | - $param_filter = function ( $params ) use ( $style ) { |
|
228 | + $param_filter = function( $params ) use ( $style ) { |
|
229 | 229 | $params['data-template-key'] = $style['slug']; |
230 | 230 | return $params; |
231 | 231 | }; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | continue; |
278 | 278 | } |
279 | 279 | |
280 | - $value = $style->post_content[ $key ]; |
|
280 | + $value = $style->post_content[$key]; |
|
281 | 281 | |
282 | 282 | $is_hex = in_array( $key, $color_settings, true ) && $value && '#' !== $value[0] && false === strpos( $value, 'rgb' ) && $value !== 'transparent'; |
283 | 283 | if ( $is_hex ) { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @param int $count Used for pagination. |
397 | 397 | * @return void |
398 | 398 | */ |
399 | - function ( $style, $key ) { |
|
399 | + function( $style, $key ) { |
|
400 | 400 | if ( ! is_numeric( $key ) ) { |
401 | 401 | // Skip active_sub/expires keys. |
402 | 402 | return; |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | * @param int $count Used for pagination. |
424 | 424 | * @return void |
425 | 425 | */ |
426 | - function ( $style ) use ( &$count ) { |
|
426 | + function( $style ) use ( &$count ) { |
|
427 | 427 | $hidden = $count > ( self::PAGE_SIZE - 1 ); |
428 | 428 | $this->echo_style_card( $style, $hidden ); |
429 | - ++$count; |
|
429 | + ++ $count; |
|
430 | 430 | } |
431 | 431 | ); |
432 | 432 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | * @param WP_Post $style |
485 | 485 | * @return bool |
486 | 486 | */ |
487 | - function ( $style ) { |
|
487 | + function( $style ) { |
|
488 | 488 | return $this->default_style->ID !== $style->ID; |
489 | 489 | } |
490 | 490 | ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | unset( $filename ); |
130 | 130 | |
131 | - $comment_count = FrmDb::get_count( |
|
131 | + $comment_count = FrmDb::get_count( |
|
132 | 132 | 'frm_item_metas', |
133 | 133 | array( |
134 | 134 | 'item_id' => $atts['entry_ids'], |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | private static function prepare_csv_headings() { |
247 | 247 | $headings = array(); |
248 | 248 | self::csv_headings( $headings ); |
249 | - $headings = apply_filters( |
|
249 | + $headings = apply_filters( |
|
250 | 250 | 'frm_csv_columns', |
251 | 251 | $headings, |
252 | 252 | self::$form_id, |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | $field_headings = array(); |
271 | 271 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
272 | 272 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
273 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
273 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
274 | 274 | } |
275 | 275 | |
276 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
276 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
277 | 277 | $field_headings = apply_filters( |
278 | 278 | 'frm_csv_field_columns', |
279 | 279 | $field_headings, |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
295 | 295 | $repeater_id = $col->field_options['in_section']; |
296 | 296 | // Set a placeholder to maintain order for repeater fields. |
297 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
297 | + $headings['repeater' . $repeater_id] = array(); |
|
298 | 298 | |
299 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
300 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
299 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
300 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
301 | 301 | $repeater_ids[] = $repeater_id; |
302 | 302 | } |
303 | 303 | |
304 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
304 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
305 | 305 | |
306 | 306 | continue; |
307 | 307 | } |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | $end = strpos( $row->meta_value, ':{' ); |
321 | 321 | $length = substr( $row->meta_value, $start, $end - $start ); |
322 | 322 | |
323 | - if ( $length > $max[ $row->field_id ] ) { |
|
324 | - $max[ $row->field_id ] = $length; |
|
323 | + if ( $length > $max[$row->field_id] ) { |
|
324 | + $max[$row->field_id] = $length; |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -332,17 +332,17 @@ discard block |
||
332 | 332 | $repeater_id = str_replace( 'repeater', '', $key ); |
333 | 333 | |
334 | 334 | $repeater_headings = array(); |
335 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
335 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
336 | 336 | $repeater_headings += self::field_headings( $col ); |
337 | 337 | } |
338 | 338 | |
339 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
339 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
340 | 340 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
341 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
341 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | } else { |
345 | - $flat[ $key ] = $heading; |
|
345 | + $flat[$key] = $heading; |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
@@ -355,10 +355,10 @@ discard block |
||
355 | 355 | }//end if |
356 | 356 | |
357 | 357 | if ( self::$comment_count ) { |
358 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
359 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
360 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
361 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
358 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
359 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
360 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
361 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
362 | 362 | } |
363 | 363 | unset( $i ); |
364 | 364 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | |
404 | 404 | private static function prepare_next_csv_rows( $next_set ) { |
405 | 405 | // order by parent_item_id so children will be first |
406 | - $where = array( |
|
406 | + $where = array( |
|
407 | 407 | 'or' => 1, |
408 | 408 | 'id' => $next_set, |
409 | 409 | 'parent_item_id' => $next_set, |
@@ -449,32 +449,32 @@ discard block |
||
449 | 449 | continue; |
450 | 450 | } |
451 | 451 | |
452 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
453 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
454 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
452 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
453 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
454 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
455 | 455 | } |
456 | 456 | |
457 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
458 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
459 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
457 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
458 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
459 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
460 | 460 | // if the data is here, it should be an array but if this field has collected data |
461 | 461 | // both while inside and outside of the repeating section, it's possible this is a string. |
462 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
462 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | // Add the repeated values. |
466 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
466 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
467 | 467 | }//end foreach |
468 | 468 | |
469 | 469 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
470 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
470 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
471 | 471 | }//end if |
472 | 472 | |
473 | 473 | // add the embedded form id |
474 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
475 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
474 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
475 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
476 | 476 | } |
477 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
477 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
@@ -495,19 +495,19 @@ discard block |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | $repeater_id = $field->field_options['in_section']; |
498 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
498 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
499 | 499 | return $metas; |
500 | 500 | } |
501 | 501 | |
502 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
503 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
504 | - $metas[ $repeater_child->id ] = ''; |
|
502 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
503 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
504 | + $metas[$repeater_child->id] = ''; |
|
505 | 505 | |
506 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
507 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
506 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
507 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
508 | 508 | } |
509 | 509 | |
510 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
510 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | |
527 | 527 | private static function add_field_values_to_csv( &$row ) { |
528 | 528 | foreach ( self::$fields as $col ) { |
529 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
529 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
530 | 530 | |
531 | 531 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
532 | 532 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -545,20 +545,20 @@ discard block |
||
545 | 545 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
546 | 546 | $label_key = $col->id . '_label'; |
547 | 547 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
548 | - $row[ $label_key ] = array(); |
|
548 | + $row[$label_key] = array(); |
|
549 | 549 | |
550 | 550 | if ( is_array( $field_value ) ) { |
551 | 551 | foreach ( $field_value as $value ) { |
552 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
552 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | } else { |
556 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
556 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
557 | 557 | } |
558 | 558 | unset( $label_key ); |
559 | 559 | } |
560 | 560 | |
561 | - $row[ $col->id ] = $field_value; |
|
561 | + $row[$col->id] = $field_value; |
|
562 | 562 | |
563 | 563 | unset( $col, $field_value ); |
564 | 564 | }//end foreach |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | 'show_icon' => false, |
582 | 582 | 'entry_id' => self::$entry->id, |
583 | 583 | 'sep' => self::$separator, |
584 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
584 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
585 | 585 | ) |
586 | 586 | ); |
587 | 587 | } |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
597 | 597 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
598 | 598 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
599 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
600 | - $row[ $column_key ] = $sub_sub_value; |
|
599 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
600 | + $row[$column_key] = $sub_sub_value; |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
@@ -605,8 +605,8 @@ discard block |
||
605 | 605 | } |
606 | 606 | |
607 | 607 | $column_key = $atts['col']->id . '_' . $key; |
608 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
609 | - $row[ $column_key ] = $sub_value; |
|
608 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
609 | + $row[$column_key] = $sub_value; |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | } |
@@ -631,18 +631,18 @@ discard block |
||
631 | 631 | $echo = 'echo' === self::$mode; |
632 | 632 | |
633 | 633 | foreach ( self::$headings as $k => $heading ) { |
634 | - if ( isset( $rows[ $k ] ) ) { |
|
635 | - $row = $rows[ $k ]; |
|
634 | + if ( isset( $rows[$k] ) ) { |
|
635 | + $row = $rows[$k]; |
|
636 | 636 | } else { |
637 | 637 | $row = ''; |
638 | 638 | // array indexed data is not at $rows[ $k ] |
639 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
639 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
640 | 640 | $start = strrpos( $k, '[' ); |
641 | - $key = substr( $k, 0, $start++ ); |
|
641 | + $key = substr( $k, 0, $start ++ ); |
|
642 | 642 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
643 | 643 | |
644 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
645 | - $row = $rows[ $key ][ $index ]; |
|
644 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
645 | + $row = $rows[$key][$index]; |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | unset( $start, $key, $index ); |