@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | if ( $new_val !== $value ) { |
212 | - $new_values[ $key ] = $new_val; |
|
212 | + $new_values[$key] = $new_val; |
|
213 | 213 | } |
214 | 214 | }//end foreach |
215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | foreach ( $values as $value_key => $value ) { |
242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
243 | - $new_values[ $value_key ] = $value; |
|
243 | + $new_values[$value_key] = $value; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
324 | 324 | foreach ( $all_fields as $fid ) { |
325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
326 | - $values['item_meta'][ $fid->id ] = ''; |
|
326 | + $values['item_meta'][$fid->id] = ''; |
|
327 | 327 | } |
328 | - $field_array[ $fid->id ] = $fid; |
|
328 | + $field_array[$fid->id] = $fid; |
|
329 | 329 | } |
330 | 330 | unset( $all_fields ); |
331 | 331 | |
332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
334 | - $field = $field_array[ $field_id ]; |
|
333 | + if ( isset( $field_array[$field_id] ) ) { |
|
334 | + $field = $field_array[$field_id]; |
|
335 | 335 | } else { |
336 | 336 | $field = FrmField::getOne( $field_id ); |
337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | continue; |
341 | 341 | } |
342 | 342 | |
343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
344 | 344 | if ( $is_settings_page ) { |
345 | 345 | self::get_settings_page_html( $values, $field ); |
346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
356 | 356 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
357 | 357 | |
358 | 358 | foreach ( $update_options as $opt => $default ) { |
359 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
360 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
359 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
360 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
364 | 364 | |
365 | 365 | $new_field = array( |
366 | 366 | 'field_options' => $field->field_options, |
367 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
367 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
368 | 368 | ); |
369 | 369 | |
370 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
371 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
370 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
371 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
372 | 372 | if ( is_array( $option ) ) { |
373 | 373 | foreach ( $option as $key => $item ) { |
374 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
374 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | } |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | */ |
402 | 402 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
403 | 403 | if ( $field->type === 'textarea' && |
404 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
405 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
404 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
405 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
406 | 406 | |
407 | 407 | $new_field['field_options']['max'] = ''; |
408 | 408 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
411 | 411 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
412 | 412 | */ |
413 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
413 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
@@ -486,11 +486,11 @@ discard block |
||
486 | 486 | * Updating the settings page |
487 | 487 | */ |
488 | 488 | private static function get_settings_page_html( $values, &$field ) { |
489 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
489 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
490 | 490 | $prev_opts = array(); |
491 | 491 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
492 | 492 | |
493 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
493 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
494 | 494 | } elseif ( $field->type === 'hidden' || $field->type === 'user_id' ) { |
495 | 495 | $prev_opts = $field->field_options; |
496 | 496 | } |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | foreach ( $field_cols as $col => $default ) { |
517 | 517 | $default = $default === '' ? $field->{$col} : $default; |
518 | 518 | |
519 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
519 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | // Don't save the template option. |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) { |
697 | 697 | self::destroy( $form->id ); |
698 | 698 | if ( empty( $form->parent_form_id ) ) { |
699 | - ++$count; |
|
699 | + ++ $count; |
|
700 | 700 | } |
701 | 701 | } |
702 | 702 | |
@@ -920,16 +920,16 @@ discard block |
||
920 | 920 | foreach ( $results as $row ) { |
921 | 921 | if ( 'trash' != $row->status ) { |
922 | 922 | if ( $row->is_template ) { |
923 | - ++$counts['template']; |
|
923 | + ++ $counts['template']; |
|
924 | 924 | } else { |
925 | - ++$counts['published']; |
|
925 | + ++ $counts['published']; |
|
926 | 926 | } |
927 | 927 | } else { |
928 | - ++$counts['trash']; |
|
928 | + ++ $counts['trash']; |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | if ( 'draft' == $row->status ) { |
932 | - ++$counts['draft']; |
|
932 | + ++ $counts['draft']; |
|
933 | 933 | } |
934 | 934 | |
935 | 935 | unset( $row ); |
@@ -970,8 +970,8 @@ discard block |
||
970 | 970 | self::maybe_get_form( $form ); |
971 | 971 | } |
972 | 972 | |
973 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
974 | - return $frm_vars['form_params'][ $form->id ]; |
|
973 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
974 | + return $frm_vars['form_params'][$form->id]; |
|
975 | 975 | } |
976 | 976 | |
977 | 977 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1000,15 +1000,15 @@ discard block |
||
1000 | 1000 | // If there are two forms on the same page, make sure not to submit both. |
1001 | 1001 | foreach ( $default_values as $var => $default ) { |
1002 | 1002 | if ( $var === 'action' ) { |
1003 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
1003 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
1004 | 1004 | } else { |
1005 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1005 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1006 | 1006 | } |
1007 | 1007 | unset( $var, $default ); |
1008 | 1008 | } |
1009 | 1009 | } else { |
1010 | 1010 | foreach ( $default_values as $var => $default ) { |
1011 | - $values[ $var ] = $default; |
|
1011 | + $values[$var] = $default; |
|
1012 | 1012 | unset( $var, $default ); |
1013 | 1013 | } |
1014 | 1014 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | 'sdir' => '', |
1035 | 1035 | ); |
1036 | 1036 | foreach ( $defaults as $var => $default ) { |
1037 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1037 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | return $values; |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | 'keep_post' => '', |
1063 | 1063 | ); |
1064 | 1064 | foreach ( $defaults as $var => $default ) { |
1065 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1065 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | return $values; |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | $form = $atts['form']; |
1166 | 1166 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
1167 | 1167 | |
1168 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
1168 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | /** |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | foreach ( $settings as $setting => $default ) { |
232 | - if ( isset( $params[ 'frm_' . $setting ] ) ) { |
|
233 | - $this->{$setting} = $params[ 'frm_' . $setting ]; |
|
232 | + if ( isset( $params['frm_' . $setting] ) ) { |
|
233 | + $this->{$setting} = $params['frm_' . $setting]; |
|
234 | 234 | } elseif ( ! isset( $this->{$setting} ) ) { |
235 | 235 | $this->{$setting} = $default; |
236 | 236 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | |
408 | 408 | $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'no_ips', 'custom_header_ip', 'tracking', 'admin_bar', 'summary_emails' ); |
409 | 409 | foreach ( $checkboxes as $set ) { |
410 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? absint( $params[ 'frm_' . $set ] ) : 0; |
|
410 | + $this->$set = isset( $params['frm_' . $set] ) ? absint( $params['frm_' . $set] ) : 0; |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $frm_roles = FrmAppHelper::frm_capabilities(); |
421 | 421 | $roles = get_editable_roles(); |
422 | 422 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
423 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
423 | + $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' ); |
|
424 | 424 | |
425 | 425 | // Make sure administrators always have permissions |
426 | 426 | if ( ! in_array( 'administrator', $this->$frm_role, true ) ) { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $page = $this->get_pagenum(); |
24 | 24 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
25 | 25 | |
26 | - $mode = self::get_param( |
|
26 | + $mode = self::get_param( |
|
27 | 27 | array( |
28 | 28 | 'param' => 'mode', |
29 | 29 | 'default' => 'list', |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | 'default' => 'name', |
36 | 36 | ) |
37 | 37 | ); |
38 | - $order = self::get_param( |
|
38 | + $order = self::get_param( |
|
39 | 39 | array( |
40 | 40 | 'param' => 'order', |
41 | 41 | 'default' => 'ASC', |
42 | 42 | ) |
43 | 43 | ); |
44 | - $start = self::get_param( |
|
44 | + $start = self::get_param( |
|
45 | 45 | array( |
46 | 46 | 'param' => 'start', |
47 | 47 | 'default' => ( $page - 1 ) * $per_page, |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $counts = FrmForm::get_count(); |
174 | 174 | $form_type = FrmAppHelper::simple_get( 'form_type', 'sanitize_title', 'published' ); |
175 | 175 | |
176 | - if ( isset( $statuses[ $form_type ] ) ) { |
|
176 | + if ( isset( $statuses[$form_type] ) ) { |
|
177 | 177 | $counts->$form_type = $this->total_items; |
178 | 178 | } |
179 | 179 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | if ( $counts->{$status} || 'draft' !== $status ) { |
196 | 196 | /* translators: %1$s: Status, %2$s: Number of items */ |
197 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
197 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | unset( $status, $name ); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | private function get_actions( &$actions, $item, $edit_link ) { |
376 | 376 | $new_actions = FrmFormsHelper::get_action_links( $item->id, $item ); |
377 | 377 | foreach ( $new_actions as $link => $action ) { |
378 | - $new_actions[ $link ] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
378 | + $new_actions[$link] = FrmFormsHelper::format_link_html( $action, 'short' ); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | if ( 'trash' === $this->status ) { |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | if ( FrmAppHelper::is_admin_page( 'formidable-settings' ) ) { |
1278 | 1278 | add_action( |
1279 | 1279 | 'frm_update_settings', |
1280 | - function ( $params ) { |
|
1280 | + function( $params ) { |
|
1281 | 1281 | if ( ! empty( $params['frm_use_html'] ) ) { |
1282 | 1282 | $inbox = new FrmInbox(); |
1283 | 1283 | $inbox->dismiss( 'deprecated_use_html' ); |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | * @param array $messages |
1297 | 1297 | * @return array |
1298 | 1298 | */ |
1299 | - function ( $messages ) use ( $url ) { |
|
1299 | + function( $messages ) use ( $url ) { |
|
1300 | 1300 | $messages[] = '<p>The option to use HTML5 in forms is currently disabled. In a future release, this setting will be removed and using HTML5 will be a requirement. <a href="' . esc_url( $url ) . '">Click here to enable it in Global Settings now</a>.</p>'; |
1301 | 1301 | return $messages; |
1302 | 1302 | } |
@@ -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 | ); |
@@ -119,20 +119,20 @@ discard block |
||
119 | 119 | |
120 | 120 | $application = array(); |
121 | 121 | foreach ( self::$keys as $key ) { |
122 | - if ( ! isset( $this->api_data[ $key ] ) ) { |
|
122 | + if ( ! isset( $this->api_data[$key] ) ) { |
|
123 | 123 | continue; |
124 | 124 | } |
125 | 125 | |
126 | - $value = $this->api_data[ $key ]; |
|
126 | + $value = $this->api_data[$key]; |
|
127 | 127 | |
128 | 128 | if ( 'icon' === $key ) { |
129 | 129 | // Icon is an array. The first array item is the image URL. |
130 | - $application[ $key ] = reset( $value ); |
|
130 | + $application[$key] = reset( $value ); |
|
131 | 131 | } elseif ( 'categories' === $key ) { |
132 | - $application[ $key ] = array_values( |
|
132 | + $application[$key] = array_values( |
|
133 | 133 | array_filter( |
134 | 134 | $value, |
135 | - function ( $category ) { |
|
135 | + function( $category ) { |
|
136 | 136 | return false === strpos( $category, '+Views' ); |
137 | 137 | } |
138 | 138 | ) |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | // Strip off the " Template" text at the end of the name as it takes up space. |
149 | 149 | $value = substr( $value, 0, -9 ); |
150 | 150 | } |
151 | - $application[ $key ] = $value; |
|
151 | + $application[$key] = $value; |
|
152 | 152 | }//end if |
153 | 153 | }//end foreach |
154 | 154 |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
301 | 301 | } |
302 | 302 | $plugins = get_plugins(); |
303 | - if ( isset( $plugins[ $plugin ] ) && ! empty( $plugins[ $plugin ]['Version'] ) ) { |
|
304 | - return $plugins[ $plugin ]['Version']; |
|
303 | + if ( isset( $plugins[$plugin] ) && ! empty( $plugins[$plugin]['Version'] ) ) { |
|
304 | + return $plugins[$plugin]['Version']; |
|
305 | 305 | } |
306 | 306 | return false; |
307 | 307 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
375 | 375 | |
376 | 376 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
377 | - $new_values[ $col ] = $values[ $col ]; |
|
377 | + $new_values[$col] = $values[$col]; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
386 | 386 | |
387 | 387 | if ( isset( $values['id'] ) ) { |
388 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
388 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
389 | 389 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
390 | 390 | } |
391 | 391 | |
@@ -394,9 +394,9 @@ discard block |
||
394 | 394 | foreach ( $new_values as $k => $v ) { |
395 | 395 | if ( is_array( $v ) ) { |
396 | 396 | if ( $k === 'default_value' ) { |
397 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
397 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
398 | 398 | } else { |
399 | - $new_values[ $k ] = serialize( $v ); |
|
399 | + $new_values[$k] = serialize( $v ); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | unset( $k, $v ); |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | if ( isset( $values['id'] ) ) { |
419 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
419 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | return $new_id; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
477 | 477 | global $frm_duplicate_ids; |
478 | 478 | |
479 | - $where = array( |
|
479 | + $where = array( |
|
480 | 480 | array( |
481 | 481 | 'or' => 1, |
482 | 482 | 'fi.form_id' => $old_form_id, |
@@ -522,8 +522,8 @@ discard block |
||
522 | 522 | |
523 | 523 | $values = apply_filters( 'frm_duplicated_field', $values ); |
524 | 524 | $new_id = self::create( $values ); |
525 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
526 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
525 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
526 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
527 | 527 | unset( $field ); |
528 | 528 | }//end foreach |
529 | 529 | } |
@@ -572,11 +572,11 @@ discard block |
||
572 | 572 | |
573 | 573 | // serialize array values |
574 | 574 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
575 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
575 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
576 | 576 | if ( 'field_options' === $opt ) { |
577 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
577 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
578 | 578 | } |
579 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
579 | + $values[$opt] = serialize( $values[$opt] ); |
|
580 | 580 | } |
581 | 581 | } |
582 | 582 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | 'id' => $id, |
732 | 732 | 'field_key' => $id, |
733 | 733 | ); |
734 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
734 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | return $type; |
@@ -763,8 +763,8 @@ discard block |
||
763 | 763 | continue; |
764 | 764 | } |
765 | 765 | |
766 | - $fields[ $result->id ] = $result; |
|
767 | - ++$count; |
|
766 | + $fields[$result->id] = $result; |
|
767 | + ++ $count; |
|
768 | 768 | if ( $limit == 1 ) { |
769 | 769 | $fields = $result; |
770 | 770 | break; |
@@ -815,8 +815,8 @@ discard block |
||
815 | 815 | $fields = array(); |
816 | 816 | $count = 0; |
817 | 817 | foreach ( $results as $result ) { |
818 | - ++$count; |
|
819 | - $fields[ $result->id ] = $result; |
|
818 | + ++ $count; |
|
819 | + $fields[$result->id] = $result; |
|
820 | 820 | if ( ! empty( $limit ) && $count >= $limit ) { |
821 | 821 | break; |
822 | 822 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | $query_type = $limit == ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
931 | 931 | |
932 | 932 | if ( is_array( $where ) ) { |
933 | - $args = array( |
|
933 | + $args = array( |
|
934 | 934 | 'order_by' => $order_by, |
935 | 935 | 'limit' => $limit, |
936 | 936 | ); |
@@ -961,9 +961,9 @@ discard block |
||
961 | 961 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
962 | 962 | |
963 | 963 | self::prepare_options( $result ); |
964 | - $results[ $r_key ]->field_options = $result->field_options; |
|
965 | - $results[ $r_key ]->options = $result->options; |
|
966 | - $results[ $r_key ]->default_value = $result->default_value; |
|
964 | + $results[$r_key]->field_options = $result->field_options; |
|
965 | + $results[$r_key]->options = $result->options; |
|
966 | + $results[$r_key]->default_value = $result->default_value; |
|
967 | 967 | |
968 | 968 | unset( $r_key, $result ); |
969 | 969 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | |
1020 | 1020 | if ( count( $next_fields ) >= self::$transient_size ) { |
1021 | 1021 | // if this transient is full, check for another |
1022 | - ++$next; |
|
1022 | + ++ $next; |
|
1023 | 1023 | self::get_next_transient( $fields, $base_name, $next ); |
1024 | 1024 | } |
1025 | 1025 | } |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | return; |
1048 | 1048 | } |
1049 | 1049 | |
1050 | - ++$next; |
|
1050 | + ++ $next; |
|
1051 | 1051 | } |
1052 | 1052 | } |
1053 | 1053 | |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | * @return bool |
1196 | 1196 | */ |
1197 | 1197 | public static function is_option_true_in_array( $field, $option ) { |
1198 | - return ! empty( $field[ $option ] ); |
|
1198 | + return ! empty( $field[$option] ); |
|
1199 | 1199 | } |
1200 | 1200 | |
1201 | 1201 | /** |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | * @return bool |
1205 | 1205 | */ |
1206 | 1206 | public static function is_option_true_in_object( $field, $option ) { |
1207 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
1207 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | /** |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | * @return bool |
1214 | 1214 | */ |
1215 | 1215 | public static function is_option_empty_in_array( $field, $option ) { |
1216 | - return empty( $field[ $option ] ); |
|
1216 | + return empty( $field[$option] ); |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | /** |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | * @return bool |
1223 | 1223 | */ |
1224 | 1224 | public static function is_option_empty_in_object( $field, $option ) { |
1225 | - return empty( $field->field_options[ $option ] ); |
|
1225 | + return empty( $field->field_options[$option] ); |
|
1226 | 1226 | } |
1227 | 1227 | |
1228 | 1228 | /** |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | * @return bool |
1232 | 1232 | */ |
1233 | 1233 | public static function is_option_value_in_object( $field, $option ) { |
1234 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
1234 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | /** |
@@ -1257,10 +1257,10 @@ discard block |
||
1257 | 1257 | * @return mixed |
1258 | 1258 | */ |
1259 | 1259 | public static function get_option_in_array( $field, $option ) { |
1260 | - if ( isset( $field[ $option ] ) ) { |
|
1261 | - $this_option = $field[ $option ]; |
|
1262 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
1263 | - $this_option = $field['field_options'][ $option ]; |
|
1260 | + if ( isset( $field[$option] ) ) { |
|
1261 | + $this_option = $field[$option]; |
|
1262 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
1263 | + $this_option = $field['field_options'][$option]; |
|
1264 | 1264 | } else { |
1265 | 1265 | $this_option = ''; |
1266 | 1266 | } |
@@ -1274,7 +1274,7 @@ discard block |
||
1274 | 1274 | * @return mixed |
1275 | 1275 | */ |
1276 | 1276 | public static function get_option_in_object( $field, $option ) { |
1277 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
1277 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
1278 | 1278 | } |
1279 | 1279 | |
1280 | 1280 | /** |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | $field_val = ''; |
150 | 150 | if ( is_object( $this->field ) ) { |
151 | 151 | $field_val = $this->field->{$column}; |
152 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
153 | - $field_val = $this->field[ $column ]; |
|
152 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
153 | + $field_val = $this->field[$column]; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | return $field_val; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if ( is_object( $this->field ) ) { |
165 | 165 | $this->field->{$column} = $value; |
166 | 166 | } elseif ( is_array( $this->field ) ) { |
167 | - $this->field[ $column ] = $value; |
|
167 | + $this->field[$column] = $value; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | printf( |
607 | 607 | /* translators: %s: Field type */ |
608 | 608 | esc_html__( '%s Options', 'formidable' ), |
609 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
609 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
610 | 610 | ); |
611 | 611 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); |
612 | 612 | ?> |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | * New field |
693 | 693 | */ |
694 | 694 | public function get_new_field_defaults() { |
695 | - $field = array( |
|
695 | + $field = array( |
|
696 | 696 | 'name' => $this->get_new_field_name(), |
697 | 697 | 'description' => '', |
698 | 698 | 'type' => $this->type, |
@@ -723,8 +723,8 @@ discard block |
||
723 | 723 | |
724 | 724 | $fields = array_merge( $fields, $pro_fields ); |
725 | 725 | |
726 | - if ( isset( $fields[ $this->type ] ) ) { |
|
727 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
726 | + if ( isset( $fields[$this->type] ) ) { |
|
727 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
728 | 728 | } |
729 | 729 | |
730 | 730 | return $name; |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | * @return array |
742 | 742 | */ |
743 | 743 | public function get_default_field_options() { |
744 | - $opts = array( |
|
744 | + $opts = array( |
|
745 | 745 | 'size' => '', |
746 | 746 | 'max' => '', |
747 | 747 | 'label' => '', |
@@ -1164,8 +1164,8 @@ discard block |
||
1164 | 1164 | $selected = $values['field_value']; |
1165 | 1165 | |
1166 | 1166 | if ( isset( $values['combo_name'] ) ) { |
1167 | - $options = $options[ $values['combo_name'] ]; |
|
1168 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
1167 | + $options = $options[$values['combo_name']]; |
|
1168 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | $input = $this->select_tag( $values ); |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | protected function fill_display_field_values( $args = array() ) { |
1219 | - $defaults = array( |
|
1219 | + $defaults = array( |
|
1220 | 1220 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
1221 | 1221 | 'field_id' => $this->get_field_column( 'id' ), |
1222 | 1222 | 'field_plus_id' => '', |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | } |
1270 | 1270 | } |
1271 | 1271 | |
1272 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
1272 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
1273 | 1273 | if ( $error_comes_first ) { |
1274 | 1274 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
1275 | 1275 | } else { |
@@ -1348,11 +1348,11 @@ discard block |
||
1348 | 1348 | |
1349 | 1349 | $field_id = $this->get_field_column( 'id' ); |
1350 | 1350 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
1351 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
1351 | + $frm_validated_unique_values[$field_id] = array(); |
|
1352 | 1352 | return false; |
1353 | 1353 | } |
1354 | 1354 | |
1355 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
1355 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
1356 | 1356 | return $already_validated_this_value; |
1357 | 1357 | } |
1358 | 1358 | |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | private function value_validated_as_unique( $value ) { |
1378 | 1378 | global $frm_validated_unique_values; |
1379 | 1379 | $field_id = $this->get_field_column( 'id' ); |
1380 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
1380 | + $frm_validated_unique_values[$field_id][] = $value; |
|
1381 | 1381 | } |
1382 | 1382 | |
1383 | 1383 | /** |
@@ -1418,8 +1418,8 @@ discard block |
||
1418 | 1418 | $value = $this->prepare_display_value( $value, $atts ); |
1419 | 1419 | |
1420 | 1420 | if ( is_array( $value ) ) { |
1421 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
1422 | - $value = $value[ $atts['show'] ]; |
|
1421 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
1422 | + $value = $value[$atts['show']]; |
|
1423 | 1423 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
1424 | 1424 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
1425 | 1425 | $value = implode( $sep, $value ); |
@@ -1549,8 +1549,8 @@ discard block |
||
1549 | 1549 | $saved_entries = $atts['ids']; |
1550 | 1550 | $new_value = array(); |
1551 | 1551 | foreach ( (array) $value as $old_child_id ) { |
1552 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
1553 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
1552 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
1553 | + $new_value[] = $saved_entries[$old_child_id]; |
|
1554 | 1554 | } |
1555 | 1555 | } |
1556 | 1556 |