@@ -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 | |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | printf( |
| 599 | 599 | /* translators: %s: Field type */ |
| 600 | 600 | esc_html__( '%s Options', 'formidable' ), |
| 601 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 601 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 602 | 602 | ); |
| 603 | 603 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); |
| 604 | 604 | ?> |
@@ -706,8 +706,8 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $fields = array_merge( $fields, $pro_fields ); |
| 708 | 708 | |
| 709 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 710 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 709 | + if ( isset( $fields[$this->type] ) ) { |
|
| 710 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | return $name; |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | * @return array |
| 725 | 725 | */ |
| 726 | 726 | public function get_default_field_options() { |
| 727 | - $opts = array( |
|
| 727 | + $opts = array( |
|
| 728 | 728 | 'size' => '', |
| 729 | 729 | 'max' => '', |
| 730 | 730 | 'label' => '', |
@@ -1145,8 +1145,8 @@ discard block |
||
| 1145 | 1145 | $selected = $values['field_value']; |
| 1146 | 1146 | |
| 1147 | 1147 | if ( isset( $values['combo_name'] ) ) { |
| 1148 | - $options = $options[ $values['combo_name'] ]; |
|
| 1149 | - $selected = ( is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 1148 | + $options = $options[$values['combo_name']]; |
|
| 1149 | + $selected = ( is_array( $selected ) && isset( $selected[$values['combo_name']] ) ) ? $selected[$values['combo_name']] : ''; |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | $input = $this->select_tag( $values ); |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | protected function fill_display_field_values( $args = array() ) { |
| 1200 | - $defaults = array( |
|
| 1200 | + $defaults = array( |
|
| 1201 | 1201 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1202 | 1202 | 'field_id' => $this->get_field_column( 'id' ), |
| 1203 | 1203 | 'field_plus_id' => '', |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | } |
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1253 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1254 | 1254 | if ( $error_comes_first ) { |
| 1255 | 1255 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1256 | 1256 | } else { |
@@ -1329,11 +1329,11 @@ discard block |
||
| 1329 | 1329 | |
| 1330 | 1330 | $field_id = $this->get_field_column( 'id' ); |
| 1331 | 1331 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1332 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1332 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1333 | 1333 | return false; |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1336 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1337 | 1337 | return $already_validated_this_value; |
| 1338 | 1338 | } |
| 1339 | 1339 | |
@@ -1358,7 +1358,7 @@ discard block |
||
| 1358 | 1358 | private function value_validated_as_unique( $value ) { |
| 1359 | 1359 | global $frm_validated_unique_values; |
| 1360 | 1360 | $field_id = $this->get_field_column( 'id' ); |
| 1361 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1361 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | public function get_value_to_save( $value, $atts ) { |
@@ -1395,8 +1395,8 @@ discard block |
||
| 1395 | 1395 | $value = $this->prepare_display_value( $value, $atts ); |
| 1396 | 1396 | |
| 1397 | 1397 | if ( is_array( $value ) ) { |
| 1398 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
| 1399 | - $value = $value[ $atts['show'] ]; |
|
| 1398 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
| 1399 | + $value = $value[$atts['show']]; |
|
| 1400 | 1400 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
| 1401 | 1401 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 1402 | 1402 | $value = implode( $sep, $value ); |
@@ -1526,8 +1526,8 @@ discard block |
||
| 1526 | 1526 | $saved_entries = $atts['ids']; |
| 1527 | 1527 | $new_value = array(); |
| 1528 | 1528 | foreach ( (array) $value as $old_child_id ) { |
| 1529 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1530 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1529 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1530 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1531 | 1531 | } |
| 1532 | 1532 | } |
| 1533 | 1533 | |
@@ -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 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 373 | 373 | |
| 374 | 374 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 375 | - $new_values[ $col ] = $values[ $col ]; |
|
| 375 | + $new_values[$col] = $values[$col]; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 384 | 384 | |
| 385 | 385 | if ( isset( $values['id'] ) ) { |
| 386 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 386 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 387 | 387 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -392,9 +392,9 @@ discard block |
||
| 392 | 392 | foreach ( $new_values as $k => $v ) { |
| 393 | 393 | if ( is_array( $v ) ) { |
| 394 | 394 | if ( $k === 'default_value' ) { |
| 395 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 395 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 396 | 396 | } else { |
| 397 | - $new_values[ $k ] = serialize( $v ); |
|
| 397 | + $new_values[$k] = serialize( $v ); |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | unset( $k, $v ); |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | if ( isset( $values['id'] ) ) { |
| 417 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 417 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | return $new_id; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 475 | 475 | global $frm_duplicate_ids; |
| 476 | 476 | |
| 477 | - $where = array( |
|
| 477 | + $where = array( |
|
| 478 | 478 | array( |
| 479 | 479 | 'or' => 1, |
| 480 | 480 | 'fi.form_id' => $old_form_id, |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 522 | 522 | $new_id = self::create( $values ); |
| 523 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 524 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 523 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 524 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 525 | 525 | unset( $field ); |
| 526 | 526 | }//end foreach |
| 527 | 527 | } |
@@ -559,11 +559,11 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | // serialize array values |
| 561 | 561 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 562 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 562 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 563 | 563 | if ( 'field_options' === $opt ) { |
| 564 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 564 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 565 | 565 | } |
| 566 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 566 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | 'id' => $id, |
| 716 | 716 | 'field_key' => $id, |
| 717 | 717 | ); |
| 718 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 718 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 719 | 719 | } |
| 720 | 720 | |
| 721 | 721 | return $type; |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | continue; |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | - $fields[ $result->id ] = $result; |
|
| 745 | - ++$count; |
|
| 744 | + $fields[$result->id] = $result; |
|
| 745 | + ++ $count; |
|
| 746 | 746 | if ( $limit == 1 ) { |
| 747 | 747 | $fields = $result; |
| 748 | 748 | break; |
@@ -786,8 +786,8 @@ discard block |
||
| 786 | 786 | $fields = array(); |
| 787 | 787 | $count = 0; |
| 788 | 788 | foreach ( $results as $result ) { |
| 789 | - ++$count; |
|
| 790 | - $fields[ $result->id ] = $result; |
|
| 789 | + ++ $count; |
|
| 790 | + $fields[$result->id] = $result; |
|
| 791 | 791 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 792 | 792 | break; |
| 793 | 793 | } |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 902 | 902 | |
| 903 | 903 | if ( is_array( $where ) ) { |
| 904 | - $args = array( |
|
| 904 | + $args = array( |
|
| 905 | 905 | 'order_by' => $order_by, |
| 906 | 906 | 'limit' => $limit, |
| 907 | 907 | ); |
@@ -932,9 +932,9 @@ discard block |
||
| 932 | 932 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 933 | 933 | |
| 934 | 934 | self::prepare_options( $result ); |
| 935 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 936 | - $results[ $r_key ]->options = $result->options; |
|
| 937 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 935 | + $results[$r_key]->field_options = $result->field_options; |
|
| 936 | + $results[$r_key]->options = $result->options; |
|
| 937 | + $results[$r_key]->default_value = $result->default_value; |
|
| 938 | 938 | |
| 939 | 939 | unset( $r_key, $result ); |
| 940 | 940 | } |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | |
| 991 | 991 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 992 | 992 | // if this transient is full, check for another |
| 993 | - ++$next; |
|
| 993 | + ++ $next; |
|
| 994 | 994 | self::get_next_transient( $fields, $base_name, $next ); |
| 995 | 995 | } |
| 996 | 996 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | return; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | - ++$next; |
|
| 1021 | + ++ $next; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | } |
| 1024 | 1024 | |
@@ -1137,19 +1137,19 @@ discard block |
||
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | public static function is_option_true_in_array( $field, $option ) { |
| 1140 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 1140 | + return isset( $field[$option] ) && $field[$option]; |
|
| 1141 | 1141 | } |
| 1142 | 1142 | |
| 1143 | 1143 | public static function is_option_true_in_object( $field, $option ) { |
| 1144 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1144 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1145 | 1145 | } |
| 1146 | 1146 | |
| 1147 | 1147 | public static function is_option_empty_in_array( $field, $option ) { |
| 1148 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 1148 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | public static function is_option_empty_in_object( $field, $option ) { |
| 1152 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 1152 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | /** |
@@ -1158,7 +1158,7 @@ discard block |
||
| 1158 | 1158 | * @return bool |
| 1159 | 1159 | */ |
| 1160 | 1160 | public static function is_option_value_in_object( $field, $option ) { |
| 1161 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1161 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | /** |
@@ -1176,10 +1176,10 @@ discard block |
||
| 1176 | 1176 | |
| 1177 | 1177 | public static function get_option_in_array( $field, $option ) { |
| 1178 | 1178 | |
| 1179 | - if ( isset( $field[ $option ] ) ) { |
|
| 1180 | - $this_option = $field[ $option ]; |
|
| 1181 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1182 | - $this_option = $field['field_options'][ $option ]; |
|
| 1179 | + if ( isset( $field[$option] ) ) { |
|
| 1180 | + $this_option = $field[$option]; |
|
| 1181 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1182 | + $this_option = $field['field_options'][$option]; |
|
| 1183 | 1183 | } else { |
| 1184 | 1184 | $this_option = ''; |
| 1185 | 1185 | } |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | } |
| 1189 | 1189 | |
| 1190 | 1190 | public static function get_option_in_object( $field, $option ) { |
| 1191 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 1191 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | 1194 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // This may occassionally skip one level/order e.g. after adding a |
| 236 | 236 | // list field, as field_order would already be prepared to be used. |
| 237 | - ++$field_order; |
|
| 237 | + ++ $field_order; |
|
| 238 | 238 | |
| 239 | 239 | if ( isset( $new_field['fields'] ) && is_array( $new_field['fields'] ) && ! empty( $new_field['fields'] ) ) { |
| 240 | 240 | // we have (inner) fields to merge |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | $order = 0; |
| 274 | 274 | foreach ( $fields as $field ) { |
| 275 | - ++$order; |
|
| 275 | + ++ $order; |
|
| 276 | 276 | $type = $this->get_field_type( $field ); |
| 277 | 277 | $new_type = $this->convert_field_type( $type, $field ); |
| 278 | 278 | if ( ! in_array( $new_type, $with_end ) && $new_type !== 'break' ) { |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $sub['name'] = __( 'Section Buttons', 'formidable' ); |
| 303 | 303 | $subs = array( $sub ); |
| 304 | 304 | $this->insert_fields_in_array( $subs, $order, 0, $fields ); |
| 305 | - ++$order; |
|
| 305 | + ++ $order; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | protected function create_fields( $form_id, &$form ) { |
| 400 | 400 | foreach ( $form['fields'] as $key => $new_field ) { |
| 401 | 401 | $new_field['form_id'] = $form_id; |
| 402 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 402 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | } elseif ( $key === 'the_post_title' ) { |
| 434 | 434 | $new_action->post_content['post_title'] = $value; |
| 435 | 435 | } elseif ( is_string( $value ) ) { |
| 436 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 436 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 437 | 437 | } else { |
| 438 | - $new_action->post_content[ $key ] = $value; |
|
| 438 | + $new_action->post_content[$key] = $value; |
|
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | 441 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | |
| 455 | 455 | $imported = $this->get_tracked_import(); |
| 456 | 456 | |
| 457 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 457 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 458 | 458 | |
| 459 | 459 | update_option( $this->tracking, $imported, false ); |
| 460 | 460 | } |
@@ -474,11 +474,11 @@ discard block |
||
| 474 | 474 | private function is_imported( $source_id ) { |
| 475 | 475 | $imported = $this->get_tracked_import(); |
| 476 | 476 | $new_form_id = 0; |
| 477 | - if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 477 | + if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 478 | 478 | return $new_form_id; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 481 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 482 | 482 | if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) { |
| 483 | 483 | // Allow reimport if the form was deleted. |
| 484 | 484 | $new_form_id = 0; |
@@ -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 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $templates = $this->get_api_info(); |
| 96 | 96 | $contact_form = 20872734; |
| 97 | - return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] ); |
|
| 97 | + return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] ); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | continue; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $data['urlByKey'][ $template['key'] ] = $template['url']; |
|
| 172 | + $data['urlByKey'][$template['key']] = $template['url']; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ( ! isset( $data['urlByKey'][ $key ] ) ) { |
|
| 175 | + if ( ! isset( $data['urlByKey'][$key] ) ) { |
|
| 176 | 176 | $error = new WP_Error( 400, 'We were unable to retrieve the template' ); |
| 177 | 177 | wp_send_json_error( $error ); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $data['url'] = $data['urlByKey'][ $key ]; |
|
| 180 | + $data['url'] = $data['urlByKey'][$key]; |
|
| 181 | 181 | }//end if |
| 182 | 182 | |
| 183 | 183 | wp_send_json_success( $data ); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
| 81 | 81 | $field_metas = array(); |
| 82 | 82 | foreach ( $metas as $meta ) { |
| 83 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
| 83 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | $reduced = array(); |
| 137 | 137 | foreach ( $filter_vals as $field_id => $value ) { |
| 138 | 138 | $field = FrmFieldFactory::get_field_object( $field_id ); |
| 139 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 140 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
| 141 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
| 142 | - unset( $reduced[ $field_id ] ); |
|
| 139 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 140 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
| 141 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
| 142 | + unset( $reduced[$field_id] ); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | return $reduced; |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | private static function prepare_entries( &$entries ) { |
| 402 | 402 | foreach ( $entries as $k => $entry ) { |
| 403 | 403 | self::prepare_entry( $entry ); |
| 404 | - $entries[ $k ] = $entry; |
|
| 404 | + $entries[$k] = $entry; |
|
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
@@ -427,19 +427,19 @@ discard block |
||
| 427 | 427 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 428 | 428 | |
| 429 | 429 | if ( $meta_val->item_id == $entry->id ) { |
| 430 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 430 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 431 | 431 | if ( $include_key ) { |
| 432 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
| 432 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
| 433 | 433 | } |
| 434 | 434 | continue; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | // include sub entries in an array |
| 438 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
| 439 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
| 438 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
| 439 | + $entry->metas[$meta_val->field_id] = array(); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
| 442 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
| 443 | 443 | |
| 444 | 444 | unset( $meta_val ); |
| 445 | 445 | } |
@@ -534,16 +534,16 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | foreach ( $metas as $m_key => $meta_val ) { |
| 537 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
| 537 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
| 538 | 538 | continue; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
| 542 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
| 541 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
| 542 | + $entries[$meta_val->item_id]->metas = array(); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 546 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 546 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 547 | 547 | unset( $m_key, $meta_val ); |
| 548 | 548 | } |
| 549 | 549 | |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | private static function get_entry_value( $values, $name, $default ) { |
| 728 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
| 728 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | /** |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | private static function maybe_add_captcha_meta( $form_id, $entry_id ) { |
| 911 | 911 | global $frm_vars; |
| 912 | 912 | if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) { |
| 913 | - $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] ); |
|
| 913 | + $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] ); |
|
| 914 | 914 | FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) ); |
| 915 | 915 | } |
| 916 | 916 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
| 163 | 163 | $to = $this->explode_emails( $to ); |
| 164 | 164 | |
| 165 | - $where = array( |
|
| 165 | + $where = array( |
|
| 166 | 166 | 'it.field_id !' => 0, |
| 167 | 167 | 'it.item_id' => $this->entry->id, |
| 168 | 168 | ); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | 'entry' => $this->entry, |
| 173 | 173 | 'form' => $this->form, |
| 174 | 174 | ); |
| 175 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 175 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 176 | 176 | |
| 177 | 177 | $this->to = array_unique( (array) $to ); |
| 178 | 178 | |
@@ -702,12 +702,12 @@ discard block |
||
| 702 | 702 | $name = trim( str_replace( $email, '', $val ) ); |
| 703 | 703 | } else { |
| 704 | 704 | // If user enters a name without an email |
| 705 | - unset( $recipients[ $key ] ); |
|
| 705 | + unset( $recipients[$key] ); |
|
| 706 | 706 | continue; |
| 707 | 707 | } |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
| 710 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
| 711 | 711 | }//end foreach |
| 712 | 712 | |
| 713 | 713 | return $recipients; |
@@ -857,7 +857,7 @@ discard block |
||
| 857 | 857 | ); |
| 858 | 858 | |
| 859 | 859 | // Remove phone number from to addresses |
| 860 | - unset( $this->to[ $key ] ); |
|
| 860 | + unset( $this->to[$key] ); |
|
| 861 | 861 | }//end if |
| 862 | 862 | }//end foreach |
| 863 | 863 | } |