@@ -49,7 +49,7 @@ |
||
| 49 | 49 | protected function get_field_value( $args ) { |
| 50 | 50 | $user_ID = get_current_user_id(); |
| 51 | 51 | $user_ID = ( $user_ID ? $user_ID : '' ); |
| 52 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // WPCS: CSRF ok. |
|
| 52 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // WPCS: CSRF ok. |
|
| 53 | 53 | $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) ); |
| 54 | 54 | $updating = $action == 'update'; |
| 55 | 55 | return ( is_numeric( $this->field['value'] ) || $posted_value || $updating ) ? $this->field['value'] : $user_ID; |
@@ -49,10 +49,10 @@ |
||
| 49 | 49 | foreach ( $pro_fields as $field_key => $field_type ) { |
| 50 | 50 | |
| 51 | 51 | if ( isset( $field_type['section'] ) ) { |
| 52 | - if ( ! isset( $field_sections[ $field_type['section'] ] ) ) { |
|
| 53 | - $field_sections[ $field_type['section'] ] = array(); |
|
| 52 | + if ( ! isset( $field_sections[$field_type['section']] ) ) { |
|
| 53 | + $field_sections[$field_type['section']] = array(); |
|
| 54 | 54 | } |
| 55 | - $field_sections[ $field_type['section'] ][ $field_key ] = $field_type; |
|
| 55 | + $field_sections[$field_type['section']][$field_key] = $field_type; |
|
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 218 | 218 | |
| 219 | 219 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 220 | - $new_values[ $col ] = $values[ $col ]; |
|
| 220 | + $new_values[$col] = $values[$col]; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | $new_values['options'] = $values['options']; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 230 | 230 | |
| 231 | 231 | if ( isset( $values['id'] ) ) { |
| 232 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 232 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 233 | 233 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | foreach ( $new_values as $k => $v ) { |
| 239 | 239 | if ( is_array( $v ) ) { |
| 240 | 240 | if ( $k === 'default_value' ) { |
| 241 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 241 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 242 | 242 | } else { |
| 243 | - $new_values[ $k ] = serialize( $v ); |
|
| 243 | + $new_values[$k] = serialize( $v ); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | unset( $k, $v ); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | if ( $query_results ) { |
| 264 | 264 | if ( isset( $values['id'] ) ) { |
| 265 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 265 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | return $new_id; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 275 | 275 | global $frm_duplicate_ids; |
| 276 | 276 | |
| 277 | - $where = array( |
|
| 277 | + $where = array( |
|
| 278 | 278 | array( |
| 279 | 279 | 'or' => 1, |
| 280 | 280 | 'fi.form_id' => $old_form_id, |
@@ -320,8 +320,8 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 322 | 322 | $new_id = self::create( $values ); |
| 323 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 324 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 323 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 324 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 325 | 325 | unset( $field ); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -352,8 +352,8 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | // serialize array values |
| 354 | 354 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 355 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 356 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 355 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 356 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | 'id' => $id, |
| 506 | 506 | 'field_key' => $id, |
| 507 | 507 | ); |
| 508 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 508 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | return $type; |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | continue; |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | - $fields[ $result->id ] = $result; |
|
| 534 | + $fields[$result->id] = $result; |
|
| 535 | 535 | $count ++; |
| 536 | 536 | if ( $limit == 1 ) { |
| 537 | 537 | $fields = $result; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | $count = 0; |
| 578 | 578 | foreach ( $results as $result ) { |
| 579 | 579 | $count ++; |
| 580 | - $fields[ $result->id ] = $result; |
|
| 580 | + $fields[$result->id] = $result; |
|
| 581 | 581 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 582 | 582 | break; |
| 583 | 583 | } |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | if ( ! empty( $sub_fields ) ) { |
| 649 | - $index = $k + $index_offset; |
|
| 649 | + $index = $k + $index_offset; |
|
| 650 | 650 | $index_offset += count( $sub_fields ); |
| 651 | 651 | array_splice( $results, $index, 0, $sub_fields ); |
| 652 | 652 | } |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 692 | 692 | |
| 693 | 693 | if ( is_array( $where ) ) { |
| 694 | - $args = array( |
|
| 694 | + $args = array( |
|
| 695 | 695 | 'order_by' => $order_by, |
| 696 | 696 | 'limit' => $limit, |
| 697 | 697 | ); |
@@ -722,9 +722,9 @@ discard block |
||
| 722 | 722 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 723 | 723 | |
| 724 | 724 | self::prepare_options( $result ); |
| 725 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 726 | - $results[ $r_key ]->options = $result->options; |
|
| 727 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 725 | + $results[$r_key]->field_options = $result->field_options; |
|
| 726 | + $results[$r_key]->options = $result->options; |
|
| 727 | + $results[$r_key]->default_value = $result->default_value; |
|
| 728 | 728 | |
| 729 | 729 | unset( $r_key, $result ); |
| 730 | 730 | } |
@@ -926,23 +926,23 @@ discard block |
||
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | public static function is_option_true_in_array( $field, $option ) { |
| 929 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 929 | + return isset( $field[$option] ) && $field[$option]; |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | public static function is_option_true_in_object( $field, $option ) { |
| 933 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 933 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | public static function is_option_empty_in_array( $field, $option ) { |
| 937 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 937 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 938 | 938 | } |
| 939 | 939 | |
| 940 | 940 | public static function is_option_empty_in_object( $field, $option ) { |
| 941 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 941 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | public static function is_option_value_in_object( $field, $option ) { |
| 945 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 945 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | /** |
@@ -960,10 +960,10 @@ discard block |
||
| 960 | 960 | |
| 961 | 961 | public static function get_option_in_array( $field, $option ) { |
| 962 | 962 | |
| 963 | - if ( isset( $field[ $option ] ) ) { |
|
| 964 | - $this_option = $field[ $option ]; |
|
| 965 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 966 | - $this_option = $field['field_options'][ $option ]; |
|
| 963 | + if ( isset( $field[$option] ) ) { |
|
| 964 | + $this_option = $field[$option]; |
|
| 965 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 966 | + $this_option = $field['field_options'][$option]; |
|
| 967 | 967 | } else { |
| 968 | 968 | $this_option = ''; |
| 969 | 969 | } |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | public static function get_option_in_object( $field, $option ) { |
| 975 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 975 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | /** |
@@ -172,6 +172,9 @@ discard block |
||
| 172 | 172 | return $response; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | + /** |
|
| 176 | + * @param string $source_form_name |
|
| 177 | + */ |
|
| 175 | 178 | protected function prepare_new_form( $source_id, $source_form_name ) { |
| 176 | 179 | return array( |
| 177 | 180 | 'import_form_id' => $source_id, |
@@ -307,6 +310,7 @@ discard block |
||
| 307 | 310 | * This switches the name field to individual fields. |
| 308 | 311 | * |
| 309 | 312 | * @since 4.04.03 |
| 313 | + * @param integer $remove |
|
| 310 | 314 | */ |
| 311 | 315 | protected function insert_fields_in_array( $subs, $start, $remove, &$fields ) { |
| 312 | 316 | array_splice( $fields, $start, $remove, $subs ); |
@@ -476,6 +480,9 @@ discard block |
||
| 476 | 480 | return array(); |
| 477 | 481 | } |
| 478 | 482 | |
| 483 | + /** |
|
| 484 | + * @param string $type |
|
| 485 | + */ |
|
| 479 | 486 | private function is_unsupported_field( $type ) { |
| 480 | 487 | $fields = $this->unsupported_field_types(); |
| 481 | 488 | |
@@ -491,6 +498,9 @@ discard block |
||
| 491 | 498 | return array(); |
| 492 | 499 | } |
| 493 | 500 | |
| 501 | + /** |
|
| 502 | + * @param string $type |
|
| 503 | + */ |
|
| 494 | 504 | protected function should_skip_field( $type ) { |
| 495 | 505 | $skip_pro_fields = $this->skip_pro_fields(); |
| 496 | 506 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | protected function create_fields( $form_id, &$form ) { |
| 397 | 397 | foreach ( $form['fields'] as $key => $new_field ) { |
| 398 | 398 | $new_field['form_id'] = $form_id; |
| 399 | - $form['fields'][ $key ]['id'] = FrmField::create( $new_field ); |
|
| 399 | + $form['fields'][$key]['id'] = FrmField::create( $new_field ); |
|
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
@@ -426,9 +426,9 @@ discard block |
||
| 426 | 426 | } elseif ( $key === 'the_post_title' ) { |
| 427 | 427 | $new_action->post_content['post_title'] = $value; |
| 428 | 428 | } elseif ( is_string( $value ) ) { |
| 429 | - $new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 429 | + $new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] ); |
|
| 430 | 430 | } else { |
| 431 | - $new_action->post_content[ $key ] = $value; |
|
| 431 | + $new_action->post_content[$key] = $value; |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | $imported = $this->get_tracked_import(); |
| 449 | 449 | |
| 450 | - $imported[ $this->slug ][ $new_form_id ] = $source_id; |
|
| 450 | + $imported[$this->slug][$new_form_id] = $source_id; |
|
| 451 | 451 | |
| 452 | 452 | update_option( $this->tracking, $imported, false ); |
| 453 | 453 | } |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | private function is_imported( $source_id ) { |
| 468 | 468 | $imported = $this->get_tracked_import(); |
| 469 | 469 | $new_form_id = 0; |
| 470 | - if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) { |
|
| 470 | + if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) { |
|
| 471 | 471 | return $new_form_id; |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - $new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) ); |
|
| 474 | + $new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) ); |
|
| 475 | 475 | if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) { |
| 476 | 476 | // Allow reimport if the form was deleted. |
| 477 | 477 | $new_form_id = 0; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * |
| 280 | 280 | * @since 4.04.04 |
| 281 | 281 | * |
| 282 | - * @return array Step data. |
|
| 282 | + * @return string Step data. |
|
| 283 | 283 | */ |
| 284 | 284 | protected function get_data_step_install() { |
| 285 | 285 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @since 4.04.04 |
| 328 | 328 | * |
| 329 | - * @return array Step data. |
|
| 329 | + * @return string Step data. |
|
| 330 | 330 | */ |
| 331 | 331 | protected function get_data_step_setup() { |
| 332 | 332 | |
@@ -235,7 +235,7 @@ |
||
| 235 | 235 | if ( is_array( $upsell ) ) { |
| 236 | 236 | foreach ( $upsell as $k => $plugin ) { |
| 237 | 237 | if ( strpos( $plugin['slug'], 'wpforms' ) !== false ) { |
| 238 | - unset( $upsell[ $k ] ); |
|
| 238 | + unset( $upsell[$k] ); |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | <?php |
| 24 | 24 | foreach ( $vars as $var ) { |
| 25 | 25 | ?> |
| 26 | - --<?php echo esc_html( str_replace( '_', '-', $var ) ); ?>:<?php echo esc_html( $defaults[ $var ] ); ?>; |
|
| 26 | + --<?php echo esc_html( str_replace( '_', '-', $var ) ); ?>:<?php echo esc_html( $defaults[$var] ); ?>; |
|
| 27 | 27 | <?php |
| 28 | 28 | } |
| 29 | 29 | ?> |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | .<?php echo esc_html( $style_class ); ?> { |
| 15 | 15 | <?php |
| 16 | 16 | foreach ( $vars as $var ) { |
| 17 | - if ( isset( $settings[ $var ] ) && $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] ) { |
|
| 17 | + if ( isset( $settings[$var] ) && $settings[$var] !== '' && $settings[$var] !== $defaults[$var] ) { |
|
| 18 | 18 | ?> |
| 19 | - --<?php echo esc_html( str_replace( '_', '-', $var ) ); ?>:<?php echo esc_html( $settings[ $var ] ); ?>; |
|
| 19 | + --<?php echo esc_html( str_replace( '_', '-', $var ) ); ?>:<?php echo esc_html( $settings[$var] ); ?>; |
|
| 20 | 20 | <?php |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | <?php } ?> |
| 142 | 142 | |
| 143 | 143 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before{ |
| 144 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
| 144 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ); ?>"; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_plus_icon:before{ |
| 148 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
| 148 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ); ?>"; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | .<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before, |
@@ -157,14 +157,14 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | .<?php echo esc_html( $style_class ); ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{ |
| 160 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
| 160 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ); ?>"; |
|
| 161 | 161 | <?php if ( ! empty( $section_color ) ) { ?> |
| 162 | 162 | color:<?php echo esc_html( $section_color . $important ); ?>; |
| 163 | 163 | <?php } ?> |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | .<?php echo esc_html( $style_class ); ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{ |
| 167 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
| 167 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ); ?>"; |
|
| 168 | 168 | <?php if ( ! empty( $section_color ) ) { ?> |
| 169 | 169 | color:<?php echo esc_html( $section_color . $important ); ?>; |
| 170 | 170 | <?php } ?> |