@@ -58,7 +58,7 @@ |
||
| 58 | 58 | protected function get_field_value( $args ) { |
| 59 | 59 | $user_ID = get_current_user_id(); |
| 60 | 60 | $user_ID = ( $user_ID ? $user_ID : '' ); |
| 61 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 61 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 62 | 62 | $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) ); |
| 63 | 63 | $updating = $action == 'update'; |
| 64 | 64 | return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID; |
@@ -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 | } |
@@ -565,11 +565,11 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | // serialize array values |
| 567 | 567 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 568 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 568 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 569 | 569 | if ( 'field_options' === $opt ) { |
| 570 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 570 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 571 | 571 | } |
| 572 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 572 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | 'id' => $id, |
| 722 | 722 | 'field_key' => $id, |
| 723 | 723 | ); |
| 724 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 724 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | return $type; |
@@ -747,8 +747,8 @@ discard block |
||
| 747 | 747 | continue; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - $fields[ $result->id ] = $result; |
|
| 751 | - ++$count; |
|
| 750 | + $fields[$result->id] = $result; |
|
| 751 | + ++ $count; |
|
| 752 | 752 | if ( $limit == 1 ) { |
| 753 | 753 | $fields = $result; |
| 754 | 754 | break; |
@@ -792,8 +792,8 @@ discard block |
||
| 792 | 792 | $fields = array(); |
| 793 | 793 | $count = 0; |
| 794 | 794 | foreach ( $results as $result ) { |
| 795 | - ++$count; |
|
| 796 | - $fields[ $result->id ] = $result; |
|
| 795 | + ++ $count; |
|
| 796 | + $fields[$result->id] = $result; |
|
| 797 | 797 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 798 | 798 | break; |
| 799 | 799 | } |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | $query_type = $limit == ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 908 | 908 | |
| 909 | 909 | if ( is_array( $where ) ) { |
| 910 | - $args = array( |
|
| 910 | + $args = array( |
|
| 911 | 911 | 'order_by' => $order_by, |
| 912 | 912 | 'limit' => $limit, |
| 913 | 913 | ); |
@@ -938,9 +938,9 @@ discard block |
||
| 938 | 938 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 939 | 939 | |
| 940 | 940 | self::prepare_options( $result ); |
| 941 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 942 | - $results[ $r_key ]->options = $result->options; |
|
| 943 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 941 | + $results[$r_key]->field_options = $result->field_options; |
|
| 942 | + $results[$r_key]->options = $result->options; |
|
| 943 | + $results[$r_key]->default_value = $result->default_value; |
|
| 944 | 944 | |
| 945 | 945 | unset( $r_key, $result ); |
| 946 | 946 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | |
| 997 | 997 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 998 | 998 | // if this transient is full, check for another |
| 999 | - ++$next; |
|
| 999 | + ++ $next; |
|
| 1000 | 1000 | self::get_next_transient( $fields, $base_name, $next ); |
| 1001 | 1001 | } |
| 1002 | 1002 | } |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | return; |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | - ++$next; |
|
| 1027 | + ++ $next; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | 1030 | |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | * @return bool |
| 1163 | 1163 | */ |
| 1164 | 1164 | public static function is_option_true_in_array( $field, $option ) { |
| 1165 | - return ! empty( $field[ $option ] ); |
|
| 1165 | + return ! empty( $field[$option] ); |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | /** |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | * @return bool |
| 1172 | 1172 | */ |
| 1173 | 1173 | public static function is_option_true_in_object( $field, $option ) { |
| 1174 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1174 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | /** |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | * @return bool |
| 1181 | 1181 | */ |
| 1182 | 1182 | public static function is_option_empty_in_array( $field, $option ) { |
| 1183 | - return empty( $field[ $option ] ); |
|
| 1183 | + return empty( $field[$option] ); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
@@ -1189,7 +1189,7 @@ discard block |
||
| 1189 | 1189 | * @return bool |
| 1190 | 1190 | */ |
| 1191 | 1191 | public static function is_option_empty_in_object( $field, $option ) { |
| 1192 | - return empty( $field->field_options[ $option ] ); |
|
| 1192 | + return empty( $field->field_options[$option] ); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | /** |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | * @return bool |
| 1199 | 1199 | */ |
| 1200 | 1200 | public static function is_option_value_in_object( $field, $option ) { |
| 1201 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1201 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | 1204 | /** |
@@ -1224,10 +1224,10 @@ discard block |
||
| 1224 | 1224 | * @return mixed |
| 1225 | 1225 | */ |
| 1226 | 1226 | public static function get_option_in_array( $field, $option ) { |
| 1227 | - if ( isset( $field[ $option ] ) ) { |
|
| 1228 | - $this_option = $field[ $option ]; |
|
| 1229 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1230 | - $this_option = $field['field_options'][ $option ]; |
|
| 1227 | + if ( isset( $field[$option] ) ) { |
|
| 1228 | + $this_option = $field[$option]; |
|
| 1229 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1230 | + $this_option = $field['field_options'][$option]; |
|
| 1231 | 1231 | } else { |
| 1232 | 1232 | $this_option = ''; |
| 1233 | 1233 | } |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | public static function get_option_in_object( $field, $option ) { |
| 1239 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 1239 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | /** |
@@ -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 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param array|object $field |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - function ( $position, $field ) { |
|
| 77 | + function( $position, $field ) { |
|
| 78 | 78 | if ( is_array( $field ) ) { |
| 79 | 79 | $this->default_label_position_field_ids[] = (int) $field['id']; |
| 80 | 80 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | * @param array|object $field |
| 92 | 92 | * @return string |
| 93 | 93 | */ |
| 94 | - function ( $classes, $field ) { |
|
| 94 | + function( $classes, $field ) { |
|
| 95 | 95 | if ( is_array( $field ) && in_array( (int) $field['id'], $this->default_label_position_field_ids, true ) ) { |
| 96 | 96 | $classes .= ' frm-default-label-position'; |
| 97 | 97 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * @param string $target_field_type |
| 119 | 119 | * @return bool |
| 120 | 120 | */ |
| 121 | - function ( $show, $field_type ) { |
|
| 121 | + function( $show, $field_type ) { |
|
| 122 | 122 | if ( 'captcha' === $field_type ) { |
| 123 | 123 | $show = false; |
| 124 | 124 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @param int $form_id |
| 147 | 147 | * @return stdClass|null |
| 148 | 148 | */ |
| 149 | - function ( $form ) { |
|
| 149 | + function( $form ) { |
|
| 150 | 150 | if ( is_object( $form ) && is_array( $form->options ) ) { |
| 151 | 151 | $form->options['js_validate'] = false; |
| 152 | 152 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $frm_settings = FrmAppHelper::get_settings(); |
| 198 | 198 | if ( 'none' === $frm_settings->load_style ) { |
| 199 | - $notes[] = function () { |
|
| 199 | + $notes[] = function() { |
|
| 200 | 200 | printf( |
| 201 | 201 | // translators: %1$s: Anchor tag open, %2$s: Anchor tag close. |
| 202 | 202 | esc_html__( 'Formidable styles are disabled. This needs to be enabled in %1$sGlobal Settings%2$s.', 'formidable' ), |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | return; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - unset( $dependencies[ $index ] ); |
|
| 357 | + unset( $dependencies[$index] ); |
|
| 358 | 358 | $dependencies = array_values( $dependencies ); |
| 359 | 359 | |
| 360 | 360 | $styles->registered['wp-admin']->deps = $dependencies; |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | return $this->get_pagenum(); |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
| 227 | - return $this->_pagination_args[ $key ]; |
|
| 226 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
| 227 | + return $this->_pagination_args[$key]; |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | private function hidden_search_inputs( $param_name ) { |
| 272 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 273 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 272 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 273 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 274 | 274 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | echo "<ul class='subsubsub'>\n"; |
| 314 | 314 | foreach ( $views as $class => $view ) { |
| 315 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 315 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 316 | 316 | } |
| 317 | 317 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 318 | 318 | echo '</ul>'; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
| 463 | 463 | foreach ( $actions as $action => $link ) { |
| 464 | - ++$i; |
|
| 464 | + ++ $i; |
|
| 465 | 465 | $sep = $i == $action_count ? '' : ' | '; |
| 466 | 466 | $out .= "<span class='$action'>$link$sep</span>"; |
| 467 | 467 | } |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | 'next' => __( 'Next page', 'formidable' ), |
| 685 | 685 | ); |
| 686 | 686 | |
| 687 | - return $labels[ $link ]; |
|
| 687 | + return $labels[$link]; |
|
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | private function current_url() { |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | |
| 775 | 775 | // If the primary column doesn't exist fall back to the |
| 776 | 776 | // first non-checkbox column. |
| 777 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 777 | + if ( ! isset( $columns[$default] ) ) { |
|
| 778 | 778 | $default = self::get_default_primary_column_name(); |
| 779 | 779 | } |
| 780 | 780 | |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 790 | 790 | |
| 791 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 791 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 792 | 792 | $column = $default; |
| 793 | 793 | } |
| 794 | 794 | |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | // In 4.3, we added a fourth argument for primary column. |
| 810 | 810 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 811 | 811 | foreach ( $this->_column_headers as $key => $value ) { |
| 812 | - $column_headers[ $key ] = $value; |
|
| 812 | + $column_headers[$key] = $value; |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | return $column_headers; |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | $data[1] = false; |
| 843 | 843 | } |
| 844 | 844 | |
| 845 | - $sortable[ $id ] = $data; |
|
| 845 | + $sortable[$id] = $data; |
|
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | $primary = $this->get_primary_column_name(); |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | static $cb_counter = 1; |
| 899 | 899 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>'; |
| 900 | 900 | $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
| 901 | - ++$cb_counter; |
|
| 901 | + ++ $cb_counter; |
|
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -920,8 +920,8 @@ discard block |
||
| 920 | 920 | $class[] = 'column-primary'; |
| 921 | 921 | } |
| 922 | 922 | |
| 923 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 924 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 923 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 924 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 925 | 925 | |
| 926 | 926 | if ( $current_orderby == $orderby ) { |
| 927 | 927 | // The sorted column. The `aria-sort` attribute must be set only on the sorted column. |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
| 1035 | 1035 | */ |
| 1036 | 1036 | protected function should_display( $args, $settings ) { |
| 1037 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
| 1037 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | /** |
@@ -14,20 +14,26 @@ |
||
| 14 | 14 | <h4><?php echo esc_html( $counter['heading'] ); ?></h4> |
| 15 | 15 | <?php if ( isset( $counter['cta'] ) && isset( $counter['cta']['display'] ) && true === $counter['cta']['display'] ) : ?> |
| 16 | 16 | <a href="<?php echo esc_url( $counter['cta']['link'] ); ?>"><?php echo esc_html( $counter['cta']['title'] ); ?></a> |
| 17 | - <?php else : ?> |
|
| 17 | + <?php else { |
|
| 18 | + : ?> |
|
| 18 | 19 | <?php if ( 'currency' === $counter['type'] ) : ?> |
| 19 | 20 | <div class="frm-flex-box frm-gap-md"> |
| 20 | 21 | <?php foreach ( $counter['items'] as $item ) : ?> |
| 21 | 22 | <b> |
| 22 | - <?php echo esc_attr( $item['counter_label']['symbol_left'] ); ?> |
|
| 23 | + <?php echo esc_attr( $item['counter_label']['symbol_left'] ); |
|
| 24 | +} |
|
| 25 | +?> |
|
| 23 | 26 | <span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); ?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $item['counter']; ?>"><?php echo (int) $item['counter']; ?></span> |
| 24 | 27 | <?php echo esc_attr( $item['counter_label']['symbol_right'] ); ?> |
| 25 | 28 | </b> |
| 26 | 29 | <?php endforeach; ?> |
| 27 | 30 | </div> |
| 28 | - <?php else : ?> |
|
| 31 | + <?php else { |
|
| 32 | + : ?> |
|
| 29 | 33 | <b> |
| 30 | - <span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); ?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $counter['counter']; ?>"><?php echo (int) $counter['counter']; ?></span> |
|
| 34 | + <span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); |
|
| 35 | +} |
|
| 36 | +?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $counter['counter']; ?>"><?php echo (int) $counter['counter']; ?></span> |
|
| 31 | 37 | </b> |
| 32 | 38 | <?php endif; ?> |
| 33 | 39 | <?php endif; ?> |