@@ -16,7 +16,7 @@ |
||
| 16 | 16 | 'title' => esc_attr__( 'Toggle Options', 'formidable' ), |
| 17 | 17 | ) |
| 18 | 18 | ); |
| 19 | - $e_args = array( |
|
| 19 | + $e_args = array( |
|
| 20 | 20 | 'textarea_name' => 'field_options[description_' . absint( $field['id'] ) . ']', |
| 21 | 21 | 'textarea_rows' => 8, |
| 22 | 22 | ); |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | $data_keys = array_keys( $data ); |
| 7 | 7 | $params = array(); |
| 8 | 8 | foreach ( $data_keys as $key ) { |
| 9 | - $params[ 'data-' . $key ] = $data[ $key ]; |
|
| 9 | + $params['data-' . $key] = $data[$key]; |
|
| 10 | 10 | } |
| 11 | 11 | $params['class'] = 'frm_show_upgrade frm_noallow'; |
| 12 | 12 | $params['href'] = '#'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'class' => '', |
| 29 | 29 | 'inc_children' => 'exclude', |
| 30 | 30 | ); |
| 31 | - $args = wp_parse_args( $args, $defaults ); |
|
| 31 | + $args = wp_parse_args( $args, $defaults ); |
|
| 32 | 32 | |
| 33 | 33 | if ( ! $args['field_id'] ) { |
| 34 | 34 | $args['field_id'] = $field_name; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 72 | 72 | if ( ! empty( $class ) ) { |
| 73 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 73 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | 'description' => '', |
| 277 | 277 | ); |
| 278 | 278 | foreach ( $defaults as $var => $default ) { |
| 279 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 280 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 279 | + if ( ! isset( $values[$var] ) ) { |
|
| 280 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | 'parent_form_id' => 0, |
| 293 | 293 | ); |
| 294 | 294 | foreach ( $defaults as $var => $default ) { |
| 295 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 296 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 295 | + if ( ! isset( $values[$var] ) ) { |
|
| 296 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | unset( $defaults ); |
@@ -330,16 +330,16 @@ discard block |
||
| 330 | 330 | $defaults = self::get_default_opts(); |
| 331 | 331 | foreach ( $defaults as $var => $default ) { |
| 332 | 332 | if ( is_array( $default ) ) { |
| 333 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 334 | - $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
|
| 333 | + if ( ! isset( $values[$var] ) ) { |
|
| 334 | + $values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array(); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | foreach ( $default as $k => $v ) { |
| 338 | - $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v ); |
|
| 338 | + $values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v ); |
|
| 339 | 339 | |
| 340 | 340 | if ( is_array( $v ) ) { |
| 341 | 341 | foreach ( $v as $k1 => $v1 ) { |
| 342 | - $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
| 342 | + $values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
| 343 | 343 | unset( $k1, $v1 ); |
| 344 | 344 | } |
| 345 | 345 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | unset( $k, $v ); |
| 348 | 348 | } |
| 349 | 349 | } else { |
| 350 | - $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
|
| 350 | + $values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default ); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | unset( $var, $default ); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | public static function fill_form_options( &$options, $values ) { |
| 388 | 388 | $defaults = self::get_default_opts(); |
| 389 | 389 | foreach ( $defaults as $var => $default ) { |
| 390 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
| 390 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
| 391 | 391 | unset( $var, $default ); |
| 392 | 392 | } |
| 393 | 393 | } |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | public static function insert_opt_html( $args ) { |
| 550 | 550 | $class = isset( $args['class'] ) ? $args['class'] : ''; |
| 551 | 551 | $fields = FrmField::all_field_selection(); |
| 552 | - $field = isset( $fields[ $args['type'] ] ) ? $fields[ $args['type'] ] : array(); |
|
| 552 | + $field = isset( $fields[$args['type']] ) ? $fields[$args['type']] : array(); |
|
| 553 | 553 | |
| 554 | 554 | self::prepare_field_type( $field ); |
| 555 | 555 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | FrmField::update( $field->id, array( 'field_order' => $field->field_order + 2 ) ); |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - $add_order += 2; |
|
| 708 | + $add_order += 2; |
|
| 709 | 709 | $open = false; |
| 710 | 710 | $reset_fields = true; |
| 711 | 711 | } |
@@ -1108,10 +1108,10 @@ discard block |
||
| 1108 | 1108 | $link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"'; |
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | - $label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] ); |
|
| 1112 | - if ( $length == 'icon' && isset( $link_details[ $length ] ) ) { |
|
| 1111 | + $label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] ); |
|
| 1112 | + if ( $length == 'icon' && isset( $link_details[$length] ) ) { |
|
| 1113 | 1113 | $label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>'; |
| 1114 | - $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
|
| 1114 | + $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
|
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | $link .= '>' . $label . '</a>'; |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | $status = 'publish'; |
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | - $name = $nice_names[ $status ]; |
|
| 1253 | + $name = $nice_names[$status]; |
|
| 1254 | 1254 | |
| 1255 | 1255 | return $name; |
| 1256 | 1256 | } |
@@ -1283,17 +1283,17 @@ discard block |
||
| 1283 | 1283 | '' => array( 'align_right' ), |
| 1284 | 1284 | ); |
| 1285 | 1285 | |
| 1286 | - $icons[ __( 'My Templates', 'formidable' ) ] = array( 'user', 'var(--orange)' ); |
|
| 1286 | + $icons[__( 'My Templates', 'formidable' )] = array( 'user', 'var(--orange)' ); |
|
| 1287 | 1287 | |
| 1288 | 1288 | $icon = $icons['']; |
| 1289 | 1289 | |
| 1290 | 1290 | if ( count( $categories ) === 1 ) { |
| 1291 | 1291 | $category = reset( $categories ); |
| 1292 | - $icon = isset( $icons[ $category ] ) ? $icons[ $category ] : $icon; |
|
| 1292 | + $icon = isset( $icons[$category] ) ? $icons[$category] : $icon; |
|
| 1293 | 1293 | } elseif ( ! empty( $categories ) ) { |
| 1294 | 1294 | foreach ( $icons as $cat => $icon ) { |
| 1295 | 1295 | if ( ! in_array( $cat, $categories ) ) { |
| 1296 | - unset( $icons[ $cat ] ); |
|
| 1296 | + unset( $icons[$cat] ); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | } |
| 1299 | 1299 | $icon = reset( $icons ); |
@@ -1422,7 +1422,7 @@ discard block |
||
| 1422 | 1422 | |
| 1423 | 1423 | foreach ( $item['categories'] as $k => $category ) { |
| 1424 | 1424 | if ( in_array( $category, $plans, true ) ) { |
| 1425 | - unset( $item['categories'][ $k ] ); |
|
| 1425 | + unset( $item['categories'][$k] ); |
|
| 1426 | 1426 | |
| 1427 | 1427 | if ( in_array( $category, array( 'Creator', 'Personal' ), true ) ) { |
| 1428 | 1428 | // Show the current package name. |
@@ -1650,9 +1650,9 @@ discard block |
||
| 1650 | 1650 | } |
| 1651 | 1651 | |
| 1652 | 1652 | foreach ( $shortcodes[0] as $key => $shortcode ) { |
| 1653 | - $options = trim( $shortcodes[3][ $key ] ); |
|
| 1653 | + $options = trim( $shortcodes[3][$key] ); |
|
| 1654 | 1654 | |
| 1655 | - if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) { |
|
| 1655 | + if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) { |
|
| 1656 | 1656 | // Skip if shortcodes. |
| 1657 | 1657 | continue; |
| 1658 | 1658 | } |
@@ -1662,7 +1662,7 @@ discard block |
||
| 1662 | 1662 | continue; |
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | - $new_shortcode = '[' . $shortcodes[2][ $key ]; |
|
| 1665 | + $new_shortcode = '[' . $shortcodes[2][$key]; |
|
| 1666 | 1666 | if ( $options ) { |
| 1667 | 1667 | $new_shortcode .= ' ' . $options; |
| 1668 | 1668 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $sub_field_class = "frm_form_field form-field frm_form_subfield-{$name} {$sub_field['wrapper_classes']}"; |
| 42 | 42 | $sub_field_desc = FrmField::get_option( $field, $name . '_desc' ); |
| 43 | 43 | |
| 44 | - if ( isset( $errors[ 'field' . $field_id . '-' . $name ] ) ) { |
|
| 44 | + if ( isset( $errors['field' . $field_id . '-' . $name] ) ) { |
|
| 45 | 45 | $sub_field_class .= ' frm_blank_field'; |
| 46 | 46 | } |
| 47 | 47 | ?> |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | <input |
| 62 | 62 | type="<?php echo esc_attr( $sub_field['type'] ); ?>" |
| 63 | 63 | id="<?php echo esc_attr( $html_id . '_' . $name ); ?>" |
| 64 | - value="<?php echo esc_attr( isset( $field_value[ $name ] ) ? $field_value[ $name ] : '' ); ?>" |
|
| 64 | + value="<?php echo esc_attr( isset( $field_value[$name] ) ? $field_value[$name] : '' ); ?>" |
|
| 65 | 65 | <?php |
| 66 | 66 | if ( empty( $args['remove_names'] ) ) { |
| 67 | 67 | echo 'name="' . esc_attr( $field_name ) . '[' . esc_attr( $name ) . ']" '; |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Don't show individual field errors when there is a combo field error. |
| 81 | - if ( ! empty( $errors ) && isset( $errors[ 'field' . $field_id . '-' . $name ] ) && ! isset( $errors[ 'field' . $field_id ] ) ) { |
|
| 81 | + if ( ! empty( $errors ) && isset( $errors['field' . $field_id . '-' . $name] ) && ! isset( $errors['field' . $field_id] ) ) { |
|
| 82 | 82 | ?> |
| 83 | - <div class="frm_error" role="alert"><?php echo esc_html( $errors[ 'field' . $field_id . '-' . $name ] ); ?></div> |
|
| 83 | + <div class="frm_error" role="alert"><?php echo esc_html( $errors['field' . $field_id . '-' . $name] ); ?></div> |
|
| 84 | 84 | <?php } ?> |
| 85 | 85 | </div> |
| 86 | 86 | <?php } ?> |
@@ -5,15 +5,15 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | class FrmFormAction { |
| 7 | 7 | |
| 8 | - public $id_base; // Root id for all actions of this type. |
|
| 9 | - public $name; // Name for this action type. |
|
| 8 | + public $id_base; // Root id for all actions of this type. |
|
| 9 | + public $name; // Name for this action type. |
|
| 10 | 10 | public $option_name; |
| 11 | - public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
| 11 | + public $action_options; // Option array passed to wp_register_sidebar_widget() |
|
| 12 | 12 | public $control_options; // Option array passed to wp_register_widget_control() |
| 13 | 13 | |
| 14 | - public $form_id; // The ID of the form to evaluate |
|
| 15 | - public $number = false; // Unique ID number of the current instance. |
|
| 16 | - public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
| 14 | + public $form_id; // The ID of the form to evaluate |
|
| 15 | + public $number = false; // Unique ID number of the current instance. |
|
| 16 | + public $id = ''; // Unique ID string of the current instance (id_base-number) |
|
| 17 | 17 | public $updated = false; // Set true when we update the data after a POST submit - makes sure we don't do it twice. |
| 18 | 18 | |
| 19 | 19 | // Member functions that you must over-ride. |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | $groups = FrmFormActionsController::form_action_groups(); |
| 152 | 152 | $group = 'misc'; |
| 153 | 153 | |
| 154 | - if ( isset( $action_options['group'] ) && isset( $groups[ $action_options['group'] ] ) ) { |
|
| 154 | + if ( isset( $action_options['group'] ) && isset( $groups[$action_options['group']] ) ) { |
|
| 155 | 155 | $group = $action_options['group']; |
| 156 | - } elseif ( isset( $groups[ $this->id_base ] ) ) { |
|
| 156 | + } elseif ( isset( $groups[$this->id_base] ) ) { |
|
| 157 | 157 | $group = $this->id_base; |
| 158 | 158 | } else { |
| 159 | 159 | foreach ( $groups as $name => $check_group ) { |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - $groups[ $group ]['id'] = $group; |
|
| 168 | - return $groups[ $group ]; |
|
| 167 | + $groups[$group]['id'] = $group; |
|
| 168 | + return $groups[$group]; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * @return integer $post_id |
| 268 | 268 | */ |
| 269 | 269 | public function maybe_create_action( $action, $forms ) { |
| 270 | - if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[ $action['menu_order'] ] ) && $forms[ $action['menu_order'] ] == 'updated' ) { |
|
| 270 | + if ( isset( $action['ID'] ) && is_numeric( $action['ID'] ) && isset( $forms[$action['menu_order']] ) && $forms[$action['menu_order']] == 'updated' ) { |
|
| 271 | 271 | // Update action only |
| 272 | 272 | $action['post_content'] = FrmAppHelper::maybe_json_decode( $action['post_content'] ); |
| 273 | 273 | $post_id = $this->save_settings( $action ); |
@@ -287,18 +287,18 @@ discard block |
||
| 287 | 287 | $switch = $this->get_global_switch_fields(); |
| 288 | 288 | |
| 289 | 289 | foreach ( (array) $action->post_content as $key => $val ) { |
| 290 | - if ( is_numeric( $val ) && isset( $frm_duplicate_ids[ $val ] ) ) { |
|
| 291 | - $action->post_content[ $key ] = $frm_duplicate_ids[ $val ]; |
|
| 290 | + if ( is_numeric( $val ) && isset( $frm_duplicate_ids[$val] ) ) { |
|
| 291 | + $action->post_content[$key] = $frm_duplicate_ids[$val]; |
|
| 292 | 292 | } elseif ( ! is_array( $val ) ) { |
| 293 | - $action->post_content[ $key ] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 294 | - } elseif ( isset( $switch[ $key ] ) && is_array( $switch[ $key ] ) ) { |
|
| 293 | + $action->post_content[$key] = FrmFieldsHelper::switch_field_ids( $val ); |
|
| 294 | + } elseif ( isset( $switch[$key] ) && is_array( $switch[$key] ) ) { |
|
| 295 | 295 | // loop through each value if empty |
| 296 | - if ( empty( $switch[ $key ] ) ) { |
|
| 297 | - $switch[ $key ] = array_keys( $val ); |
|
| 296 | + if ( empty( $switch[$key] ) ) { |
|
| 297 | + $switch[$key] = array_keys( $val ); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - foreach ( $switch[ $key ] as $subkey ) { |
|
| 301 | - $action->post_content[ $key ] = $this->duplicate_array_walk( $action->post_content[ $key ], $subkey, $val ); |
|
| 300 | + foreach ( $switch[$key] as $subkey ) { |
|
| 301 | + $action->post_content[$key] = $this->duplicate_array_walk( $action->post_content[$key], $subkey, $val ); |
|
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | 304 | |
@@ -316,20 +316,20 @@ discard block |
||
| 316 | 316 | foreach ( $subkey as $subkey2 ) { |
| 317 | 317 | foreach ( (array) $val as $ck => $cv ) { |
| 318 | 318 | if ( is_array( $cv ) ) { |
| 319 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey2, $cv ); |
|
| 320 | - } elseif ( isset( $cv[ $subkey ] ) && is_numeric( $cv[ $subkey ] ) && isset( $frm_duplicate_ids[ $cv[ $subkey ] ] ) ) { |
|
| 321 | - $action[ $ck ][ $subkey ] = $frm_duplicate_ids[ $cv[ $subkey ] ]; |
|
| 319 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey2, $cv ); |
|
| 320 | + } elseif ( isset( $cv[$subkey] ) && is_numeric( $cv[$subkey] ) && isset( $frm_duplicate_ids[$cv[$subkey]] ) ) { |
|
| 321 | + $action[$ck][$subkey] = $frm_duplicate_ids[$cv[$subkey]]; |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } else { |
| 326 | 326 | foreach ( (array) $val as $ck => $cv ) { |
| 327 | 327 | if ( is_array( $cv ) ) { |
| 328 | - $action[ $ck ] = $this->duplicate_array_walk( $action[ $ck ], $subkey, $cv ); |
|
| 329 | - } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[ $cv ] ) ) { |
|
| 330 | - $action[ $ck ] = $frm_duplicate_ids[ $cv ]; |
|
| 328 | + $action[$ck] = $this->duplicate_array_walk( $action[$ck], $subkey, $cv ); |
|
| 329 | + } elseif ( $ck == $subkey && isset( $frm_duplicate_ids[$cv] ) ) { |
|
| 330 | + $action[$ck] = $frm_duplicate_ids[$cv]; |
|
| 331 | 331 | } elseif ( $ck == $subkey ) { |
| 332 | - $action[ $ck ] = $this->maybe_switch_field_ids( $action[ $ck ] ); |
|
| 332 | + $action[$ck] = $this->maybe_switch_field_ids( $action[$ck] ); |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | } |
@@ -353,10 +353,10 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 356 | - if ( isset( $_POST[ $this->option_name ] ) && is_array( $_POST[ $this->option_name ] ) ) { |
|
| 356 | + if ( isset( $_POST[$this->option_name] ) && is_array( $_POST[$this->option_name] ) ) { |
|
| 357 | 357 | // Sanitizing removes scripts and <email> type of values. |
| 358 | 358 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
| 359 | - $settings = wp_unslash( $_POST[ $this->option_name ] ); |
|
| 359 | + $settings = wp_unslash( $_POST[$this->option_name] ); |
|
| 360 | 360 | } else { |
| 361 | 361 | return; |
| 362 | 362 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | foreach ( $settings as $number => $new_instance ) { |
| 367 | 367 | $this->_set( $number ); |
| 368 | 368 | |
| 369 | - $old_instance = isset( $all_instances[ $number ] ) ? $all_instances[ $number ] : array(); |
|
| 369 | + $old_instance = isset( $all_instances[$number] ) ? $all_instances[$number] : array(); |
|
| 370 | 370 | |
| 371 | 371 | if ( ! isset( $new_instance['post_status'] ) ) { |
| 372 | 372 | $new_instance['post_status'] = 'draft'; |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $instance['post_content'] = apply_filters( 'frm_before_save_' . $this->id_base . '_action', $instance['post_content'], $instance, $new_instance, $old_instance, $this ); |
| 407 | 407 | |
| 408 | 408 | if ( false !== $instance ) { |
| 409 | - $all_instances[ $number ] = $instance; |
|
| 409 | + $all_instances[$number] = $instance; |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | $action_ids[] = $this->save_settings( $instance ); |
@@ -482,12 +482,12 @@ discard block |
||
| 482 | 482 | // some plugins/themes are formatting the post_excerpt |
| 483 | 483 | $action->post_excerpt = sanitize_title( $action->post_excerpt ); |
| 484 | 484 | |
| 485 | - if ( ! isset( $action_controls[ $action->post_excerpt ] ) ) { |
|
| 485 | + if ( ! isset( $action_controls[$action->post_excerpt] ) ) { |
|
| 486 | 486 | continue; |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - $action = $action_controls[ $action->post_excerpt ]->prepare_action( $action ); |
|
| 490 | - $settings[ $action->ID ] = $action; |
|
| 489 | + $action = $action_controls[$action->post_excerpt]->prepare_action( $action ); |
|
| 490 | + $settings[$action->ID] = $action; |
|
| 491 | 491 | |
| 492 | 492 | if ( count( $settings ) >= $limit ) { |
| 493 | 493 | break; |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | 'limit' => 99, |
| 518 | 518 | 'post_status' => $default_status, |
| 519 | 519 | ); |
| 520 | - $args = wp_parse_args( $args, $defaults ); |
|
| 520 | + $args = wp_parse_args( $args, $defaults ); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | /** |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | $action = $this->prepare_action( $action ); |
| 580 | 580 | |
| 581 | - $settings[ $action->ID ] = $action; |
|
| 581 | + $settings[$action->ID] = $action; |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | if ( 1 === $limit ) { |
@@ -615,10 +615,10 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | foreach ( $default_values as $k => $vals ) { |
| 617 | 617 | if ( is_array( $vals ) && ! empty( $vals ) ) { |
| 618 | - if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[ $k ] ) ) { |
|
| 618 | + if ( 'event' == $k && ! $this->action_options['force_event'] && ! empty( $action->post_content[$k] ) ) { |
|
| 619 | 619 | continue; |
| 620 | 620 | } |
| 621 | - $action->post_content[ $k ] = wp_parse_args( $action->post_content[ $k ], $vals ); |
|
| 621 | + $action->post_content[$k] = wp_parse_args( $action->post_content[$k], $vals ); |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
@@ -693,14 +693,14 @@ discard block |
||
| 693 | 693 | * Migrate settings from form->options into new action. |
| 694 | 694 | */ |
| 695 | 695 | public function migrate_to_2( $form, $update = 'update' ) { |
| 696 | - $action = $this->prepare_new( $form->id ); |
|
| 696 | + $action = $this->prepare_new( $form->id ); |
|
| 697 | 697 | FrmAppHelper::unserialize_or_decode( $form->options ); |
| 698 | 698 | |
| 699 | 699 | // fill with existing options |
| 700 | 700 | foreach ( $action->post_content as $name => $val ) { |
| 701 | - if ( isset( $form->options[ $name ] ) ) { |
|
| 702 | - $action->post_content[ $name ] = $form->options[ $name ]; |
|
| 703 | - unset( $form->options[ $name ] ); |
|
| 701 | + if ( isset( $form->options[$name] ) ) { |
|
| 702 | + $action->post_content[$name] = $form->options[$name]; |
|
| 703 | + unset( $form->options[$name] ); |
|
| 704 | 704 | } |
| 705 | 705 | } |
| 706 | 706 | |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | $stop = $stop ? false : true; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - $met[ $stop ] = $stop; |
|
| 769 | + $met[$stop] = $stop; |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | if ( $notification['conditions']['any_all'] == 'all' && ! empty( $met ) && isset( $met[0] ) && isset( $met[1] ) ) { |
@@ -817,8 +817,8 @@ discard block |
||
| 817 | 817 | private static function get_value_from_entry( $entry, $field_id ) { |
| 818 | 818 | $observed_value = ''; |
| 819 | 819 | |
| 820 | - if ( isset( $entry->metas[ $field_id ] ) ) { |
|
| 821 | - $observed_value = $entry->metas[ $field_id ]; |
|
| 820 | + if ( isset( $entry->metas[$field_id] ) ) { |
|
| 821 | + $observed_value = $entry->metas[$field_id]; |
|
| 822 | 822 | } elseif ( $entry->post_id && FrmAppHelper::pro_is_installed() ) { |
| 823 | 823 | $field = FrmField::getOne( $field_id ); |
| 824 | 824 | $observed_value = FrmProEntryMetaHelper::get_post_or_meta_value( |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | </li><?php |
| 17 | 17 | $render_icon = true; |
| 18 | 18 | foreach ( array( 20872734, 20874748, 20882522, 20874739, 20908981, 28109851 ) as $template ) { |
| 19 | - if ( isset( $templates[ $template ] ) ) { |
|
| 20 | - $template = $templates[ $template ]; |
|
| 19 | + if ( isset( $templates[$template] ) ) { |
|
| 20 | + $template = $templates[$template]; |
|
| 21 | 21 | require $view_path . 'list-template.php'; |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | <ul class="frm-templates-list frm-categories-list"> |
| 46 | 46 | <?php foreach ( $categories as $category ) { ?> |
| 47 | 47 | <?php |
| 48 | - $category_templates = $templates_by_category[ $category ]; |
|
| 48 | + $category_templates = $templates_by_category[$category]; |
|
| 49 | 49 | $count = count( $category_templates ); |
| 50 | 50 | $available = FrmFormsHelper::available_count( $category_templates, $args ); |
| 51 | 51 | ?> |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | return $errors; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
| 17 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
| 18 | 18 | $frm_settings = FrmAppHelper::get_settings(); |
| 19 | 19 | $errors['form'] = $frm_settings->admin_permission; |
| 20 | 20 | } |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | 'key_pointer' => '', // the pointer in the posted array |
| 89 | 89 | 'exclude' => array(), // exclude these field types from validation |
| 90 | 90 | ); |
| 91 | - $args = wp_parse_args( $args, $defaults ); |
|
| 91 | + $args = wp_parse_args( $args, $defaults ); |
|
| 92 | 92 | |
| 93 | 93 | if ( empty( $args['parent_field_id'] ) ) { |
| 94 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
| 94 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
| 95 | 95 | } else { |
| 96 | 96 | // value is from a nested form |
| 97 | 97 | $value = $values; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 115 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 115 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 116 | 116 | } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 117 | 117 | self::maybe_add_item_name( $value, $posted_field ); |
| 118 | 118 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $pattern = self::phone_format( $field ); |
| 189 | 189 | |
| 190 | 190 | if ( ! preg_match( $pattern, $value ) ) { |
| 191 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 191 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 192 | 192 | } |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | */ |
| 299 | 299 | private static function form_is_in_progress( $values ) { |
| 300 | 300 | return FrmAppHelper::pro_is_installed() && |
| 301 | - ( isset( $values[ 'frm_page_order_' . $values['form_id'] ] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 301 | + ( isset( $values['frm_page_order_' . $values['form_id']] ) || FrmAppHelper::get_post_param( 'frm_next_page' ) ) && |
|
| 302 | 302 | FrmField::get_all_types_in_form( $values['form_id'], 'break' ); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | foreach ( $datas['missing_keys'] as $key_index => $key ) { |
| 544 | 544 | $found = self::is_akismet_guest_info_value( $key, $value, $field_id, $datas['name_field_ids'] ); |
| 545 | 545 | if ( $found ) { |
| 546 | - $datas[ $key ] = $value; |
|
| 546 | + $datas[$key] = $value; |
|
| 547 | 547 | $datas['frm_duplicated'][] = $field_id; |
| 548 | - unset( $datas['missing_keys'][ $key_index ] ); |
|
| 548 | + unset( $datas['missing_keys'][$key_index] ); |
|
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 593 | 593 | if ( $include_value ) { |
| 594 | - $datas[ $key ] = $value; |
|
| 594 | + $datas[$key] = $value; |
|
| 595 | 595 | } |
| 596 | 596 | unset( $key, $value ); |
| 597 | 597 | } |
@@ -608,10 +608,10 @@ discard block |
||
| 608 | 608 | private static function add_comment_content_to_akismet( &$datas, $values ) { |
| 609 | 609 | if ( isset( $datas['frm_duplicated'] ) ) { |
| 610 | 610 | foreach ( $datas['frm_duplicated'] as $index ) { |
| 611 | - if ( isset( $values['item_meta'][ $index ] ) ) { |
|
| 612 | - unset( $values['item_meta'][ $index ] ); |
|
| 611 | + if ( isset( $values['item_meta'][$index] ) ) { |
|
| 612 | + unset( $values['item_meta'][$index] ); |
|
| 613 | 613 | } else { |
| 614 | - unset( $values[ $index ] ); |
|
| 614 | + unset( $values[$index] ); |
|
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | unset( $datas['frm_duplicated'] ); |
@@ -632,14 +632,14 @@ discard block |
||
| 632 | 632 | private static function skip_adding_values_to_akismet( &$values ) { |
| 633 | 633 | $skipped_fields = self::get_akismet_skipped_field_ids( $values ); |
| 634 | 634 | foreach ( $skipped_fields as $skipped_field ) { |
| 635 | - if ( ! isset( $values['item_meta'][ $skipped_field->id ] ) ) { |
|
| 635 | + if ( ! isset( $values['item_meta'][$skipped_field->id] ) ) { |
|
| 636 | 636 | continue; |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | if ( self::should_really_skip_field( $skipped_field, $values ) ) { |
| 640 | - unset( $values['item_meta'][ $skipped_field->id ] ); |
|
| 641 | - if ( isset( $values['item_meta']['other'][ $skipped_field->id ] ) ) { |
|
| 642 | - unset( $values['item_meta']['other'][ $skipped_field->id ] ); |
|
| 640 | + unset( $values['item_meta'][$skipped_field->id] ); |
|
| 641 | + if ( isset( $values['item_meta']['other'][$skipped_field->id] ) ) { |
|
| 642 | + unset( $values['item_meta']['other'][$skipped_field->id] ); |
|
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | 645 | } |
@@ -672,14 +672,14 @@ discard block |
||
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | // If a choice field has Other option, but Other is not selected. |
| 675 | - if ( empty( $values['item_meta']['other'][ $field_data->id ] ) ) { |
|
| 675 | + if ( empty( $values['item_meta']['other'][$field_data->id] ) ) { |
|
| 676 | 676 | return true; |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | // Check if submitted value is same as one of field option. |
| 680 | 680 | foreach ( $field_data->options as $option ) { |
| 681 | 681 | $option_value = ! is_array( $option ) ? $option : ( isset( $option['value'] ) ? $option['value'] : '' ); |
| 682 | - if ( $values['item_meta']['other'][ $field_data->id ] === $option_value ) { |
|
| 682 | + if ( $values['item_meta']['other'][$field_data->id] === $option_value ) { |
|
| 683 | 683 | return true; |
| 684 | 684 | } |
| 685 | 685 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | // Convert name array to string. |
| 751 | 751 | if ( isset( $value['first'] ) && isset( $value['last'] ) ) { |
| 752 | - $values['item_meta'][ $field_id ] = trim( implode( ' ', $value ) ); |
|
| 752 | + $values['item_meta'][$field_id] = trim( implode( ' ', $value ) ); |
|
| 753 | 753 | $values['name_field_ids'][] = $field_id; |
| 754 | 754 | continue; |
| 755 | 755 | } |
@@ -770,8 +770,8 @@ discard block |
||
| 770 | 770 | continue; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | - if ( ! isset( $values['item_meta'][ $subsubindex ] ) ) { |
|
| 774 | - $values['item_meta'][ $subsubindex ] = array(); |
|
| 773 | + if ( ! isset( $values['item_meta'][$subsubindex] ) ) { |
|
| 774 | + $values['item_meta'][$subsubindex] = array(); |
|
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | // Convert name array to string. |
@@ -781,11 +781,11 @@ discard block |
||
| 781 | 781 | $values['name_field_ids'][] = $subsubindex; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | - $values['item_meta'][ $subsubindex ][] = $subsubvalue; |
|
| 784 | + $values['item_meta'][$subsubindex][] = $subsubvalue; |
|
| 785 | 785 | } |
| 786 | 786 | } |
| 787 | 787 | |
| 788 | - unset( $values['item_meta'][ $field_id ] ); |
|
| 788 | + unset( $values['item_meta'][$field_id] ); |
|
| 789 | 789 | } |
| 790 | 790 | |
| 791 | 791 | return $form_ids; |
@@ -113,7 +113,8 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 115 | 115 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
| 116 | - } elseif ( ! isset( $_POST['item_name'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 116 | + } elseif ( ! isset( $_POST['item_name'] ) ) { |
|
| 117 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 117 | 118 | self::maybe_add_item_name( $value, $posted_field ); |
| 118 | 119 | } |
| 119 | 120 | |
@@ -655,12 +656,14 @@ discard block |
||
| 655 | 656 | * @return bool |
| 656 | 657 | */ |
| 657 | 658 | private static function should_really_skip_field( $field_data, $values ) { |
| 658 | - if ( empty( $field_data->options ) ) { // This is skipped field types. |
|
| 659 | + if ( empty( $field_data->options ) ) { |
|
| 660 | +// This is skipped field types. |
|
| 659 | 661 | return true; |
| 660 | 662 | } |
| 661 | 663 | |
| 662 | 664 | FrmAppHelper::unserialize_or_decode( $field_data->options ); |
| 663 | - if ( ! $field_data->options ) { // Check if an error happens when unserializing, or empty options. |
|
| 665 | + if ( ! $field_data->options ) { |
|
| 666 | +// Check if an error happens when unserializing, or empty options. |
|
| 664 | 667 | return true; |
| 665 | 668 | } |
| 666 | 669 | |
@@ -743,7 +746,8 @@ discard block |
||
| 743 | 746 | // Blacklist check for File field in the old version doesn't contain `form_id`. |
| 744 | 747 | $form_ids = isset( $values['form_id'] ) ? array( absint( $values['form_id'] ) ) : array(); |
| 745 | 748 | foreach ( $values['item_meta'] as $field_id => $value ) { |
| 746 | - if ( ! is_numeric( $field_id ) ) { // Maybe `other`. |
|
| 749 | + if ( ! is_numeric( $field_id ) ) { |
|
| 750 | +// Maybe `other`. |
|
| 747 | 751 | continue; |
| 748 | 752 | } |
| 749 | 753 | |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * @param array $atts |
| 46 | 46 | */ |
| 47 | 47 | private function _set( $param, $atts ) { |
| 48 | - if ( isset( $atts[ $param ] ) ) { |
|
| 49 | - $this->{$param} = $atts[ $param ]; |
|
| 48 | + if ( isset( $atts[$param] ) ) { |
|
| 49 | + $this->{$param} = $atts[$param]; |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $exclude = array( 'field_obj', 'html' ); |
| 92 | 92 | foreach ( $exclude as $ex ) { |
| 93 | - if ( isset( $atts[ $ex ] ) ) { |
|
| 94 | - unset( $this->pass_args[ $ex ] ); |
|
| 93 | + if ( isset( $atts[$ex] ) ) { |
|
| 94 | + unset( $this->pass_args[$ex] ); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | * @param array $set |
| 104 | 104 | */ |
| 105 | 105 | private function set_from_field( $atts, $set ) { |
| 106 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
| 107 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
| 106 | + if ( isset( $atts[$set['param']] ) ) { |
|
| 107 | + $this->{$set['param']} = $atts[$set['param']]; |
|
| 108 | 108 | } else { |
| 109 | 109 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
| 110 | 110 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | private function replace_error_shortcode() { |
| 231 | 231 | $this->maybe_add_error_id(); |
| 232 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
| 232 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
| 233 | 233 | |
| 234 | 234 | if ( ! empty( $error ) && false === strpos( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) { |
| 235 | 235 | $error_body = self::get_error_body( $this->html ); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @since 3.06.02 |
| 271 | 271 | */ |
| 272 | 272 | private function maybe_add_error_id() { |
| 273 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 273 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 274 | 274 | return; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
| 351 | 351 | |
| 352 | 352 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 353 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 353 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 354 | 354 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 355 | 355 | |
| 356 | 356 | $replace_with = ''; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
| 364 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | unset( $shortcode_atts['class'] ); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? 'true' : 'false'; |
|
| 396 | + $shortcode_atts['aria-invalid'] = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? 'true' : 'false'; |
|
| 397 | 397 | |
| 398 | 398 | $this->field_obj->set_field_column( 'shortcodes', $shortcode_atts ); |
| 399 | 399 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | private function get_field_div_classes() { |
| 450 | 450 | // Add error class |
| 451 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
| 451 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
| 452 | 452 | |
| 453 | 453 | // Add label position class |
| 454 | 454 | $settings = $this->field_obj->display_field_settings(); |
@@ -87,7 +87,8 @@ |
||
| 87 | 87 | |
| 88 | 88 | if ( ! isset( $imported['form_status'] ) || empty( $imported['form_status'] ) ) { |
| 89 | 89 | // Check for an error message in the XML. |
| 90 | - if ( isset( $xml->Code ) && isset( $xml->Message ) ) { // phpcs:ignore WordPress.NamingConventions |
|
| 90 | + if ( isset( $xml->Code ) && isset( $xml->Message ) ) { |
|
| 91 | +// phpcs:ignore WordPress.NamingConventions |
|
| 91 | 92 | $imported['error'] = (string) $xml->Message; // phpcs:ignore WordPress.NamingConventions |
| 92 | 93 | } |
| 93 | 94 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | if ( $term && is_array( $term ) ) { |
| 142 | 142 | $imported['imported']['terms'] ++; |
| 143 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
| 143 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | unset( $term, $t ); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // Keep track of whether this specific form was updated or not. |
| 199 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
| 199 | + $imported['form_status'][$form_id] = 'imported'; |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | // Update field ids/keys to new ones. |
| 212 | 212 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
| 213 | 213 | |
| 214 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
| 214 | + $imported['forms'][(int) $item->id] = $form_id; |
|
| 215 | 215 | |
| 216 | 216 | // Send pre 2.0 form options through function that creates actions. |
| 217 | 217 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -279,15 +279,15 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Keep track of whether this specific form was updated or not |
| 282 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
| 282 | + $imported['form_status'][$form_id] = 'updated'; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | private static function get_form_fields( $form_id ) { |
| 286 | 286 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
| 287 | 287 | $old_fields = array(); |
| 288 | 288 | foreach ( $form_fields as $f ) { |
| 289 | - $old_fields[ $f->id ] = $f; |
|
| 290 | - $old_fields[ $f->field_key ] = $f->id; |
|
| 289 | + $old_fields[$f->id] = $f; |
|
| 290 | + $old_fields[$f->field_key] = $f->id; |
|
| 291 | 291 | unset( $f ); |
| 292 | 292 | } |
| 293 | 293 | $form_fields = $old_fields; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
| 346 | 346 | if ( $parent_form_id ) { |
| 347 | - $child_forms[ $form_id ] = $parent_form_id; |
|
| 347 | + $child_forms[$form_id] = $parent_form_id; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
| 361 | 361 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
| 362 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
| 362 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
| 363 | 363 | // Update all children with this old parent_form_id |
| 364 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
| 364 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
| 365 | 365 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
| 366 | 366 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
| 367 | 367 | } |
@@ -391,27 +391,27 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | if ( ! empty( $this_form ) ) { |
| 393 | 393 | // check for field to edit by field id |
| 394 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
| 394 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
| 395 | 395 | FrmField::update( $f['id'], $f ); |
| 396 | 396 | $imported['updated']['fields'] ++; |
| 397 | 397 | |
| 398 | - unset( $form_fields[ $f['id'] ] ); |
|
| 398 | + unset( $form_fields[$f['id']] ); |
|
| 399 | 399 | |
| 400 | 400 | //unset old field key |
| 401 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 402 | - unset( $form_fields[ $f['field_key'] ] ); |
|
| 401 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 402 | + unset( $form_fields[$f['field_key']] ); |
|
| 403 | 403 | } |
| 404 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
| 405 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
| 404 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
| 405 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
| 406 | 406 | |
| 407 | 407 | // check for field to edit by field key |
| 408 | 408 | unset( $f['id'] ); |
| 409 | 409 | |
| 410 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
| 410 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
| 411 | 411 | $imported['updated']['fields'] ++; |
| 412 | 412 | |
| 413 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); //unset old field id |
|
| 414 | - unset( $form_fields[ $f['field_key'] ] ); //unset old field key |
|
| 413 | + unset( $form_fields[$form_fields[$f['field_key']]] ); //unset old field id |
|
| 414 | + unset( $form_fields[$f['field_key']] ); //unset old field key |
|
| 415 | 415 | } else { |
| 416 | 416 | // if no matching field id or key in this form, create the field |
| 417 | 417 | self::create_imported_field( $f, $imported ); |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | if ( $f['type'] == 'form' || ( $f['type'] == 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
| 521 | 521 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
| 522 | 522 | $form_select = (int) $f['field_options']['form_select']; |
| 523 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
| 524 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
| 523 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
| 524 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | } |
@@ -542,8 +542,8 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
| 544 | 544 | $old_form = $f['field_options']['get_values_form']; |
| 545 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
| 546 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
| 545 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
| 546 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | 549 | } |
@@ -564,12 +564,12 @@ discard block |
||
| 564 | 564 | private static function migrate_placeholders( &$f ) { |
| 565 | 565 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
| 566 | 566 | foreach ( $update_values as $k => $v ) { |
| 567 | - $f[ $k ] = $v; |
|
| 567 | + $f[$k] = $v; |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
| 571 | 571 | foreach ( $update_values as $k => $v ) { |
| 572 | - $f[ $k ] = $v; |
|
| 572 | + $f[$k] = $v; |
|
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | public static function migrate_field_placeholder( $field, $type ) { |
| 584 | 584 | $field = (array) $field; |
| 585 | 585 | $field_options = $field['field_options']; |
| 586 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
| 586 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
| 587 | 587 | return array(); |
| 588 | 588 | } |
| 589 | 589 | |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | if ( $opt == $default_value ) { |
| 612 | - unset( $options[ $opt_key ] ); |
|
| 612 | + unset( $options[$opt_key] ); |
|
| 613 | 613 | break; |
| 614 | 614 | } |
| 615 | 615 | } |
@@ -664,10 +664,10 @@ discard block |
||
| 664 | 664 | $field_object->type = 'file'; // Fake the file type as FrmProImport::import_attachment checks for file type. |
| 665 | 665 | |
| 666 | 666 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
| 667 | - unset( $field['options'][ $key ]['src'] ); // Remove the src from options as it isn't required after import. |
|
| 667 | + unset( $field['options'][$key]['src'] ); // Remove the src from options as it isn't required after import. |
|
| 668 | 668 | |
| 669 | 669 | if ( is_numeric( $image_id ) ) { |
| 670 | - $field['options'][ $key ]['image'] = $image_id; |
|
| 670 | + $field['options'][$key]['image'] = $image_id; |
|
| 671 | 671 | } |
| 672 | 672 | } |
| 673 | 673 | |
@@ -837,8 +837,8 @@ discard block |
||
| 837 | 837 | } else { |
| 838 | 838 | if ( $post['post_type'] === 'frm_display' ) { |
| 839 | 839 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
| 840 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
| 841 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
| 840 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
| 841 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
| 842 | 842 | } |
| 843 | 843 | // Create/update post now |
| 844 | 844 | $post_id = wp_insert_post( $post ); |
@@ -849,27 +849,27 @@ discard block |
||
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
| 852 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
| 852 | + $posts_with_shortcodes[$post_id] = $post; |
|
| 853 | 853 | } |
| 854 | 854 | |
| 855 | 855 | self::update_postmeta( $post, $post_id ); |
| 856 | 856 | self::update_layout( $post, $post_id ); |
| 857 | 857 | |
| 858 | 858 | $this_type = 'posts'; |
| 859 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
| 860 | - $this_type = $post_types[ $post['post_type'] ]; |
|
| 859 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
| 860 | + $this_type = $post_types[$post['post_type']]; |
|
| 861 | 861 | } |
| 862 | 862 | |
| 863 | 863 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
| 864 | - $imported['updated'][ $this_type ] ++; |
|
| 864 | + $imported['updated'][$this_type] ++; |
|
| 865 | 865 | } else { |
| 866 | - $imported['imported'][ $this_type ] ++; |
|
| 866 | + $imported['imported'][$this_type] ++; |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | - $imported['posts'][ (int) $old_id ] = $post_id; |
|
| 869 | + $imported['posts'][(int) $old_id] = $post_id; |
|
| 870 | 870 | |
| 871 | 871 | if ( $post['post_type'] === 'frm_display' ) { |
| 872 | - $view_ids[ (int) $old_id ] = $post_id; |
|
| 872 | + $view_ids[(int) $old_id] = $post_id; |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -996,9 +996,9 @@ discard block |
||
| 996 | 996 | $post['attachment_url'] = (string) $item->attachment_url; |
| 997 | 997 | } |
| 998 | 998 | |
| 999 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
| 999 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
| 1000 | 1000 | // update to new form id |
| 1001 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
| 1001 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | // Don't allow default styles to take over a site's default style |
@@ -1035,8 +1035,8 @@ discard block |
||
| 1035 | 1035 | ); |
| 1036 | 1036 | |
| 1037 | 1037 | //switch old form and field ids to new ones |
| 1038 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
| 1039 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
| 1038 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
| 1039 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
| 1040 | 1040 | } else { |
| 1041 | 1041 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1042 | 1042 | |
@@ -1047,15 +1047,15 @@ discard block |
||
| 1047 | 1047 | } elseif ( 'frm_options' === $m['key'] ) { |
| 1048 | 1048 | |
| 1049 | 1049 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
| 1050 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
| 1051 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
| 1050 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
| 1051 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
| 1052 | 1052 | } |
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | $check_dup_array = array(); |
| 1056 | 1056 | if ( isset( $m['value']['order_by'] ) && ! empty( $m['value']['order_by'] ) ) { |
| 1057 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
| 1058 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
| 1057 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
| 1058 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
| 1059 | 1059 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
| 1060 | 1060 | $check_dup_array[] = 'order_by'; |
| 1061 | 1061 | } |
@@ -1066,9 +1066,9 @@ discard block |
||
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | foreach ( $check_dup_array as $check_k ) { |
| 1069 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
| 1070 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
| 1071 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
| 1069 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
| 1070 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
| 1071 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | unset( $mk, $mv ); |
| 1074 | 1074 | } |
@@ -1081,11 +1081,11 @@ discard block |
||
| 1081 | 1081 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
| 1082 | 1082 | } |
| 1083 | 1083 | |
| 1084 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
| 1084 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | private static function populate_layout( &$post, $layout ) { |
| 1088 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
| 1088 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
| 1089 | 1089 | } |
| 1090 | 1090 | |
| 1091 | 1091 | /** |
@@ -1113,11 +1113,11 @@ discard block |
||
| 1113 | 1113 | $name = (string) $c; |
| 1114 | 1114 | } |
| 1115 | 1115 | |
| 1116 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
| 1117 | - $post['tax_input'][ $taxonomy ] = array(); |
|
| 1116 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
| 1117 | + $post['tax_input'][$taxonomy] = array(); |
|
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
| 1120 | + $post['tax_input'][$taxonomy][] = $name; |
|
| 1121 | 1121 | unset( $name ); |
| 1122 | 1122 | } |
| 1123 | 1123 | } |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | |
| 1251 | 1251 | $message = '<ul>'; |
| 1252 | 1252 | foreach ( $result as $type => $results ) { |
| 1253 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
| 1253 | + if ( ! isset( $t_strings[$type] ) ) { |
|
| 1254 | 1254 | // only print imported and updated |
| 1255 | 1255 | continue; |
| 1256 | 1256 | } |
@@ -1262,7 +1262,7 @@ discard block |
||
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | if ( ! empty( $s_message ) ) { |
| 1265 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
| 1265 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
| 1266 | 1266 | $message .= implode( ', ', $s_message ); |
| 1267 | 1267 | $message .= '</li>'; |
| 1268 | 1268 | } |
@@ -1314,8 +1314,8 @@ discard block |
||
| 1314 | 1314 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
| 1315 | 1315 | ); |
| 1316 | 1316 | |
| 1317 | - if ( isset( $strings[ $type ] ) ) { |
|
| 1318 | - $s_message[] = $strings[ $type ]; |
|
| 1317 | + if ( isset( $strings[$type] ) ) { |
|
| 1318 | + $s_message[] = $strings[$type]; |
|
| 1319 | 1319 | } else { |
| 1320 | 1320 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
| 1321 | 1321 | |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | |
| 1464 | 1464 | foreach ( $options as $key => $option ) { |
| 1465 | 1465 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
| 1466 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1466 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
| 1467 | 1467 | $updated = true; |
| 1468 | 1468 | } |
| 1469 | 1469 | } |
@@ -1492,8 +1492,8 @@ discard block |
||
| 1492 | 1492 | */ |
| 1493 | 1493 | private static function remove_defaults( $defaults, &$saved ) { |
| 1494 | 1494 | foreach ( $saved as $key => $value ) { |
| 1495 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
| 1496 | - unset( $saved[ $key ] ); |
|
| 1495 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
| 1496 | + unset( $saved[$key] ); |
|
| 1497 | 1497 | } |
| 1498 | 1498 | } |
| 1499 | 1499 | } |
@@ -1504,14 +1504,14 @@ discard block |
||
| 1504 | 1504 | * @since 3.06 |
| 1505 | 1505 | */ |
| 1506 | 1506 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
| 1507 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
| 1507 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
| 1508 | 1508 | return; |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
| 1512 | - $default_html = $defaults[ $html_name ]; |
|
| 1511 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
| 1512 | + $default_html = $defaults[$html_name]; |
|
| 1513 | 1513 | if ( $old_html == $default_html ) { |
| 1514 | - unset( $options[ $html_name ] ); |
|
| 1514 | + unset( $options[$html_name] ); |
|
| 1515 | 1515 | |
| 1516 | 1516 | return; |
| 1517 | 1517 | } |
@@ -1519,7 +1519,7 @@ discard block |
||
| 1519 | 1519 | // Account for some of the older field default HTML. |
| 1520 | 1520 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
| 1521 | 1521 | if ( $old_html == $default_html ) { |
| 1522 | - unset( $options[ $html_name ] ); |
|
| 1522 | + unset( $options[$html_name] ); |
|
| 1523 | 1523 | } |
| 1524 | 1524 | } |
| 1525 | 1525 | |
@@ -1606,8 +1606,8 @@ discard block |
||
| 1606 | 1606 | ); |
| 1607 | 1607 | |
| 1608 | 1608 | foreach ( $post_settings as $post_setting ) { |
| 1609 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
| 1610 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
| 1609 | + if ( isset( $form_options[$post_setting] ) ) { |
|
| 1610 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
| 1611 | 1611 | } |
| 1612 | 1612 | unset( $post_setting ); |
| 1613 | 1613 | } |
@@ -1678,11 +1678,11 @@ discard block |
||
| 1678 | 1678 | foreach ( $post_content as $key => $setting ) { |
| 1679 | 1679 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
| 1680 | 1680 | // Replace old IDs with new IDs |
| 1681 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
| 1681 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
| 1682 | 1682 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
| 1683 | 1683 | foreach ( $setting as $k => $val ) { |
| 1684 | 1684 | // Replace old IDs with new IDs |
| 1685 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
| 1685 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
| 1686 | 1686 | } |
| 1687 | 1687 | } |
| 1688 | 1688 | unset( $key, $setting ); |
@@ -1758,8 +1758,8 @@ discard block |
||
| 1758 | 1758 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
| 1759 | 1759 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
| 1760 | 1760 | foreach ( $delete_settings as $index ) { |
| 1761 | - if ( isset( $form_options[ $index ] ) ) { |
|
| 1762 | - unset( $form_options[ $index ] ); |
|
| 1761 | + if ( isset( $form_options[$index] ) ) { |
|
| 1762 | + unset( $form_options[$index] ); |
|
| 1763 | 1763 | } |
| 1764 | 1764 | } |
| 1765 | 1765 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1812,12 +1812,12 @@ discard block |
||
| 1812 | 1812 | 'reply_to_name' => '', |
| 1813 | 1813 | ); |
| 1814 | 1814 | foreach ( $reply_fields as $f => $val ) { |
| 1815 | - if ( isset( $notification[ $f ] ) ) { |
|
| 1816 | - $atts[ $f ] = $notification[ $f ]; |
|
| 1817 | - if ( 'custom' == $notification[ $f ] ) { |
|
| 1818 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
| 1819 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
| 1820 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
| 1815 | + if ( isset( $notification[$f] ) ) { |
|
| 1816 | + $atts[$f] = $notification[$f]; |
|
| 1817 | + if ( 'custom' == $notification[$f] ) { |
|
| 1818 | + $atts[$f] = $notification['cust_' . $f]; |
|
| 1819 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
| 1820 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
| 1821 | 1821 | } |
| 1822 | 1822 | } |
| 1823 | 1823 | unset( $f, $val ); |
@@ -1848,13 +1848,13 @@ discard block |
||
| 1848 | 1848 | foreach ( $atts['email_to'] as $key => $email_field ) { |
| 1849 | 1849 | |
| 1850 | 1850 | if ( is_numeric( $email_field ) ) { |
| 1851 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
| 1851 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | 1854 | if ( strpos( $email_field, '|' ) ) { |
| 1855 | 1855 | $email_opt = explode( '|', $email_field ); |
| 1856 | 1856 | if ( isset( $email_opt[0] ) ) { |
| 1857 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1857 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
| 1858 | 1858 | } |
| 1859 | 1859 | unset( $email_opt ); |
| 1860 | 1860 | } |
@@ -1875,12 +1875,12 @@ discard block |
||
| 1875 | 1875 | // Add more fields to the new notification |
| 1876 | 1876 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
| 1877 | 1877 | foreach ( $add_fields as $add_field ) { |
| 1878 | - if ( isset( $notification[ $add_field ] ) ) { |
|
| 1879 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
| 1878 | + if ( isset( $notification[$add_field] ) ) { |
|
| 1879 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
| 1880 | 1880 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
| 1881 | - $new_notification['post_content'][ $add_field ] = 0; |
|
| 1881 | + $new_notification['post_content'][$add_field] = 0; |
|
| 1882 | 1882 | } else { |
| 1883 | - $new_notification['post_content'][ $add_field ] = ''; |
|
| 1883 | + $new_notification['post_content'][$add_field] = ''; |
|
| 1884 | 1884 | } |
| 1885 | 1885 | unset( $add_field ); |
| 1886 | 1886 | } |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
| 1905 | 1905 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
| 1906 | 1906 | if ( is_numeric( $email_key ) ) { |
| 1907 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1907 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
| 1908 | 1908 | } |
| 1909 | 1909 | unset( $email_key, $val ); |
| 1910 | 1910 | } |